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