@@ -30,55 +30,65 @@ load(":push.bzl", "docker_push")
30
30
# The release of the github.com/google/containerregistry to consume.
31
31
CONTAINERREGISTRY_RELEASE = "v0.0.11"
32
32
33
- def docker_repositories ():
33
+ def docker_repositories (excludes = [], overrides = {} ):
34
34
"""Download dependencies of docker rules."""
35
- native .http_file (
36
- name = "puller" ,
37
- url = ("https://storage.googleapis.com/containerregistry-releases/" +
38
- CONTAINERREGISTRY_RELEASE + "/puller.par" ),
39
- sha256 = "90a76d01ee57a5df7353a533c96966822c9efda61636c11eac11344171556017" ,
40
- executable = True ,
41
- )
35
+ gcr_release = overrides .get ("containerregistry" , CONTAINERREGISTRY_RELEASE )
36
+ if "puller" not in excludes :
37
+ native .http_file (
38
+ name = "puller" ,
39
+ url = ("https://storage.googleapis.com/containerregistry-releases/" +
40
+ gcr_release + "/puller.par" ),
41
+ sha256 = overrides .get (
42
+ "puller" , "90a76d01ee57a5df7353a533c96966822c9efda61636c11eac11344171556017" ),
43
+ executable = True ,
44
+ )
42
45
43
- native .http_file (
44
- name = "pusher" ,
45
- url = ("https://storage.googleapis.com/containerregistry-releases/" +
46
- CONTAINERREGISTRY_RELEASE + "/pusher.par" ),
47
- sha256 = "1989ceb41144784dccb3476cea5b5f1bef112bb0aae56544b9c56572894c38ab" ,
48
- executable = True ,
49
- )
46
+ if "pusher" not in excludes :
47
+ native .http_file (
48
+ name = "pusher" ,
49
+ url = ("https://storage.googleapis.com/containerregistry-releases/" +
50
+ gcr_release + "/pusher.par" ),
51
+ sha256 = overrides .get (
52
+ "pusher" , "1989ceb41144784dccb3476cea5b5f1bef112bb0aae56544b9c56572894c38ab" ),
53
+ executable = True ,
54
+ )
50
55
51
- native .git_repository (
52
- name = "containerregistry" ,
53
- remote = "https://github.com/google/containerregistry.git" ,
54
- tag = CONTAINERREGISTRY_RELEASE ,
55
- )
56
+ if "containerregistry" not in excludes :
57
+ native .git_repository (
58
+ name = "containerregistry" ,
59
+ remote = "https://github.com/google/containerregistry.git" ,
60
+ tag = gcr_release ,
61
+ )
56
62
57
63
# TODO(mattmoor): Remove all of this (copied from google/containerregistry)
58
64
# once transitive workspace instantiation lands.
59
- native .new_http_archive (
60
- name = "httplib2" ,
61
- url = "https://codeload.github.com/httplib2/httplib2/tar.gz/v0.10.3" ,
62
- sha256 = "d1bee28a68cc665c451c83d315e3afdbeb5391f08971dcc91e060d5ba16986f1" ,
63
- strip_prefix = "httplib2-0.10.3/python2/httplib2/" ,
64
- type = "tar.gz" ,
65
- build_file_content = """
65
+ if "httplib2" not in excludes :
66
+ # TODO(mattmoor): Is there a clean way to override?
67
+ native .new_http_archive (
68
+ name = "httplib2" ,
69
+ url = "https://codeload.github.com/httplib2/httplib2/tar.gz/v0.10.3" ,
70
+ sha256 = "d1bee28a68cc665c451c83d315e3afdbeb5391f08971dcc91e060d5ba16986f1" ,
71
+ strip_prefix = "httplib2-0.10.3/python2/httplib2/" ,
72
+ type = "tar.gz" ,
73
+ build_file_content = """
66
74
py_library(
67
75
name = "httplib2",
68
76
srcs = glob(["**/*.py"]),
69
77
data = ["cacerts.txt"],
70
78
visibility = ["//visibility:public"]
71
79
)""" ,
72
- )
80
+ )
73
81
74
82
# Used by oauth2client
75
- native .new_http_archive (
76
- name = "six" ,
77
- url = "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz" ,
78
- sha256 = "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5" ,
79
- strip_prefix = "six-1.9.0/" ,
80
- type = "tar.gz" ,
81
- build_file_content = """
83
+ if "six" not in excludes :
84
+ # TODO(mattmoor): Is there a clean way to override?
85
+ native .new_http_archive (
86
+ name = "six" ,
87
+ url = "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz" ,
88
+ sha256 = "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5" ,
89
+ strip_prefix = "six-1.9.0/" ,
90
+ type = "tar.gz" ,
91
+ build_file_content = """
82
92
# Rename six.py to __init__.py
83
93
genrule(
84
94
name = "rename",
@@ -91,16 +101,18 @@ py_library(
91
101
srcs = [":__init__.py"],
92
102
visibility = ["//visibility:public"],
93
103
)"""
94
- )
104
+ )
95
105
96
106
# Used for authentication in containerregistry
97
- native .new_http_archive (
98
- name = "oauth2client" ,
99
- url = "https://codeload.github.com/google/oauth2client/tar.gz/v4.0.0" ,
100
- sha256 = "7230f52f7f1d4566a3f9c3aeb5ffe2ed80302843ce5605853bee1f08098ede46" ,
101
- strip_prefix = "oauth2client-4.0.0/oauth2client/" ,
102
- type = "tar.gz" ,
103
- build_file_content = """
107
+ if "oauth2client" not in excludes :
108
+ # TODO(mattmoor): Is there a clean way to override?
109
+ native .new_http_archive (
110
+ name = "oauth2client" ,
111
+ url = "https://codeload.github.com/google/oauth2client/tar.gz/v4.0.0" ,
112
+ sha256 = "7230f52f7f1d4566a3f9c3aeb5ffe2ed80302843ce5605853bee1f08098ede46" ,
113
+ strip_prefix = "oauth2client-4.0.0/oauth2client/" ,
114
+ type = "tar.gz" ,
115
+ build_file_content = """
104
116
py_library(
105
117
name = "oauth2client",
106
118
srcs = glob(["**/*.py"]),
@@ -110,26 +122,30 @@ py_library(
110
122
"@six//:six",
111
123
]
112
124
)"""
113
- )
125
+ )
114
126
115
127
# Used for parallel execution in containerregistry
116
- native .new_http_archive (
117
- name = "concurrent" ,
118
- url = "https://codeload.github.com/agronholm/pythonfutures/tar.gz/3.0.5" ,
119
- sha256 = "a7086ddf3c36203da7816f7e903ce43d042831f41a9705bc6b4206c574fcb765" ,
120
- strip_prefix = "pythonfutures-3.0.5/concurrent/" ,
121
- type = "tar.gz" ,
122
- build_file_content = """
128
+ if "concurrent" not in excludes :
129
+ # TODO(mattmoor): Is there a clean way to override?
130
+ native .new_http_archive (
131
+ name = "concurrent" ,
132
+ url = "https://codeload.github.com/agronholm/pythonfutures/tar.gz/3.0.5" ,
133
+ sha256 = "a7086ddf3c36203da7816f7e903ce43d042831f41a9705bc6b4206c574fcb765" ,
134
+ strip_prefix = "pythonfutures-3.0.5/concurrent/" ,
135
+ type = "tar.gz" ,
136
+ build_file_content = """
123
137
py_library(
124
138
name = "concurrent",
125
139
srcs = glob(["**/*.py"]),
126
140
visibility = ["//visibility:public"]
127
141
)"""
128
- )
142
+ )
129
143
130
144
# For packaging python tools.
131
- native .git_repository (
132
- name = "subpar" ,
133
- remote = "https://github.com/google/subpar" ,
134
- commit = "7e12cc130eb8f09c8cb02c3585a91a4043753c56" ,
135
- )
145
+ if "subpar" not in excludes :
146
+ native .git_repository (
147
+ name = "subpar" ,
148
+ remote = "https://github.com/google/subpar" ,
149
+ commit = overrides .get (
150
+ "subpar" , "7e12cc130eb8f09c8cb02c3585a91a4043753c56" ),
151
+ )
0 commit comments