diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2023-11-20 00:24:30 -0500 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2024-01-01 20:27:16 -0500 |
commit | 13164f230a1f1b9940b6ddfc9effc1917bb7cbb8 (patch) | |
tree | d0749721f1ef7ac677d5d2563f588b87def68d6f | |
parent | 55b39c97c6a10301d5d33eca822b444dd79b46d7 (diff) |
[librestage]: limit arch per regex
-rwxr-xr-x | src/abslibre-tools/librestage | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index 017cd6a..cc9c57b 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -28,8 +28,6 @@ source "$(librelib conf)" source "$(librelib messages)" -LimitArch="*" - usage() { print "Usage: %s [-A <arch>] [REPO]" "${0##*/}" print "Stages the package(s) build by ./PKGBUILD for upload." @@ -38,29 +36,29 @@ usage() { of the parent directory if a repository is not named." echo echo "Supported options:" - echo " -h Display this help and exit" - echo " -A <arch> Stage only packages built for arches matching the given" - echo " wildcard string. Default: *" + echo " -A <arch> Stage packages with arch(s) matching the given regex only" + echo " -h Display this help and exit" } main() { + local arch_rx='.*' + local arg repo + if [[ -w / ]]; then error "This program should be run as a regular user" return $EXIT_NOPERMISSION fi # Parse options, set up - while getopts 'hA:' arg; do + while getopts 'A:h' arg; do case $arg in + A) arch_rx="$OPTARG";; h) usage; return $EXIT_SUCCESS;; - A) LimitArch="$OPTARG";; *) usage >&2; return $EXIT_INVALIDARGUMENT;; esac done - local shiftlen=$(( OPTIND - 1 )) - shift $shiftlen + shift $(( OPTIND - 1 )) - local repo= case $# in 0) repo="$(basename "$(dirname "$PWD")")";; 1) repo=$1;; @@ -93,7 +91,8 @@ main() { local CARCH _pkgname pkgnames pkgfile for CARCH in "${arch[@]}"; do # Skip this arch if necessary - [[ "$CARCH" == $LimitArch ]] || continue + [[ "$CARCH" =~ $arch_rx ]] || continue + # This supports both pacman < 5.1 pkgname-debug # packages and pacman >= 5.1 pkgbase-debug packages. pkgnames=("${pkgname[@]}" "${pkgname[@]/%/-debug}") |