Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-20 09:20:01 +0200
committerErich Eckner <git@eckner.net>2018-06-20 09:20:01 +0200
commit8b38129b5ea7c240d48cdc0f5216c2ec7b6a6c24 (patch)
tree155bdc2d4ae07e5e45a9ea2d7da18fbc5b550361
parent7c9e48da1f3c88cff6602658ff74476445e1b2bd (diff)
lib/common-functions: remove_old_package_versions(): "sed w" does not append - we need to do it with a single sed invocation
-rwxr-xr-xlib/common-functions41
1 files changed, 23 insertions, 18 deletions
diff --git a/lib/common-functions b/lib/common-functions
index 0585917..984f76c 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -175,25 +175,30 @@ remove_old_package_versions() {
expand_version 3 | \
sort -k3V,3 -k2r,2 | \
shrink_version 3 | \
- sed -n '
- /^'"${bpir_id}"' /q
- s/^\([0-9]\+ \)\(\S\+ \)\{2\}/\1/
- h
- /^[0-9]\+ 0 / {
- s/^\(\S\+ \)\{2\}//
- s/ \S\+$//
- w'"${tmp_dir}"'/repo-removes
- g
- }
- s/^\(\S\+ \)\{5\}//
- w'"${tmp_dir}"'/sftp-removes
- s/$/.sig/
- w'"${tmp_dir}"'/sftp-removes
- g
- s/ .*$//
- w'"${tmp_dir}"'/db-removes
+ sed '
+ s/^/'"${bpir_id}"' /
+ $ a
'
- done
+ done | \
+ sed -n '
+ /^\([0-9]\+\) \1 /,/^$/ d
+ /^$/ d
+ s/^[0-9]\+ \([0-9]\+ \)\(\S\+ \)\{2\}/\1/
+ h
+ /^[0-9]\+ 0 / {
+ s/^\(\S\+ \)\{2\}//
+ s/ \S\+$//
+ w'"${tmp_dir}"'/repo-removes
+ g
+ }
+ s/^\(\S\+ \)\{5\}//
+ w'"${tmp_dir}"'/sftp-removes
+ s/$/.sig/
+ w'"${tmp_dir}"'/sftp-removes
+ g
+ s/ .*$//
+ w'"${tmp_dir}"'/db-removes
+ '
for file in 'repo-removes' 'sftp-remove' 'db-removes'; do
if [ -s "${tmp_dir}/${file}" ]; then