A newline starts a new command in shell scripts and eval uses the shell
grammar. Use a space instead to fix multiline repo templates.
Also avoid one subshell.
When a variables is declared (with 'local' or 'export') a failing
command is ignored[0]. Changing that so abuild should now error out
properly in more cases.
Also remove 1 pipe that could have prevented an issue recently[1] where
the 'du' command core dumped but abuild didn't error.
The other pipes were not changed for now since it may be better to use
'set -o pipefail' instead. That may require some changes with commands
like grep which use a non-zero exit code to indicate if a match was
found or similar[2].
[0]: https://www.shellcheck.net/wiki/SC2155
[1]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16005#note_395899
[2]: https://github.com/koalaman/shellcheck/issues/665
The setfattr/getfattr commands were not guaranteed to be available and
abuild wouldn't properly error when they are not. That may cause some
hidden issues.
Changing the code to not need setfattr/getfattr like it is done in
default_dbg ([3ad93d9a83]) and pacman mkpkg ([pacman@88d054093c1]).
The code works by first writing the stripped output into a temporary file
and then replace the contents of the already existing file without changing
any file metadata.
[3ad93d9a83]: 3ad93d9a83
[pacman@88d054093c1]: 88d054093c
This mechanism was an optional speed optimization for apk-tools which has
been replaced with a better one **before the 2.0 full release** of apk-tools.
This in combination with the fact that the code is endian dependant and
therefor is incompatible with reproducible builds seems enough reason to
remove the code.
This fixes 'abuild rootbld' failing to mount when srcdir is moved
outside of $HOME (eg. in /run). This also has the advantage of building
more reproducible even when the build path leaks into the packges (which
happens in most -dbg packages).
I rebuilt networkmanager locally and was greeted with this:
>>> Size difference for networkmanager: 16 MiB -> 2772 KiB
It turns out networkmanager-elogind provides networkmanager so apk info
will list both, and the former is much bigger so it looked like the
rebuilt package was much smaller when there was almost no difference (as
expected)
Fix by matching on exact package name for both lines; this is already
what we were doing with the local package anyway and the apk fetch
correctly picks the correct package in this case
according to the meson documentation the arguments are
'meson setup <builddir> <srcdir>'. meson is very relaxed and allows the
wrong order but this behavior should not be endorsed by a template.
This is because of the following race condition case:
A B
|
lockfd = open(lockfile, ...) |
| unlink(lockfile)
lockf(lockfd, F_LOCK, 0) |
According to [1], to recover from an ESTALE error, an application must
close the file or directory where the error occurred, and reopen it so
the NFS client can resolve the pathname again and retrieve the new file
handle.
[1] https://nfs.sourceforge.net/#faq_a10
The test suite expects ABUILD_USERDIR to be "$HOME"/.abuild but that
could be overwritten in ABUILD_CONF. So use the fixed value instead of
relying on the default.