From 2a84dd8adfed7fdff1c553908ecb353944000b63 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 21 Jun 2017 11:08:11 +0200 Subject: bin/build-master-status: introduce and use new function ls_master_mirror --- bin/build-master-status | 17 +++++++---------- bin/common-functions | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/bin/build-master-status b/bin/build-master-status index 44596ef..69274a3 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -79,11 +79,10 @@ if [ $# -ne 0 ]; then fi stable="$( - ${master_mirror_command} "${master_mirror_directory}/i686/" | \ - awk '{print $5}' | \ - grep -v 'testing$\|staging$\|^\.$' | \ + ls_master_mirror 'i686' | \ + grep -v 'testing$\|staging$' | \ while read -r dir; do - ${master_mirror_command} "${master_mirror_directory}/i686/${dir}/" + ls_master_mirror "i686/${dir}" done | \ grep -c '\.pkg\.tar\.xz$' )" @@ -101,20 +100,18 @@ pending_packages="$( wc -l )" staging="$( - ${master_mirror_command} "${master_mirror_directory}/i686/" | \ - awk '{print $5}' | \ + ls_master_mirror 'i686' | \ grep 'staging$' | \ while read -r dir; do - ${master_mirror_command} "${master_mirror_directory}/i686/${dir}/" + ls_master_mirror "i686/${dir}" done | \ grep -c '\.pkg\.tar\.xz$' )" testing="$( - ${master_mirror_command} "${master_mirror_directory}/i686/" | \ - awk '{print $5}' | \ + ls_master_mirror 'i686' | \ grep 'testing$' | \ while read -r dir; do - ${master_mirror_command} "${master_mirror_directory}/i686/${dir}/" + ls_master_mirror "i686/${dir}" done | \ grep -c '\.pkg\.tar\.xz$' )" diff --git a/bin/common-functions b/bin/common-functions index 9b69657..b07e75d 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -308,6 +308,20 @@ official_or_community() { fi } +# ls_master_mirror $path +# list content of $path on the master mirror (via rsync) + +ls_master_mirror() { + + local path="$1" + + ${master_mirror_command} \ + "${master_mirror_directory}/${path}/" | \ + grep -v '\s\.$' | \ + awk '{print $5}' + +} + # remove_old_package_versions $directory $package_file # removes all other versions of $package_file in $directory on the master mirror @@ -322,9 +336,7 @@ remove_old_package_versions() { --recursive \ --delete \ $( \ - ${master_mirror_command} \ - "${master_mirror_directory}/${directory}/" | \ - awk '{print $5}' | \ + ls_master_mirror "${directory}" | \ grep "^$(str_to_regex "${pkgname}")\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \ grep -v "^$(str_to_regex "${package}")\(\.sig\)\?\$" | \ sed 's|^|--include=|' -- cgit v1.2.3-54-g00ecf