Skip to content

Commit 858020d

Browse files
committed
pacman-mirror: allow 'push' even if only the databases changed
We will introduce the 'remove' command in the next commit. This command will not require any new version of any package to be uploaded, yet it still will need the databases to be uploaded. Prepare the 'push' command to detect that situation. The diff for this commit is best viewed with the `-w` option. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 134d473 commit 858020d

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

pacman-mirror.sh

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -213,53 +213,55 @@ push () {
213213
to_upload="$(printf "%s\n%s\n%s\n" "$old_list" "$old_list" "$new_list" |
214214
sort | uniq -u)"
215215
216-
test -n "$to_upload" || {
216+
test -n "$to_upload" || test "x$old_list" != "x$new_list" || {
217217
echo "Nothing to be done" >&2
218218
return
219219
}
220220
221-
to_upload_basenames="$(echo "$to_upload" |
222-
sed 's/-[0-9].*//' |
223-
sort | uniq)"
224-
225221
db_version="$(db_version)"
226222
next_db_version="$(next_db_version "$db_version")"
227223
228-
# Verify that the packages exist already
229-
for basename in $to_upload_basenames
230-
do
231-
case " $(echo "$old_list" | tr '\n' ' ')" in
232-
*" $basename"-[0-9]*)
233-
;;
234-
*)
235-
package_exists $basename ||
236-
die "The package $basename does not yet exist... Add it at https://bintray.com/git-for-windows/pacman/new/package?pkgPath="
237-
;;
238-
esac
239-
done
224+
test -z "$to_upload" || {
225+
to_upload_basenames="$(echo "$to_upload" |
226+
sed 's/-[0-9].*//' |
227+
sort | uniq)"
240228
241-
for name in $to_upload
242-
do
243-
basename=${name%%-[0-9]*}
244-
version=${name#$basename-}
245-
for arch in $architectures
229+
# Verify that the packages exist already
230+
for basename in $to_upload_basenames
246231
do
247-
case "$name" in
248-
mingw-w64-*)
249-
filename=$name-any.pkg.tar.xz
232+
case " $(echo "$old_list" | tr '\n' ' ')" in
233+
*" $basename"-[0-9]*)
250234
;;
251235
*)
252-
filename=$name-$arch.pkg.tar.xz
236+
package_exists $basename ||
237+
die "The package $basename does not yet exist... Add it at https://bintray.com/git-for-windows/pacman/new/package?pkgPath="
253238
;;
254239
esac
255-
(cd "$(arch_dir $arch)" &&
256-
if test -f $filename
257-
then
258-
upload $basename $version $arch $filename
259-
fi) || exit
260240
done
261-
publish $basename $version
262-
done
241+
242+
for name in $to_upload
243+
do
244+
basename=${name%%-[0-9]*}
245+
version=${name#$basename-}
246+
for arch in $architectures
247+
do
248+
case "$name" in
249+
mingw-w64-*)
250+
filename=$name-any.pkg.tar.xz
251+
;;
252+
*)
253+
filename=$name-$arch.pkg.tar.xz
254+
;;
255+
esac
256+
(cd "$(arch_dir $arch)" &&
257+
if test -f $filename
258+
then
259+
upload $basename $version $arch $filename
260+
fi) || exit
261+
done
262+
publish $basename $version
263+
done
264+
}
263265
264266
delete_version package-database "$db_version"
265267

0 commit comments

Comments
 (0)