diff options
author | Pascal Terjan <pterjan@mageia.org> | 2022-08-27 21:32:00 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2022-08-27 21:32:00 +0000 |
commit | 7e9a4f5f9a0dda34e4fd0c971f5e4624e31827e0 (patch) | |
tree | b7d15c572a2d00ccbe56324a79242bed56e09ba0 /modules | |
parent | fbd3511f318d971b179c585cc5dec7a5d0dccb85 (diff) | |
download | puppet-7e9a4f5f9a0dda34e4fd0c971f5e4624e31827e0.tar puppet-7e9a4f5f9a0dda34e4fd0c971f5e4624e31827e0.tar.gz puppet-7e9a4f5f9a0dda34e4fd0c971f5e4624e31827e0.tar.bz2 puppet-7e9a4f5f9a0dda34e4fd0c971f5e4624e31827e0.tar.xz puppet-7e9a4f5f9a0dda34e4fd0c971f5e4624e31827e0.zip |
Also clean tainted and nonfree by default
Diffstat (limited to 'modules')
-rwxr-xr-x | modules/buildsystem/templates/cleaner.rb | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/modules/buildsystem/templates/cleaner.rb b/modules/buildsystem/templates/cleaner.rb index 1bdf393a..d9457757 100755 --- a/modules/buildsystem/templates/cleaner.rb +++ b/modules/buildsystem/templates/cleaner.rb @@ -4,13 +4,13 @@ def usage puts "Usage: #{$0} [options]" puts "Moves obsolete packages" puts - puts "-h, --help show help" + puts "-h, --help show this help" puts "-a, --archs <arch1>,<arch2>,... list of architectures to clean" - puts "-a, --auto do not ask confirmation" - puts "-p, --base <path> base path to the repository" - puts "-m, --media <media> which media to clean (default: core/release)" - puts "-d, --destination <path> path to the old packages storage" - puts "-v, --version <version> version to clean (default: cauldron)" + puts "-a, --auto do not ask confirmation" + puts "-p, --base <path> base path to the repository" + puts "-m, --media <media1>,<media2>,... list of media to clean (default: core/release,tainted/release,nonfree/release)" + puts "-d, --destination <path> path to the old packages storage" + puts "-v, --version <version> version to clean (default: cauldron)" end require 'fileutils' @@ -30,7 +30,7 @@ def process base_path = "<%= scope.lookupvar('buildsystem::var::repository::bootstrap_root') %>/distrib" archs = [ "i586", "x86_64", "aarch64", "armv7hl" ] - media = "core/release" + medias = ["core/release", "tainted/release", "nonfree/release"] old_path = "<%= scope.lookupvar('buildsystem::var::youri::packages_archivedir') %>" version = "cauldron" auto = false @@ -43,7 +43,7 @@ def process when '--destination' old_path = arg when '--media' - media = arg + medias = arg.split(",") when '--archs' archs = arg.split(",") when '--auto' @@ -55,38 +55,39 @@ def process end end - src_path = "#{base_path}/#{version}/SRPMS/#{media}" - - $used_srcs = {} - $srcs = {} - $srcages = {} - $noarch = {} - - # Get a list of all src.rpm and their build time + medias.each{|media| + src_path = "#{base_path}/#{version}/SRPMS/#{media}" + + $used_srcs = {} + $srcs = {} + $srcages = {} + $noarch = {} + + # Get a list of all src.rpm and their build time + + `urpmf --synthesis "#{src_path}/media_info/synthesis.hdlist.cz" --qf '%filename:%buildtime:buildarchs' "."`.each_line{|l| + l2 = l.split(':') + filename = l2[0] + 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] + $srcs[filename] = true + $noarch[name] = true if buildarch == 'noarch' + } + # TODO: Take an upload lock to avoid being confused by emi moving things + 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) + move_packages(bin_path, old_path, old_packages, auto) + move_packages(debug_path, old_path, old_debug_packages, auto) + } + $used_srcs.keys.each{|s| $srcs.delete(s)} - `urpmf --synthesis "#{src_path}/media_info/synthesis.hdlist.cz" --qf '%filename:%buildtime:buildarchs' "."`.each_line{|l| - l2 = l.split(':') - filename = l2[0] - 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] - $srcs[filename] = true - $noarch[name] = true if buildarch == 'noarch' - } - # TODO: Take an upload lock to avoid being confused by emi moving things - 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) - move_packages(bin_path, old_path, old_packages, auto) - move_packages(debug_path, old_path, old_debug_packages, auto) + move_packages(src_path, old_path, $srcs.keys, auto) } - $used_srcs.keys.each{|s| $srcs.delete(s)} - - move_packages(src_path, old_path, $srcs.keys, auto) - end def move_packages(src, dst, list, auto) |