Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-09 11:04:24 +0100
committerErich Eckner <git@eckner.net>2018-03-09 11:04:24 +0100
commit07de651e7222691c5eabef6ac156ab0f33fc3314 (patch)
tree76d86275ec94ad32a04e7677e070228a2dad5858 /bin
parentb5bacd8de3c56f996f8fdd27365e735e71e0c152 (diff)
bin/db-update: repo-copy and repo-remove packages in bunches
Diffstat (limited to 'bin')
-rwxr-xr-xbin/db-update47
1 files changed, 32 insertions, 15 deletions
diff --git a/bin/db-update b/bin/db-update
index a1622ec..ca52688 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -195,21 +195,38 @@ for source_stability in 'testing' 'staging'; do
done
# remove to-be-deleted packages
- while read -r pkgname repo; do
- cd "${tmp_dir}/dbs/${repo}"
- repo-remove -q "${repo}.db.tar.gz" "${pkgname%-*-*-*}"
- done < \
- "${tmp_dir}/rm"
-
- # delete and add moved packages
- while read -r pkgname from_repo to_repo; do
- repo-copy \
- "${tmp_dir}/dbs/${from_repo}/${from_repo}.db.tar.gz" \
- "${tmp_dir}/dbs/${to_repo}/${to_repo}.db.tar.gz" \
- "${pkgname%-*}"
- repo-remove -q "${tmp_dir}/dbs/${from_repo}/${from_repo}.db.tar.gz" "${pkgname%-*-*-*}"
- done < \
- "${tmp_dir}/mv"
+ # shellcheck disable=SC2094
+ cut -d' ' -f2 < \
+ "${tmp_dir}/rm" | \
+ sort -u | \
+ while read -r repo; do
+ grep " $(str_to_regex "${repo}")\$" "${tmp_dir}/rm" | \
+ sed '
+ s/\(-[^-]\+\)\{3\} \S\+$//
+ ' | \
+ xargs -r repo-remove -q "${tmp_dir}/dbs/${repo}/${repo}.db.tar.gz"
+ done
+
+ # copy and delete moved packages
+ # shellcheck disable=SC2094
+ cut -d' ' -f2,3 < \
+ "${tmp_dir}/mv" | \
+ sort -u | \
+ while read -r from_repo to_repo; do
+ grep " $(str_to_regex "${from_repo}") $(str_to_regex "${to_repo}")\$" "${tmp_dir}/mv" | \
+ sed '
+ s/-[^-]\+ \S\+ \S\+$//
+ ' | \
+ xargs -r repo-copy \
+ "${tmp_dir}/dbs/${from_repo}/${from_repo}.db.tar.gz" \
+ "${tmp_dir}/dbs/${to_repo}/${to_repo}.db.tar.gz"
+ grep " $(str_to_regex "${from_repo}") $(str_to_regex "${to_repo}")\$" "${tmp_dir}/mv" | \
+ sed '
+ s/\(-[^-]\+\)\{3\} \S\+ \S\+$//
+ ' | \
+ xargs -r repo-remove -q \
+ "${tmp_dir}/dbs/${from_repo}/${from_repo}.db.tar.gz"
+ done
# move the packages remotely via sftp
{