@@ -102,9 +102,9 @@ DEVBUILDS = "devbuilds"
102102PACKAGE_SOURCES = [DEFAULT , NIGHTLY , DEVBUILDS ]
103103
104104PACKAGES_FROM = {
105- DEFAULT : '' ,
106- NIGHTLY : ' samba-nightly' ,
107- DEVBUILDS : ' devbuilds' ,
105+ DEFAULT : "" ,
106+ NIGHTLY : " samba-nightly" ,
107+ DEVBUILDS : " devbuilds" ,
108108}
109109
110110# SOURCE_DIRS - image source paths
@@ -121,7 +121,7 @@ DEFAULT_DISTRO_BASES = [FEDORA]
121121LATEST = "latest"
122122QUAL_NONE = "unqualified"
123123QUAL_DISTRO = "distro-qualified"
124- QUAL_FQIN = ' fqin'
124+ QUAL_FQIN = " fqin"
125125
126126
127127_DISCOVERED_CONTAINER_ENGINES = []
@@ -207,23 +207,42 @@ def container_build(cli, target):
207207 tasks = []
208208
209209 # For docker cross-builds we need to use buildx
210- if "docker" in eng and target .arch != host_arch ():
210+ if "docker" in eng and target .arch != host_arch ():
211211 args = [eng , "buildx" ]
212212
213213 # Docker's default builder only supports the host architecture.
214214 # Therefore, we need to create a new builder to support other
215215 # architectures, and we must ensure we start with a fresh builder
216216 # that does not contain any images from previous builds.
217- tasks .append (lambda : run (cli , args + ["rm" , target .flat_name ()], check = False ))
218- tasks .append (lambda : run (cli , args + ["create" , f"--name={ target .flat_name ()} " ], check = True ))
217+ tasks .append (
218+ lambda : run (cli , args + ["rm" , target .flat_name ()], check = False )
219+ )
220+ tasks .append (
221+ lambda : run (
222+ cli ,
223+ args + ["create" , f"--name={ target .flat_name ()} " ],
224+ check = True ,
225+ )
226+ )
219227
220- tasks .append (lambda : run (cli , args + [
221- "build" ,
222- f"--builder={ target .flat_name ()} " ,
223- f"--platform=linux/{ target .arch } " ,
224- "--load" ] + create_common_container_engine_args (cli , target ), check = True ))
228+ tasks .append (
229+ lambda : run (
230+ cli ,
231+ args
232+ + [
233+ "build" ,
234+ f"--builder={ target .flat_name ()} " ,
235+ f"--platform=linux/{ target .arch } " ,
236+ "--load" ,
237+ ]
238+ + create_common_container_engine_args (cli , target ),
239+ check = True ,
240+ )
241+ )
225242
226- tasks .append (lambda : run (cli , args + ["rm" , target .flat_name ()], check = True ))
243+ tasks .append (
244+ lambda : run (cli , args + ["rm" , target .flat_name ()], check = True )
245+ )
227246 else :
228247 args = [eng , "build" ]
229248 if target .arch != host_arch () or FORCE_ARCH_FLAG :
@@ -235,17 +254,24 @@ def container_build(cli, target):
235254 # are the same, skip passing the extra argument.
236255 args += [f"--arch={ target .arch } " ]
237256
238- tasks .append (lambda : run (cli , args + create_common_container_engine_args (cli , target ), check = True ))
257+ tasks .append (
258+ lambda : run (
259+ cli ,
260+ args + create_common_container_engine_args (cli , target ),
261+ check = True ,
262+ )
263+ )
239264
240265 for task in tasks :
241266 task ()
242267
268+
243269def create_common_container_engine_args (cli , target ):
244270 args = []
245271 pkgs_from = PACKAGES_FROM [target .pkg_source ]
246272 if pkgs_from :
247273 args .append (f"--build-arg=INSTALL_PACKAGES_FROM={ pkgs_from } " )
248-
274+
249275 if cli .extra_build_arg :
250276 args .extend (cli .extra_build_arg )
251277
@@ -258,6 +284,7 @@ def create_common_container_engine_args(cli, target):
258284 args .append (kind_source_dir (target .name ))
259285 return [str (a ) for a in args ]
260286
287+
261288def container_push (cli , push_name ):
262289 """Construct and execute a command to push a container image."""
263290 args = [container_engine (cli ), "push" , push_name ]
@@ -306,7 +333,9 @@ def kind_source_dir(kind):
306333
307334def target_containerfile (target ):
308335 """Return the path to a containerfile given an image target."""
309- return str (kind_source_dir (target .name ) / f"Containerfile.{ target .distro } " )
336+ return str (
337+ kind_source_dir (target .name ) / f"Containerfile.{ target .distro } "
338+ )
310339
311340
312341def host_arch ():
@@ -659,7 +688,7 @@ def main():
659688 parser .add_argument (
660689 "--push-selected-tags" ,
661690 type = QMatcher ,
662- help = QMatcher .__doc__
691+ help = QMatcher .__doc__ ,
663692 )
664693 parser .add_argument (
665694 "--buildfile-prefix" ,
@@ -724,8 +753,10 @@ def main():
724753 action = "store_const" ,
725754 dest = "main_action" ,
726755 const = retag ,
727- help = ("Regenerate any short (unqualified) tags expected to exist"
728- " for a given FQIN. Requires FQIN to already exist locally." ),
756+ help = (
757+ "Regenerate any short (unqualified) tags expected to exist"
758+ " for a given FQIN. Requires FQIN to already exist locally."
759+ ),
729760 )
730761 cli = parser .parse_args ()
731762
0 commit comments