From 6c20ee5a43322d2bd05495d5ccea944789fe6a1c Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Thu, 28 Jul 2022 16:00:40 -0700 Subject: [PATCH] Add needed features (0.4.0) * Add --disable-gpg-check switch to sync scripts * Add --disable-repo-gpg-check switch to sync scripts * Add datestamp for future image use --- iso/empanadas/empanadas/scripts/sync_from_peridot.py | 4 ++++ iso/empanadas/empanadas/scripts/sync_sig.py | 6 +++++- iso/empanadas/empanadas/templates/repoconfig.tmpl | 12 ++++++------ iso/empanadas/empanadas/util/dnf_utils.py | 12 ++++++++++++ iso/empanadas/empanadas/util/iso_utils.py | 10 ++++++++++ iso/empanadas/empanadas/util/shared.py | 8 +++++++- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/iso/empanadas/empanadas/scripts/sync_from_peridot.py b/iso/empanadas/empanadas/scripts/sync_from_peridot.py index d025f65..4301ede 100755 --- a/iso/empanadas/empanadas/scripts/sync_from_peridot.py +++ b/iso/empanadas/empanadas/scripts/sync_from_peridot.py @@ -26,6 +26,8 @@ parser.add_argument('--refresh-treeinfo', action='store_true') # I am aware this is confusing, I want podman to be the default option parser.add_argument('--simple', action='store_false') parser.add_argument('--logger', type=str) +parser.add_argument('--disable-gpg-check', action='store_false') +parser.add_argument('--disable-repo-gpg-check', action='store_false') # Parse them results = parser.parse_args() @@ -54,6 +56,8 @@ a = RepoSync( logger=results.logger, refresh_extra_files=results.refresh_extra_files, refresh_treeinfo=results.refresh_treeinfo, + gpg_check=results.disable_gpg_check, + repo_gpg_check=results.disable_repo_gpg_check, ) def run(): diff --git a/iso/empanadas/empanadas/scripts/sync_sig.py b/iso/empanadas/empanadas/scripts/sync_sig.py index 8602d4d..46296f9 100755 --- a/iso/empanadas/empanadas/scripts/sync_sig.py +++ b/iso/empanadas/empanadas/scripts/sync_sig.py @@ -29,6 +29,8 @@ parser.add_argument('--refresh-extra-files', action='store_true') # I am aware this is confusing, I want podman to be the default option parser.add_argument('--simple', action='store_false') parser.add_argument('--logger', type=str) +parser.add_argument('--disable-gpg-check', action='store_false') +parser.add_argument('--disable-repo-gpg-check', action='store_false') # Parse them results = parser.parse_args() @@ -56,7 +58,9 @@ a = SigRepoSync( fullrun=results.full_run, nofail=results.no_fail, refresh_extra_files=results.refresh_extra_files, - logger=results.logger + logger=results.logger, + gpg_check=results.disable_gpg_check, + repo_gpg_check=results.disable_repo_gpg_check, ) diff --git a/iso/empanadas/empanadas/templates/repoconfig.tmpl b/iso/empanadas/empanadas/templates/repoconfig.tmpl index d322929..248ee48 100644 --- a/iso/empanadas/empanadas/templates/repoconfig.tmpl +++ b/iso/empanadas/empanadas/templates/repoconfig.tmpl @@ -3,24 +3,24 @@ name={{repo.name}} baseurl={{ repo.baseurl }} enabled=1 -gpgcheck=1 -repo_gpgcheck=1 +gpgcheck={{ gpg_check }} +repo_gpgcheck={{ repo_gpg_check }} gpgkey={{ repo.gpgkey }} [{{ repo.name }}-debug] name={{repo.name}} baseurl={{ repo.baseurl }}-debug enabled=1 -gpgcheck=1 -repo_gpgcheck=1 +gpgcheck={{ gpg_check }} +repo_gpgcheck={{ repo_gpg_check }} gpgkey={{ repo.gpgkey }} [{{ repo.name }}-source] name={{repo.name}} baseurl={{ repo.srcbaseurl }} enabled=1 -gpgcheck=1 -repo_gpgcheck=1 +gpgcheck={{ gpg_check }} +repo_gpgcheck={{ repo_gpg_check }} gpgkey={{ repo.gpgkey }} {% endfor %} diff --git a/iso/empanadas/empanadas/util/dnf_utils.py b/iso/empanadas/empanadas/util/dnf_utils.py index 6dc4897..a90d807 100644 --- a/iso/empanadas/empanadas/util/dnf_utils.py +++ b/iso/empanadas/empanadas/util/dnf_utils.py @@ -57,6 +57,8 @@ class RepoSync: fullrun: bool = False, nofail: bool = False, gpgkey: str = 'stable', + gpg_check: bool = True, + repo_gpg_check: bool = True, rlmode: str = 'stable', just_pull_everything: bool = False, logger=None @@ -103,6 +105,8 @@ class RepoSync: self.extra_files = rlvars['extra_files'] self.gpgkey = gpgkey self.checksum = rlvars['checksum'] + self.gpg_check = gpg_check + self.repo_gpg_check = repo_gpg_check self.compose_id = '{}-{}-{}'.format( config['shortname'], @@ -241,6 +245,8 @@ class RepoSync: self.hashed, self.extra_files, self.gpgkey, + self.gpg_check, + self.repo_gpg_check, self.tmplenv, self.log ) @@ -1486,6 +1492,8 @@ class SigRepoSync: fullrun: bool = False, nofail: bool = False, gpgkey: str = 'stable', + gpg_check: bool = True, + repo_gpg_check: bool = True, logger=None ): self.nofail = nofail @@ -1516,6 +1524,8 @@ class SigRepoSync: self.fullversion = rlvars['revision'] self.sigrepo = repo self.checksum = rlvars['checksum'] + self.gpg_check = gpg_check + self.repo_gpg_check = repo_gpg_check # Relevant major version items self.sigvars = sigvars @@ -1672,6 +1682,8 @@ class SigRepoSync: self.hashed, self.extra_files, self.gpgkey, + self.gpg_check, + self.repo_gpg_check, self.tmplenv, self.log ) diff --git a/iso/empanadas/empanadas/util/iso_utils.py b/iso/empanadas/empanadas/util/iso_utils.py index b236fc1..32f4a63 100644 --- a/iso/empanadas/empanadas/util/iso_utils.py +++ b/iso/empanadas/empanadas/util/iso_utils.py @@ -61,6 +61,8 @@ class IsoBuild: extra_iso_mode: str = 'local', compose_dir_is_here: bool = False, hashed: bool = False, + updated_image: bool = False, + image_increment: str = '0', image=None, logger=None ): @@ -93,6 +95,10 @@ class IsoBuild: self.checksum = rlvars['checksum'] self.profile = rlvars['profile'] self.hashed = hashed + self.updated_image = updated_image + self.updated_image_increment = "." + image_increment + self.updated_image_date = (time.strftime("%Y%m%d", time.localtime()) + + self.updated_image_increment) # Relevant major version items self.arch = arch @@ -809,6 +815,10 @@ class IsoBuild: if self.release_candidate: rclevel = '-' + self.rclvl + datestamp = '' + if self.updated_image: + datestamp = '-' + self.updated_image_date.copy() + volid = '{}-{}-{}{}-{}-{}'.format( self.shortname, self.major_version, diff --git a/iso/empanadas/empanadas/util/shared.py b/iso/empanadas/empanadas/util/shared.py index c417ab1..3923062 100644 --- a/iso/empanadas/empanadas/util/shared.py +++ b/iso/empanadas/empanadas/util/shared.py @@ -411,6 +411,8 @@ class Shared: hashed, extra_files, gpgkey, + gpg_check, + repo_gpg_check, templates, logger, dest_path='/var/tmp' @@ -468,7 +470,11 @@ class Shared: repolist.append(repodata) template = templates.get_template('repoconfig.tmpl') - output = template.render(repos=repolist) + output = template.render( + repos=repolist, + gpg_check=gpg_check, + repo_gpg_check=repo_gpg_check + ) config_file.write(output) config_file.close()