Skip to content

Commit 08d9487

Browse files
dschojeremyd2019
andcommitted
pacman-helper quick_remove: allow specifying package names
Instead of filenames, it is much more natural to specify the package name. One caveat is that the package name must also contain the CPU architecture in that case, but it can leave out the version number. For example, instead of pacman-helper.sh quick_remove cyrus-sasl-2.1.28-2-i686.pkg.tar.xz one can now write pacman-helper.sh quick_remove cyrus-sasl-i686 To make this safer with regards to package names that end in `-<digit>[...]` (like `msys2-runtime-3.3`), either the full version has to be provided, including pkgrel, or the version has to be omitted. Co-authored-by: Jeremy Drake <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7f37678 commit 08d9487

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

pacman-helper.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,22 @@ quick_action () { # <action> <file>...
274274
# skip explicit signatures; we copy them automatically
275275
continue
276276
;;
277+
*-i686|*-x86_64|*-aarch64)
278+
test remove = "$label" || die "Cannot add $path"
279+
arch=${file##*-}
280+
file=${file%-$arch}
281+
file=${file%-[0-9]*-[0-9]*}
282+
key=${arch}_msys
283+
;;
284+
mingw-w64-i686-*|mingw-w64-x86_64-*|mingw-w64-clang-aarch64-*)
285+
test remove = "$label" || die "Cannot add $path"
286+
arch=${file#mingw-w64-}
287+
arch=${arch#clang-}
288+
arch=${arch%%-*}
289+
file=${file%-any}
290+
file=${file%-[0-9]*-[0-9]*}
291+
key=${arch}_mingw
292+
;;
277293
*)
278294
echo "Skipping unknown file: $file" >&2
279295
continue
@@ -413,7 +429,11 @@ quick_action () { # <action> <file>...
413429

414430
# Remove the existing versions from the Git branch
415431
printf '%s\n' $msys $mingw |
416-
sed 's/-[^-]*-[^-]*-[^-]*\.pkg\.tar\.\(xz\|zst\)$/-[0-9]*/' |
432+
sed '/\.pkg\.tar/{
433+
s/-[^-]*-[^-]*-[^-]*\.pkg\.tar\.\(xz\|zst\)$/-[0-9]*/
434+
b
435+
}
436+
s/$/-[0-9]*/' |
417437
xargs git rm --sparse --cached -- ||
418438
die "Could not remove the existing versions from the Git branch in $arch"
419439

0 commit comments

Comments
 (0)