From d593ef96961b8b9b8800ce87d7f4cc7acc1aa743 Mon Sep 17 00:00:00 2001 From: op-ct Date: Mon, 27 Feb 2023 17:02:30 -0500 Subject: [PATCH] Ensure `reposync_only` uses ONLY reposync repos (#199) * Avoid repo name collision * Make reposync_only reposync ONLY * Update versioned metadata --- CHANGELOG.md | 9 +++++++++ lib/simp/rake/build/auto.rb | 4 ++-- lib/simp/rake/build/pkg.rb | 10 +++++----- lib/simp/rake/build/unpack.rb | 29 ++++++++++++++++++----------- lib/simp/rake/helpers/version.rb | 2 +- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb9ec069..73a6cef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### 5.18.0 /2023-02-27 +- Added + - `SIMP_BUILD_reposync_only` now excludes RPMs and yum repos from the ISO + `unpack` task +- Fixed + - Change common repo name `base` to avoid repoclosure conflict warnings + - EL7 ISO unpack no longer interferes with reposync repos when + `SIMP_BUILD_reposync_only=yes` + ### 5.17.1 /2022-11-11 - Fixed - Fixed an edge case where the `SIMP` directory YUM metadata was not diff --git a/lib/simp/rake/build/auto.rb b/lib/simp/rake/build/auto.rb index 5ef6abe4..092d4cec 100644 --- a/lib/simp/rake/build/auto.rb +++ b/lib/simp/rake/build/auto.rb @@ -361,9 +361,9 @@ def define end target_data['isos'].each do |iso| - puts "---- rake unpack[#{iso},#{do_merge},#{Dir.pwd},isoinfo,#{target_data['os_version']}]" + puts "---- rake unpack[#{iso},#{do_merge},#{Dir.pwd},isoinfo,#{target_data['os_version']}#{reposync_only}]" Rake::Task['unpack'].reenable - Rake::Task['unpack'].invoke(iso,do_merge,Dir.pwd,'isoinfo',target_data['os_version']) + Rake::Task['unpack'].invoke(iso,do_merge,Dir.pwd,'isoinfo',target_data['os_version'],reposync_only) end else puts diff --git a/lib/simp/rake/build/pkg.rb b/lib/simp/rake/build/pkg.rb index 871e9f3e..116a63cc 100644 --- a/lib/simp/rake/build/pkg.rb +++ b/lib/simp/rake/build/pkg.rb @@ -544,7 +544,7 @@ def populate_rpm_dir(rpm_dir) Finds all rpm files in the target dir and all of its subdirectories, then reports which packages have unresolved dependencies. This needs to be run - after rake tasks tar:build and unpack if operating on the base SIMP repo. + after rake tasks tar:build and unpack if operating on the basetest SIMP repo. * :target_dir - The directory to assess. Default #{@build_dir}/SIMP. * :aux_dir - Auxillary repo glob to use when assessing. Default #{@build_dir}/Ext_*. Defaults to ''(empty) if :target_dir is not the system default. @@ -594,14 +594,14 @@ def populate_rpm_dir(rpm_dir) Dir.mktmpdir do |temp_pkg_dir| Dir.chdir(temp_pkg_dir) do - mkdir_p('repos/base') + mkdir_p('repos/basetest') mkdir_p('repos/lookaside') mkdir_p('repodata') Dir.glob(File.join(args[:target_dir], '**', '*.rpm')) .delete_if{|x| x =~ /\.src\.rpm$/} .each do |path| - sym_path = "repos/base/#{File.basename(path)}" + sym_path = "repos/basetest/#{File.basename(path)}" ln_sf(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path) end @@ -637,9 +637,9 @@ def populate_rpm_dir(rpm_dir) dnf_system = which('dnf') if dnf_system - cmd = 'repoclosure -c base.conf --disablerepo=* --enablerepo=base' + cmd = 'repoclosure -c basetest.conf --disablerepo=* --enablerepo=basetest' else - cmd = 'repoclosure -c repodata -n -t -r base -l lookaside -c yum.conf' + cmd = 'repoclosure -c repodata -n -t -r basetest -l lookaside -c yum.conf' end if ENV['SIMP_BUILD_verbose'] == 'yes' diff --git a/lib/simp/rake/build/unpack.rb b/lib/simp/rake/build/unpack.rb index 7b02f574..1bc64b66 100644 --- a/lib/simp/rake/build/unpack.rb +++ b/lib/simp/rake/build/unpack.rb @@ -28,23 +28,26 @@ def define_tasks * :isoinfo - The isoinfo executable to use to extract stuff from the ISO. Defaults to 'isoinfo'. * :version - optional override for the number (e.g., '7.0' instead of '7') + * :exclude_repos - Don't unpack repos or packages when true " =end - task :unpack,[:iso_path, :merge, :targetdir, :isoinfo, :version] do |t,args| + task :unpack,[:iso_path, :merge, :targetdir, :isoinfo, :version, :exclude_repos] do |t,args| args.with_defaults( - :iso_path => '', - :isoinfo => 'isoinfo', - :targetdir => Dir.pwd, - :merge => false, - :version => false, + :iso_path => '', + :isoinfo => 'isoinfo', + :targetdir => Dir.pwd, + :merge => false, + :version => false, + :exclude_repos => false, ) - iso_path = args.iso_path - iso_info = which(args.isoinfo) - targetdir = args.targetdir - merge = args.merge - version = args.version + iso_path = args.iso_path + iso_info = which(args.isoinfo) + targetdir = args.targetdir + merge = args.merge + version = args.version + exclude_repos = args.exclude_repos # Checking for valid arguments File.exist?(args.iso_path) or @@ -102,6 +105,10 @@ def define_tasks iso_toc.each do |iso_entry| target = "#{out_dir}#{iso_entry}" unless File.exist?(target) + if exclude_repos && target =~ %r{\.rpm$|repodata|repomd.xml} + puts " [exclude_repos] SKIPPING repo/package file: #{target}" + next + end FileUtils.mkdir_p(File.dirname(target)) system("#{iso_info} -R -x #{iso_entry} -i #{iso_path} > #{target}") end diff --git a/lib/simp/rake/helpers/version.rb b/lib/simp/rake/helpers/version.rb index 92c5c794..16926402 100644 --- a/lib/simp/rake/helpers/version.rb +++ b/lib/simp/rake/helpers/version.rb @@ -2,5 +2,5 @@ module Simp; end module Simp::Rake; end class Simp::Rake::Helpers - VERSION = '5.17.1' + VERSION = '5.18.0' end