Skip to content

Commit

Permalink
Clean hotfix directory before patching the srpm contents
Browse files Browse the repository at this point in the history
For those of us who don't patch the srpm contents correctly the first or
even second time, we should do something like make clean before we extract
the srpm, patch things, and attempt to rpmbuild.
  • Loading branch information
jrafanie committed Jan 2, 2025
1 parent 9ac5a5c commit 80eb3c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/manageiq/rpm_build/build_hotfix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def generate_rpm
where_am_i

Dir.chdir(HOTFIX_DIR) do
clean_hotfix_directory
unpack_srpm
update_spec
copy_patches
Expand Down Expand Up @@ -64,6 +65,11 @@ def update_spec
File.write(rpm_spec, spec_text)
end

def clean_hotfix_directory
files = Dir.glob("*").reject {|path| path.end_with?("src.rpm") }
FileUtils.rm_f(files, :verbose => true)
end

def unpack_srpm
srpm = Dir.glob("*.src.rpm").first
shell_cmd("rpm2cpio #{srpm} | cpio -idmv")
Expand Down

0 comments on commit 80eb3c1

Please sign in to comment.