Allow only creating unified ISO for specified arch

Fixes: https://pagure.io/pungi/issue/1393
JIRA: RHELCMP-807
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-06-08 19:46:03 +08:00
parent ffb65e8770
commit 0196d7fd00
2 changed files with 12 additions and 2 deletions

View File

@ -18,11 +18,18 @@ def parse_args():
parser.add_argument( parser.add_argument(
"compose", metavar="<compose-path>", nargs=1, help="path to compose", "compose", metavar="<compose-path>", nargs=1, help="path to compose",
) )
parser.add_argument(
"--arch",
metavar="<arch>",
dest="arches",
action="append",
help="only generate ISOs for specified arch",
)
return parser.parse_args() return parser.parse_args()
def main(): def main():
args = parse_args() args = parse_args()
iso = UnifiedISO(args.compose[0]) iso = UnifiedISO(args.compose[0], arches=args.arches)
iso.create(delete_temp=True) iso.create(delete_temp=True)

View File

@ -63,7 +63,7 @@ DEFAULT_CHECKSUMS = ["md5", "sha1", "sha256"]
class UnifiedISO(object): class UnifiedISO(object):
def __init__(self, compose_path, output_path=None): def __init__(self, compose_path, output_path=None, arches=None):
self.compose_path = os.path.abspath(compose_path) self.compose_path = os.path.abspath(compose_path)
compose_subdir = os.path.join(self.compose_path, "compose") compose_subdir = os.path.join(self.compose_path, "compose")
if os.path.exists(compose_subdir): if os.path.exists(compose_subdir):
@ -84,6 +84,7 @@ class UnifiedISO(object):
self.productid = {} # {arch/stc: {variant: old_path} self.productid = {} # {arch/stc: {variant: old_path}
self.conf = self.read_config() self.conf = self.read_config()
self.images = None # productmd.images.Images instance self.images = None # productmd.images.Images instance
self.arches = arches
def create(self, delete_temp=True): def create(self, delete_temp=True):
print("Creating unified ISOs for: {0}".format(self.compose_path)) print("Creating unified ISOs for: {0}".format(self.compose_path))
@ -161,6 +162,8 @@ class UnifiedISO(object):
# copy files to new location; change RPM location to $variant_uid # copy files to new location; change RPM location to $variant_uid
for variant in self.ci.get_variants(recursive=False): for variant in self.ci.get_variants(recursive=False):
for arch in variant.arches: for arch in variant.arches:
if self.arches and arch not in self.arches:
continue
print("Processing: {0}.{1}".format(variant.uid, arch)) print("Processing: {0}.{1}".format(variant.uid, arch))
try: try:
tree_dir = os.path.join( tree_dir = os.path.join(