From 1ba76a849ab98b0788e977ea53f565c3bda4b9b4 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Mon, 11 Jul 2022 16:01:19 -0700 Subject: [PATCH] force build --- iso/empanadas/empanadas/scripts/build_iso_live.py | 2 ++ iso/empanadas/empanadas/util/iso_utils.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/iso/empanadas/empanadas/scripts/build_iso_live.py b/iso/empanadas/empanadas/scripts/build_iso_live.py index 92cc100..6b2e5fa 100755 --- a/iso/empanadas/empanadas/scripts/build_iso_live.py +++ b/iso/empanadas/empanadas/scripts/build_iso_live.py @@ -16,6 +16,7 @@ parser.add_argument('--logger', type=str) parser.add_argument('--live-iso-mode', type=str, default='local') parser.add_argument('--hashed', action='store_true') parser.add_argument('--just-copy-it', action='store_true', help="Just copy the images to the compose dir") +parser.add_argument('--force-build', action='store_true', help="Just build and overwrite the images") results = parser.parse_args() rlvars = rldict[results.release] major = rlvars['major'] @@ -30,6 +31,7 @@ a = LiveBuild( compose_dir_is_here=results.local_compose, hashed=results.hashed, justcopyit=results.just_copy_it, + force_build=results.force_build, logger=results.logger ) diff --git a/iso/empanadas/empanadas/util/iso_utils.py b/iso/empanadas/empanadas/util/iso_utils.py index 2b9c3e8..86a80d8 100644 --- a/iso/empanadas/empanadas/util/iso_utils.py +++ b/iso/empanadas/empanadas/util/iso_utils.py @@ -1426,6 +1426,7 @@ class LiveBuild: hashed: bool = False, image=None, justcopyit: bool = False, + force_build: bool = False, logger=None ): @@ -1449,6 +1450,7 @@ class LiveBuild: self.live_result_root = config['mock_work_root'] + "/lmc" self.mock_isolation = isolation self.force_download = force_download + self.force_build = force_build self.live_iso_mode = live_iso_mode self.checksum = rlvars['checksum'] self.profile = rlvars['profile'] @@ -1863,6 +1865,16 @@ class LiveBuild: self.major_version, arch ) + + if self.justcopyit: + if os.path.exists(os.path.join(live_res_dir, isoname)): + self.log.warn(Color.WARN + 'Image already exists.') + if self.force_build: + self.log.warn(Color.WARN + 'Building anyway.') + else: + self.log.warn(Color.WARN + 'Skipping.') + return + live_iso_cmd = '/bin/bash {}/liveisobuild-{}-{}.sh'.format(entries_dir, arch, image) self.log.info('Starting mock build...') p = subprocess.call(shlex.split(live_iso_cmd))