abump: check version before we build

This commit is contained in:
Natanael Copa 2021-04-29 12:48:24 +02:00
parent 1510dbf6fb
commit fe2aca3b7d
2 changed files with 33 additions and 0 deletions

View File

@ -51,6 +51,9 @@ do_bump() {
|| die "APKBUILD has different \$pkgname for $name"
type package | grep -q function \
|| die "missing package() for $name"
if [ "$pkgver" = "$ver" ] && git diff-index --quiet HEAD -- APKBUILD; then
die "version is already $ver"
fi
cd "${a%/*}"
section=${PWD%/*}

View File

@ -83,3 +83,33 @@ teardown() {
run $ABUMP foo-1.0
[ $status -ne 0 ]
}
@test "abump: test bumping same version which is not in git" {
mkdir -p "$tmpdir"/main/foo
cd "$tmpdir"/main/foo
echo "first" > foo-1.0.txt
echo "second" > foo-1.1.txt
cat > APKBUILD <<-EOF
# Maintainer: Test user <user@example.com>
pkgname="foo"
pkgver=1.0
pkgrel=0
pkgdesc="dummy package for test"
url="https://alpinelinux.org"
license="MIT"
arch="noarch"
source="foo-\$pkgver.txt"
options="!check"
package() {
install -D "\$srcdir"/foo-\$pkgver.txt "\$pkgdir"/foo
}
EOF
$ABUILD checksum
$ABUILD
git add APKBUILD foo-1.0.txt
git commit -m "test commit"
sed -i -e 's/pkgver=.*/pkgver=1.1/' APKBUILD
$ABUMP foo-1.1
}