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.
If some package fails, then stop processing the rest. This is so we
don't risk test build the rest for the packages against wrong lib.
For example, if 'abump libfoo-2.0 foo-2.0' fails on libfoo, we don't
want testbuild foo-2.0, which might end with success against libfoo-1.
We also echo the list of packages that was not bumped, so its easy to
copy/paste next run.
It appears that when the subshell has a ||, the 'set -e' within
subshell gets invalidated.
This will work as expected:
( set -e; false; echo "should not get here" )
While this will not work as expected:
( set -e; false; echo "should not get here" ) || false
We resolve it by using $? to detect the status of subshell. We also let
the exitcode indicate how many packages that failed.
While here we also refactor it so most of the loop happens within the
subshell. This lets us set (or increase) rc variable once, and it
reduces number of forks which gives slightly better performance.
We actually want be able to re-run abump without needing reset the
pkgver in case we had to fix things.
This reverts commit 8198ded868.
Conflicts:
abump.in