1
0
mirror of https://gitlab.alpinelinux.org/alpine/abuild.git synced 2025-04-19 06:42:18 +03:00

abump: add option -b BRANCH to create git branch before bumping

Create a git branch from HEAD before normal operation.
This commit is contained in:
El RIDO 2025-01-04 21:36:09 +01:00 committed by Natanael Copa
parent 22635adebf
commit 8c01ae7038
2 changed files with 14 additions and 5 deletions

View File

@ -6,15 +6,15 @@ abump(1)
# SYNOPSIS
*abump* [-s _CVE-1_,...] [-f _ISSUE_] [-k|--keep] _PKGNAME-1.2.3_
*abump* [-s _CVE-1_,...] [-f _ISSUE_] [-b|--branch] [-k|--keep] _PKGNAME-1.2.3_
# DESCRIPTION
*abump* updates the *pkgver* in an APKBUILD file, updates its checksums,
rebuilds it, and finally creates a new commit commit with the changes resulting.
*abump* operates looks for the specified package in nested directories inside
the current working, assuming a layout like that of the aports repository.
*abump* looks for the specified package in nested directories inside the current
working directory, assuming a layout like that of the aports repository.
# OPTIONS
@ -25,6 +25,9 @@ the current working, assuming a layout like that of the aports repository.
Include *Fixes #ISSUE* in the commit message. This will close the upstream
issue when the commit is merged into the aports master branch.
*-b, --branch*
Create a git branch from HEAD before normal operation.
*-k, --keep*
Keep existing packages.

View File

@ -97,10 +97,11 @@ fixes #${fixes#\#}
usage() {
cat <<-__EOF__
$program $program_version - bump pkgver in APKBUILDs
Usage: $program [-s CVE-1,CVE-2,...] [-f ISSUE] [-k|--keep] PKGNAME-1.2.3 ...
Usage: $program [-s CVE-1,CVE-2,...] [-f ISSUE] [-b|--branch] [-k|--keep] PKGNAME-1.2.3 ...
Options:
-s, --security CVE1,CVE-2,... Security update
-f, --fixes ISSUE Fixes ISSUE
-b, --branch Create a git branch from HEAD before normal operation
-k, --keep Run abuild with -k to keep existing packages
-q, --quiet
-h, --help Show this help
@ -111,8 +112,9 @@ usage() {
keep=
cvelist=
fixes=
branch=
args=$(getopt -o f:s:kqh --long fixes:,security:,keep,quiet,help \
args=$(getopt -o f:s:bkqh --long fixes:,security:,branch,keep,quiet,help \
-n "$program" -- "$@")
if [ $? -ne 0 ]; then
usage >&2
@ -123,6 +125,7 @@ while true; do
case $1 in
-s|--security) cvelist=" ($2)"; shift;;
-f|--fixes) fixes="$2"; shift;;
-b|--branch) branch=1;;
-k|--keep) keep="-k";;
-q|--quiet) quiet=1;; # suppresses msg
-h|--help) usage; exit 0;;
@ -138,6 +141,9 @@ fi
[ -n "$APORTSDIR" ] || error "can't locate \$APORTSDIR"
git rev-parse 2>/dev/null || die "not in a git tree"
if [ "$branch" = 1 ]; then
git checkout -b "bump-$1"
fi
abuild_opts="${ABUILD_OPTS- -r} $keep"