@@ -592,23 +592,33 @@ class BuildRequest:
592
592
def __bool__ (self ):
593
593
return bool (self .images or self .indexes )
594
594
595
- def expanded (self , indexes = False , distro_qualified = True ):
595
+ def expanded (
596
+ self , indexes = False , distro_qualified = True , unqualified = True
597
+ ):
596
598
new_req = self .__class__ (self .images , self .indexes )
597
599
if indexes :
598
600
new_req ._build_indexes ()
599
- new_req ._expand_special_tags (distro_qualified = distro_qualified )
601
+ new_req ._expand_special_tags (
602
+ distro_qualified = distro_qualified , unqualified = unqualified
603
+ )
600
604
return new_req
601
605
602
- def _expand_special_tags (self , distro_qualified = True ):
606
+ def _expand_special_tags (self , distro_qualified = True , unqualified = True ):
603
607
if self .indexes :
604
608
for image in self .indexes :
605
609
# distro qualified is redundant with the default tag of an
606
610
# index/manifest as well as mainly needed for backwards
607
611
# compatibility something we don't want for indexes.
608
- add_special_tags (image , distro_qualified = False )
612
+ add_special_tags (
613
+ image , distro_qualified = False , unqualified = unqualified
614
+ )
609
615
else :
610
616
for image in self .images :
611
- add_special_tags (image , distro_qualified = distro_qualified )
617
+ add_special_tags (
618
+ image ,
619
+ distro_qualified = distro_qualified ,
620
+ unqualified = unqualified ,
621
+ )
612
622
613
623
def _build_indexes (self ):
614
624
_indexes = {}
@@ -645,11 +655,13 @@ def generate_request(cli):
645
655
)
646
656
images [str (timg )] = timg
647
657
return BuildRequest (images = images .values ()).expanded (
648
- indexes = cli .combined , distro_qualified = cli .distro_qualified
658
+ indexes = cli .combined ,
659
+ distro_qualified = cli .distro_qualified ,
660
+ unqualified = cli .unqualified ,
649
661
)
650
662
651
663
652
- def add_special_tags (img , distro_qualified = True ):
664
+ def add_special_tags (img , distro_qualified = True , unqualified = True ):
653
665
"""Certain images have special tags. Given an image, add general (non-FQIN)
654
666
tags to that image.
655
667
"""
@@ -659,7 +671,7 @@ def add_special_tags(img, distro_qualified=True):
659
671
# the project.
660
672
_host_arch = host_arch ()
661
673
arch_ok = img .supports_arch (_host_arch )
662
- if img .distro in [FEDORA , OPENSUSE ]:
674
+ if unqualified and img .distro in [FEDORA , OPENSUSE ]:
663
675
if arch_ok and img .pkg_source == DEFAULT :
664
676
img .additional_tags .append ((LATEST , QUAL_NONE ))
665
677
if arch_ok and img .pkg_source == NIGHTLY :
@@ -979,6 +991,14 @@ def main():
979
991
" will be created."
980
992
),
981
993
)
994
+ parser .add_argument (
995
+ "--unqualified" ,
996
+ action = argparse .BooleanOptionalAction ,
997
+ default = True ,
998
+ help = (
999
+ "Specify if image tags like nightly or latest" " will be created."
1000
+ ),
1001
+ )
982
1002
parser .add_argument (
983
1003
"--combined" ,
984
1004
action = argparse .BooleanOptionalAction ,
0 commit comments