abump: source APKBUILD in subshell
As demonstrated in b7813c3
(abump: demonstrate abump environment
polution, 2022-10-15), sourcing APKBUILDs in abump polutes it's
environment.
Address that by sourcing the APKBUILD in a subshell as well as some of
the checks following it that need the information from the APKBUILD.
That information is not used any later, it's not an issue that it's
discarded outside of the subshell.
This commit is contained in:
parent
b7813c377c
commit
15b6128a45
25
abump.in
25
abump.in
|
@ -44,16 +44,21 @@ do_bump() {
|
||||||
a=$(aports_buildscript "$name" ) \
|
a=$(aports_buildscript "$name" ) \
|
||||||
|| die "can't find APKBUILD for $name"
|
|| die "can't find APKBUILD for $name"
|
||||||
|
|
||||||
# verify APKBUILD
|
# sourcing APKBUILDs should not affect the environment of abump
|
||||||
. "$a" || exit 1
|
# so do that in a subshell, along with any checks that need the
|
||||||
name=${name#*/}
|
# information from the APKBUILD.
|
||||||
[ "$pkgname" = "$name" ] \
|
(
|
||||||
|| die "APKBUILD has different \$pkgname for $name"
|
# verify APKBUILD
|
||||||
type package | grep -q function \
|
. "$a" || exit 1
|
||||||
|| die "missing package() for $name"
|
name=${name#*/}
|
||||||
if [ "$pkgver" = "$ver" ] && git diff-index --quiet HEAD -- "$a"; then
|
[ "$pkgname" = "$name" ] \
|
||||||
die "version is already $ver"
|
|| die "APKBUILD has different \$pkgname for $name"
|
||||||
fi
|
type package | grep -q function \
|
||||||
|
|| die "missing package() for $name"
|
||||||
|
if [ "$pkgver" = "$ver" ] && git diff-index --quiet HEAD -- "$a"; then
|
||||||
|
die "version is already $ver"
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
cd "${a%/*}"
|
cd "${a%/*}"
|
||||||
section=${PWD%/*}
|
section=${PWD%/*}
|
||||||
|
|
Loading…
Reference in New Issue