aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2024-01-03 19:36:46 +0000
committerPascal Terjan <pterjan@mageia.org>2024-01-03 19:38:17 +0000
commitc61cf7a3f1b1ccb227e53bad5bdc7440574a4cff (patch)
tree4107ca93ff4ae269d2301aff5d2326f6fc0c16b3
parent87bfc7841635e011dfc060e833a835d8ec4e754d (diff)
downloadpuppet-c61cf7a3f1b1ccb227e53bad5bdc7440574a4cff.tar
puppet-c61cf7a3f1b1ccb227e53bad5bdc7440574a4cff.tar.gz
puppet-c61cf7a3f1b1ccb227e53bad5bdc7440574a4cff.tar.bz2
puppet-c61cf7a3f1b1ccb227e53bad5bdc7440574a4cff.tar.xz
puppet-c61cf7a3f1b1ccb227e53bad5bdc7440574a4cff.zip
Cleanup duplicate src.rpm
Sometimes someone moves a package manually and we end up with several versions of a package. In this case we should delete the src.rpm and handle its binary packages like if it was gone.
-rwxr-xr-xmodules/buildsystem/templates/cleaner.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/buildsystem/templates/cleaner.rb b/modules/buildsystem/templates/cleaner.rb
index 97b91ab0..88195e15 100755
--- a/modules/buildsystem/templates/cleaner.rb
+++ b/modules/buildsystem/templates/cleaner.rb
@@ -65,6 +65,7 @@ def process
src_path = "#{base_path}/#{version}/SRPMS/#{media}"
$used_srcs = {}
+ $old_srcs = {}
$srcs = {}
$srcages = {}
$noarch = {}
@@ -76,7 +77,19 @@ def process
buildtime = l2[1].to_i
buildarch = l2[2].rstrip
name = name_from_filename(filename)
- $srcages[name] = [ filename, buildtime ] unless $srcages[name] && buildtime < $srcages[name][1]
+ if $srcages[name] then
+ if buildtime < $srcages[name][1] then
+ # This src.rpm is older, ignore it and store it in the list to be deleted
+ $old_srcs[filename] = true
+ next
+ else
+ # This src.rpm has an older version, ignore that version and store it in the list to be deleted
+ old_filename = $srcages[name][0]
+ $old_srcs[old_filename] = true
+ $srcs.delete(old_filename)
+ end
+ end
+ $srcages[name] = [ filename, buildtime ]
$srcs[filename] = true
$noarch[name] = true if buildarch == 'noarch'
}
@@ -90,7 +103,7 @@ def process
}
$used_srcs.keys.each{|s| $srcs.delete(s)}
- move_packages(src_path, old_path, $srcs.keys, auto)
+ move_packages(src_path, old_path, $srcs.keys + $old_srcs.keys, auto)
}
end