[Dev] [PATCH] libremakepkg: fix building packages requring a rw startdir

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri May 17 01:03:56 GMT 2019

Several packages require a read-write startdir:
- Some packages have a pkgver that is computed dynamically
  through a pkgver function. This is the case for many packages
  using git repositories. At the end of the package build, the
  pkgver is automatically updated in the PKGBUILD, however,
  without that fix that fails with libremakepkg as the PKGBUILD
  was set read-only.
- Some packages like linux-libre are modifying the install=
  script. This is done by creating a temporary install script
  in the startdir that is then modified with sed. Once this is
  done that install script is then dynamically selected.
  As this also require to have read-write access to the
  startdir to be read-write it fails to build the package if
  it's not the case.

In both cases it's possible to modify the PKGBUILDs to
workaround the issue, however the Arch Linux distribution has
a read-write startdir, and modifying each affected packages
would significatively increase the cost (in time and efforts)
of maintaining Parabola.

This was broken by the following commit:
646ac02 libremakepkg,chcleanup: Be stricter about network access

Thanks to elibrokeit on the #parabola IRC channel on Freenode
for helping me identifying the cause of read-only mounts in

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
 src/chroot-tools/libremakepkg | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index b427fd0..263c95b 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -124,11 +124,9 @@ build() (
 	local run_ynet=()
 	local run_nnet=()
 	if $INCHROOT; then
-		local _run=(sh -c "mount --bind -o ro -- ${startdir at Q} ${startdir at Q} && cd ${startdir at Q} && \$@" --)
 		run_ynet=(unshare --mount       -- "${_run[@]}")
 		run_nnet=(unshare --mount --net -- "${_run[@]}")
-		librechroot_flags+=(-r "$startdir:/startdir")
 		run_ynet=(librechroot "${librechroot_flags[@]}"    run)
 		run_nnet=(librechroot "${librechroot_flags[@]}" -N run)
@@ -279,6 +277,7 @@ main() {
 			"Waiting for existing lock on build directory to be released"
+			-w "$PWD:/startdir"
 			-n "$CHROOT"
 			-l "$copy"

More information about the Dev mailing list