Skip to content

Commit

Permalink
Ensure reposync_only uses ONLY reposync repos (#199)
Browse files Browse the repository at this point in the history
* Avoid repo name collision

* Make reposync_only reposync ONLY

* Update versioned metadata
  • Loading branch information
op-ct authored Feb 27, 2023
1 parent e2d9901 commit d593ef9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/simp/rake/build/auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/simp/rake/build/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down
29 changes: 18 additions & 11 deletions lib/simp/rake/build/unpack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <version> 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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/simp/rake/helpers/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module Simp; end
module Simp::Rake; end

class Simp::Rake::Helpers
VERSION = '5.17.1'
VERSION = '5.18.0'
end

0 comments on commit d593ef9

Please sign in to comment.