1111#
1212# - 'add' to add packages to the local mirror
1313#
14+ # - 'remove' to make the next 'push' skip the given package(s)
15+ #
1416# - 'push' to synchronize local changes (after calling `repo-add`) to the
1517# remote Pacman repository
1618
@@ -25,12 +27,12 @@ export CURL_CA_BUNDLE
2527
2628mode=
2729case " $1 " in
28- fetch|add|push)
30+ fetch|add|remove| push)
2931 mode=" $1 "
3032 shift
3133 ;;
3234* )
33- die " Usage: $0 ( fetch | push | add <package>... )"
35+ die " Usage: $0 ( fetch | push | ( add | remove ) <package>... )"
3436 ;;
3537esac
3638
@@ -174,13 +176,27 @@ add () { # <file>
174176 done
175177}
176178
179+ remove () { # <package>...
180+ test $# -gt 0 ||
181+ die " What packages do you want to add?"
182+
183+ for package
184+ do
185+ for arch in $architectures
186+ do
187+ (cd " $( arch_dir $arch ) " &&
188+ rm $package -* .pkg.tar.xz &&
189+ repo-remove git-for-windows.db.tar.xz $package )
190+ done
191+ done
192+ }
193+
194+
177195update_local_package_databases () {
178196 for arch in $architectures
179197 do
180198 (cd " $( arch_dir $arch ) " &&
181- repo-add --new git-for-windows.db.tar.xz \
182- * .pkg.tar.xz
183- )
199+ repo-add --new git-for-windows.db.tar.xz * .pkg.tar.xz)
184200 done
185201}
186202
@@ -215,53 +231,55 @@ push () {
215231 to_upload="$(printf "%s\n%s\n%s\n" "$old_list " "$old_list " "$new_list " |
216232 sort | uniq -u)"
217233
218- test -n "$to_upload " || {
234+ test -n "$to_upload " || test "x $old_list " != "x $new_list " || {
219235 echo "Nothing to be done" >&2
220236 return
221237 }
222238
223- to_upload_basenames="$(echo "$to_upload " |
224- sed 's/-[0 -9 ].*//' |
225- sort | uniq)"
226-
227239 db_version="$(db_version)"
228240 next_db_version="$(next_db_version "$db_version ")"
229241
230- # Verify that the packages exist already
231- for basename in $to_upload_basenames
232- do
233- case " $(echo "$old_list " | tr '\n' ' ')" in
234- *" $basename "-[0 -9 ]*)
235- ;;
236- *)
237- package_exists $basename ||
238- die "The package $basename does not yet exist... Add it at https://bintray.com/git-for-windows/pacman/new/package?pkgPath="
239- ;;
240- esac
241- done
242+ test -z "$to_upload " || {
243+ to_upload_basenames="$(echo "$to_upload " |
244+ sed 's/-[0 -9 ].*//' |
245+ sort | uniq)"
242246
243- for name in $to_upload
244- do
245- basename=${name%% -[0-9]* }
246- version=${name# $basename -}
247- for arch in $architectures
247+ # Verify that the packages exist already
248+ for basename in $to_upload_basenames
248249 do
249- case "$name " in
250- mingw-w64 -*)
251- filename=$name -any.pkg.tar.xz
250+ case " $(echo "$old_list " | tr '\n' ' ')" in
251+ *" $basename "-[0 -9 ]*)
252252 ;;
253253 *)
254- filename=$name -$arch .pkg.tar.xz
254+ package_exists $basename ||
255+ die "The package $basename does not yet exist... Add it at https://bintray.com/git-for-windows/pacman/new/package?pkgPath="
255256 ;;
256257 esac
257- (cd "$(arch_dir $arch )" &&
258- if test -f $filename
259- then
260- upload $basename $version $arch $filename
261- fi) || exit
262258 done
263- publish $basename $version
264- done
259+
260+ for name in $to_upload
261+ do
262+ basename=${name%% -[0-9]* }
263+ version=${name# $basename -}
264+ for arch in $architectures
265+ do
266+ case "$name " in
267+ mingw-w64 -*)
268+ filename=$name -any.pkg.tar.xz
269+ ;;
270+ *)
271+ filename=$name -$arch .pkg.tar.xz
272+ ;;
273+ esac
274+ (cd "$(arch_dir $arch )" &&
275+ if test -f $filename
276+ then
277+ upload $basename $version $arch $filename
278+ fi) || exit
279+ done
280+ publish $basename $version
281+ done
282+ }
265283
266284 delete_version package-database "$db_version "
267285
0 commit comments