1212
1313DebianArch = namedtuple ("DebianArch" , ["bashbrew" , "dpkg" , "qemu" , "rust" ])
1414
15- debian_arches = [
15+ debian_lts_arches = [
1616 DebianArch ("amd64" , "amd64" , "linux/amd64" , "x86_64-unknown-linux-gnu" ),
1717 DebianArch ("arm32v7" , "armhf" , "linux/arm/v7" , "armv7-unknown-linux-gnueabihf" ),
1818 DebianArch ("arm64v8" , "arm64" , "linux/arm64" , "aarch64-unknown-linux-gnu" ),
1919 DebianArch ("i386" , "i386" , "linux/386" , "i686-unknown-linux-gnu" ),
20+ ]
21+
22+ debian_non_lts_arches = [
2023 DebianArch ("ppc64le" , "ppc64el" , "linux/ppc64le" , "powerpc64le-unknown-linux-gnu" ),
2124 DebianArch ("s390x" , "s390x" , "linux/s390x" , "s390x-unknown-linux-gnu" ),
2225]
2326
27+ DebianVariant = namedtuple ("DebianVariant" , ["name" , "arches" ])
28+
2429debian_variants = [
25- "bullseye" ,
26- "bookworm" ,
30+ DebianVariant ( "bullseye" , debian_lts_arches ) ,
31+ DebianVariant ( "bookworm" , debian_lts_arches + debian_non_lts_arches ) ,
2732]
2833
2934default_debian_variant = "bookworm"
@@ -59,36 +64,34 @@ def write_file(file, contents):
5964 f .write (contents )
6065
6166def 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-
6867 end = ' *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \\ \n '
6968 end += ' esac'
7069
7170 template = read_file ("Dockerfile-debian.template" )
7271 slim_template = read_file ("Dockerfile-slim.template" )
7372
7473 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
7780
7881 for rust_version in supported_rust_versions :
7982 rendered = template \
8083 .replace ("%%RUST-VERSION%%" , rust_version ) \
8184 .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 )
8588
8689 rendered = slim_template \
8790 .replace ("%%RUST-VERSION%%" , rust_version ) \
8891 .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 )
9295
9396def update_alpine ():
9497 arch_case = 'apkArch="$(apk --print-arch)"; \\ \n '
@@ -120,10 +123,10 @@ def update_ci():
120123
121124 versions = ""
122125 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 "
127130
128131 for version in alpine_versions :
129132 versions += f" - name: alpine{ version } \n "
@@ -142,23 +145,23 @@ def update_nightly_ci():
142145 versions = ""
143146 for variant in debian_variants :
144147 platforms = []
145- for arch in debian_arches :
148+ for arch in variant . arches :
146149 platforms .append (f"{ arch .qemu } " )
147150 platforms = "," .join (platforms )
148151
149- tags = [f"nightly-{ variant } " ]
150- if variant == default_debian_variant :
152+ tags = [f"nightly-{ variant . name } " ]
153+ if variant . name == default_debian_variant :
151154 tags .append ("nightly" )
152155
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 "
155158 versions += f" platforms: { platforms } \n "
156159 versions += f" tags: |\n "
157160 for tag in tags :
158161 versions += f" { tag } \n "
159162
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 "
162165 versions += f" platforms: { platforms } \n "
163166 versions += f" tags: |\n "
164167 for tag in tags :
@@ -223,33 +226,33 @@ def generate_stackbrew_library():
223226 for variant in debian_variants :
224227 tags = []
225228 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 :
229232 for version_tag in version_tags ():
230233 tags .append (version_tag )
231234 tags .append ("latest" )
232235
233- arches = debian_arches [:]
236+ arches = variant . arches [:]
234237
235238 library += single_library (
236239 tags ,
237240 map (lambda a : a .bashbrew , arches ),
238- os .path .join (stable_rust_version , variant ))
241+ os .path .join (stable_rust_version , variant . name ))
239242
240243 tags = []
241244 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 :
245248 for version_tag in version_tags ():
246249 tags .append (f"{ version_tag } -slim" )
247250 tags .append ("slim" )
248251
249252 library += single_library (
250253 tags ,
251254 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" ))
253256
254257 for version in alpine_versions :
255258 tags = []
0 commit comments