Skip to content

Commit f9f425b

Browse files
committed
pacman-mirror add: remove obsoleted versions of the added files
When `repo-add` runs, it will try to add obsolete file versions first, if present, and later replace them with the current version. That is a lot of unneeded churn, so let's just remove previous versions when adding new ones. Note: this only affects the local mirror; Bintray will still have the old versions, so we naturally have a backup. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 764430f commit f9f425b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pacman-mirror.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,18 @@ add () { # <file>
140140
;;
141141
esac
142142
dir="$(arch_dir $arch)"
143-
mkdir -p "$dir"
143+
if test -d "$dir"
144+
then
145+
prefix="${path##*/}"
146+
prefix="${prefix%%-[0-9][0-9.]*}"
147+
(cd "$dir" &&
148+
for file in "$prefix"-[0-9][0-9.]*
149+
do
150+
rm -v "$file"
151+
done)
152+
else
153+
mkdir -p "$dir"
154+
fi
144155
cp "$path" "$dir/"
145156
done
146157
}

0 commit comments

Comments
 (0)