12
12
13
13
DebianArch = namedtuple ("DebianArch" , ["bashbrew" , "dpkg" , "qemu" , "rust" ])
14
14
15
- debian_arches = [
15
+ debian_lts_arches = [
16
16
DebianArch ("amd64" , "amd64" , "linux/amd64" , "x86_64-unknown-linux-gnu" ),
17
17
DebianArch ("arm32v7" , "armhf" , "linux/arm/v7" , "armv7-unknown-linux-gnueabihf" ),
18
18
DebianArch ("arm64v8" , "arm64" , "linux/arm64" , "aarch64-unknown-linux-gnu" ),
19
19
DebianArch ("i386" , "i386" , "linux/386" , "i686-unknown-linux-gnu" ),
20
+ ]
21
+
22
+ debian_non_lts_arches = [
20
23
DebianArch ("ppc64le" , "ppc64el" , "linux/ppc64le" , "powerpc64le-unknown-linux-gnu" ),
21
24
DebianArch ("s390x" , "s390x" , "linux/s390x" , "s390x-unknown-linux-gnu" ),
22
25
]
23
26
27
+ DebianVariant = namedtuple ("DebianVariant" , ["name" , "arches" ])
28
+
24
29
debian_variants = [
25
- "bullseye" ,
26
- "bookworm" ,
30
+ DebianVariant ( "bullseye" , debian_lts_arches ) ,
31
+ DebianVariant ( "bookworm" , debian_lts_arches + debian_non_lts_arches ) ,
27
32
]
28
33
29
34
default_debian_variant = "bookworm"
@@ -59,36 +64,34 @@ def write_file(file, contents):
59
64
f .write (contents )
60
65
61
66
def update_debian ():
62
- arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\ \n '
63
- arch_case += ' case "${dpkgArch##*-}" in \\ \n '
64
- for arch in debian_arches :
65
- hash = rustup_hash (arch .rust )
66
- arch_case += f" { arch .dpkg } ) rustArch='{ arch .rust } '; rustupSha256='{ hash } ' ;; \\ \n "
67
-
68
67
end = ' *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \\ \n '
69
68
end += ' esac'
70
69
71
70
template = read_file ("Dockerfile-debian.template" )
72
71
slim_template = read_file ("Dockerfile-slim.template" )
73
72
74
73
for variant in debian_variants :
75
- case = arch_case
76
- case += end
74
+ arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\ \n '
75
+ arch_case += ' case "${dpkgArch##*-}" in \\ \n '
76
+ for arch in variant .arches :
77
+ hash = rustup_hash (arch .rust )
78
+ arch_case += f" { arch .dpkg } ) rustArch='{ arch .rust } '; rustupSha256='{ hash } ' ;; \\ \n "
79
+ arch_case += end
77
80
78
81
for rust_version in supported_rust_versions :
79
82
rendered = template \
80
83
.replace ("%%RUST-VERSION%%" , rust_version ) \
81
84
.replace ("%%RUSTUP-VERSION%%" , rustup_version ) \
82
- .replace ("%%DEBIAN-SUITE%%" , variant ) \
83
- .replace ("%%ARCH-CASE%%" , case )
84
- write_file (f"{ rust_version } /{ variant } /Dockerfile" , rendered )
85
+ .replace ("%%DEBIAN-SUITE%%" , variant . name ) \
86
+ .replace ("%%ARCH-CASE%%" , arch_case )
87
+ write_file (f"{ rust_version } /{ variant . name } /Dockerfile" , rendered )
85
88
86
89
rendered = slim_template \
87
90
.replace ("%%RUST-VERSION%%" , rust_version ) \
88
91
.replace ("%%RUSTUP-VERSION%%" , rustup_version ) \
89
- .replace ("%%DEBIAN-SUITE%%" , variant ) \
90
- .replace ("%%ARCH-CASE%%" , case )
91
- write_file (f"{ rust_version } /{ variant } /slim/Dockerfile" , rendered )
92
+ .replace ("%%DEBIAN-SUITE%%" , variant . name ) \
93
+ .replace ("%%ARCH-CASE%%" , arch_case )
94
+ write_file (f"{ rust_version } /{ variant . name } /slim/Dockerfile" , rendered )
92
95
93
96
def update_alpine ():
94
97
arch_case = 'apkArch="$(apk --print-arch)"; \\ \n '
@@ -120,10 +123,10 @@ def update_ci():
120
123
121
124
versions = ""
122
125
for variant in debian_variants :
123
- versions += f" - name: { variant } \n "
124
- versions += f" variant: { variant } \n "
125
- versions += f" - name: slim-{ variant } \n "
126
- versions += f" variant: { variant } /slim\n "
126
+ versions += f" - name: { variant . name } \n "
127
+ versions += f" variant: { variant . name } \n "
128
+ versions += f" - name: slim-{ variant . name } \n "
129
+ versions += f" variant: { variant . name } /slim\n "
127
130
128
131
for version in alpine_versions :
129
132
versions += f" - name: alpine{ version } \n "
@@ -142,23 +145,23 @@ def update_nightly_ci():
142
145
versions = ""
143
146
for variant in debian_variants :
144
147
platforms = []
145
- for arch in debian_arches :
148
+ for arch in variant . arches :
146
149
platforms .append (f"{ arch .qemu } " )
147
150
platforms = "," .join (platforms )
148
151
149
- tags = [f"nightly-{ variant } " ]
150
- if variant == default_debian_variant :
152
+ tags = [f"nightly-{ variant . name } " ]
153
+ if variant . name == default_debian_variant :
151
154
tags .append ("nightly" )
152
155
153
- versions += f" - name: { variant } \n "
154
- versions += f" context: nightly/{ variant } \n "
156
+ versions += f" - name: { variant . name } \n "
157
+ versions += f" context: nightly/{ variant . name } \n "
155
158
versions += f" platforms: { platforms } \n "
156
159
versions += f" tags: |\n "
157
160
for tag in tags :
158
161
versions += f" { tag } \n "
159
162
160
- versions += f" - name: slim-{ variant } \n "
161
- versions += f" context: nightly/{ variant } /slim\n "
163
+ versions += f" - name: slim-{ variant . name } \n "
164
+ versions += f" context: nightly/{ variant . name } /slim\n "
162
165
versions += f" platforms: { platforms } \n "
163
166
versions += f" tags: |\n "
164
167
for tag in tags :
@@ -223,33 +226,33 @@ def generate_stackbrew_library():
223
226
for variant in debian_variants :
224
227
tags = []
225
228
for version_tag in version_tags ():
226
- tags .append (f"{ version_tag } -{ variant } " )
227
- tags .append (variant )
228
- if variant == default_debian_variant :
229
+ tags .append (f"{ version_tag } -{ variant . name } " )
230
+ tags .append (variant . name )
231
+ if variant . name == default_debian_variant :
229
232
for version_tag in version_tags ():
230
233
tags .append (version_tag )
231
234
tags .append ("latest" )
232
235
233
- arches = debian_arches [:]
236
+ arches = variant . arches [:]
234
237
235
238
library += single_library (
236
239
tags ,
237
240
map (lambda a : a .bashbrew , arches ),
238
- os .path .join (stable_rust_version , variant ))
241
+ os .path .join (stable_rust_version , variant . name ))
239
242
240
243
tags = []
241
244
for version_tag in version_tags ():
242
- tags .append (f"{ version_tag } -slim-{ variant } " )
243
- tags .append (f"slim-{ variant } " )
244
- if variant == default_debian_variant :
245
+ tags .append (f"{ version_tag } -slim-{ variant . name } " )
246
+ tags .append (f"slim-{ variant . name } " )
247
+ if variant . name == default_debian_variant :
245
248
for version_tag in version_tags ():
246
249
tags .append (f"{ version_tag } -slim" )
247
250
tags .append ("slim" )
248
251
249
252
library += single_library (
250
253
tags ,
251
254
map (lambda a : a .bashbrew , arches ),
252
- os .path .join (stable_rust_version , variant , "slim" ))
255
+ os .path .join (stable_rust_version , variant . name , "slim" ))
253
256
254
257
for version in alpine_versions :
255
258
tags = []
0 commit comments