aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2023-01-08 17:00:34 +0000
committerPascal Terjan <pterjan@mageia.org>2023-01-08 17:00:34 +0000
commita2c6bacb09be6e82673c25373c4f716db0de1a4c (patch)
tree1135dc536d4a61d04c006f915a96beca29c367f7 /modules
parentaf440a8aee43646dc6a1d078ab1af745551c5e0a (diff)
downloadpuppet-a2c6bacb09be6e82673c25373c4f716db0de1a4c.tar
puppet-a2c6bacb09be6e82673c25373c4f716db0de1a4c.tar.gz
puppet-a2c6bacb09be6e82673c25373c4f716db0de1a4c.tar.bz2
puppet-a2c6bacb09be6e82673c25373c4f716db0de1a4c.tar.xz
puppet-a2c6bacb09be6e82673c25373c4f716db0de1a4c.zip
Fix cleaner.rb
It did not really wait for 7d for removed subpackages. Also remove an incorrect condition, src.rpm is usually slightly older that binary rpms, and fix the tests.
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/buildsystem/templates/cleaner.rb6
-rw-r--r--modules/buildsystem/templates/cleaner_test.rb34
2 files changed, 23 insertions, 17 deletions
diff --git a/modules/buildsystem/templates/cleaner.rb b/modules/buildsystem/templates/cleaner.rb
index 45e683d9..97b91ab0 100755
--- a/modules/buildsystem/templates/cleaner.rb
+++ b/modules/buildsystem/templates/cleaner.rb
@@ -203,14 +203,12 @@ def check_binaries(arch, srcs, srcages, src_path, path, used_srcs)
srcname = name_from_filename(src)
if srcages[srcname] then
# The src.rpm is gone but there is a different version of it
+ latestsrc = srcages[srcname][0]
# Only delete old binaries after 7d or if there is a new version
name = name_from_filename(filename)
- next unless (srcages[srcname][1] < Time.now.to_i - 24*60*60*7 || all_versions[name].include?(src))
- # Do not delete newer binaries, upload may be in progress
- next unless buildtime < srcages[srcname][1]
+ next unless (srcages[srcname][1] < Time.now.to_i - 24*60*60*7 || all_versions[name].include?(latestsrc))
# Do not delete if the new version of the package hasn't been built for this arch yet
# 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
diff --git a/modules/buildsystem/templates/cleaner_test.rb b/modules/buildsystem/templates/cleaner_test.rb
index 875d90c4..804bd1b5 100644
--- a/modules/buildsystem/templates/cleaner_test.rb
+++ b/modules/buildsystem/templates/cleaner_test.rb
@@ -26,7 +26,7 @@ class TestCleaner < Test::Unit::TestCase
srcages['foo'] = [ 'foo-43-1.src.rpm', Time.now.to_i - 15*24*3600 ]
srcs = {}
srcs['foo-43-1.src.rpm'] = true
- assert_equal(['libfoo1-42-1.armv7hl.rpm'], check_binaries(srcs, srcages, '', nil))
+ assert_equal(['libfoo1-42-1.armv7hl.rpm'], check_binaries('armv7hl', srcs, srcages, '', '', nil))
end
def test_recent
@@ -36,7 +36,7 @@ class TestCleaner < Test::Unit::TestCase
srcages['foo'] = [ 'foo-43.src.rpm', Time.now.to_i - 24*3600 ]
srcs = {}
srcs['foo-43-1.src.rpm'] = true
- assert_equal([], check_binaries(srcs, srcages, '', nil))
+ assert_equal([], check_binaries('armv7hl', srcs, srcages, '', '', nil))
end
def test_arm_late
@@ -46,7 +46,7 @@ class TestCleaner < Test::Unit::TestCase
srcages['foo'] = [ 'foo-43.src.rpm', Time.now.to_i - 24*3600 ]
srcs = {}
srcs['foo-43-1.src.rpm'] = true
- assert_equal([], check_binaries(srcs, srcages, '', nil))
+ assert_equal([], check_binaries('armv7hl', srcs, srcages, '', '', nil))
end
def test_multiple_versions
@@ -57,19 +57,27 @@ class TestCleaner < Test::Unit::TestCase
srcages['foo'] = [ 'foo-42-2.src.rpm', Time.now.to_i - 24*3600 ]
srcs = {}
srcs['foo-42-2.src.rpm'] = true
- assert_equal(['foo-42-1.noarch.rpm'], check_binaries(srcs, srcages, '', nil))
+ assert_equal(['foo-42-1.noarch.rpm'], check_binaries('i586', srcs, srcages, '', '', nil))
end
- def test_newer_binary
- # Package built after src remains (could happen due to race condition with upload)
- $noarch = { 'foo' => true }
- srctime = Time.now.to_i - 10*24*3600
- bintime = Time.now.to_i - 3600
- setpackages(["foo-42-2.src.rpm:foo-42-2.i586.rpm:#{bintime}", "foo-42-1.src.rpm:foo-bar-42-1.i586.rpm:#{srctime}"])
+ def test_icu
+ $noarch = {}
+ now = Time.now.to_i
+ srctime = now - 3600
+ oldbintime = now - 10*24*3600
+ newbintime = now - 3200
+ setpackages([
+ "icu-71.1-2.mga9.src.rpm:icu71-data-71.1-2.mga9.noarch.rpm:#{oldbintime}",
+ "icu-71.1-2.mga9.src.rpm:lib64icu71-71.1-2.mga9.aarch64.rpm:#{oldbintime}",
+ "icu-72.1-1.mga9.src.rpm:icu72-data-72.1-1.mga9.noarch.rpm:#{newbintime}",
+ "icu-72.1-1.mga9.src.rpm:lib64icu-devel-72.1-1.mga9.aarch64.rpm:#{newbintime}",
+ "icu-72.1-1.mga9.src.rpm:lib64icu72-72.1-1.mga9.aarch64.rpm:#{newbintime}"
+ ])
srcages = {}
- srcages['foo'] = [ 'foo-42-1.src.rpm', srctime ]
+ srcages['icu'] = [ 'icu-71.1-2.mga9.src.rpm', srctime ]
srcs = {}
- srcs['foo-42-1.src.rpm'] = true
- assert_equal([], check_binaries(srcs, srcages, '', nil))
+ srcs['icu-71.1-2.mga9.src.rpm'] = true
+ assert_equal([], check_binaries('aarch64', srcs, srcages, '', '', nil))
end
+
end