aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2022-09-30 20:39:49 +0000
committerPascal Terjan <pterjan@mageia.org>2022-09-30 20:40:03 +0000
commit76da7f42ef3fdcedce7f29814635298b426e6247 (patch)
treecc0f89d158f6352fc05cd31d12357f19ec1bf722
parent575998882c34193b3c0f7a3ed889f22352d18b2e (diff)
downloadpuppet-76da7f42ef3fdcedce7f29814635298b426e6247.tar
puppet-76da7f42ef3fdcedce7f29814635298b426e6247.tar.gz
puppet-76da7f42ef3fdcedce7f29814635298b426e6247.tar.bz2
puppet-76da7f42ef3fdcedce7f29814635298b426e6247.tar.xz
puppet-76da7f42ef3fdcedce7f29814635298b426e6247.zip
Cleanup packages no longer built on an arch
-rwxr-xr-xmodules/buildsystem/templates/cleaner.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/modules/buildsystem/templates/cleaner.rb b/modules/buildsystem/templates/cleaner.rb
index 906a03c6..45e683d9 100755
--- a/modules/buildsystem/templates/cleaner.rb
+++ b/modules/buildsystem/templates/cleaner.rb
@@ -83,8 +83,8 @@ def process
archs.each{|arch|
bin_path = "#{base_path}/#{version}/#{arch}/media/#{media}"
debug_path = bin_path.sub("/media/", "/media/debug/")
- old_packages = check_binaries($srcs, $srcages, bin_path, $used_srcs)
- old_debug_packages = check_binaries($srcs, {}, debug_path, nil)
+ old_packages = check_binaries(arch, $srcs, $srcages, src_path, bin_path, $used_srcs)
+ old_debug_packages = check_binaries(arch, $srcs, {}, src_path, debug_path, nil)
move_packages(bin_path, old_path, old_packages, auto)
move_packages(debug_path, old_path, old_debug_packages, auto)
}
@@ -162,7 +162,24 @@ def name_from_filename(filename)
filename.sub(/-[^-]*-[^-]*$/, '')
end
-def check_binaries(srcs, srcages, path, used_srcs)
+def arch_wanted(src, arch)
+ exclusive_arch = `rpmquery -p #{src} --qf '[%{EXCLUSIVEARCH} ]'`.rstrip
+ if exclusive_arch != "" then
+ if !exclusive_arch.split(/ /).include?(arch) then
+ return false
+ end
+ end
+ exclude_arch = `rpmquery -p #{src} --qf '[%{EXCLUDEARCH} ]'`.rstrip
+ if exclude_arch != "" then
+ if exclude_arch.split(/ /).include?(arch) then
+ return false
+ end
+ end
+
+ return true
+end
+
+def check_binaries(arch, srcs, srcages, src_path, path, used_srcs)
used_here_srcs = {}
all_versions = {}
packages(path) {|src, filename, buildtime|
@@ -192,7 +209,9 @@ def check_binaries(srcs, srcages, path, used_srcs)
# Do not delete newer binaries, upload may be in progress
next unless buildtime < srcages[srcname][1]
# Do not delete if the new version of the package hasn't been built for this arch yet
- next unless used_here_srcs[srcages[srcname][0]]
+ # but still delete it if it is no longer expected to be built.
+ latestsrc = srcages[srcname][0]
+ next unless (used_here_srcs[latestsrc] || !arch_wanted("#{src_path}/#{latestsrc}", arch))
end
old_binaries << filename
end