Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-19 13:47:32 +0200
committerErich Eckner <git@eckner.net>2017-06-19 13:47:32 +0200
commite4677e04f39bfca06ca7b1fb92f89b7684f20e87 (patch)
tree8d6724ef0ee19e840d8e62df5c71ec70b1e9cd3e /bin/common-functions
parent5e7e1ac0a4932156cfd399447968959f6081d3fe (diff)
switch from sshfs to rsync - to avoid needing to remount
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions28
1 files changed, 20 insertions, 8 deletions
diff --git a/bin/common-functions b/bin/common-functions
index 911a580..cc59e94 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -106,7 +106,7 @@ find_repository_with_commit() {
return 0
fi
done
- >&2 echo "can't find repository with commit '$1'"
+ >&2 printf 'find_repository_with_commit: Cannot find repository with commit "%s"\n' "$1"
exit 1
}
@@ -299,18 +299,30 @@ official_or_community() {
esac
}
-# remove_old_package_versions $package_file
-# removes all other versions of $package_file in the current directory
+# remove_old_package_versions $directory $package_file
+# removes all other versions of $package_file in $directory on the master mirror
remove_old_package_versions() {
- local package="$1"
+ local directory="$1"
+ local package="$2"
+
local pkgname="${package%-*-*-*.pkg.tar.xz}"
- ls | \
- grep "^$(str_to_regex "${pkgname}")\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \
- grep -v "^$(str_to_regex "${package}")\(\.sig\)\?\$" | \
- xargs -rn1 rm
+ ${master_mirror_command} \
+ --recursive \
+ --delete \
+ $( \
+ ${master_mirror_command} \
+ "${master_mirror_directory}/${directory}/" | \
+ awk '{print $5}' | \
+ grep "^$(str_to_regex "${pkgname}")\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \
+ grep -v "^$(str_to_regex "${package}")\(\.sig\)\?\$" | \
+ sed 's|^|--include=|'
+ ) \
+ '--exclude=*' \
+ ./ \
+ "${master_mirror_directory}/${directory}/"
}