@@ -237,7 +237,9 @@ def _run(cmd, *args, **kwargs):
237237 return subprocess .run (cmd , * args , ** kwargs )
238238
239239
240- def _container_cmd (ctx , args , * , workdir = None , interactive = False ):
240+ def _container_cmd (
241+ ctx , args , * , workdir = None , interactive = False , extra_args = None
242+ ):
241243 rm_container = not ctx .cli .keep_container
242244 cmd = [
243245 ctx .container_engine ,
@@ -277,8 +279,8 @@ def _container_cmd(ctx, args, *, workdir=None, interactive=False):
277279 )
278280 cmd .append (f"-eCCACHE_DIR={ ccdir } " )
279281 cmd .append (f"-eCCACHE_BASEDIR={ ctx .cli .homedir } " )
280- for extra_arg in ctx . cli . extra or []:
281- cmd .append ( extra_arg )
282+ cmd . extend ( extra_args or [])
283+ cmd .extend ( ctx . cli . extra or [] )
282284 if ctx .npm_cache_dir :
283285 # use :z so that other builds can use the cache
284286 cmd .extend ([
@@ -367,6 +369,11 @@ def hint(cls):
367369 return ", " .join (s .value for s in cls )
368370
369371
372+ class ImageVariant (StrEnum ):
373+ DEFAULT = 'default' # build everything + make check
374+ PACKAGES = 'packages' # test deps. ignored, only for packages
375+
376+
370377class Context :
371378 """Command context."""
372379
@@ -409,6 +416,8 @@ def target_tag(self):
409416 branch = _git_current_branch (self ).replace ("/" , "-" )
410417 except subprocess .CalledProcessError :
411418 branch = "UNKNOWN"
419+ if self .cli .image_variant is not ImageVariant .DEFAULT :
420+ suffix = f".{ self .cli .image_variant } { suffix } "
412421 return f"{ branch } .{ self .cli .distro } { suffix } "
413422
414423 def base_branch (self ):
@@ -614,6 +623,8 @@ def build_container(ctx):
614623 f"--volume={ ctx .dnf_cache_dir } :/var/cache/dnf:Z" ,
615624 "--build-arg=CLEAN_DNF=no" ,
616625 ]
626+ if ctx .cli .image_variant is ImageVariant .PACKAGES :
627+ cmd .append ("--build-arg=FOR_MAKE_CHECK=false" )
617628 if ctx .cli .build_args :
618629 cmd .extend ([f"--build-arg={ v } " for v in ctx .cli .build_args ])
619630 cmd += ["-f" , ctx .cli .containerfile , ctx .cli .containerdir ]
@@ -726,6 +737,9 @@ def bc_build_tests(ctx):
726737 "-c" ,
727738 f"cd { ctx .cli .homedir } && source ./src/script/run-make.sh && build tests" ,
728739 ],
740+ # for compatibility with earlier versions that baked this env var
741+ # into the build images
742+ extra_args = ['-eFOR_MAKE_CHECK=1' ],
729743 )
730744 with ctx .user_command ():
731745 _run (cmd , check = True , ctx = ctx )
@@ -1078,6 +1092,13 @@ def parse_cli(build_step_names):
10781092 help = "Specify a set of valid image sources. "
10791093 f"May be a comma separated list of { ImageSource .hint ()} " ,
10801094 )
1095+ g_image .add_argument (
1096+ "--image-variant" ,
1097+ type = ImageVariant ,
1098+ choices = sorted (v .value for v in ImageVariant ),
1099+ default = ImageVariant .DEFAULT .value ,
1100+ help = "Specify the variant of the build image desired." ,
1101+ )
10811102 g_image .add_argument (
10821103 "--base-image" ,
10831104 help = (
0 commit comments