Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
@ 2023-09-26  7:52 classabbyamp
  2023-09-26  8:00 ` [PR PATCH] [Updated] " classabbyamp
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26  7:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2368 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 8481 bytes --]

From b3c8a7e0c75c3a0bf5135f314ec150b12e2ee123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/2] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3dc393c2965bd212dc936c0be473c8626e97d0e0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/2] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
@ 2023-09-26  8:00 ` classabbyamp
  2023-09-26  8:10 ` classabbyamp
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26  8:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 9307 bytes --]

From b3c8a7e0c75c3a0bf5135f314ec150b12e2ee123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3dc393c2965bd212dc936c0be473c8626e97d0e0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From f1dd218fc65ae9703638d7edc8e2d32925ecc2ed Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:59:28 -0400
Subject: [PATCH 3/3] common/travis/prepare.sh: support new masterdir naming

---
 common/travis/prepare.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..8d1770c29b3b2 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,5 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /masterdir-'"$BOOTSTRAP"'...\x1b[0m'
+ln -s / "masterdir-$BOOTSTRAP"

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
  2023-09-26  8:00 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-09-26  8:10 ` classabbyamp
  2023-09-26  8:11 ` classabbyamp
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26  8:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 9666 bytes --]

From b3c8a7e0c75c3a0bf5135f314ec150b12e2ee123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3dc393c2965bd212dc936c0be473c8626e97d0e0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From c2fab75b094e772aeb284fb6ae15b27ed72db3bd Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:59:28 -0400
Subject: [PATCH 3/3] common/travis/: support new masterdir naming

---
 common/travis/build.sh   | 3 ++-
 common/travis/prepare.sh | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/common/travis/build.sh b/common/travis/build.sh
index 007a61f994d78..de57c0eb67cae 100755
--- a/common/travis/build.sh
+++ b/common/travis/build.sh
@@ -2,8 +2,9 @@
 #
 # build.sh
 
+arch="-A $1"
 if [ "$1" != "$2" ]; then
-	arch="-a $2"
+	arch="$arch -a $2"
 fi
 
 if [ "$3" = 1 ]; then
diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..16a3f42b6c73b 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,7 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /masterdir-'"$BOOTSTRAP"'...\x1b[0m'
+ln -s / "masterdir-$BOOTSTRAP"
+
+sh -x cat /.xbps_chroot_init

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
  2023-09-26  8:00 ` [PR PATCH] [Updated] " classabbyamp
  2023-09-26  8:10 ` classabbyamp
@ 2023-09-26  8:11 ` classabbyamp
  2023-09-26  8:13 ` classabbyamp
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26  8:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 9669 bytes --]

From b3c8a7e0c75c3a0bf5135f314ec150b12e2ee123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3dc393c2965bd212dc936c0be473c8626e97d0e0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From a3fd875f97ea1ddd49a05269645415f692a8b547 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:59:28 -0400
Subject: [PATCH 3/3] common/travis/: support new masterdir naming

---
 common/travis/build.sh   | 3 ++-
 common/travis/prepare.sh | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/travis/build.sh b/common/travis/build.sh
index 007a61f994d78..de57c0eb67cae 100755
--- a/common/travis/build.sh
+++ b/common/travis/build.sh
@@ -2,8 +2,9 @@
 #
 # build.sh
 
+arch="-A $1"
 if [ "$1" != "$2" ]; then
-	arch="-a $2"
+	arch="$arch -a $2"
 fi
 
 if [ "$3" = 1 ]; then
diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..8c0ff68d9513e 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,8 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /masterdir-'"$BOOTSTRAP"'...\x1b[0m'
+ln -s / "masterdir-$BOOTSTRAP"
+
+set -x
+cat /.xbps_chroot_init

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (2 preceding siblings ...)
  2023-09-26  8:11 ` classabbyamp
@ 2023-09-26  8:13 ` classabbyamp
  2023-09-26  8:17 ` classabbyamp
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26  8:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 9632 bytes --]

From b3c8a7e0c75c3a0bf5135f314ec150b12e2ee123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3dc393c2965bd212dc936c0be473c8626e97d0e0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From 72d4ed4a85c356cb88ebde0cd57640b07e9a44dc Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:59:28 -0400
Subject: [PATCH 3/3] common/travis/: support new masterdir naming

---
 common/travis/build.sh   | 3 ++-
 common/travis/prepare.sh | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/common/travis/build.sh b/common/travis/build.sh
index 007a61f994d78..de57c0eb67cae 100755
--- a/common/travis/build.sh
+++ b/common/travis/build.sh
@@ -2,8 +2,9 @@
 #
 # build.sh
 
+arch="-A $1"
 if [ "$1" != "$2" ]; then
-	arch="-a $2"
+	arch="$arch -a $2"
 fi
 
 if [ "$3" = 1 ]; then
diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..8d1770c29b3b2 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,5 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /masterdir-'"$BOOTSTRAP"'...\x1b[0m'
+ln -s / "masterdir-$BOOTSTRAP"

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (3 preceding siblings ...)
  2023-09-26  8:13 ` classabbyamp
@ 2023-09-26  8:17 ` classabbyamp
  2023-09-26 11:43 ` lemmi
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26  8:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 9307 bytes --]

From b3c8a7e0c75c3a0bf5135f314ec150b12e2ee123 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3dc393c2965bd212dc936c0be473c8626e97d0e0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From 66c340a9bd49d3566492ba4d34b737c7759d21f2 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:59:28 -0400
Subject: [PATCH 3/3] common/travis/prepare.sh: support new masterdir naming

---
 common/travis/prepare.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..8d1770c29b3b2 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,5 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /masterdir-'"$BOOTSTRAP"'...\x1b[0m'
+ln -s / "masterdir-$BOOTSTRAP"

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (4 preceding siblings ...)
  2023-09-26  8:17 ` classabbyamp
@ 2023-09-26 11:43 ` lemmi
  2023-09-26 18:51 ` SpidFightFR
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: lemmi @ 2023-09-26 11:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

New comment by lemmi on void-packages repository

https://github.com/void-linux/void-packages/pull/46263#issuecomment-1735367273

Comment:
I like this change a lot. Personally I'm not opposed to remove the redundant flag to `{binary-,}bootstrap`, or at least fail if both options, `-A` and the argument to `bootstrap`, are specified. I'm less eager to rename `masterdir`, but since it's kind of an odd choice, I'm not against that.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (5 preceding siblings ...)
  2023-09-26 11:43 ` lemmi
@ 2023-09-26 18:51 ` SpidFightFR
  2023-09-26 18:53 ` [PR REVIEW] " classabbyamp
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: SpidFightFR @ 2023-09-26 18:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

New comment by SpidFightFR on void-packages repository

https://github.com/void-linux/void-packages/pull/46263#issuecomment-1736100125

Comment:
Following the progress on that PR, it looks very interesting ! 🙏

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR REVIEW] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (6 preceding siblings ...)
  2023-09-26 18:51 ` SpidFightFR
@ 2023-09-26 18:53 ` classabbyamp
  2023-12-26  1:45 ` github-actions
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-09-26 18:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

New review comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46263#discussion_r1337650046

Comment:
it might be better to revert back to `masterdir` naming if `XBPS_CHROOT_CMD = ethereal`

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (7 preceding siblings ...)
  2023-09-26 18:53 ` [PR REVIEW] " classabbyamp
@ 2023-12-26  1:45 ` github-actions
  2023-12-26 17:54 ` [PR PATCH] [Updated] " classabbyamp
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: github-actions @ 2023-12-26  1:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/46263#issuecomment-1869188314

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (8 preceding siblings ...)
  2023-12-26  1:45 ` github-actions
@ 2023-12-26 17:54 ` classabbyamp
  2024-01-17  4:34 ` classabbyamp
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2023-12-26 17:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 9307 bytes --]

From 6f38a9121d56da28a2c8f02b20f393722ad5f57a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..81341f38cc761 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -490,6 +490,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -524,9 +525,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -614,10 +615,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -740,13 +741,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -758,7 +767,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 255a1961a1a6d59782f9c4c47aec5cc5984b5b7d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From e2498d0d78bca74e9ac3129edf01c9fa597d5ee4 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:59:28 -0400
Subject: [PATCH 3/3] common/travis/prepare.sh: support new masterdir naming

---
 common/travis/prepare.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..8d1770c29b3b2 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,5 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /masterdir-'"$BOOTSTRAP"'...\x1b[0m'
+ln -s / "masterdir-$BOOTSTRAP"

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (9 preceding siblings ...)
  2023-12-26 17:54 ` [PR PATCH] [Updated] " classabbyamp
@ 2024-01-17  4:34 ` classabbyamp
  2024-01-17  4:46 ` classabbyamp
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  4:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 11576 bytes --]

From 18d620e69f34d07e903bedcdf1e7b404ebebc131 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..dc4635b74925c 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +618,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +744,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +770,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From d4e81acfea1e0246431b272c5dd5e286cd2e0e2f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From be772350df257b43e320e6d99093f0500dabab5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/3] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..e9169e1ba2a96 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e `void-packages/masterdir-<arch>`, where `<arch>` is your native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (10 preceding siblings ...)
  2024-01-17  4:34 ` classabbyamp
@ 2024-01-17  4:46 ` classabbyamp
  2024-01-17  4:50 ` classabbyamp
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  4:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 12755 bytes --]

From 18d620e69f34d07e903bedcdf1e7b404ebebc131 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/4] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..dc4635b74925c 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +618,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +744,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +770,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From d4e81acfea1e0246431b272c5dd5e286cd2e0e2f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/4] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From 970b66c7f3bf553770d7dcc0cad022e782ad9285 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/4] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..bd7fed879019f 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

From e5099ae76ceb6a134a3cfa232e336d317b411f1d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:45:24 -0500
Subject: [PATCH 4/4] fixup! xbps-src: add -A flag for host arch, create
 masterdir per host arch

---
 xbps-src | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xbps-src b/xbps-src
index dc4635b74925c..024da90ba99a4 100755
--- a/xbps-src
+++ b/xbps-src
@@ -204,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -529,6 +529,7 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
 fi
 
 # if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+echo "===============> $XBPS_CHROOT_CMD"
 : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
 [ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (11 preceding siblings ...)
  2024-01-17  4:46 ` classabbyamp
@ 2024-01-17  4:50 ` classabbyamp
  2024-01-17  4:51 ` classabbyamp
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  4:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 13930 bytes --]

From 18d620e69f34d07e903bedcdf1e7b404ebebc131 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/5] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 57 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..dc4635b74925c 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,9 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +618,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +744,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +770,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From d4e81acfea1e0246431b272c5dd5e286cd2e0e2f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/5] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From 970b66c7f3bf553770d7dcc0cad022e782ad9285 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/5] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..bd7fed879019f 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

From e5099ae76ceb6a134a3cfa232e336d317b411f1d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:45:24 -0500
Subject: [PATCH 4/5] fixup! xbps-src: add -A flag for host arch, create
 masterdir per host arch

---
 xbps-src | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xbps-src b/xbps-src
index dc4635b74925c..024da90ba99a4 100755
--- a/xbps-src
+++ b/xbps-src
@@ -204,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -529,6 +529,7 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
 fi
 
 # if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
+echo "===============> $XBPS_CHROOT_CMD"
 : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
 [ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 

From c0d16e22ab57c3d0f361f93b7f720e12cbdb59f4 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:49:33 -0500
Subject: [PATCH 5/5] fixup! xbps-src: add -A flag for host arch, create
 masterdir per host arch

---
 xbps-src | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xbps-src b/xbps-src
index 024da90ba99a4..aac7452615596 100755
--- a/xbps-src
+++ b/xbps-src
@@ -528,9 +528,13 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>.
-echo "===============> $XBPS_CHROOT_CMD"
-: "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+else
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+fi
 [ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (12 preceding siblings ...)
  2024-01-17  4:50 ` classabbyamp
@ 2024-01-17  4:51 ` classabbyamp
  2024-01-17  5:02 ` classabbyamp
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  4:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 12148 bytes --]

From 5dee8a62ea4a581fe3da1cc4e62a122becec72d6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 64 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..aac7452615596 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -194,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,14 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+else
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+fi
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +623,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +749,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +775,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From cea3d6c83e41aa76dd476ef512cf4d6161b9555b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From db362fc6018e647a704a7503d98c8e3df5c969d1 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/3] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..bd7fed879019f 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (13 preceding siblings ...)
  2024-01-17  4:51 ` classabbyamp
@ 2024-01-17  5:02 ` classabbyamp
  2024-01-17  5:44 ` classabbyamp
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  5:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 12893 bytes --]

From 5dee8a62ea4a581fe3da1cc4e62a122becec72d6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/4] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 64 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..aac7452615596 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -194,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,14 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+else
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+fi
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +623,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +749,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +775,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From cea3d6c83e41aa76dd476ef512cf4d6161b9555b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/4] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From db362fc6018e647a704a7503d98c8e3df5c969d1 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/4] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..bd7fed879019f 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

From 3c093587e1197967792a90d2b9fb709a65c233f3 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Jan 2024 00:02:47 -0500
Subject: [PATCH 4/4] temp

---
 common/travis/prepare.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..23be153185ee1 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,10 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
+echo "/usr/lib/xbps.d"
+cat /usr/lib/xbps.d/*
+echo "/etc/xbps.d"
+cat /etc/xbps.d/*
+
 /bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
 ln -s / masterdir

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (14 preceding siblings ...)
  2024-01-17  5:02 ` classabbyamp
@ 2024-01-17  5:44 ` classabbyamp
  2024-01-17  6:50 ` [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot classabbyamp
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  5:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 76006 bytes --]

From 5dee8a62ea4a581fe3da1cc4e62a122becec72d6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/5] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 64 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..aac7452615596 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -194,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,14 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+else
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+fi
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +623,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +749,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +775,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From cea3d6c83e41aa76dd476ef512cf4d6161b9555b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/5] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From db362fc6018e647a704a7503d98c8e3df5c969d1 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/5] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..bd7fed879019f 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

From 7e2908a3ca79576049b00d73d3bf4610c7a2f031 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Jan 2024 00:32:27 -0500
Subject: [PATCH 4/5] *: rename masterdir to buildroot

masterdir has always been a bit of mystifying name. buildroot is
straightforward and self-explanatory.
---
 .github/workflows/build.yaml                  |   4 +-
 .github/workflows/cycles.yml                  |   2 +-
 Manual.md                                     |  12 +-
 README.md                                     |  38 ++---
 common/build-style/cmake.sh                   |   2 +-
 common/chroot-style/README                    |   2 +-
 common/chroot-style/bwrap.sh                  |   8 +-
 common/chroot-style/ethereal.sh               |  32 ++---
 common/chroot-style/uchroot.sh                |   8 +-
 common/chroot-style/uunshare.sh               |   8 +-
 common/environment/configure/bootstrap.sh     |   4 +-
 common/environment/configure/pkg-config.sh    |   2 +-
 common/travis/prepare.sh                      |   4 +-
 common/xbps-src/libexec/xbps-src-dopkg.sh     |   4 +-
 common/xbps-src/shutils/chroot.sh             |  96 ++++++-------
 common/xbps-src/shutils/common.sh             |   4 +-
 common/xbps-src/shutils/cross.sh              |   4 +-
 common/xbps-src/shutils/pkgtarget.sh          |   2 +-
 srcpkgs/acl/template                          |   4 +-
 srcpkgs/chroot-git/template                   |   2 +-
 srcpkgs/chroot-util-linux/template            |   4 +-
 srcpkgs/gcc/template                          |   4 +-
 srcpkgs/glibc/template                        |   2 +-
 .../patches/py-smbus_fix-destdir.patch        |   2 +-
 srcpkgs/libgccjit/template                    |   2 +-
 srcpkgs/libmpc/template                       |   4 +-
 srcpkgs/man-db/template                       |   2 +-
 srcpkgs/pciutils/template                     |   4 +-
 srcpkgs/python3-adblock/template              |   2 +-
 .../files/generating-distfiles.md             |  24 ++--
 srcpkgs/sydbox/template                       |   2 +-
 xbps-src                                      | 136 +++++++++---------
 32 files changed, 215 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 03b5c270dbb44..0ce7685fd6211 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -40,7 +40,7 @@ jobs:
           xbps-install -y grep curl git
       - name: Clone and checkout
         uses: classabbyamp/treeless-checkout-action@v1
-      - name: Create hostrepo and prepare masterdir
+      - name: Create hostrepo and prepare buildroot
         run: |
          ln -s "$(pwd)" /hostrepo &&
          common/travis/set_mirror.sh &&
@@ -95,7 +95,7 @@ jobs:
 
       - name: Clone and checkout
         uses: classabbyamp/treeless-checkout-action@v1
-      - name: Create hostrepo and prepare masterdir
+      - name: Create hostrepo and prepare buildroot
         run: |
          ln -s "$(pwd)" /hostrepo &&
          common/travis/set_mirror.sh &&
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 292282daa9842..7c7fab4848ed2 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -29,7 +29,7 @@ jobs:
       - name: Clone and checkout
         uses: classabbyamp/treeless-checkout-action@v1
 
-      - name: Create hostrepo and prepare masterdir
+      - name: Create hostrepo and prepare buildroot
         run: |
           ln -s "$(pwd)" /hostrepo &&
           common/travis/set_mirror.sh &&
diff --git a/Manual.md b/Manual.md
index e6a98551eee30..6fcbb4d280865 100644
--- a/Manual.md
+++ b/Manual.md
@@ -149,7 +149,7 @@ If the default `do_check` function provided by the build style doesn't do anythi
 or can't run in all environments, `make_check` should be set to fitting value or
 `do_check` should be customized to limit testsuite unless `XBPS_CHECK_PKGS` is `full`.
 
-- `install` This phase installs the `package files` into the package destdir `<masterdir>/destdir/<pkgname>-<version>`,
+- `install` This phase installs the `package files` into the package destdir `<buildroot>/destdir/<pkgname>-<version>`,
 via `make install` or any other compatible method.
 
 - `pkg` This phase builds the `binary packages` with files stored in the
@@ -347,7 +347,7 @@ The following variables are defined by `xbps-src` and can be used on any templat
 - `sourcepkg`  Set to the to main package name, can be used to match the main package
 rather than additional binary package names.
 
-- `CHROOT_READY`  Set if the target chroot (masterdir) is ready for chroot builds.
+- `CHROOT_READY`  Set if the target chroot (buildroot) is ready for chroot builds.
 
 - `CROSS_BUILD` Set if `xbps-src` is cross compiling a package.
 
@@ -355,17 +355,17 @@ rather than additional binary package names.
 Longer testsuites should only be run in `do_check()` if it is set to `full`.
 
 - `DESTDIR` Full path to the fake destdir used by the source pkg, set to
-`<masterdir>/destdir/${sourcepkg}-${version}`.
+`<buildroot>/destdir/${sourcepkg}-${version}`.
 
 - `FILESDIR` Full path to the `files` package directory, i.e `srcpkgs/foo/files`.
 The `files` directory can be used to store additional files to be installed
 as part of the source package.
 
 - `PKGDESTDIR` Full path to the fake destdir used by the `pkg_install()` function in
-`subpackages`, set to `<masterdir>/destdir/${pkgname}-${version}`.
+`subpackages`, set to `<buildroot>/destdir/${pkgname}-${version}`.
 
 - `XBPS_BUILDDIR` Directory to store the `source code` of the source package being processed,
-set to `<masterdir>/builddir`. The package `wrksrc` is always stored
+set to `<buildroot>/builddir`. The package `wrksrc` is always stored
 in this directory such as `${XBPS_BUILDDIR}/${wrksrc}`.
 
 - `XBPS_MACHINE` The machine architecture as returned by `xbps-uhelper arch`.
@@ -1166,7 +1166,7 @@ defined by a `build_style` script.
 
 Current working directory for functions is set as follows:
 
-- For pre_fetch, pre_extract, do_clean: `<masterdir>`.
+- For pre_fetch, pre_extract, do_clean: `<buildroot>`.
 
 - For do_fetch, post_fetch: `XBPS_BUILDDIR`.
 
diff --git a/README.md b/README.md
index bd7fed879019f..997557e87ca62 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,8 @@ See [Contributing](./CONTRIBUTING.md) for a general overview of how to contribut
 - [Distfiles mirrors](#distfiles-mirrors)
 - [Cross compiling packages for a target architecture](#cross-compiling)
 - [Using xbps-src in a foreign Linux distribution](#foreign)
-- [Remaking the masterdir](#remaking-masterdir)
-- [Keeping your masterdir uptodate](#updating-masterdir)
+- [Remaking the buildroot](#remaking-buildroot)
+- [Keeping your buildroot uptodate](#updating-buildroot)
 - [Building 32bit packages on x86_64](#building-32bit)
 - [Building packages natively for the musl C library](#building-for-musl)
 - [Building void base-system from scratch](#building-base-system)
@@ -47,7 +47,7 @@ For bootstrapping additionally:
 - objcopy(1), objdump(1), strip(1): binutils
 
 `xbps-src` requires [a utility to chroot](#chroot-methods) and bind mount existing directories
-into a `masterdir` that is used as its main `chroot` directory. `xbps-src` supports
+into a `buildroot` that is used as its main `chroot` directory. `xbps-src` supports
 multiple utilities to accomplish this task.
 
 > NOTE: `xbps-src` does not allow building as root anymore. Use one of the chroot
@@ -154,7 +154,7 @@ Destroys host system it runs on. Only useful for one-shot containers, i.e docker
 ### Install the bootstrap packages
 
 There is a set of packages that makes up the initial build container, called the `bootstrap`.
-These packages are installed into the `masterdir` in order to create the container.
+These packages are installed into the `buildroot` in order to create the container.
 
 The primary and recommended way to set up this container is using the `binary-bootstrap`
 command. This will use pre-existing binary packages, either from remote `xbps` repositories
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir-<arch>
+            |- buildroot-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
+ - `buildroot-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -413,7 +413,7 @@ checksum verification, the original download location is used.
 If you use `uchroot` for your XBPS_CHROOT_CMD, you may also specify a local path
 using the `file://` prefix or simply an absolute path on your build host (e.g. /mnt/distfiles).
 Mirror locations specified this way are bind mounted inside the chroot environment
-under $XBPS_MASTERDIR and searched for distfiles just the same as remote locations.
+under $XBPS_BUILDROOT and searched for distfiles just the same as remote locations.
 
 <a name="cross-compiling"></a>
 ### Cross compiling packages for a target architecture
@@ -450,18 +450,18 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
+The default buildroot is created in the current working directory, i.e. `void-packages/buildroot-<arch>`, where `<arch>` for the default buildroot is is the native xbps architecture.
 
-<a name="remaking-masterdir"></a>
-### Remaking the masterdir
+<a name="remaking-buildroot"></a>
+### Remaking the buildroot
 
-If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a masterdir with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact):
+If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a buildroot with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact):
 
     $ ./xbps-src zap
     $ ./xbps-src binary-bootstrap
 
-<a name="updating-masterdir"></a>
-### Keeping your masterdir uptodate
+<a name="updating-buildroot"></a>
+### Keeping your buildroot uptodate
 
 Sometimes the bootstrap packages must be updated to the latest available version in repositories, this is accomplished with the `bootstrap-update` target:
 
@@ -472,10 +472,10 @@ Sometimes the bootstrap packages must be updated to the latest available version
 
 Two ways are available to build 32bit packages on x86\_64:
 
- - native mode with a 32bit masterdir (recommended, used in official repository)
+ - native mode with a 32bit buildroot (recommended, used in official repository)
  - cross compilation mode to i686 [target](#cross-compiling)
 
-The canonical mode (native) needs a new x86 `masterdir`:
+The canonical mode (native) needs a new x86 `buildroot`:
 
     $ ./xbps-src -A i686 binary-bootstrap
     $ ./xbps-src -A i686 ...
@@ -483,13 +483,13 @@ The canonical mode (native) needs a new x86 `masterdir`:
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
-To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
+The canonical way of building packages for same architecture but different C library is through a dedicated buildroot by using the host architecture flag `-A`.
+To build for x86_64-musl on glibc x86_64 system, prepare a new buildroot with the musl packages:
 
     $ ./xbps-src -A x86_64-musl binary-bootstrap
 
-This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
-Your new masterdir is now ready to build packages natively for the musl C library:
+This will create and bootstrap a new buildroot called `buildroot-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
+Your new buildroot is now ready to build packages natively for the musl C library:
 
     $ ./xbps-src -A x86_64-musl pkg ...
 
diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh
index 124ed354eff67..3349ddbc23420 100644
--- a/common/build-style/cmake.sh
+++ b/common/build-style/cmake.sh
@@ -14,7 +14,7 @@ SET(CMAKE_SYSTEM_VERSION 1)
 SET(CMAKE_C_COMPILER   ${CC})
 SET(CMAKE_CXX_COMPILER ${CXX})
 
-SET(CMAKE_FIND_ROOT_PATH  "${XBPS_MASTERDIR}/usr;${XBPS_MASTERDIR}")
+SET(CMAKE_FIND_ROOT_PATH  "${XBPS_BUILDROOT}/usr;${XBPS_BUILDROOT}")
 
 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/common/chroot-style/README b/common/chroot-style/README
index a5d89d016cf15..9891b863da57a 100644
--- a/common/chroot-style/README
+++ b/common/chroot-style/README
@@ -4,7 +4,7 @@ CHROOT STYLES
 This directory contains scripts to perform the chroot operation with xbps-src.
 The scripts should accept at least 5 arguments:
 
-	- $1 (MASTERDIR) masterdir to chroot
+	- $1 (BUILDROOT) buildroot to chroot
 	- $2 (DISTDIR) path to the void-packages directory
 	- $3 (HOSTDIR) path to hostdir
 	- $4 (EXTRA_ARGS) additional arguments to be passed
diff --git a/common/chroot-style/bwrap.sh b/common/chroot-style/bwrap.sh
index de4323506a3e0..b7ba4767c068a 100755
--- a/common/chroot-style/bwrap.sh
+++ b/common/chroot-style/bwrap.sh
@@ -3,7 +3,7 @@
 # This chroot script uses bubblewrap (see https://github.com/containers/bubblewrap)
 #
 set -e
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
@@ -13,11 +13,11 @@ if ! command -v bwrap >/dev/null 2>&1; then
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
-exec bwrap --bind "$MASTERDIR" / --ro-bind "$DISTDIR" /void-packages \
+exec bwrap --bind "$BUILDROOT" / --ro-bind "$DISTDIR" /void-packages \
 	 --dev /dev --tmpfs /tmp --proc /proc \
 	${HOSTDIR:+--bind "$HOSTDIR" /host} $EXTRA_ARGS "$@"
diff --git a/common/chroot-style/ethereal.sh b/common/chroot-style/ethereal.sh
index a226465cc82ff..90b70e371cdf9 100755
--- a/common/chroot-style/ethereal.sh
+++ b/common/chroot-style/ethereal.sh
@@ -1,13 +1,13 @@
 #!/bin/sh
 #
 # This chroot script uses symlinks to emulate being in a chroot using
-# the host system as the masterdir
+# the host system as the buildroot
 #
 # It will damage your host system, only use it in disposable
 # containers.
 #
 # 2 extra steps required when using this chroot-style:
-# 1. Symlink / to masterdir inside the void-packages repo
+# 1. Symlink / to buildroot inside the void-packages repo
 # 2. write the arch of the host system, as dictated by xbps-uhelper arch
 # into /.xbps_chroot_init
 #
@@ -20,24 +20,24 @@
 # $ xbps-install -y -r /tmp/image \
 #				 -R http://mirrors.servercentral.com/voidlinux/current \
 #				 -S base-chroot
-# $ tar -pC /tmp/image -c . | sudo docker import - voidlinux/masterdir
+# $ tar -pC /tmp/image -c . | sudo docker import - voidlinux/buildroot
 # $ rm -rf /tmp/image
 # # docker run --rm -it \
 #			   -e XBPS_CHROOT_CMD=ethereal \
 #			   -e XBPS_ALLOW_CHROOT_BREAKOUT=yes \
-#			   -v $(pwd):/hostrepo voidlinux/masterdir \
-#			   /bin/bash -c 'ln -s / /hostrepo/masterdir && /hostrepo/xbps-src pkg <pkgname>'
+#			   -v $(pwd):/hostrepo voidlinux/buildroot \
+#			   /bin/bash -c 'ln -s / /hostrepo/buildroot && /hostrepo/xbps-src pkg <pkgname>'
 #
 
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
 readonly CMD="$5"
 shift 5
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
@@ -72,16 +72,16 @@ if [ "${XBPS_ALLOW_CHROOT_BREAKOUT}" != "yes" ]; then
 	exit 1
 fi
 
-if [ ! -L "$MASTERDIR" -o "$(readlink "$MASTERDIR")" != "/" ]; then
-	msg_red "$MASTERDIR isn't symlinked to /!\n"
+if [ ! -L "$BUILDROOT" -o "$(readlink "$BUILDROOT")" != "/" ]; then
+	msg_red "$BUILDROOT isn't symlinked to /!\n"
 	exit 1
 fi
 
-fake_mount "$DISTDIR" "$MASTERDIR"/void-packages
+fake_mount "$DISTDIR" "$BUILDROOT"/void-packages
 
 # Do the same for hostdir
 if [ -n "$HOSTDIR" ]; then
-	fake_mount "$HOSTDIR" "$MASTERDIR"/host
+	fake_mount "$HOSTDIR" "$BUILDROOT"/host
 fi
 
 # xbps-src may send some other binds, parse them here
@@ -118,8 +118,8 @@ cd "${OLDPWD}"
 # Remove the symlink and restore an empty dir to simulate
 # an umount operation.
 if [ -n "$HOSTDIR" ]; then
-	rm -f "$MASTERDIR"/host
-	mkdir -p "$MASTERDIR"/host
+	rm -f "$BUILDROOT"/host
+	mkdir -p "$BUILDROOT"/host
 fi
 
 # Same as the operation above, do it all for all mountpoints
@@ -129,7 +129,7 @@ for m in $mounts; do
 	mkdir -p "$m"
 done
 
-rm -f "$MASTERDIR"/void-packages
-mkdir -p "$MASTERDIR"/void-packages
+rm -f "$BUILDROOT"/void-packages
+mkdir -p "$BUILDROOT"/void-packages
 
 exit $ret
diff --git a/common/chroot-style/uchroot.sh b/common/chroot-style/uchroot.sh
index 5fe47eb9f8bcb..501c422f5b645 100755
--- a/common/chroot-style/uchroot.sh
+++ b/common/chroot-style/uchroot.sh
@@ -2,7 +2,7 @@
 #
 # This chroot script uses xbps-uchroot(1).
 #
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
@@ -13,9 +13,9 @@ if ! command -v xbps-uchroot >/dev/null 2>&1; then
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
-exec xbps-uchroot $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@
+exec xbps-uchroot $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $BUILDROOT $CMD $@
diff --git a/common/chroot-style/uunshare.sh b/common/chroot-style/uunshare.sh
index 4d5146445fd2d..66a9a4eac66db 100755
--- a/common/chroot-style/uunshare.sh
+++ b/common/chroot-style/uunshare.sh
@@ -2,7 +2,7 @@
 #
 # This chroot script uses xbps-uunshare(1) with user_namespaces(7).
 #
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
@@ -13,9 +13,9 @@ if ! command -v xbps-uunshare >/dev/null 2>&1; then
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
-exec xbps-uunshare $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@
+exec xbps-uunshare $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $BUILDROOT $CMD $@
diff --git a/common/environment/configure/bootstrap.sh b/common/environment/configure/bootstrap.sh
index f5ba5f442c7c0..558b64ecc2eb8 100644
--- a/common/environment/configure/bootstrap.sh
+++ b/common/environment/configure/bootstrap.sh
@@ -1,4 +1,4 @@
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS+=" -isystem ${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib -Wl,-rpath-link=${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS+=" -isystem ${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS+=" -L${XBPS_BUILDROOT}/usr/lib -Wl,-rpath-link=${XBPS_BUILDROOT}/usr/lib"
 fi
diff --git a/common/environment/configure/pkg-config.sh b/common/environment/configure/pkg-config.sh
index bf81c5f9afa68..d43baeee1f1da 100644
--- a/common/environment/configure/pkg-config.sh
+++ b/common/environment/configure/pkg-config.sh
@@ -1,5 +1,5 @@
 # This snippet setups pkg-config vars.
 
 if [ -z "$CHROOT_READY" ]; then
-	export PKG_CONFIG_PATH="${XBPS_MASTERDIR}/usr/lib/pkgconfig:${XBPS_MASTERDIR}/usr/share/pkgconfig"
+	export PKG_CONFIG_PATH="${XBPS_BUILDROOT}/usr/lib/pkgconfig:${XBPS_BUILDROOT}/usr/share/pkgconfig"
 fi
diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..5086c8f0b2f3b 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,5 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /buildroot...\x1b[0m'
+ln -s / buildroot
diff --git a/common/xbps-src/libexec/xbps-src-dopkg.sh b/common/xbps-src/libexec/xbps-src-dopkg.sh
index 5fec7b9d8d56c..ab1a322ec612f 100755
--- a/common/xbps-src/libexec/xbps-src-dopkg.sh
+++ b/common/xbps-src/libexec/xbps-src-dopkg.sh
@@ -36,8 +36,8 @@ if [ "$sourcepkg" != "$PKGNAME" ]; then
     pkgname=$PKGNAME
 fi
 
-if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
-    export XBPS_ARCH=$(<$XBPS_MASTERDIR/.xbps_chroot_init)
+if [ -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
+    export XBPS_ARCH=$(<$XBPS_BUILDROOT/.xbps_chroot_init)
 fi
 
 # Run do-pkg hooks.
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index fc17dae4fdbe9..9db8910238f29 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -27,8 +27,8 @@ install_base_chroot() {
         msg_error "xbps-src: failed to install base-chroot!\n"
     fi
     # Reconfigure base-files to create dirs/symlinks.
-    if xbps-query -r $XBPS_MASTERDIR base-files &>/dev/null; then
-        XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_MASTERDIR -f base-files &>/dev/null
+    if xbps-query -r $XBPS_BUILDROOT base-files &>/dev/null; then
+        XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_BUILDROOT -f base-files &>/dev/null
     fi
 
     msg_normal "xbps-src: installed base-chroot successfully!\n"
@@ -38,14 +38,14 @@ install_base_chroot() {
 }
 
 reconfigure_base_chroot() {
-    local statefile="$XBPS_MASTERDIR/.xbps_chroot_configured"
+    local statefile="$XBPS_BUILDROOT/.xbps_chroot_configured"
     local pkgs="glibc-locales ca-certificates"
     [ -z "$IN_CHROOT" -o -e $statefile ] && return 0
     # Reconfigure ca-certificates.
     msg_normal "xbps-src: reconfiguring base-chroot...\n"
     for f in ${pkgs}; do
-        if xbps-query -r $XBPS_MASTERDIR $f &>/dev/null; then
-            xbps-reconfigure -r $XBPS_MASTERDIR -f $f
+        if xbps-query -r $XBPS_BUILDROOT $f &>/dev/null; then
+            xbps-reconfigure -r $XBPS_BUILDROOT -f $f
         fi
     done
     touch -f $statefile
@@ -54,27 +54,27 @@ reconfigure_base_chroot() {
 update_base_chroot() {
     local keep_all_force=$1
     [ -z "$CHROOT_READY" ] && return
-    msg_normal "xbps-src: updating software in $XBPS_MASTERDIR masterdir...\n"
+    msg_normal "xbps-src: updating software in $XBPS_BUILDROOT buildroot...\n"
     # no need to sync repodata, chroot_sync_repodata() does it for us.
     if $(${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -nu|grep -q xbps); then
         ${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu xbps || msg_error "xbps-src: failed to update xbps!\n"
     fi
     ${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu || msg_error "xbps-src: failed to update base-chroot!\n"
-    msg_normal "xbps-src: cleaning up $XBPS_MASTERDIR masterdir...\n"
+    msg_normal "xbps-src: cleaning up $XBPS_BUILDROOT buildroot...\n"
     [ -z "$XBPS_KEEP_ALL" -a -z "$XBPS_SKIP_DEPS" ] && remove_pkg_autodeps
-    [ -z "$XBPS_KEEP_ALL" -a -z "$keep_all_force" ] && rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
+    [ -z "$XBPS_KEEP_ALL" -a -z "$keep_all_force" ] && rm -rf $XBPS_BUILDROOT/builddir $XBPS_BUILDROOT/destdir
 }
 
 # FIXME: $XBPS_FFLAGS is not set when chroot_init() is run
 # It is set in common/build-profiles/bootstrap.sh but lost somewhere?
 chroot_init() {
-    mkdir -p $XBPS_MASTERDIR/etc/xbps
+    mkdir -p $XBPS_BUILDROOT/etc/xbps
 
     : ${XBPS_CONFIG_FILE:=/dev/null}
-    cat > $XBPS_MASTERDIR/etc/xbps/xbps-src.conf <<_EOF
+    cat > $XBPS_BUILDROOT/etc/xbps/xbps-src.conf <<_EOF
 # Generated configuration file by xbps-src, DO NOT EDIT!
 $(grep -E '^XBPS_.*' "$XBPS_CONFIG_FILE")
-XBPS_MASTERDIR=/
+XBPS_BUILDROOT=/
 XBPS_CFLAGS="$XBPS_CFLAGS"
 XBPS_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_FFLAGS="$XBPS_FFLAGS"
@@ -85,7 +85,7 @@ XBPS_HOSTDIR=/host
 _EOF
 
     # Create custom script to start the chroot bash shell.
-    cat > $XBPS_MASTERDIR/bin/xbps-shell <<_EOF
+    cat > $XBPS_BUILDROOT/bin/xbps-shell <<_EOF
 #!/bin/sh
 
 XBPS_SRC_VERSION="$XBPS_SRC_VERSION"
@@ -97,52 +97,52 @@ PATH=/void-packages:/usr/bin
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
     CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    PS1="[\u@$XBPS_BUILDROOT \W]$ " /bin/bash +h "\$@"
 _EOF
 
-    chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
-    cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc
+    chmod 755 $XBPS_BUILDROOT/bin/xbps-shell
+    cp -f /etc/resolv.conf $XBPS_BUILDROOT/etc
     return 0
 }
 
 chroot_prepare() {
     local f=
 
-    if [ -f $XBPS_MASTERDIR/.xbps_chroot_init ]; then
+    if [ -f $XBPS_BUILDROOT/.xbps_chroot_init ]; then
         return 0
-    elif [ ! -f $XBPS_MASTERDIR/bin/bash ]; then
-        msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n"
+    elif [ ! -f $XBPS_BUILDROOT/bin/bash ]; then
+        msg_error "Bootstrap not installed in $XBPS_BUILDROOT, can't continue.\n"
     fi
 
     # Some software expects /etc/localtime to be a symbolic link it can read to
     # determine the name of the time zone, so set up the expected link
     # structure.
-    ln -sf ../usr/share/zoneinfo/UTC $XBPS_MASTERDIR/etc/localtime
+    ln -sf ../usr/share/zoneinfo/UTC $XBPS_BUILDROOT/etc/localtime
 
     for f in dev sys tmp proc host boot; do
-        [ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
+        [ ! -d $XBPS_BUILDROOT/$f ] && mkdir -p $XBPS_BUILDROOT/$f
     done
 
     # Copy /etc/passwd and /etc/group from base-files.
-    cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_MASTERDIR/etc
+    cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_BUILDROOT/etc
     echo "$(whoami):x:$(id -u):$(id -g):$(whoami) user:/tmp:/bin/xbps-shell" \
-        >> $XBPS_MASTERDIR/etc/passwd
-    cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_MASTERDIR/etc
-    echo "$(whoami):x:$(id -g):" >> $XBPS_MASTERDIR/etc/group
+        >> $XBPS_BUILDROOT/etc/passwd
+    cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_BUILDROOT/etc
+    echo "$(whoami):x:$(id -g):" >> $XBPS_BUILDROOT/etc/group
 
     # Copy /etc/hosts from base-files.
-    cp -f $XBPS_SRCPKGDIR/base-files/files/hosts $XBPS_MASTERDIR/etc
+    cp -f $XBPS_SRCPKGDIR/base-files/files/hosts $XBPS_BUILDROOT/etc
 
     # Prepare default locale: en_US.UTF-8.
-    if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then
+    if [ -s ${XBPS_BUILDROOT}/etc/default/libc-locales ]; then
         printf '%s\n' \
             'C.UTF-8 UTF-8' \
             'en_US.UTF-8 UTF-8' \
-            >> ${XBPS_MASTERDIR}/etc/default/libc-locales
+            >> ${XBPS_BUILDROOT}/etc/default/libc-locales
     fi
 
-    touch -f $XBPS_MASTERDIR/.xbps_chroot_init
-    [ -n "$1" ] && echo $1 >> $XBPS_MASTERDIR/.xbps_chroot_init
+    touch -f $XBPS_BUILDROOT/.xbps_chroot_init
+    [ -n "$1" ] && echo $1 >> $XBPS_BUILDROOT/.xbps_chroot_init
 
     return 0
 }
@@ -155,8 +155,8 @@ chroot_handler() {
     if [ -n "$IN_CHROOT" -o -z "$CHROOT_READY" ]; then
         return 0
     fi
-    if [ ! -d $XBPS_MASTERDIR/void-packages ]; then
-        mkdir -p $XBPS_MASTERDIR/void-packages
+    if [ ! -d $XBPS_BUILDROOT/void-packages ]; then
+        mkdir -p $XBPS_BUILDROOT/void-packages
     fi
 
     case "$action" in
@@ -168,7 +168,7 @@ chroot_handler() {
 
     if [ "$action" = "chroot" ]; then
         $XBPS_COMMONDIR/chroot-style/${XBPS_CHROOT_CMD:=uunshare}.sh \
-            $XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" /bin/xbps-shell
+            $XBPS_BUILDROOT $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" /bin/xbps-shell
         rv=$?
     else
         env -i -- PATH="/usr/bin:$PATH" SHELL=/bin/sh \
@@ -190,7 +190,7 @@ chroot_handler() {
             XBPS_ALLOW_CHROOT_BREAKOUT="$XBPS_ALLOW_CHROOT_BREAKOUT" \
             ${XBPS_ALT_REPOSITORY:+XBPS_ALT_REPOSITORY=$XBPS_ALT_REPOSITORY} \
             $XBPS_COMMONDIR/chroot-style/${XBPS_CHROOT_CMD:=uunshare}.sh \
-            $XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" \
+            $XBPS_BUILDROOT $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" \
             /void-packages/xbps-src $XBPS_OPTIONS $action $pkg
         rv=$?
     fi
@@ -202,8 +202,8 @@ chroot_sync_repodata() {
     local f= hostdir= confdir= crossconfdir=
 
     # always start with an empty xbps.d
-    confdir=$XBPS_MASTERDIR/etc/xbps.d
-    crossconfdir=$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
+    confdir=$XBPS_BUILDROOT/etc/xbps.d
+    crossconfdir=$XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
 
     [ -d $confdir ] && rm -rf $confdir
     [ -d $crossconfdir ] && rm -rf $crossconfdir
@@ -286,13 +286,13 @@ chroot_sync_repodata() {
 
     # Copy host repos to the cross root.
     if [ -n "$XBPS_CROSS_BUILD" ]; then
-        rm -rf $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
-        mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
+        rm -rf $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
+        mkdir -p $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
         # Disable 00-repository-main.conf from share/xbps.d (part of xbps)
-        ln -s /dev/null $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d/00-repository-main.conf
+        ln -s /dev/null $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d/00-repository-main.conf
         # copy xbps.d files from host for local repos
-        cp ${XBPS_MASTERDIR}/etc/xbps.d/*local*.conf \
-            $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
+        cp ${XBPS_BUILDROOT}/etc/xbps.d/*local*.conf \
+            $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
         if [ "$XBPS_SKIP_REMOTEREPOS" ]; then
             rm -f $crossconfdir/*remote*
         else
@@ -314,11 +314,11 @@ chroot_sync_repodata() {
     fi
 
 
-    # Copy xbps repository keys to the masterdir.
-    mkdir -p $XBPS_MASTERDIR/var/db/xbps/keys
-    cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_MASTERDIR/var/db/xbps/keys
+    # Copy xbps repository keys to the buildroot.
+    mkdir -p $XBPS_BUILDROOT/var/db/xbps/keys
+    cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_BUILDROOT/var/db/xbps/keys
     if [ -n "$(shopt -s nullglob; echo "$XBPS_DISTDIR"/etc/repo-keys/*.plist)" ]; then
-        cp -f "$XBPS_DISTDIR"/etc/repo-keys/*.plist "$XBPS_MASTERDIR"/var/db/xbps/keys
+        cp -f "$XBPS_DISTDIR"/etc/repo-keys/*.plist "$XBPS_BUILDROOT"/var/db/xbps/keys
     fi
 
     # Make sure to sync index for remote repositories.
@@ -329,14 +329,14 @@ chroot_sync_repodata() {
 
     if [ -n "$XBPS_CROSS_BUILD" ]; then
         # Copy host keys to the target rootdir.
-        mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
-        cp $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
-            $XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
+        mkdir -p $XBPS_BUILDROOT/$XBPS_CROSS_BASE/var/db/xbps/keys
+        cp $XBPS_BUILDROOT/var/db/xbps/keys/*.plist \
+            $XBPS_BUILDROOT/$XBPS_CROSS_BASE/var/db/xbps/keys
         # Make sure to sync index for remote repositories.
         if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
             msg_normal "xbps-src: updating repositories for target ($XBPS_TARGET_MACHINE)...\n"
             env -- XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE \
-                $XBPS_INSTALL_CMD $XBPS_INSTALL_ARGS -r $XBPS_MASTERDIR/$XBPS_CROSS_BASE -S
+                $XBPS_INSTALL_CMD $XBPS_INSTALL_ARGS -r $XBPS_BUILDROOT/$XBPS_CROSS_BASE -S
         fi
     fi
 
diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index 4083e08ee084f..f662bffff3b9d 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -137,8 +137,8 @@ error_func() {
 exit_and_cleanup() {
     local rval=$1
 
-    if [ -n "$XBPS_TEMP_MASTERDIR" -a "$XBPS_TEMP_MASTERDIR" != "1" ]; then
-        rm -rf "$XBPS_TEMP_MASTERDIR"
+    if [ -n "$XBPS_TEMP_BUILDROOT" -a "$XBPS_TEMP_BUILDROOT" != "1" ]; then
+        rm -rf "$XBPS_TEMP_BUILDROOT"
     fi
     exit ${rval:=0}
 }
diff --git a/common/xbps-src/shutils/cross.sh b/common/xbps-src/shutils/cross.sh
index c21bab1747875..5c1b2b35cc4ec 100644
--- a/common/xbps-src/shutils/cross.sh
+++ b/common/xbps-src/shutils/cross.sh
@@ -4,7 +4,7 @@ remove_pkg_cross_deps() {
     local rval= tmplogf= prevs=0
     [ -z "$XBPS_CROSS_BUILD" ] && return 0
 
-    cd $XBPS_MASTERDIR || return 1
+    cd $XBPS_BUILDROOT || return 1
     msg_normal "${pkgver:-xbps-src}: removing autocrossdeps, please wait...\n"
     tmplogf=$(mktemp) || exit 1
 
@@ -35,7 +35,7 @@ remove_pkg_cross_deps() {
 
 prepare_cross_sysroot() {
     local cross="$1"
-    local statefile="$XBPS_MASTERDIR/.xbps-${cross}-done"
+    local statefile="$XBPS_BUILDROOT/.xbps-${cross}-done"
 
     [ -z "$cross" -o "$cross" = "" -o -f $statefile ] && return 0
 
diff --git a/common/xbps-src/shutils/pkgtarget.sh b/common/xbps-src/shutils/pkgtarget.sh
index 1e76a1b93b19e..3a5e3f4337cb8 100644
--- a/common/xbps-src/shutils/pkgtarget.sh
+++ b/common/xbps-src/shutils/pkgtarget.sh
@@ -58,7 +58,7 @@ pkg_available() {
 remove_pkg_autodeps() {
     local rval= tmplogf= errlogf= prevs=
 
-    cd $XBPS_MASTERDIR || return 1
+    cd $XBPS_BUILDROOT || return 1
     msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
     tmplogf=$(mktemp) || exit 1
     errlogf=$(mktemp) || exit 1
diff --git a/srcpkgs/acl/template b/srcpkgs/acl/template
index 9fa74946a2409..bccb3259c799a 100644
--- a/srcpkgs/acl/template
+++ b/srcpkgs/acl/template
@@ -15,8 +15,8 @@ distfiles="${NONGNU_SITE}/acl/acl-${version}.tar.gz"
 checksum=760c61c68901b37fdd5eefeeaf4c0c7a26bdfdd8ac747a1edff1ce0e243c11af
 
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS+=" -I${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS+=" -I${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS+=" -L${XBPS_BUILDROOT}/usr/lib"
 fi
 
 acl-devel_package() {
diff --git a/srcpkgs/chroot-git/template b/srcpkgs/chroot-git/template
index 3e2d1847cde84..bfad07282eede 100644
--- a/srcpkgs/chroot-git/template
+++ b/srcpkgs/chroot-git/template
@@ -48,7 +48,7 @@ do_configure() {
 	fi
 	if ! [ "$CHROOT_READY" ]; then
 		cat <<-EOF >>config.mak
-		ZLIB_PATH = ${XBPS_MASTERDIR}/usr
+		ZLIB_PATH = ${XBPS_BUILDROOT}/usr
 		NO_CURL = Yes
 		EOF
 	fi
diff --git a/srcpkgs/chroot-util-linux/template b/srcpkgs/chroot-util-linux/template
index e2c3c5f49ed70..ee8ad13034552 100644
--- a/srcpkgs/chroot-util-linux/template
+++ b/srcpkgs/chroot-util-linux/template
@@ -23,8 +23,8 @@ provides="util-linux-${version}_${revision}"
 repository=bootstrap
 
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS+=" -I${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS+=" -I${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS+=" -L${XBPS_BUILDROOT}/usr/lib"
 fi
 
 post_install() {
diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template
index a8f6096042247..6e1a9f65abdfd 100644
--- a/srcpkgs/gcc/template
+++ b/srcpkgs/gcc/template
@@ -237,7 +237,7 @@ do_configure() {
 		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
 		_langs+=",objc,obj-c++,fortran"
 	elif [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		export LD_LIBRARY_PATH="${XBPS_BUILDROOT}/usr/lib${XBPS_TARGET_WORDSIZE}"
 		_args+=" --build=${_triplet}"
 	else
 		_langs="c,c++,objc,obj-c++,fortran,lto"
@@ -318,7 +318,7 @@ do_configure() {
 }
 do_build() {
 	if [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		export LD_LIBRARY_PATH="${XBPS_BUILDROOT}/usr/lib${XBPS_TARGET_WORDSIZE}"
 	fi
 	cd build
 	if [ "$build_option_gnatboot" ]; then
diff --git a/srcpkgs/glibc/template b/srcpkgs/glibc/template
index 3272a1df265c1..13d3e2b88172c 100644
--- a/srcpkgs/glibc/template
+++ b/srcpkgs/glibc/template
@@ -88,7 +88,7 @@ do_configure() {
 		configure_args+=" --with-sysroot=${XBPS_CROSS_BASE}"
 		configure_args+=" --with-headers=${XBPS_CROSS_BASE}/usr/include"
 	else
-		configure_args+=" --with-headers=${XBPS_MASTERDIR}/usr/include"
+		configure_args+=" --with-headers=${XBPS_BUILDROOT}/usr/include"
 	fi
 
 	# Disable SSP from CFLAGS (enabled below)
diff --git a/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch b/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch
index f61e4122cd622..b23bf806bc5c7 100644
--- a/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch
+++ b/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch
@@ -1,4 +1,4 @@
-I had to add '--root' to the patch for it to not poison the masterdir.
+I had to add '--root' to the patch for it to not poison the buildroot.
   That part will still be needed as a patch when the next version gets released.
   -- 0x5c
 original message below
diff --git a/srcpkgs/libgccjit/template b/srcpkgs/libgccjit/template
index fde1affd54b7c..fe601a2c099c6 100644
--- a/srcpkgs/libgccjit/template
+++ b/srcpkgs/libgccjit/template
@@ -107,7 +107,7 @@ do_configure() {
 		_args+=" --host=$XBPS_CROSS_TRIPLET"
 		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
 	elif [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		export LD_LIBRARY_PATH="${XBPS_BUILDROOT}/usr/lib${XBPS_TARGET_WORDSIZE}"
 		_args+=" --build=${_target_triplet}"
 	else
 		_args+=" --build=${_target_triplet}"
diff --git a/srcpkgs/libmpc/template b/srcpkgs/libmpc/template
index 0d5622143a584..388f425ff9af2 100644
--- a/srcpkgs/libmpc/template
+++ b/srcpkgs/libmpc/template
@@ -14,8 +14,8 @@ distfiles="${GNU_SITE}/mpc/mpc-${version}.tar.gz"
 checksum=ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8
 
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS="-I${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS="-L${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS="-I${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS="-L${XBPS_BUILDROOT}/usr/lib"
 fi
 
 post_install() {
diff --git a/srcpkgs/man-db/template b/srcpkgs/man-db/template
index cea1193c9d6e9..21fcfce74e438 100644
--- a/srcpkgs/man-db/template
+++ b/srcpkgs/man-db/template
@@ -27,7 +27,7 @@ system_accounts="_man"
 _man_homedir="/var/cache/man"
 make_dirs="/var/cache/man 0755 _man _man"
 
-# among others, requires the _man user to be available in the masterdir
+# among others, requires the _man user to be available in the buildroot
 make_check=no
 
 alternatives="
diff --git a/srcpkgs/pciutils/template b/srcpkgs/pciutils/template
index b5c8eb6bea052..95f67cdd4aacc 100644
--- a/srcpkgs/pciutils/template
+++ b/srcpkgs/pciutils/template
@@ -18,7 +18,7 @@ do_build() {
 		RANLIB=${RANLIB} PREFIX=/usr CC=${CC} \
 		HOST=${XBPS_TARGET_MACHINE%-musl}-linux ZLIB=yes \
 		SHAREDIR=/usr/share/hwdata MANDIR=/usr/share/man all
-	cp lib/libpci.a ${XBPS_MASTERDIR}/tmp
+	cp lib/libpci.a ${XBPS_BUILDROOT}/tmp
 	make clean
 	make OPT="${CFLAGS}" SHARED=yes AR=${AR} \
 		RANLIB=${RANLIB} PREFIX=/usr CC=${CC} \
@@ -30,7 +30,7 @@ do_install() {
 	make SHARED=yes PREFIX=/usr SHAREDIR=/usr/share/hwdata STRIP= \
 		MANDIR=/usr/share/man SBINDIR=/usr/bin \
 		DESTDIR=${DESTDIR} install install-lib
-	vinstall ${XBPS_MASTERDIR}/tmp/libpci.a 644 usr/lib
+	vinstall ${XBPS_BUILDROOT}/tmp/libpci.a 644 usr/lib
 
 	# Set corrects perms to shlib.
 	chmod 755 ${DESTDIR}/usr/lib/libpci.so.${version}
diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
index 71aeb5c9a84c4..a8aa682724ff2 100644
--- a/srcpkgs/python3-adblock/template
+++ b/srcpkgs/python3-adblock/template
@@ -21,7 +21,7 @@ do_build() {
 	maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
 
 	# Drop platform specifiers from the wheel; pip will refuse to install,
-	# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
+	# e.g., an armv7l wheel on an aarch64 system even if the buildroot is
 	# armv7l. The wheel is correct; no need for name compatibility checks.
 	mkdir -p dist
 	mv adblock-${version}-*.whl dist/adblock-${version}-py3-none-any.whl
diff --git a/srcpkgs/rust-bootstrap/files/generating-distfiles.md b/srcpkgs/rust-bootstrap/files/generating-distfiles.md
index 36ee0ad230f2e..ff94a61f51b28 100644
--- a/srcpkgs/rust-bootstrap/files/generating-distfiles.md
+++ b/srcpkgs/rust-bootstrap/files/generating-distfiles.md
@@ -9,16 +9,16 @@ problems.
 Note: Void no longer officially supports PowerPC platforms,
 this guide is kept for historical reasons as well as for future reference.
 
-### Set up appropriate masterdirs and remote-repositories
+### Set up appropriate buildroots and remote-repositories
 
 This guide assumes you're on an x86\_64 machine. If you're not, please adapt the
 appropriate sections.
 
-First, we bootstrap our masterdirs. We need both a glibc one and a musl one:
+First, we bootstrap our buildroots. We need both a glibc one and a musl one:
 
 ```
-$ ./xbps-src -m masterdir-glibc binary-bootstrap x86_64
-$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
+$ ./xbps-src -A x86_64 binary-bootstrap
+$ ./xbps-src -A x86_64-musl binary-bootstrap
 ```
 
 In addition to those, we need to set up binary remotes for the ppc repos. As
@@ -36,11 +36,11 @@ repo, but you can include them locally by creating these three files:
 
 Assuming you've already adjusted the version and checksums for the distfiles
 provided by upstream, we can now start building rust for our native
-architecture, with both glibc and musl. Run this for both masterdirs
+architecture, with both glibc and musl. Run this for both buildroots
 bootstrapped above
 
 ```
-$ ./xbps-src -m <masterdir> pkg cargo
+$ ./xbps-src -A <hostarch> pkg cargo
 ```
 
 This builds `rust-bootstrap`, `cargo-bootstrap`, `rust` and `cargo` for your
@@ -52,14 +52,14 @@ Now that we have the our native architecture covered, we cross build for the
 architectures we need to generate distfiles for:
 
 ```
-$ ./xbps-src -m <masterdir> -a <arch> pkg -o bindist rust
-$ ./xbps-src -m <masterdir> -a <arch> pkg rust
-$ ./xbps-src -m <masterdir> -a <arch> pkg -o bindist cargo
+$ ./xbps-src -A <hostarch> -a <arch> pkg -o bindist rust
+$ ./xbps-src -A <hostarch> -a <arch> pkg rust
+$ ./xbps-src -A <hostarch> -a <arch> pkg -o bindist cargo
 ```
 
-Repeat these three steps for `masterdir-glibc` with `ppc`, `masterdir-musl` with
-`ppc64le-musl` and `masterdir-glibc` with `ppc64`. In the case of `ppc`, you can
-skip the `bindist` build for rust, as we are taking those from upstream.
+Repeat these three steps for `-A x86_64` with `ppc` and `ppc64`, and `-A x86_64-musl`
+with `ppc64le-musl`. In the case of `ppc`, you can skip the `bindist` build for rust,
+as we are taking those from upstream.
 
 Now that we have run those commands, the generated distfiles are available in
 `hostdir/sources/distfiles`. Generate a `sha256sum` for each of those files, and
diff --git a/srcpkgs/sydbox/template b/srcpkgs/sydbox/template
index 2ab945bef8bfb..868a8504a8427 100644
--- a/srcpkgs/sydbox/template
+++ b/srcpkgs/sydbox/template
@@ -11,7 +11,7 @@ license="MIT"
 homepage="https://sydbox.exherbolinux.org"
 distfiles="https://gitlab.exherbo.org/sydbox/sydbox-1/-/archive/v${version}/sydbox-1-v${version}.tar.gz"
 checksum=681e44816f2780f9b45a2ef601acc4174bc8336277ea6b9015aad8213b93e3c0
-# needs perlful grep which breaks masterdir
+# needs perlful grep which breaks buildroot
 make_check=no
 nocross="unable to properly check if seccomp is supported"
 
diff --git a/xbps-src b/xbps-src
index aac7452615596..f17a892d66ff0 100755
--- a/xbps-src
+++ b/xbps-src
@@ -15,15 +15,15 @@ $PROGNAME: [options] <target> [arguments]
 Targets: (only one may be specified)
 
 binary-bootstrap
-    Install bootstrap packages from host repositories into <masterdir>.
+    Install bootstrap packages from host repositories into <buildroot>.
     If the optional '-A <arch>' flag is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir> will
+    from this architecture, and its required xbps utilities. The <buildroot> will
     be initialized for chroot operations.
 
 bootstrap
-    Build and install from source the bootstrap packages into <masterdir>.
+    Build and install from source the bootstrap packages into <buildroot>.
     If the optional '-A <arch>' flag is set, it will build and install bootstrap
-    packages from this architecture, and its required xbps utilities. The <masterdir>
+    packages from this architecture, and its required xbps utilities. The <buildroot>
     will be initialized for chroot operations.
 
 bootstrap-update
@@ -34,7 +34,7 @@ consistency-check
     Runs a consistency check on all packages
 
 chroot
-    Enter to the chroot in <masterdir>.
+    Enter to the chroot in <buildroot>.
 
 clean-repocache
     Removes obsolete packages from <hostdir>/repocache.
@@ -44,7 +44,7 @@ fetch <pkgname>
 
 extract <pkgname>
     Extract package source distribution file(s) into the build directory.
-    By default set to <masterdir>/builddir.
+    By default set to <buildroot>/builddir.
 
 patch <pkgname>
     Patch the package sources and perform other operations required to
@@ -67,12 +67,12 @@ pkg <pkgname>
     Build binary package for <pkgname> and all required dependencies.
 
 clean [pkgname]
-    Removes auto dependencies, cleans up <masterdir>/builddir and <masterdir>/destdir.
-    If <pkgname> argument is specified, package files from <masterdir>/destdir and its
-    build directory in <masterdir>/buiddir are removed.
+    Removes auto dependencies, cleans up <buildroot>/builddir and <buildroot>/destdir.
+    If <pkgname> argument is specified, package files from <buildroot>/destdir and its
+    build directory in <buildroot>/buiddir are removed.
 
 list
-    Lists installed packages in <masterdir>.
+    Lists installed packages in <buildroot>.
 
 remove <pkgname>
     Remove target package from <destdir>. If <pkgname>-<version> is not matched
@@ -148,14 +148,14 @@ update-hash-cache
     Update the hash cache with existing source distfiles.
 
 zap
-    Removes a masterdir but preserving ccache, distcc and host directories.
+    Removes a buildroot but preserving ccache, distcc and host directories.
 
 Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
 -A <host>
-    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    Use this host machine. Automatically creates buildroot-<host> if it doesn't
     already exist. Some host machines may require qemu-user-static and
     binfmt-support if not natively supported by the processor. Supported hosts:
 
@@ -186,7 +186,7 @@ $(print_cross_targets)
 -g  Enable building -dbg packages with debugging symbols.
 
 -H  <hostdir>
-    Absolute path to a directory to be bind mounted at <masterdir>/host.
+    Absolute path to a directory to be bind mounted at <buildroot>/host.
     The host directory stores binary packages, sources and package dependencies
     downloaded from remote repositories.
     If unset defaults to void-packages/hostdir.
@@ -201,10 +201,10 @@ $(print_cross_targets)
 
 -L  Disable ASCII colors.
 
--m  <masterdir>
-    Absolute path to a directory to be used as masterdir.
-    The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir-<host>.
+-m  <buildroot>
+    Absolute path to a directory to be used as buildroot.
+    The buildroot is the main directory to build/store/compile packages.
+    If unset defaults to void-packages/buildroot-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -236,9 +236,9 @@ $(print_cross_targets)
 
 -s  Make vsed warnings errors.
 
--t  Create a temporary masterdir to not pollute the current one. Note that
-    the existing masterdir must be fully populated with binary-bootstrap first.
-    Once the target has finished, this temporary masterdir will be removed.
+-t  Create a temporary buildroot to not pollute the current one. Note that
+    the existing buildroot must be fully populated with binary-bootstrap first.
+    Once the target has finished, this temporary buildroot will be removed.
     This flag requires xbps-uchroot(1), and won't work on filesystems that don't
     support overlayfs.
 
@@ -288,15 +288,15 @@ check_build_requirements() {
 }
 
 chroot_check() {
-    if [ -f $XBPS_MASTERDIR/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
+    if [ -f $XBPS_BUILDROOT/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
         export CHROOT_READY=1
     fi
 }
 
 check_native_arch() {
     if [ "$CHROOT_READY" ]; then
-        if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
-            export XBPS_ARCH=$(<$XBPS_MASTERDIR/.xbps_chroot_init)
+        if [ -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
+            export XBPS_ARCH=$(<$XBPS_BUILDROOT/.xbps_chroot_init)
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
@@ -305,10 +305,10 @@ check_native_arch() {
     fi
 }
 
-masterdir_zap() {
-    rm -rf "$XBPS_MASTERDIR"
-    mkdir -p "$XBPS_MASTERDIR"
-    msg_normal "xbps-src: $XBPS_MASTERDIR masterdir cleaned up.\n"
+buildroot_zap() {
+    rm -rf "$XBPS_BUILDROOT"
+    mkdir -p "$XBPS_BUILDROOT"
+    msg_normal "xbps-src: $XBPS_BUILDROOT buildroot cleaned up.\n"
 }
 
 exit_func() {
@@ -348,7 +348,7 @@ setup_distfiles_mirror() {
                 msg_warn "xbps-src: Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n"
                 continue
             fi
-            mkdir -p "$XBPS_MASTERDIR/$path"
+            mkdir -p "$XBPS_BUILDROOT/$path"
             XBPS_CHROOT_CMD_ARGS+=" -b $path:$path"
         else
             case "$XBPS_TARGET" in
@@ -397,7 +397,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         I) XBPS_ARG_SKIP_DEPS=1; XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -I -N";;
         j) XBPS_ARG_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
         L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
-        m) XBPS_ARG_MASTERDIR="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
+        m) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
         N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
         o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
         p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;
@@ -406,7 +406,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         K) XBPS_ARG_CHECK_PKGS=full; XBPS_OPTIONS+=" -K";;
         r) XBPS_ARG_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
         s) XBPS_ARG_STRICT=yes; XBPS_OPTIONS+=" -s";;
-        t) XBPS_ARG_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
+        t) XBPS_ARG_TEMP_BUILDROOT=1; XBPS_OPTIONS+=" -t -C";;
         V) echo "xbps-src-$XBPS_SRC_VERSION $(xbps-uhelper -V)" && exit 0;;
         --) shift; break;;
     esac
@@ -439,13 +439,13 @@ readonly REQHOST_UTILS="xbps-install xbps-query xbps-rindex xbps-uhelper \
 check_reqhost_utils
 
 #
-# Set XBPS_CONFIG_FILE, XBPS_DISTDIR, XBPS_MASTERDIR
+# Set XBPS_CONFIG_FILE, XBPS_DISTDIR, XBPS_BUILDROOT
 # and XBPS_HOSTDIR.
 #
 if [ "$IN_CHROOT" ]; then
     readonly XBPS_CONFIG_FILE=/etc/xbps/xbps-src.conf
     readonly XBPS_DISTDIR=/void-packages
-    readonly XBPS_MASTERDIR=/
+    readonly XBPS_BUILDROOT=/
     readonly XBPS_HOSTDIR=/host
 else
     _distdir="$(readlink -f ${0%/*})"
@@ -483,7 +483,7 @@ fi
 [ -n "$XBPS_ARG_SKIP_REMOTEREPOS" ] && XBPS_SKIP_REMOTEREPOS=1
 [ -n "$XBPS_ARG_BUILD_FORCEMODE" ] && XBPS_BUILD_FORCEMODE=1
 [ -n "$XBPS_ARG_INFORMATIVE_RUN" ] && XBPS_INFORMATIVE_RUN=1
-[ -n "$XBPS_ARG_TEMP_MASTERDIR" ] && XBPS_TEMP_MASTERDIR=1
+[ -n "$XBPS_ARG_TEMP_BUILDROOT" ] && XBPS_TEMP_BUILDROOT=1
 [ -n "$XBPS_ARG_BINPKG_EXISTS" ] && XBPS_BINPKG_EXISTS=1
 [ -n "$XBPS_ARG_USE_GIT_REVS" ] && XBPS_USE_GIT_REVS=1
 [ -n "$XBPS_ARG_DEBUG_PKGS" ] && XBPS_DEBUG_PKGS=1
@@ -506,18 +506,18 @@ else
 fi
 
 export XBPS_BUILD_ONLY_ONE_PKG XBPS_SKIP_REMOTEREPOS XBPS_BUILD_FORCEMODE \
-       XBPS_INFORMATIVE_RUN XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
+       XBPS_INFORMATIVE_RUN XBPS_TEMP_BUILDROOT XBPS_BINPKG_EXISTS \
        XBPS_USE_GIT_REVS XBPS_CHECK_PKGS XBPS_DEBUG_PKGS XBPS_SKIP_DEPS \
        XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_STRICT XBPS_CROSS_BUILD \
        XBPS_MAKEJOBS XBPS_PRINT_VARIABLES XBPS_IGNORE_BROKENNESS
 
-# The masterdir/hostdir variables are forced and readonly in chroot
+# The buildroot/hostdir variables are forced and readonly in chroot
 if [ -z "$IN_CHROOT" ]; then
-    [ -n "$XBPS_ARG_MASTERDIR" ] && XBPS_MASTERDIR="$XBPS_ARG_MASTERDIR"
+    [ -n "$XBPS_ARG_BUILDROOT" ] && XBPS_BUILDROOT="$XBPS_ARG_BUILDROOT"
     [ -n "$XBPS_ARG_HOSTDIR" ] && XBPS_HOSTDIR="$XBPS_ARG_HOSTDIR"
 
-    # Sanitize masterdir/hostdir once set for real (resolve links)
-    export XBPS_MASTERDIR="$(readlink -f $XBPS_MASTERDIR 2>/dev/null)"
+    # Sanitize buildroot/hostdir once set for real (resolve links)
+    export XBPS_BUILDROOT="$(readlink -f $XBPS_BUILDROOT 2>/dev/null)"
     export XBPS_HOSTDIR="$(readlink -f $XBPS_HOSTDIR 2>/dev/null)"
 fi
 
@@ -528,21 +528,21 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# if XBPS_BUILDROOT unset, defaults to $XBPS_DISTDIR/buildroot-<host machine>
 # unless in a container for simplicity of container/CI usage
 if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
-    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+    : "${XBPS_BUILDROOT:=$XBPS_DISTDIR/buildroot}"
 else
-    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+    : "${XBPS_BUILDROOT:=$XBPS_DISTDIR/buildroot-$XBPS_MACHINE}"
 fi
-[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
+[ ! -d "$XBPS_BUILDROOT" ] && mkdir -p "$XBPS_BUILDROOT"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
 [ ! -d $XBPS_HOSTDIR ] && mkdir -p $XBPS_HOSTDIR
 
-if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
-    echo "ERROR: can't write to masterdir $XBPS_MASTERDIR." 1>&2
+if [ -d "$XBPS_BUILDROOT" -a ! -w "$XBPS_BUILDROOT" ]; then
+    echo "ERROR: can't write to buildroot $XBPS_BUILDROOT." 1>&2
     exit 1
 fi
 
@@ -560,8 +560,8 @@ if [ -n "$XBPS_HOSTDIR" ]; then
     export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
     readonly XBPS_SRCDISTDIR=$XBPS_HOSTDIR/sources
 else
-    export XBPS_REPOSITORY=$XBPS_MASTERDIR/host/binpkgs
-    readonly XBPS_SRCDISTDIR=$XBPS_MASTERDIR/host/sources
+    export XBPS_REPOSITORY=$XBPS_BUILDROOT/host/binpkgs
+    readonly XBPS_SRCDISTDIR=$XBPS_BUILDROOT/host/sources
 fi
 
 # Set XBPS_REPOSITORY to our current branch.
@@ -596,7 +596,7 @@ fi
 chroot_check
 check_native_arch
 
-# test if to use linux32 for 32-bit masterdirs in 64-bit environments
+# test if to use linux32 for 32-bit buildroots in 64-bit environments
 # x86_64, ppc64 (BE) and aarch64 are capable of this, others are not
 linux32_check() {
     local hostarch="$1"
@@ -616,11 +616,11 @@ linux32_check() {
 }
 
 # Reconfigure pkgs for 32bit on 64-bit systems and reexec itself.
-if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
-    export XBPS_ARCH=${XBPS_ARCH:-$(<$XBPS_MASTERDIR/.xbps_chroot_init)}
+if [ -z "$XBPS_REINIT" -a -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
+    export XBPS_ARCH=${XBPS_ARCH:-$(<$XBPS_BUILDROOT/.xbps_chroot_init)}
     if linux32_check "$XBPS_MACHINE" "$XBPS_ARCH"; then
         # reconfigure pkgs via linux32
-        linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
+        linux32 xbps-reconfigure -r ${XBPS_BUILDROOT} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
         exec linux32 $0 ${XBPS_OPTIONS} "$@"
@@ -645,14 +645,14 @@ if [ "$IN_CHROOT" ]; then
     readonly XBPS_DESTDIR=/destdir
     readonly XBPS_BUILDDIR=/builddir
 else
-    readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
-    readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d"
-    readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d"
-    readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
-    readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
-    readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR"
-    readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
-    readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
+    readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_BUILDROOT"
+    readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_BUILDROOT -C etc/xbps.d"
+    readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_BUILDROOT -C etc/xbps.d"
+    readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_BUILDROOT"
+    readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_BUILDROOT"
+    readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_BUILDROOT"
+    readonly XBPS_DESTDIR=$XBPS_BUILDROOT/destdir
+    readonly XBPS_BUILDDIR=$XBPS_BUILDROOT/builddir
 fi
 readonly XBPS_RINDEX_CMD="xbps-rindex"
 readonly XBPS_FETCH_CMD="xbps-fetch"
@@ -669,8 +669,8 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
     XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
-    XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
-    XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
+    XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_BUILDROOT XBPS_SRC_VERSION \
+    XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_BUILDROOT XBPS_BINPKG_EXISTS \
     XBPS_LIBEXECDIR XBPS_DISTDIR XBPS_DISTFILES_MIRROR XBPS_ALLOW_RESTRICTED \
     XBPS_USE_GIT_COMMIT_DATE XBPS_PKG_COMPTYPE XBPS_REPO_COMPTYPE \
     XBPS_BUILDHELPERDIR XBPS_USE_BUILD_MTIME XBPS_BUILD_ENVIRONMENT \
@@ -684,9 +684,9 @@ for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
     unset val
 done
 
-# A temporary masterdir requires xbps-uchroot(1) and -O to use overlayfs
+# A temporary buildroot requires xbps-uchroot(1) and -O to use overlayfs
 # on tmpfs (available with xbps-0.45).
-if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
+if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_BUILDROOT" ]; then
     export XBPS_CHROOT_CMD="uchroot"
     export XBPS_CHROOT_CMD_ARGS+=" -O"
 fi
@@ -695,7 +695,7 @@ fi
 #
 if [ -z "$IN_CHROOT" ]; then
     # In non chroot case always prefer host tools.
-    export PATH="$PATH:$XBPS_MASTERDIR/usr/bin"
+    export PATH="$PATH:$XBPS_BUILDROOT/usr/bin"
 fi
 
 #
@@ -774,7 +774,7 @@ case "$XBPS_TARGET" in
             $XBPS_LIBEXECDIR/build.sh \
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
-        [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
+        [ -d $XBPS_BUILDROOT ] && rm -rf $XBPS_BUILDROOT
         install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
@@ -796,14 +796,14 @@ case "$XBPS_TARGET" in
             else
                 remove_pkg_autodeps
             fi
-            msg_normal "xbps-src: cleaning up masterdir...\n"
+            msg_normal "xbps-src: cleaning up buildroot...\n"
             # Needed to remove Go Modules
             [ -d "$XBPS_BUILDDIR" ] && chmod -R +wX $XBPS_BUILDDIR
             rm -rf \
                 $XBPS_BUILDDIR \
                 $XBPS_DESTDIR
-            rm -rf $XBPS_MASTERDIR/tmp
-            mkdir -p $XBPS_MASTERDIR/tmp
+            rm -rf $XBPS_BUILDROOT/tmp
+            mkdir -p $XBPS_BUILDROOT/tmp
         else
             read_pkg
             if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
@@ -1021,7 +1021,7 @@ case "$XBPS_TARGET" in
         update_hash_cache
         ;;
     zap)
-        masterdir_zap
+        buildroot_zap
         ;;
     *)
         msg_red "xbps-src: invalid target $XBPS_TARGET.\n"

From 51c733546160169de27a58a2fd45cf6254c2c8be Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Jan 2024 00:39:59 -0500
Subject: [PATCH 5/5] xbps-src: rename -m to -B, but leave it as an alias

---
 xbps-src | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/xbps-src b/xbps-src
index f17a892d66ff0..fb51e71635c29 100755
--- a/xbps-src
+++ b/xbps-src
@@ -166,6 +166,11 @@ $(print_cross_targets)
 
 $(print_cross_targets)
 
+-B  <buildroot>
+    Absolute path to a directory to be used as buildroot.
+    The buildroot is the main directory to build/store/compile packages.
+    If unset defaults to void-packages/buildroot-<host>.
+
 -b  Build packages even if marked as broken, nocross, or excluded with archs.
 
 -c  <configuration>
@@ -201,10 +206,7 @@ $(print_cross_targets)
 
 -L  Disable ASCII colors.
 
--m  <buildroot>
-    Absolute path to a directory to be used as buildroot.
-    The buildroot is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/buildroot-<host>.
+-m  Legacy alias for -B
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -371,7 +373,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:B:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -384,6 +386,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
         A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
+        B) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -B $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
         C) XBPS_ARG_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;
@@ -397,7 +400,8 @@ while getopts "$XBPS_OPTSTRING" opt; do
         I) XBPS_ARG_SKIP_DEPS=1; XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -I -N";;
         j) XBPS_ARG_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
         L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
-        m) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
+        # legacy alias for -B
+        m) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -B $OPTARG";;
         N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
         o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
         p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (15 preceding siblings ...)
  2024-01-17  5:44 ` classabbyamp
@ 2024-01-17  6:50 ` classabbyamp
  2024-01-22 18:00 ` classabbyamp
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-17  6:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- masterdir name has changed to buildroot
- default buildroot naming now includes the host `XBPS_ARCH`, e.g. `buildroot-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new buildroot per host arch automatically
- using an arbitrary buildroot is still supported via `-B <buildroot>` (`-m` still exists as an alias), and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the buildroot's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault buildroot:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... buildroot-x86_64 ...
```
*nondefault buildroot:*
```
$ ./xbps-src -B buildroot-idk binary-bootstrap
$ ls
... buildroot-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... buildroot-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 78385 bytes --]

From 848063d7a531bcf11e7ee66cbddee77f6fb7c20a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Jan 2024 01:08:32 -0500
Subject: [PATCH 1/5] *: rename masterdir to buildroot

---
 .github/workflows/build.yaml                  |   4 +-
 .github/workflows/cycles.yml                  |   2 +-
 Manual.md                                     |  12 +-
 README.md                                     |  44 +++---
 common/build-style/cmake.sh                   |   2 +-
 common/chroot-style/README                    |   2 +-
 common/chroot-style/bwrap.sh                  |   8 +-
 common/chroot-style/ethereal.sh               |  32 ++---
 common/chroot-style/uchroot.sh                |   8 +-
 common/chroot-style/uunshare.sh               |   8 +-
 common/environment/configure/bootstrap.sh     |   4 +-
 common/environment/configure/pkg-config.sh    |   2 +-
 common/travis/prepare.sh                      |   4 +-
 common/xbps-src/libexec/xbps-src-dopkg.sh     |   4 +-
 common/xbps-src/shutils/chroot.sh             |  96 ++++++-------
 common/xbps-src/shutils/common.sh             |   4 +-
 common/xbps-src/shutils/cross.sh              |   4 +-
 common/xbps-src/shutils/pkgtarget.sh          |   2 +-
 srcpkgs/acl/template                          |   4 +-
 srcpkgs/chroot-git/template                   |   2 +-
 srcpkgs/chroot-util-linux/template            |   4 +-
 srcpkgs/gcc/template                          |   4 +-
 srcpkgs/glibc/template                        |   2 +-
 .../patches/py-smbus_fix-destdir.patch        |   2 +-
 srcpkgs/libgccjit/template                    |   2 +-
 srcpkgs/libmpc/template                       |   4 +-
 srcpkgs/man-db/template                       |   2 +-
 srcpkgs/pciutils/template                     |   4 +-
 srcpkgs/python3-adblock/template              |   2 +-
 .../files/generating-distfiles.md             |  22 +--
 srcpkgs/sydbox/template                       |   2 +-
 xbps-src                                      | 130 +++++++++---------
 32 files changed, 214 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 03b5c270dbb44..0ce7685fd6211 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -40,7 +40,7 @@ jobs:
           xbps-install -y grep curl git
       - name: Clone and checkout
         uses: classabbyamp/treeless-checkout-action@v1
-      - name: Create hostrepo and prepare masterdir
+      - name: Create hostrepo and prepare buildroot
         run: |
          ln -s "$(pwd)" /hostrepo &&
          common/travis/set_mirror.sh &&
@@ -95,7 +95,7 @@ jobs:
 
       - name: Clone and checkout
         uses: classabbyamp/treeless-checkout-action@v1
-      - name: Create hostrepo and prepare masterdir
+      - name: Create hostrepo and prepare buildroot
         run: |
          ln -s "$(pwd)" /hostrepo &&
          common/travis/set_mirror.sh &&
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 292282daa9842..7c7fab4848ed2 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -29,7 +29,7 @@ jobs:
       - name: Clone and checkout
         uses: classabbyamp/treeless-checkout-action@v1
 
-      - name: Create hostrepo and prepare masterdir
+      - name: Create hostrepo and prepare buildroot
         run: |
           ln -s "$(pwd)" /hostrepo &&
           common/travis/set_mirror.sh &&
diff --git a/Manual.md b/Manual.md
index e6a98551eee30..6fcbb4d280865 100644
--- a/Manual.md
+++ b/Manual.md
@@ -149,7 +149,7 @@ If the default `do_check` function provided by the build style doesn't do anythi
 or can't run in all environments, `make_check` should be set to fitting value or
 `do_check` should be customized to limit testsuite unless `XBPS_CHECK_PKGS` is `full`.
 
-- `install` This phase installs the `package files` into the package destdir `<masterdir>/destdir/<pkgname>-<version>`,
+- `install` This phase installs the `package files` into the package destdir `<buildroot>/destdir/<pkgname>-<version>`,
 via `make install` or any other compatible method.
 
 - `pkg` This phase builds the `binary packages` with files stored in the
@@ -347,7 +347,7 @@ The following variables are defined by `xbps-src` and can be used on any templat
 - `sourcepkg`  Set to the to main package name, can be used to match the main package
 rather than additional binary package names.
 
-- `CHROOT_READY`  Set if the target chroot (masterdir) is ready for chroot builds.
+- `CHROOT_READY`  Set if the target chroot (buildroot) is ready for chroot builds.
 
 - `CROSS_BUILD` Set if `xbps-src` is cross compiling a package.
 
@@ -355,17 +355,17 @@ rather than additional binary package names.
 Longer testsuites should only be run in `do_check()` if it is set to `full`.
 
 - `DESTDIR` Full path to the fake destdir used by the source pkg, set to
-`<masterdir>/destdir/${sourcepkg}-${version}`.
+`<buildroot>/destdir/${sourcepkg}-${version}`.
 
 - `FILESDIR` Full path to the `files` package directory, i.e `srcpkgs/foo/files`.
 The `files` directory can be used to store additional files to be installed
 as part of the source package.
 
 - `PKGDESTDIR` Full path to the fake destdir used by the `pkg_install()` function in
-`subpackages`, set to `<masterdir>/destdir/${pkgname}-${version}`.
+`subpackages`, set to `<buildroot>/destdir/${pkgname}-${version}`.
 
 - `XBPS_BUILDDIR` Directory to store the `source code` of the source package being processed,
-set to `<masterdir>/builddir`. The package `wrksrc` is always stored
+set to `<buildroot>/builddir`. The package `wrksrc` is always stored
 in this directory such as `${XBPS_BUILDDIR}/${wrksrc}`.
 
 - `XBPS_MACHINE` The machine architecture as returned by `xbps-uhelper arch`.
@@ -1166,7 +1166,7 @@ defined by a `build_style` script.
 
 Current working directory for functions is set as follows:
 
-- For pre_fetch, pre_extract, do_clean: `<masterdir>`.
+- For pre_fetch, pre_extract, do_clean: `<buildroot>`.
 
 - For do_fetch, post_fetch: `XBPS_BUILDDIR`.
 
diff --git a/README.md b/README.md
index 8710f20ae1916..3245d1adf6901 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,8 @@ See [Contributing](./CONTRIBUTING.md) for a general overview of how to contribut
 - [Distfiles mirrors](#distfiles-mirrors)
 - [Cross compiling packages for a target architecture](#cross-compiling)
 - [Using xbps-src in a foreign Linux distribution](#foreign)
-- [Remaking the masterdir](#remaking-masterdir)
-- [Keeping your masterdir uptodate](#updating-masterdir)
+- [Remaking the buildroot](#remaking-buildroot)
+- [Keeping your buildroot uptodate](#updating-buildroot)
 - [Building 32bit packages on x86_64](#building-32bit)
 - [Building packages natively for the musl C library](#building-for-musl)
 - [Building void base-system from scratch](#building-base-system)
@@ -47,7 +47,7 @@ For bootstrapping additionally:
 - objcopy(1), objdump(1), strip(1): binutils
 
 `xbps-src` requires [a utility to chroot](#chroot-methods) and bind mount existing directories
-into a `masterdir` that is used as its main `chroot` directory. `xbps-src` supports
+into a `buildroot` that is used as its main `chroot` directory. `xbps-src` supports
 multiple utilities to accomplish this task.
 
 > NOTE: `xbps-src` does not allow building as root anymore. Use one of the chroot
@@ -154,7 +154,7 @@ Destroys host system it runs on. Only useful for one-shot containers, i.e docker
 ### Install the bootstrap packages
 
 There is a set of packages that makes up the initial build container, called the `bootstrap`.
-These packages are installed into the `masterdir` in order to create the container.
+These packages are installed into the `buildroot` in order to create the container.
 
 The primary and recommended way to set up this container is using the `binary-bootstrap`
 command. This will use pre-existing binary packages, either from remote `xbps` repositories
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- buildroot
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `buildroot`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -413,7 +413,7 @@ checksum verification, the original download location is used.
 If you use `uchroot` for your XBPS_CHROOT_CMD, you may also specify a local path
 using the `file://` prefix or simply an absolute path on your build host (e.g. /mnt/distfiles).
 Mirror locations specified this way are bind mounted inside the chroot environment
-under $XBPS_MASTERDIR and searched for distfiles just the same as remote locations.
+under $XBPS_BUILDROOT and searched for distfiles just the same as remote locations.
 
 <a name="cross-compiling"></a>
 ### Cross compiling packages for a target architecture
@@ -450,18 +450,18 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default buildroot is created in the current working directory, i.e `void-packages/buildroot`.
 
-<a name="remaking-masterdir"></a>
-### Remaking the masterdir
+<a name="remaking-buildroot"></a>
+### Remaking the buildroot
 
-If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a masterdir with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact):
+If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a buildroot with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact):
 
     $ ./xbps-src zap
     $ ./xbps-src binary-bootstrap
 
-<a name="updating-masterdir"></a>
-### Keeping your masterdir uptodate
+<a name="updating-buildroot"></a>
+### Keeping your buildroot uptodate
 
 Sometimes the bootstrap packages must be updated to the latest available version in repositories, this is accomplished with the `bootstrap-update` target:
 
@@ -472,25 +472,25 @@ Sometimes the bootstrap packages must be updated to the latest available version
 
 Two ways are available to build 32bit packages on x86\_64:
 
- - native mode with a 32bit masterdir (recommended, used in official repository)
+ - native mode with a 32bit buildroot (recommended, used in official repository)
  - cross compilation mode to i686 [target](#cross-compiling)
 
-The canonical mode (native) needs a new x86 `masterdir`:
+The canonical mode (native) needs a new x86 `buildroot`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -m buildroot-x86 binary-bootstrap i686
+    $ ./xbps-src -m buildroot-x86 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
-To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
+Canonical way of building packages for same architecture but different C library is through dedicated buildroot.
+To build for x86_64-musl on glibc x86_64 system, prepare a new buildroot with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -m buildroot-x86_64-musl binary-bootstrap x86_64-musl
 
-Your new masterdir is now ready to build packages natively for the musl C library:
+Your new buildroot is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -m buildroot-x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch
diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh
index 124ed354eff67..3349ddbc23420 100644
--- a/common/build-style/cmake.sh
+++ b/common/build-style/cmake.sh
@@ -14,7 +14,7 @@ SET(CMAKE_SYSTEM_VERSION 1)
 SET(CMAKE_C_COMPILER   ${CC})
 SET(CMAKE_CXX_COMPILER ${CXX})
 
-SET(CMAKE_FIND_ROOT_PATH  "${XBPS_MASTERDIR}/usr;${XBPS_MASTERDIR}")
+SET(CMAKE_FIND_ROOT_PATH  "${XBPS_BUILDROOT}/usr;${XBPS_BUILDROOT}")
 
 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/common/chroot-style/README b/common/chroot-style/README
index a5d89d016cf15..9891b863da57a 100644
--- a/common/chroot-style/README
+++ b/common/chroot-style/README
@@ -4,7 +4,7 @@ CHROOT STYLES
 This directory contains scripts to perform the chroot operation with xbps-src.
 The scripts should accept at least 5 arguments:
 
-	- $1 (MASTERDIR) masterdir to chroot
+	- $1 (BUILDROOT) buildroot to chroot
 	- $2 (DISTDIR) path to the void-packages directory
 	- $3 (HOSTDIR) path to hostdir
 	- $4 (EXTRA_ARGS) additional arguments to be passed
diff --git a/common/chroot-style/bwrap.sh b/common/chroot-style/bwrap.sh
index de4323506a3e0..b7ba4767c068a 100755
--- a/common/chroot-style/bwrap.sh
+++ b/common/chroot-style/bwrap.sh
@@ -3,7 +3,7 @@
 # This chroot script uses bubblewrap (see https://github.com/containers/bubblewrap)
 #
 set -e
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
@@ -13,11 +13,11 @@ if ! command -v bwrap >/dev/null 2>&1; then
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
-exec bwrap --bind "$MASTERDIR" / --ro-bind "$DISTDIR" /void-packages \
+exec bwrap --bind "$BUILDROOT" / --ro-bind "$DISTDIR" /void-packages \
 	 --dev /dev --tmpfs /tmp --proc /proc \
 	${HOSTDIR:+--bind "$HOSTDIR" /host} $EXTRA_ARGS "$@"
diff --git a/common/chroot-style/ethereal.sh b/common/chroot-style/ethereal.sh
index a226465cc82ff..90b70e371cdf9 100755
--- a/common/chroot-style/ethereal.sh
+++ b/common/chroot-style/ethereal.sh
@@ -1,13 +1,13 @@
 #!/bin/sh
 #
 # This chroot script uses symlinks to emulate being in a chroot using
-# the host system as the masterdir
+# the host system as the buildroot
 #
 # It will damage your host system, only use it in disposable
 # containers.
 #
 # 2 extra steps required when using this chroot-style:
-# 1. Symlink / to masterdir inside the void-packages repo
+# 1. Symlink / to buildroot inside the void-packages repo
 # 2. write the arch of the host system, as dictated by xbps-uhelper arch
 # into /.xbps_chroot_init
 #
@@ -20,24 +20,24 @@
 # $ xbps-install -y -r /tmp/image \
 #				 -R http://mirrors.servercentral.com/voidlinux/current \
 #				 -S base-chroot
-# $ tar -pC /tmp/image -c . | sudo docker import - voidlinux/masterdir
+# $ tar -pC /tmp/image -c . | sudo docker import - voidlinux/buildroot
 # $ rm -rf /tmp/image
 # # docker run --rm -it \
 #			   -e XBPS_CHROOT_CMD=ethereal \
 #			   -e XBPS_ALLOW_CHROOT_BREAKOUT=yes \
-#			   -v $(pwd):/hostrepo voidlinux/masterdir \
-#			   /bin/bash -c 'ln -s / /hostrepo/masterdir && /hostrepo/xbps-src pkg <pkgname>'
+#			   -v $(pwd):/hostrepo voidlinux/buildroot \
+#			   /bin/bash -c 'ln -s / /hostrepo/buildroot && /hostrepo/xbps-src pkg <pkgname>'
 #
 
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
 readonly CMD="$5"
 shift 5
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
@@ -72,16 +72,16 @@ if [ "${XBPS_ALLOW_CHROOT_BREAKOUT}" != "yes" ]; then
 	exit 1
 fi
 
-if [ ! -L "$MASTERDIR" -o "$(readlink "$MASTERDIR")" != "/" ]; then
-	msg_red "$MASTERDIR isn't symlinked to /!\n"
+if [ ! -L "$BUILDROOT" -o "$(readlink "$BUILDROOT")" != "/" ]; then
+	msg_red "$BUILDROOT isn't symlinked to /!\n"
 	exit 1
 fi
 
-fake_mount "$DISTDIR" "$MASTERDIR"/void-packages
+fake_mount "$DISTDIR" "$BUILDROOT"/void-packages
 
 # Do the same for hostdir
 if [ -n "$HOSTDIR" ]; then
-	fake_mount "$HOSTDIR" "$MASTERDIR"/host
+	fake_mount "$HOSTDIR" "$BUILDROOT"/host
 fi
 
 # xbps-src may send some other binds, parse them here
@@ -118,8 +118,8 @@ cd "${OLDPWD}"
 # Remove the symlink and restore an empty dir to simulate
 # an umount operation.
 if [ -n "$HOSTDIR" ]; then
-	rm -f "$MASTERDIR"/host
-	mkdir -p "$MASTERDIR"/host
+	rm -f "$BUILDROOT"/host
+	mkdir -p "$BUILDROOT"/host
 fi
 
 # Same as the operation above, do it all for all mountpoints
@@ -129,7 +129,7 @@ for m in $mounts; do
 	mkdir -p "$m"
 done
 
-rm -f "$MASTERDIR"/void-packages
-mkdir -p "$MASTERDIR"/void-packages
+rm -f "$BUILDROOT"/void-packages
+mkdir -p "$BUILDROOT"/void-packages
 
 exit $ret
diff --git a/common/chroot-style/uchroot.sh b/common/chroot-style/uchroot.sh
index 5fe47eb9f8bcb..501c422f5b645 100755
--- a/common/chroot-style/uchroot.sh
+++ b/common/chroot-style/uchroot.sh
@@ -2,7 +2,7 @@
 #
 # This chroot script uses xbps-uchroot(1).
 #
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
@@ -13,9 +13,9 @@ if ! command -v xbps-uchroot >/dev/null 2>&1; then
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
-exec xbps-uchroot $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@
+exec xbps-uchroot $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $BUILDROOT $CMD $@
diff --git a/common/chroot-style/uunshare.sh b/common/chroot-style/uunshare.sh
index 4d5146445fd2d..66a9a4eac66db 100755
--- a/common/chroot-style/uunshare.sh
+++ b/common/chroot-style/uunshare.sh
@@ -2,7 +2,7 @@
 #
 # This chroot script uses xbps-uunshare(1) with user_namespaces(7).
 #
-readonly MASTERDIR="$1"
+readonly BUILDROOT="$1"
 readonly DISTDIR="$2"
 readonly HOSTDIR="$3"
 readonly EXTRA_ARGS="$4"
@@ -13,9 +13,9 @@ if ! command -v xbps-uunshare >/dev/null 2>&1; then
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$BUILDROOT" -o -z "$DISTDIR" ]; then
+	echo "$0 BUILDROOT/DISTDIR not set"
 	exit 1
 fi
 
-exec xbps-uunshare $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@
+exec xbps-uunshare $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $BUILDROOT $CMD $@
diff --git a/common/environment/configure/bootstrap.sh b/common/environment/configure/bootstrap.sh
index f5ba5f442c7c0..558b64ecc2eb8 100644
--- a/common/environment/configure/bootstrap.sh
+++ b/common/environment/configure/bootstrap.sh
@@ -1,4 +1,4 @@
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS+=" -isystem ${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib -Wl,-rpath-link=${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS+=" -isystem ${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS+=" -L${XBPS_BUILDROOT}/usr/lib -Wl,-rpath-link=${XBPS_BUILDROOT}/usr/lib"
 fi
diff --git a/common/environment/configure/pkg-config.sh b/common/environment/configure/pkg-config.sh
index bf81c5f9afa68..d43baeee1f1da 100644
--- a/common/environment/configure/pkg-config.sh
+++ b/common/environment/configure/pkg-config.sh
@@ -1,5 +1,5 @@
 # This snippet setups pkg-config vars.
 
 if [ -z "$CHROOT_READY" ]; then
-	export PKG_CONFIG_PATH="${XBPS_MASTERDIR}/usr/lib/pkgconfig:${XBPS_MASTERDIR}/usr/share/pkgconfig"
+	export PKG_CONFIG_PATH="${XBPS_BUILDROOT}/usr/lib/pkgconfig:${XBPS_BUILDROOT}/usr/share/pkgconfig"
 fi
diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh
index 46072e9f81ea9..5086c8f0b2f3b 100755
--- a/common/travis/prepare.sh
+++ b/common/travis/prepare.sh
@@ -10,5 +10,5 @@ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
 echo XBPS_CHROOT_CMD=ethereal >> etc/conf
 echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
 
-/bin/echo -e '\x1b[32mLinking / to /masterdir...\x1b[0m'
-ln -s / masterdir
+/bin/echo -e '\x1b[32mLinking / to /buildroot...\x1b[0m'
+ln -s / buildroot
diff --git a/common/xbps-src/libexec/xbps-src-dopkg.sh b/common/xbps-src/libexec/xbps-src-dopkg.sh
index 5fec7b9d8d56c..ab1a322ec612f 100755
--- a/common/xbps-src/libexec/xbps-src-dopkg.sh
+++ b/common/xbps-src/libexec/xbps-src-dopkg.sh
@@ -36,8 +36,8 @@ if [ "$sourcepkg" != "$PKGNAME" ]; then
     pkgname=$PKGNAME
 fi
 
-if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
-    export XBPS_ARCH=$(<$XBPS_MASTERDIR/.xbps_chroot_init)
+if [ -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
+    export XBPS_ARCH=$(<$XBPS_BUILDROOT/.xbps_chroot_init)
 fi
 
 # Run do-pkg hooks.
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index fc17dae4fdbe9..9db8910238f29 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -27,8 +27,8 @@ install_base_chroot() {
         msg_error "xbps-src: failed to install base-chroot!\n"
     fi
     # Reconfigure base-files to create dirs/symlinks.
-    if xbps-query -r $XBPS_MASTERDIR base-files &>/dev/null; then
-        XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_MASTERDIR -f base-files &>/dev/null
+    if xbps-query -r $XBPS_BUILDROOT base-files &>/dev/null; then
+        XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_BUILDROOT -f base-files &>/dev/null
     fi
 
     msg_normal "xbps-src: installed base-chroot successfully!\n"
@@ -38,14 +38,14 @@ install_base_chroot() {
 }
 
 reconfigure_base_chroot() {
-    local statefile="$XBPS_MASTERDIR/.xbps_chroot_configured"
+    local statefile="$XBPS_BUILDROOT/.xbps_chroot_configured"
     local pkgs="glibc-locales ca-certificates"
     [ -z "$IN_CHROOT" -o -e $statefile ] && return 0
     # Reconfigure ca-certificates.
     msg_normal "xbps-src: reconfiguring base-chroot...\n"
     for f in ${pkgs}; do
-        if xbps-query -r $XBPS_MASTERDIR $f &>/dev/null; then
-            xbps-reconfigure -r $XBPS_MASTERDIR -f $f
+        if xbps-query -r $XBPS_BUILDROOT $f &>/dev/null; then
+            xbps-reconfigure -r $XBPS_BUILDROOT -f $f
         fi
     done
     touch -f $statefile
@@ -54,27 +54,27 @@ reconfigure_base_chroot() {
 update_base_chroot() {
     local keep_all_force=$1
     [ -z "$CHROOT_READY" ] && return
-    msg_normal "xbps-src: updating software in $XBPS_MASTERDIR masterdir...\n"
+    msg_normal "xbps-src: updating software in $XBPS_BUILDROOT buildroot...\n"
     # no need to sync repodata, chroot_sync_repodata() does it for us.
     if $(${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -nu|grep -q xbps); then
         ${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu xbps || msg_error "xbps-src: failed to update xbps!\n"
     fi
     ${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu || msg_error "xbps-src: failed to update base-chroot!\n"
-    msg_normal "xbps-src: cleaning up $XBPS_MASTERDIR masterdir...\n"
+    msg_normal "xbps-src: cleaning up $XBPS_BUILDROOT buildroot...\n"
     [ -z "$XBPS_KEEP_ALL" -a -z "$XBPS_SKIP_DEPS" ] && remove_pkg_autodeps
-    [ -z "$XBPS_KEEP_ALL" -a -z "$keep_all_force" ] && rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
+    [ -z "$XBPS_KEEP_ALL" -a -z "$keep_all_force" ] && rm -rf $XBPS_BUILDROOT/builddir $XBPS_BUILDROOT/destdir
 }
 
 # FIXME: $XBPS_FFLAGS is not set when chroot_init() is run
 # It is set in common/build-profiles/bootstrap.sh but lost somewhere?
 chroot_init() {
-    mkdir -p $XBPS_MASTERDIR/etc/xbps
+    mkdir -p $XBPS_BUILDROOT/etc/xbps
 
     : ${XBPS_CONFIG_FILE:=/dev/null}
-    cat > $XBPS_MASTERDIR/etc/xbps/xbps-src.conf <<_EOF
+    cat > $XBPS_BUILDROOT/etc/xbps/xbps-src.conf <<_EOF
 # Generated configuration file by xbps-src, DO NOT EDIT!
 $(grep -E '^XBPS_.*' "$XBPS_CONFIG_FILE")
-XBPS_MASTERDIR=/
+XBPS_BUILDROOT=/
 XBPS_CFLAGS="$XBPS_CFLAGS"
 XBPS_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_FFLAGS="$XBPS_FFLAGS"
@@ -85,7 +85,7 @@ XBPS_HOSTDIR=/host
 _EOF
 
     # Create custom script to start the chroot bash shell.
-    cat > $XBPS_MASTERDIR/bin/xbps-shell <<_EOF
+    cat > $XBPS_BUILDROOT/bin/xbps-shell <<_EOF
 #!/bin/sh
 
 XBPS_SRC_VERSION="$XBPS_SRC_VERSION"
@@ -97,52 +97,52 @@ PATH=/void-packages:/usr/bin
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
     CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    PS1="[\u@$XBPS_BUILDROOT \W]$ " /bin/bash +h "\$@"
 _EOF
 
-    chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
-    cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc
+    chmod 755 $XBPS_BUILDROOT/bin/xbps-shell
+    cp -f /etc/resolv.conf $XBPS_BUILDROOT/etc
     return 0
 }
 
 chroot_prepare() {
     local f=
 
-    if [ -f $XBPS_MASTERDIR/.xbps_chroot_init ]; then
+    if [ -f $XBPS_BUILDROOT/.xbps_chroot_init ]; then
         return 0
-    elif [ ! -f $XBPS_MASTERDIR/bin/bash ]; then
-        msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n"
+    elif [ ! -f $XBPS_BUILDROOT/bin/bash ]; then
+        msg_error "Bootstrap not installed in $XBPS_BUILDROOT, can't continue.\n"
     fi
 
     # Some software expects /etc/localtime to be a symbolic link it can read to
     # determine the name of the time zone, so set up the expected link
     # structure.
-    ln -sf ../usr/share/zoneinfo/UTC $XBPS_MASTERDIR/etc/localtime
+    ln -sf ../usr/share/zoneinfo/UTC $XBPS_BUILDROOT/etc/localtime
 
     for f in dev sys tmp proc host boot; do
-        [ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
+        [ ! -d $XBPS_BUILDROOT/$f ] && mkdir -p $XBPS_BUILDROOT/$f
     done
 
     # Copy /etc/passwd and /etc/group from base-files.
-    cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_MASTERDIR/etc
+    cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_BUILDROOT/etc
     echo "$(whoami):x:$(id -u):$(id -g):$(whoami) user:/tmp:/bin/xbps-shell" \
-        >> $XBPS_MASTERDIR/etc/passwd
-    cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_MASTERDIR/etc
-    echo "$(whoami):x:$(id -g):" >> $XBPS_MASTERDIR/etc/group
+        >> $XBPS_BUILDROOT/etc/passwd
+    cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_BUILDROOT/etc
+    echo "$(whoami):x:$(id -g):" >> $XBPS_BUILDROOT/etc/group
 
     # Copy /etc/hosts from base-files.
-    cp -f $XBPS_SRCPKGDIR/base-files/files/hosts $XBPS_MASTERDIR/etc
+    cp -f $XBPS_SRCPKGDIR/base-files/files/hosts $XBPS_BUILDROOT/etc
 
     # Prepare default locale: en_US.UTF-8.
-    if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then
+    if [ -s ${XBPS_BUILDROOT}/etc/default/libc-locales ]; then
         printf '%s\n' \
             'C.UTF-8 UTF-8' \
             'en_US.UTF-8 UTF-8' \
-            >> ${XBPS_MASTERDIR}/etc/default/libc-locales
+            >> ${XBPS_BUILDROOT}/etc/default/libc-locales
     fi
 
-    touch -f $XBPS_MASTERDIR/.xbps_chroot_init
-    [ -n "$1" ] && echo $1 >> $XBPS_MASTERDIR/.xbps_chroot_init
+    touch -f $XBPS_BUILDROOT/.xbps_chroot_init
+    [ -n "$1" ] && echo $1 >> $XBPS_BUILDROOT/.xbps_chroot_init
 
     return 0
 }
@@ -155,8 +155,8 @@ chroot_handler() {
     if [ -n "$IN_CHROOT" -o -z "$CHROOT_READY" ]; then
         return 0
     fi
-    if [ ! -d $XBPS_MASTERDIR/void-packages ]; then
-        mkdir -p $XBPS_MASTERDIR/void-packages
+    if [ ! -d $XBPS_BUILDROOT/void-packages ]; then
+        mkdir -p $XBPS_BUILDROOT/void-packages
     fi
 
     case "$action" in
@@ -168,7 +168,7 @@ chroot_handler() {
 
     if [ "$action" = "chroot" ]; then
         $XBPS_COMMONDIR/chroot-style/${XBPS_CHROOT_CMD:=uunshare}.sh \
-            $XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" /bin/xbps-shell
+            $XBPS_BUILDROOT $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" /bin/xbps-shell
         rv=$?
     else
         env -i -- PATH="/usr/bin:$PATH" SHELL=/bin/sh \
@@ -190,7 +190,7 @@ chroot_handler() {
             XBPS_ALLOW_CHROOT_BREAKOUT="$XBPS_ALLOW_CHROOT_BREAKOUT" \
             ${XBPS_ALT_REPOSITORY:+XBPS_ALT_REPOSITORY=$XBPS_ALT_REPOSITORY} \
             $XBPS_COMMONDIR/chroot-style/${XBPS_CHROOT_CMD:=uunshare}.sh \
-            $XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" \
+            $XBPS_BUILDROOT $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" \
             /void-packages/xbps-src $XBPS_OPTIONS $action $pkg
         rv=$?
     fi
@@ -202,8 +202,8 @@ chroot_sync_repodata() {
     local f= hostdir= confdir= crossconfdir=
 
     # always start with an empty xbps.d
-    confdir=$XBPS_MASTERDIR/etc/xbps.d
-    crossconfdir=$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
+    confdir=$XBPS_BUILDROOT/etc/xbps.d
+    crossconfdir=$XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
 
     [ -d $confdir ] && rm -rf $confdir
     [ -d $crossconfdir ] && rm -rf $crossconfdir
@@ -286,13 +286,13 @@ chroot_sync_repodata() {
 
     # Copy host repos to the cross root.
     if [ -n "$XBPS_CROSS_BUILD" ]; then
-        rm -rf $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
-        mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
+        rm -rf $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
+        mkdir -p $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
         # Disable 00-repository-main.conf from share/xbps.d (part of xbps)
-        ln -s /dev/null $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d/00-repository-main.conf
+        ln -s /dev/null $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d/00-repository-main.conf
         # copy xbps.d files from host for local repos
-        cp ${XBPS_MASTERDIR}/etc/xbps.d/*local*.conf \
-            $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
+        cp ${XBPS_BUILDROOT}/etc/xbps.d/*local*.conf \
+            $XBPS_BUILDROOT/$XBPS_CROSS_BASE/etc/xbps.d
         if [ "$XBPS_SKIP_REMOTEREPOS" ]; then
             rm -f $crossconfdir/*remote*
         else
@@ -314,11 +314,11 @@ chroot_sync_repodata() {
     fi
 
 
-    # Copy xbps repository keys to the masterdir.
-    mkdir -p $XBPS_MASTERDIR/var/db/xbps/keys
-    cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_MASTERDIR/var/db/xbps/keys
+    # Copy xbps repository keys to the buildroot.
+    mkdir -p $XBPS_BUILDROOT/var/db/xbps/keys
+    cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_BUILDROOT/var/db/xbps/keys
     if [ -n "$(shopt -s nullglob; echo "$XBPS_DISTDIR"/etc/repo-keys/*.plist)" ]; then
-        cp -f "$XBPS_DISTDIR"/etc/repo-keys/*.plist "$XBPS_MASTERDIR"/var/db/xbps/keys
+        cp -f "$XBPS_DISTDIR"/etc/repo-keys/*.plist "$XBPS_BUILDROOT"/var/db/xbps/keys
     fi
 
     # Make sure to sync index for remote repositories.
@@ -329,14 +329,14 @@ chroot_sync_repodata() {
 
     if [ -n "$XBPS_CROSS_BUILD" ]; then
         # Copy host keys to the target rootdir.
-        mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
-        cp $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
-            $XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
+        mkdir -p $XBPS_BUILDROOT/$XBPS_CROSS_BASE/var/db/xbps/keys
+        cp $XBPS_BUILDROOT/var/db/xbps/keys/*.plist \
+            $XBPS_BUILDROOT/$XBPS_CROSS_BASE/var/db/xbps/keys
         # Make sure to sync index for remote repositories.
         if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
             msg_normal "xbps-src: updating repositories for target ($XBPS_TARGET_MACHINE)...\n"
             env -- XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE \
-                $XBPS_INSTALL_CMD $XBPS_INSTALL_ARGS -r $XBPS_MASTERDIR/$XBPS_CROSS_BASE -S
+                $XBPS_INSTALL_CMD $XBPS_INSTALL_ARGS -r $XBPS_BUILDROOT/$XBPS_CROSS_BASE -S
         fi
     fi
 
diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index 4083e08ee084f..f662bffff3b9d 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -137,8 +137,8 @@ error_func() {
 exit_and_cleanup() {
     local rval=$1
 
-    if [ -n "$XBPS_TEMP_MASTERDIR" -a "$XBPS_TEMP_MASTERDIR" != "1" ]; then
-        rm -rf "$XBPS_TEMP_MASTERDIR"
+    if [ -n "$XBPS_TEMP_BUILDROOT" -a "$XBPS_TEMP_BUILDROOT" != "1" ]; then
+        rm -rf "$XBPS_TEMP_BUILDROOT"
     fi
     exit ${rval:=0}
 }
diff --git a/common/xbps-src/shutils/cross.sh b/common/xbps-src/shutils/cross.sh
index c21bab1747875..5c1b2b35cc4ec 100644
--- a/common/xbps-src/shutils/cross.sh
+++ b/common/xbps-src/shutils/cross.sh
@@ -4,7 +4,7 @@ remove_pkg_cross_deps() {
     local rval= tmplogf= prevs=0
     [ -z "$XBPS_CROSS_BUILD" ] && return 0
 
-    cd $XBPS_MASTERDIR || return 1
+    cd $XBPS_BUILDROOT || return 1
     msg_normal "${pkgver:-xbps-src}: removing autocrossdeps, please wait...\n"
     tmplogf=$(mktemp) || exit 1
 
@@ -35,7 +35,7 @@ remove_pkg_cross_deps() {
 
 prepare_cross_sysroot() {
     local cross="$1"
-    local statefile="$XBPS_MASTERDIR/.xbps-${cross}-done"
+    local statefile="$XBPS_BUILDROOT/.xbps-${cross}-done"
 
     [ -z "$cross" -o "$cross" = "" -o -f $statefile ] && return 0
 
diff --git a/common/xbps-src/shutils/pkgtarget.sh b/common/xbps-src/shutils/pkgtarget.sh
index 1e76a1b93b19e..3a5e3f4337cb8 100644
--- a/common/xbps-src/shutils/pkgtarget.sh
+++ b/common/xbps-src/shutils/pkgtarget.sh
@@ -58,7 +58,7 @@ pkg_available() {
 remove_pkg_autodeps() {
     local rval= tmplogf= errlogf= prevs=
 
-    cd $XBPS_MASTERDIR || return 1
+    cd $XBPS_BUILDROOT || return 1
     msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
     tmplogf=$(mktemp) || exit 1
     errlogf=$(mktemp) || exit 1
diff --git a/srcpkgs/acl/template b/srcpkgs/acl/template
index 9fa74946a2409..bccb3259c799a 100644
--- a/srcpkgs/acl/template
+++ b/srcpkgs/acl/template
@@ -15,8 +15,8 @@ distfiles="${NONGNU_SITE}/acl/acl-${version}.tar.gz"
 checksum=760c61c68901b37fdd5eefeeaf4c0c7a26bdfdd8ac747a1edff1ce0e243c11af
 
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS+=" -I${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS+=" -I${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS+=" -L${XBPS_BUILDROOT}/usr/lib"
 fi
 
 acl-devel_package() {
diff --git a/srcpkgs/chroot-git/template b/srcpkgs/chroot-git/template
index 3e2d1847cde84..bfad07282eede 100644
--- a/srcpkgs/chroot-git/template
+++ b/srcpkgs/chroot-git/template
@@ -48,7 +48,7 @@ do_configure() {
 	fi
 	if ! [ "$CHROOT_READY" ]; then
 		cat <<-EOF >>config.mak
-		ZLIB_PATH = ${XBPS_MASTERDIR}/usr
+		ZLIB_PATH = ${XBPS_BUILDROOT}/usr
 		NO_CURL = Yes
 		EOF
 	fi
diff --git a/srcpkgs/chroot-util-linux/template b/srcpkgs/chroot-util-linux/template
index e2c3c5f49ed70..ee8ad13034552 100644
--- a/srcpkgs/chroot-util-linux/template
+++ b/srcpkgs/chroot-util-linux/template
@@ -23,8 +23,8 @@ provides="util-linux-${version}_${revision}"
 repository=bootstrap
 
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS+=" -I${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS+=" -I${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS+=" -L${XBPS_BUILDROOT}/usr/lib"
 fi
 
 post_install() {
diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template
index a8f6096042247..6e1a9f65abdfd 100644
--- a/srcpkgs/gcc/template
+++ b/srcpkgs/gcc/template
@@ -237,7 +237,7 @@ do_configure() {
 		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
 		_langs+=",objc,obj-c++,fortran"
 	elif [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		export LD_LIBRARY_PATH="${XBPS_BUILDROOT}/usr/lib${XBPS_TARGET_WORDSIZE}"
 		_args+=" --build=${_triplet}"
 	else
 		_langs="c,c++,objc,obj-c++,fortran,lto"
@@ -318,7 +318,7 @@ do_configure() {
 }
 do_build() {
 	if [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		export LD_LIBRARY_PATH="${XBPS_BUILDROOT}/usr/lib${XBPS_TARGET_WORDSIZE}"
 	fi
 	cd build
 	if [ "$build_option_gnatboot" ]; then
diff --git a/srcpkgs/glibc/template b/srcpkgs/glibc/template
index 3272a1df265c1..13d3e2b88172c 100644
--- a/srcpkgs/glibc/template
+++ b/srcpkgs/glibc/template
@@ -88,7 +88,7 @@ do_configure() {
 		configure_args+=" --with-sysroot=${XBPS_CROSS_BASE}"
 		configure_args+=" --with-headers=${XBPS_CROSS_BASE}/usr/include"
 	else
-		configure_args+=" --with-headers=${XBPS_MASTERDIR}/usr/include"
+		configure_args+=" --with-headers=${XBPS_BUILDROOT}/usr/include"
 	fi
 
 	# Disable SSP from CFLAGS (enabled below)
diff --git a/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch b/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch
index f61e4122cd622..b23bf806bc5c7 100644
--- a/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch
+++ b/srcpkgs/i2c-tools/patches/py-smbus_fix-destdir.patch
@@ -1,4 +1,4 @@
-I had to add '--root' to the patch for it to not poison the masterdir.
+I had to add '--root' to the patch for it to not poison the buildroot.
   That part will still be needed as a patch when the next version gets released.
   -- 0x5c
 original message below
diff --git a/srcpkgs/libgccjit/template b/srcpkgs/libgccjit/template
index fde1affd54b7c..fe601a2c099c6 100644
--- a/srcpkgs/libgccjit/template
+++ b/srcpkgs/libgccjit/template
@@ -107,7 +107,7 @@ do_configure() {
 		_args+=" --host=$XBPS_CROSS_TRIPLET"
 		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
 	elif [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		export LD_LIBRARY_PATH="${XBPS_BUILDROOT}/usr/lib${XBPS_TARGET_WORDSIZE}"
 		_args+=" --build=${_target_triplet}"
 	else
 		_args+=" --build=${_target_triplet}"
diff --git a/srcpkgs/libmpc/template b/srcpkgs/libmpc/template
index 0d5622143a584..388f425ff9af2 100644
--- a/srcpkgs/libmpc/template
+++ b/srcpkgs/libmpc/template
@@ -14,8 +14,8 @@ distfiles="${GNU_SITE}/mpc/mpc-${version}.tar.gz"
 checksum=ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8
 
 if [ -z "$CHROOT_READY" ]; then
-	CFLAGS="-I${XBPS_MASTERDIR}/usr/include"
-	LDFLAGS="-L${XBPS_MASTERDIR}/usr/lib"
+	CFLAGS="-I${XBPS_BUILDROOT}/usr/include"
+	LDFLAGS="-L${XBPS_BUILDROOT}/usr/lib"
 fi
 
 post_install() {
diff --git a/srcpkgs/man-db/template b/srcpkgs/man-db/template
index cea1193c9d6e9..21fcfce74e438 100644
--- a/srcpkgs/man-db/template
+++ b/srcpkgs/man-db/template
@@ -27,7 +27,7 @@ system_accounts="_man"
 _man_homedir="/var/cache/man"
 make_dirs="/var/cache/man 0755 _man _man"
 
-# among others, requires the _man user to be available in the masterdir
+# among others, requires the _man user to be available in the buildroot
 make_check=no
 
 alternatives="
diff --git a/srcpkgs/pciutils/template b/srcpkgs/pciutils/template
index b5c8eb6bea052..95f67cdd4aacc 100644
--- a/srcpkgs/pciutils/template
+++ b/srcpkgs/pciutils/template
@@ -18,7 +18,7 @@ do_build() {
 		RANLIB=${RANLIB} PREFIX=/usr CC=${CC} \
 		HOST=${XBPS_TARGET_MACHINE%-musl}-linux ZLIB=yes \
 		SHAREDIR=/usr/share/hwdata MANDIR=/usr/share/man all
-	cp lib/libpci.a ${XBPS_MASTERDIR}/tmp
+	cp lib/libpci.a ${XBPS_BUILDROOT}/tmp
 	make clean
 	make OPT="${CFLAGS}" SHARED=yes AR=${AR} \
 		RANLIB=${RANLIB} PREFIX=/usr CC=${CC} \
@@ -30,7 +30,7 @@ do_install() {
 	make SHARED=yes PREFIX=/usr SHAREDIR=/usr/share/hwdata STRIP= \
 		MANDIR=/usr/share/man SBINDIR=/usr/bin \
 		DESTDIR=${DESTDIR} install install-lib
-	vinstall ${XBPS_MASTERDIR}/tmp/libpci.a 644 usr/lib
+	vinstall ${XBPS_BUILDROOT}/tmp/libpci.a 644 usr/lib
 
 	# Set corrects perms to shlib.
 	chmod 755 ${DESTDIR}/usr/lib/libpci.so.${version}
diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template
index 71aeb5c9a84c4..a8aa682724ff2 100644
--- a/srcpkgs/python3-adblock/template
+++ b/srcpkgs/python3-adblock/template
@@ -21,7 +21,7 @@ do_build() {
 	maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
 
 	# Drop platform specifiers from the wheel; pip will refuse to install,
-	# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
+	# e.g., an armv7l wheel on an aarch64 system even if the buildroot is
 	# armv7l. The wheel is correct; no need for name compatibility checks.
 	mkdir -p dist
 	mv adblock-${version}-*.whl dist/adblock-${version}-py3-none-any.whl
diff --git a/srcpkgs/rust-bootstrap/files/generating-distfiles.md b/srcpkgs/rust-bootstrap/files/generating-distfiles.md
index 36ee0ad230f2e..572ed716ae35e 100644
--- a/srcpkgs/rust-bootstrap/files/generating-distfiles.md
+++ b/srcpkgs/rust-bootstrap/files/generating-distfiles.md
@@ -9,16 +9,16 @@ problems.
 Note: Void no longer officially supports PowerPC platforms,
 this guide is kept for historical reasons as well as for future reference.
 
-### Set up appropriate masterdirs and remote-repositories
+### Set up appropriate buildroots and remote-repositories
 
 This guide assumes you're on an x86\_64 machine. If you're not, please adapt the
 appropriate sections.
 
-First, we bootstrap our masterdirs. We need both a glibc one and a musl one:
+First, we bootstrap our buildroots. We need both a glibc one and a musl one:
 
 ```
-$ ./xbps-src -m masterdir-glibc binary-bootstrap x86_64
-$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
+$ ./xbps-src -m buildroot-glibc binary-bootstrap x86_64
+$ ./xbps-src -m buildroot-musl binary-bootstrap x86_64-musl
 ```
 
 In addition to those, we need to set up binary remotes for the ppc repos. As
@@ -36,11 +36,11 @@ repo, but you can include them locally by creating these three files:
 
 Assuming you've already adjusted the version and checksums for the distfiles
 provided by upstream, we can now start building rust for our native
-architecture, with both glibc and musl. Run this for both masterdirs
+architecture, with both glibc and musl. Run this for both buildroots
 bootstrapped above
 
 ```
-$ ./xbps-src -m <masterdir> pkg cargo
+$ ./xbps-src -m <buildroot> pkg cargo
 ```
 
 This builds `rust-bootstrap`, `cargo-bootstrap`, `rust` and `cargo` for your
@@ -52,13 +52,13 @@ Now that we have the our native architecture covered, we cross build for the
 architectures we need to generate distfiles for:
 
 ```
-$ ./xbps-src -m <masterdir> -a <arch> pkg -o bindist rust
-$ ./xbps-src -m <masterdir> -a <arch> pkg rust
-$ ./xbps-src -m <masterdir> -a <arch> pkg -o bindist cargo
+$ ./xbps-src -m <buildroot> -a <arch> pkg -o bindist rust
+$ ./xbps-src -m <buildroot> -a <arch> pkg rust
+$ ./xbps-src -m <buildroot> -a <arch> pkg -o bindist cargo
 ```
 
-Repeat these three steps for `masterdir-glibc` with `ppc`, `masterdir-musl` with
-`ppc64le-musl` and `masterdir-glibc` with `ppc64`. In the case of `ppc`, you can
+Repeat these three steps for `buildroot-glibc` with `ppc`, `buildroot-musl` with
+`ppc64le-musl` and `buildroot-glibc` with `ppc64`. In the case of `ppc`, you can
 skip the `bindist` build for rust, as we are taking those from upstream.
 
 Now that we have run those commands, the generated distfiles are available in
diff --git a/srcpkgs/sydbox/template b/srcpkgs/sydbox/template
index 2ab945bef8bfb..868a8504a8427 100644
--- a/srcpkgs/sydbox/template
+++ b/srcpkgs/sydbox/template
@@ -11,7 +11,7 @@ license="MIT"
 homepage="https://sydbox.exherbolinux.org"
 distfiles="https://gitlab.exherbo.org/sydbox/sydbox-1/-/archive/v${version}/sydbox-1-v${version}.tar.gz"
 checksum=681e44816f2780f9b45a2ef601acc4174bc8336277ea6b9015aad8213b93e3c0
-# needs perlful grep which breaks masterdir
+# needs perlful grep which breaks buildroot
 make_check=no
 nocross="unable to properly check if seccomp is supported"
 
diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..33448ee1e84fe 100755
--- a/xbps-src
+++ b/xbps-src
@@ -15,13 +15,13 @@ $PROGNAME: [options] <target> [arguments]
 Targets: (only one may be specified)
 
 binary-bootstrap [arch]
-    Install bootstrap packages from host repositories into <masterdir>.
+    Install bootstrap packages from host repositories into <buildroot>.
     If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
+    from this architecture, and its required xbps utilities. The <buildroot>
     will be initialized for chroot operations.
 
 bootstrap
-    Build and install from source the bootstrap packages into <masterdir>.
+    Build and install from source the bootstrap packages into <buildroot>.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -31,7 +31,7 @@ consistency-check
     Runs a consistency check on all packages
 
 chroot
-    Enter to the chroot in <masterdir>.
+    Enter to the chroot in <buildroot>.
 
 clean-repocache
     Removes obsolete packages from <hostdir>/repocache.
@@ -41,7 +41,7 @@ fetch <pkgname>
 
 extract <pkgname>
     Extract package source distribution file(s) into the build directory.
-    By default set to <masterdir>/builddir.
+    By default set to <buildroot>/builddir.
 
 patch <pkgname>
     Patch the package sources and perform other operations required to
@@ -64,12 +64,12 @@ pkg <pkgname>
     Build binary package for <pkgname> and all required dependencies.
 
 clean [pkgname]
-    Removes auto dependencies, cleans up <masterdir>/builddir and <masterdir>/destdir.
-    If <pkgname> argument is specified, package files from <masterdir>/destdir and its
-    build directory in <masterdir>/buiddir are removed.
+    Removes auto dependencies, cleans up <buildroot>/builddir and <buildroot>/destdir.
+    If <pkgname> argument is specified, package files from <buildroot>/destdir and its
+    build directory in <buildroot>/buiddir are removed.
 
 list
-    Lists installed packages in <masterdir>.
+    Lists installed packages in <buildroot>.
 
 remove <pkgname>
     Remove target package from <destdir>. If <pkgname>-<version> is not matched
@@ -145,7 +145,7 @@ update-hash-cache
     Update the hash cache with existing source distfiles.
 
 zap
-    Removes a masterdir but preserving ccache, distcc and host directories.
+    Removes a buildroot but preserving ccache, distcc and host directories.
 
 Options:
 
@@ -176,7 +176,7 @@ $(print_cross_targets)
 -g  Enable building -dbg packages with debugging symbols.
 
 -H  <hostdir>
-    Absolute path to a directory to be bind mounted at <masterdir>/host.
+    Absolute path to a directory to be bind mounted at <buildroot>/host.
     The host directory stores binary packages, sources and package dependencies
     downloaded from remote repositories.
     If unset defaults to void-packages/hostdir.
@@ -191,10 +191,10 @@ $(print_cross_targets)
 
 -L  Disable ASCII colors.
 
--m  <masterdir>
-    Absolute path to a directory to be used as masterdir.
-    The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+-m  <buildroot>
+    Absolute path to a directory to be used as buildroot.
+    The buildroot is the main directory to build/store/compile packages.
+    If unset defaults to void-packages/buildroot.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -226,9 +226,9 @@ $(print_cross_targets)
 
 -s  Make vsed warnings errors.
 
--t  Create a temporary masterdir to not pollute the current one. Note that
-    the existing masterdir must be fully populated with binary-bootstrap first.
-    Once the target has finished, this temporary masterdir will be removed.
+-t  Create a temporary buildroot to not pollute the current one. Note that
+    the existing buildroot must be fully populated with binary-bootstrap first.
+    Once the target has finished, this temporary buildroot will be removed.
     This flag requires xbps-uchroot(1), and won't work on filesystems that don't
     support overlayfs.
 
@@ -278,15 +278,15 @@ check_build_requirements() {
 }
 
 chroot_check() {
-    if [ -f $XBPS_MASTERDIR/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
+    if [ -f $XBPS_BUILDROOT/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
         export CHROOT_READY=1
     fi
 }
 
 check_native_arch() {
     if [ "$CHROOT_READY" ]; then
-        if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
-            export XBPS_ARCH=$(<$XBPS_MASTERDIR/.xbps_chroot_init)
+        if [ -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
+            export XBPS_ARCH=$(<$XBPS_BUILDROOT/.xbps_chroot_init)
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
@@ -306,10 +306,10 @@ check_native_arch() {
     fi
 }
 
-masterdir_zap() {
-    rm -rf "$XBPS_MASTERDIR"
-    mkdir -p "$XBPS_MASTERDIR"
-    msg_normal "xbps-src: $XBPS_MASTERDIR masterdir cleaned up.\n"
+buildroot_zap() {
+    rm -rf "$XBPS_BUILDROOT"
+    mkdir -p "$XBPS_BUILDROOT"
+    msg_normal "xbps-src: $XBPS_BUILDROOT buildroot cleaned up.\n"
 }
 
 exit_func() {
@@ -349,7 +349,7 @@ setup_distfiles_mirror() {
                 msg_warn "xbps-src: Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n"
                 continue
             fi
-            mkdir -p "$XBPS_MASTERDIR/$path"
+            mkdir -p "$XBPS_BUILDROOT/$path"
             XBPS_CHROOT_CMD_ARGS+=" -b $path:$path"
         else
             case "$XBPS_TARGET" in
@@ -397,7 +397,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         I) XBPS_ARG_SKIP_DEPS=1; XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -I -N";;
         j) XBPS_ARG_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
         L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
-        m) XBPS_ARG_MASTERDIR="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
+        m) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
         N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
         o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
         p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;
@@ -406,7 +406,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         K) XBPS_ARG_CHECK_PKGS=full; XBPS_OPTIONS+=" -K";;
         r) XBPS_ARG_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
         s) XBPS_ARG_STRICT=yes; XBPS_OPTIONS+=" -s";;
-        t) XBPS_ARG_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
+        t) XBPS_ARG_TEMP_BUILDROOT=1; XBPS_OPTIONS+=" -t -C";;
         V) echo "xbps-src-$XBPS_SRC_VERSION $(xbps-uhelper -V)" && exit 0;;
         --) shift; break;;
     esac
@@ -439,13 +439,13 @@ readonly REQHOST_UTILS="xbps-install xbps-query xbps-rindex xbps-uhelper \
 check_reqhost_utils
 
 #
-# Set XBPS_CONFIG_FILE, XBPS_DISTDIR, XBPS_MASTERDIR
+# Set XBPS_CONFIG_FILE, XBPS_DISTDIR, XBPS_BUILDROOT
 # and XBPS_HOSTDIR.
 #
 if [ "$IN_CHROOT" ]; then
     readonly XBPS_CONFIG_FILE=/etc/xbps/xbps-src.conf
     readonly XBPS_DISTDIR=/void-packages
-    readonly XBPS_MASTERDIR=/
+    readonly XBPS_BUILDROOT=/
     readonly XBPS_HOSTDIR=/host
 else
     _distdir="$(readlink -f ${0%/*})"
@@ -483,7 +483,7 @@ fi
 [ -n "$XBPS_ARG_SKIP_REMOTEREPOS" ] && XBPS_SKIP_REMOTEREPOS=1
 [ -n "$XBPS_ARG_BUILD_FORCEMODE" ] && XBPS_BUILD_FORCEMODE=1
 [ -n "$XBPS_ARG_INFORMATIVE_RUN" ] && XBPS_INFORMATIVE_RUN=1
-[ -n "$XBPS_ARG_TEMP_MASTERDIR" ] && XBPS_TEMP_MASTERDIR=1
+[ -n "$XBPS_ARG_TEMP_BUILDROOT" ] && XBPS_TEMP_BUILDROOT=1
 [ -n "$XBPS_ARG_BINPKG_EXISTS" ] && XBPS_BINPKG_EXISTS=1
 [ -n "$XBPS_ARG_USE_GIT_REVS" ] && XBPS_USE_GIT_REVS=1
 [ -n "$XBPS_ARG_DEBUG_PKGS" ] && XBPS_DEBUG_PKGS=1
@@ -505,18 +505,18 @@ else
 fi
 
 export XBPS_BUILD_ONLY_ONE_PKG XBPS_SKIP_REMOTEREPOS XBPS_BUILD_FORCEMODE \
-       XBPS_INFORMATIVE_RUN XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
+       XBPS_INFORMATIVE_RUN XBPS_TEMP_BUILDROOT XBPS_BINPKG_EXISTS \
        XBPS_USE_GIT_REVS XBPS_CHECK_PKGS XBPS_DEBUG_PKGS XBPS_SKIP_DEPS \
        XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_STRICT XBPS_CROSS_BUILD \
        XBPS_MAKEJOBS XBPS_PRINT_VARIABLES XBPS_IGNORE_BROKENNESS
 
-# The masterdir/hostdir variables are forced and readonly in chroot
+# The buildroot/hostdir variables are forced and readonly in chroot
 if [ -z "$IN_CHROOT" ]; then
-    [ -n "$XBPS_ARG_MASTERDIR" ] && XBPS_MASTERDIR="$XBPS_ARG_MASTERDIR"
+    [ -n "$XBPS_ARG_BUILDROOT" ] && XBPS_BUILDROOT="$XBPS_ARG_BUILDROOT"
     [ -n "$XBPS_ARG_HOSTDIR" ] && XBPS_HOSTDIR="$XBPS_ARG_HOSTDIR"
 
-    # Sanitize masterdir/hostdir once set for real (resolve links)
-    export XBPS_MASTERDIR="$(readlink -f $XBPS_MASTERDIR 2>/dev/null)"
+    # Sanitize buildroot/hostdir once set for real (resolve links)
+    export XBPS_BUILDROOT="$(readlink -f $XBPS_BUILDROOT 2>/dev/null)"
     export XBPS_HOSTDIR="$(readlink -f $XBPS_HOSTDIR 2>/dev/null)"
 fi
 
@@ -527,16 +527,16 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_BUILDROOT unset, defaults to $XBPS_DISTDIR/buildroot.
+: ${XBPS_BUILDROOT:=$XBPS_DISTDIR/buildroot}
+[ ! -d $XBPS_BUILDROOT ] &&  mkdir -p $XBPS_BUILDROOT
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
 [ ! -d $XBPS_HOSTDIR ] && mkdir -p $XBPS_HOSTDIR
 
-if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
-    echo "ERROR: can't write to masterdir $XBPS_MASTERDIR." 1>&2
+if [ -d "$XBPS_BUILDROOT" -a ! -w "$XBPS_BUILDROOT" ]; then
+    echo "ERROR: can't write to buildroot $XBPS_BUILDROOT." 1>&2
     exit 1
 fi
 
@@ -554,8 +554,8 @@ if [ -n "$XBPS_HOSTDIR" ]; then
     export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
     readonly XBPS_SRCDISTDIR=$XBPS_HOSTDIR/sources
 else
-    export XBPS_REPOSITORY=$XBPS_MASTERDIR/host/binpkgs
-    readonly XBPS_SRCDISTDIR=$XBPS_MASTERDIR/host/sources
+    export XBPS_REPOSITORY=$XBPS_BUILDROOT/host/binpkgs
+    readonly XBPS_SRCDISTDIR=$XBPS_BUILDROOT/host/sources
 fi
 
 # Set XBPS_REPOSITORY to our current branch.
@@ -590,7 +590,7 @@ fi
 chroot_check
 check_native_arch
 
-# test if to use linux32 for 32-bit masterdirs in 64-bit environments
+# test if to use linux32 for 32-bit buildroots in 64-bit environments
 # x86_64, ppc64 (BE) and aarch64 are capable of this, others are not
 linux32_check() {
     local hostarch="$1"
@@ -610,11 +610,11 @@ linux32_check() {
 }
 
 # Reconfigure pkgs for 32bit on 64-bit systems and reexec itself.
-if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
-    export XBPS_ARCH=${XBPS_ARCH:-$(<$XBPS_MASTERDIR/.xbps_chroot_init)}
+if [ -z "$XBPS_REINIT" -a -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
+    export XBPS_ARCH=${XBPS_ARCH:-$(<$XBPS_BUILDROOT/.xbps_chroot_init)}
     if linux32_check "$XBPS_MACHINE" "$XBPS_ARCH"; then
         # reconfigure pkgs via linux32
-        linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
+        linux32 xbps-reconfigure -r ${XBPS_BUILDROOT} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
         exec linux32 $0 ${XBPS_OPTIONS} $@
@@ -639,14 +639,14 @@ if [ "$IN_CHROOT" ]; then
     readonly XBPS_DESTDIR=/destdir
     readonly XBPS_BUILDDIR=/builddir
 else
-    readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
-    readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d"
-    readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d"
-    readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
-    readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
-    readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR"
-    readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
-    readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
+    readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_BUILDROOT"
+    readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_BUILDROOT -C etc/xbps.d"
+    readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_BUILDROOT -C etc/xbps.d"
+    readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_BUILDROOT"
+    readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_BUILDROOT"
+    readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_BUILDROOT"
+    readonly XBPS_DESTDIR=$XBPS_BUILDROOT/destdir
+    readonly XBPS_BUILDDIR=$XBPS_BUILDROOT/builddir
 fi
 readonly XBPS_RINDEX_CMD="xbps-rindex"
 readonly XBPS_FETCH_CMD="xbps-fetch"
@@ -663,8 +663,8 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
     XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
-    XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
-    XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
+    XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_BUILDROOT XBPS_SRC_VERSION \
+    XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_BUILDROOT XBPS_BINPKG_EXISTS \
     XBPS_LIBEXECDIR XBPS_DISTDIR XBPS_DISTFILES_MIRROR XBPS_ALLOW_RESTRICTED \
     XBPS_USE_GIT_COMMIT_DATE XBPS_PKG_COMPTYPE XBPS_REPO_COMPTYPE \
     XBPS_BUILDHELPERDIR XBPS_USE_BUILD_MTIME XBPS_BUILD_ENVIRONMENT \
@@ -678,9 +678,9 @@ for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
     unset val
 done
 
-# A temporary masterdir requires xbps-uchroot(1) and -O to use overlayfs
+# A temporary buildroot requires xbps-uchroot(1) and -O to use overlayfs
 # on tmpfs (available with xbps-0.45).
-if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
+if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_BUILDROOT" ]; then
     export XBPS_CHROOT_CMD="uchroot"
     export XBPS_CHROOT_CMD_ARGS+=" -O"
 fi
@@ -689,7 +689,7 @@ fi
 #
 if [ -z "$IN_CHROOT" ]; then
     # In non chroot case always prefer host tools.
-    export PATH="$PATH:$XBPS_MASTERDIR/usr/bin"
+    export PATH="$PATH:$XBPS_BUILDROOT/usr/bin"
 fi
 
 #
@@ -760,7 +760,7 @@ case "$XBPS_TARGET" in
             $XBPS_LIBEXECDIR/build.sh \
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
-        [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
+        [ -d $XBPS_BUILDROOT ] && rm -rf $XBPS_BUILDROOT
         install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
         ;;
     bootstrap-update)
@@ -782,14 +782,14 @@ case "$XBPS_TARGET" in
             else
                 remove_pkg_autodeps
             fi
-            msg_normal "xbps-src: cleaning up masterdir...\n"
+            msg_normal "xbps-src: cleaning up buildroot...\n"
             # Needed to remove Go Modules
             [ -d "$XBPS_BUILDDIR" ] && chmod -R +wX $XBPS_BUILDDIR
             rm -rf \
                 $XBPS_BUILDDIR \
                 $XBPS_DESTDIR
-            rm -rf $XBPS_MASTERDIR/tmp
-            mkdir -p $XBPS_MASTERDIR/tmp
+            rm -rf $XBPS_BUILDROOT/tmp
+            mkdir -p $XBPS_BUILDROOT/tmp
         else
             read_pkg
             if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
@@ -1007,7 +1007,7 @@ case "$XBPS_TARGET" in
         update_hash_cache
         ;;
     zap)
-        masterdir_zap
+        buildroot_zap
         ;;
     *)
         msg_red "xbps-src: invalid target $XBPS_TARGET.\n"

From 6cda8239d651809aff8b95e49772264696848990 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 2/5] xbps-src: add -A flag for host arch, create buildroot per
 host arch

---
 xbps-src | 64 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/xbps-src b/xbps-src
index 33448ee1e84fe..0cbf8467654a9 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <buildroot>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <buildroot>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <buildroot> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <buildroot>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <buildroot>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -194,7 +204,7 @@ $(print_cross_targets)
 -m  <buildroot>
     Absolute path to a directory to be used as buildroot.
     The buildroot is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/buildroot.
+    If unset defaults to void-packages/buildroot-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,14 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_BUILDROOT unset, defaults to $XBPS_DISTDIR/buildroot.
-: ${XBPS_BUILDROOT:=$XBPS_DISTDIR/buildroot}
-[ ! -d $XBPS_BUILDROOT ] &&  mkdir -p $XBPS_BUILDROOT
+# if XBPS_BUILDROOT unset, defaults to $XBPS_DISTDIR/buildroot-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_BUILDROOT:=$XBPS_DISTDIR/buildroot}"
+else
+    : "${XBPS_BUILDROOT:=$XBPS_DISTDIR/buildroot-$XBPS_MACHINE}"
+fi
+[ ! -d "$XBPS_BUILDROOT" ] && mkdir -p "$XBPS_BUILDROOT"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +623,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_BUILDROOT/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_BUILDROOT} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +749,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +775,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_BUILDROOT ] && rm -rf $XBPS_BUILDROOT
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From be1b9d5a14ddbd67db8f3392f48added9c39050b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Jan 2024 01:31:50 -0500
Subject: [PATCH 3/5] README.md: update documentation for new buildroot
 creation

also a file that references a bunch of old args
---
 README.md                                       | 17 +++++++++--------
 .../files/generating-distfiles.md               | 16 ++++++++--------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index 3245d1adf6901..7f52d7d0c7b7e 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- buildroot
+            |- buildroot-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `buildroot`: master directory to be used as rootfs to build/install packages.
+ - `buildroot-<arch>`: directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default buildroot is created in the current working directory, i.e `void-packages/buildroot`.
+The default buildroot is created in the current working directory, i.e. `void-packages/buildroot-<arch>`, where `<arch>` for the default buildroot is is the native xbps architecture.
 
 <a name="remaking-buildroot"></a>
 ### Remaking the buildroot
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `buildroot`:
 
-    $ ./xbps-src -m buildroot-x86 binary-bootstrap i686
-    $ ./xbps-src -m buildroot-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated buildroot.
+The canonical way of building packages for same architecture but different C library is through a dedicated buildroot by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new buildroot with the musl packages:
 
-    $ ./xbps-src -m buildroot-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new buildroot called `buildroot-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new buildroot is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m buildroot-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch
diff --git a/srcpkgs/rust-bootstrap/files/generating-distfiles.md b/srcpkgs/rust-bootstrap/files/generating-distfiles.md
index 572ed716ae35e..e97615d46bd86 100644
--- a/srcpkgs/rust-bootstrap/files/generating-distfiles.md
+++ b/srcpkgs/rust-bootstrap/files/generating-distfiles.md
@@ -17,8 +17,8 @@ appropriate sections.
 First, we bootstrap our buildroots. We need both a glibc one and a musl one:
 
 ```
-$ ./xbps-src -m buildroot-glibc binary-bootstrap x86_64
-$ ./xbps-src -m buildroot-musl binary-bootstrap x86_64-musl
+$ ./xbps-src -A x86_64 binary-bootstrap
+$ ./xbps-src -A x86_64-musl binary-bootstrap
 ```
 
 In addition to those, we need to set up binary remotes for the ppc repos. As
@@ -40,7 +40,7 @@ architecture, with both glibc and musl. Run this for both buildroots
 bootstrapped above
 
 ```
-$ ./xbps-src -m <buildroot> pkg cargo
+$ ./xbps-src -A <hostarch> pkg cargo
 ```
 
 This builds `rust-bootstrap`, `cargo-bootstrap`, `rust` and `cargo` for your
@@ -52,13 +52,13 @@ Now that we have the our native architecture covered, we cross build for the
 architectures we need to generate distfiles for:
 
 ```
-$ ./xbps-src -m <buildroot> -a <arch> pkg -o bindist rust
-$ ./xbps-src -m <buildroot> -a <arch> pkg rust
-$ ./xbps-src -m <buildroot> -a <arch> pkg -o bindist cargo
+$ ./xbps-src -A <hostarch> -a <arch> pkg -o bindist rust
+$ ./xbps-src -A <hostarch> -a <arch> pkg rust
+$ ./xbps-src -A <hostarch> -a <arch> pkg -o bindist cargo
 ```
 
-Repeat these three steps for `buildroot-glibc` with `ppc`, `buildroot-musl` with
-`ppc64le-musl` and `buildroot-glibc` with `ppc64`. In the case of `ppc`, you can
+Repeat these three steps for `-A x86_64` with `ppc` and `ppc64`, and for
+`-A x86_64-musl` with `ppc64le-musl`. In the case of `ppc`, you can
 skip the `bindist` build for rust, as we are taking those from upstream.
 
 Now that we have run those commands, the generated distfiles are available in

From a89cf835e57eb391d694fe6ec606963208e42ebb Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Jan 2024 00:39:59 -0500
Subject: [PATCH 4/5] xbps-src: rename -m to -B, but leave it as an alias

---
 xbps-src | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xbps-src b/xbps-src
index 0cbf8467654a9..6b42dcfe54e91 100755
--- a/xbps-src
+++ b/xbps-src
@@ -166,6 +166,11 @@ $(print_cross_targets)
 
 $(print_cross_targets)
 
+-B  <buildroot>
+    Absolute path to a directory to be used as buildroot.
+    The buildroot is the main directory to build/store/compile packages.
+    If unset defaults to void-packages/buildroot-<host>.
+
 -b  Build packages even if marked as broken, nocross, or excluded with archs.
 
 -c  <configuration>
@@ -201,10 +206,7 @@ $(print_cross_targets)
 
 -L  Disable ASCII colors.
 
--m  <buildroot>
-    Absolute path to a directory to be used as buildroot.
-    The buildroot is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/buildroot-<host>.
+-m  Legacy alias for -B.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -371,7 +373,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:B:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -384,6 +386,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
         A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
+        B) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -B $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
         C) XBPS_ARG_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;
@@ -397,7 +400,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
         I) XBPS_ARG_SKIP_DEPS=1; XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -I -N";;
         j) XBPS_ARG_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
         L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
-        m) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
+        m) XBPS_ARG_BUILDROOT="$OPTARG"; XBPS_OPTIONS+=" -B $OPTARG";; # legacy alias for -B
         N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
         o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
         p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;

From 1a0ee3b785f1058966f8c047ee6afdbdbb642b42 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 5/5] xbps: patch xbps-src completions for -A and -B

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 62 ++++++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..3c0009e922f70
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,62 @@
+diff --git a/data/_xbps_src b/data/_xbps_src
+index 43b5f704..63fd2f31 100644
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -6,7 +6,7 @@ local ret=0 archs top
+ 
+ archs=(aarch64-musl aarch64 armv5te-musl armv5te armv5tel-musl armv5tel armv6hf-musl armv6hf armv6l-musl armv6l armv7hf-musl armv7hf armv7l-musl armv7l i686-musl i686 mips-musl mipsel-musl mipselhf-musl mipshf-musl ppc-musl ppc ppc64-musl ppc64 ppc64le-musl ppc64le x86_64-musl)
+ 
+-# path to masterdir and srcpkgs.
++# path to buildroot and srcpkgs.
+ top=$~_comp_command1:h
+ 
+ _xbps_src_all_packages() {
+@@ -15,18 +15,21 @@ _xbps_src_all_packages() {
+ 
+ _xbps_src_destdir_packages() {
+ 	local -a dirs
+-	dirs=( $top/masterdir/destdir/*~[^-]#-linux-[^-]#(N/) )
++	dirs=( $top/buildroot/destdir/*~[^-]#-linux-[^-]#(N/) )
+ 	compadd "$@" -- ${${dirs:t}%-*}
+ }
+ 
+ _xbps_src_build_packages() {
+ 	local -a dirs
+-	dirs=( $top/masterdir/builddir/*~[^-]#-linux-[^-]#(N/) )
++	dirs=( $top/buildroot/builddir/*~[^-]#-linux-[^-]#(N/) )
+ 	compadd "$@" -- ${${dirs:t}%-*}
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
++	'-B[Absolute path to buildroot]:buildroot:_files -/' \
++	'-b[Build broken, nocross, or excluded packages]' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+ 	'-f[Force building and registering binary packages]' \
+@@ -38,12 +41,11 @@ _arguments -s : \
+ 	'-I[Ignore required dependencies]' \
+ 	'-j[Number of parallel build jobs]:number: ' \
+ 	'-L[Disable ASCII colors]' \
+-	'-m[Absolute path to masterdir]:masterdir:_files -/' \
+ 	'-N[Disable use of remote repositories]' \
+ 	'-o[Set package build options]:options: ' \
+ 	'-q[Suppress output of xbps-src]' \
+ 	'-r[Use alternative local repository]:repo:_files -/' \
+-	'-t[Create a temporary masterdir]' \
++	'-t[Create a temporary buildroot]' \
+ 	'1:target:->target' \
+ 	'*::args:->args' && ret=0
+ 
+@@ -64,9 +66,7 @@ case $state in
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (16 preceding siblings ...)
  2024-01-17  6:50 ` [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot classabbyamp
@ 2024-01-22 18:00 ` classabbyamp
  2024-01-22 19:58 ` [PR REVIEW] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch ahesford
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-22 18:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- masterdir name has changed to buildroot
- default buildroot naming now includes the host `XBPS_ARCH`, e.g. `buildroot-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new buildroot per host arch automatically
- using an arbitrary buildroot is still supported via `-B <buildroot>` (`-m` still exists as an alias), and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the buildroot's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault buildroot:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... buildroot-x86_64 ...
```
*nondefault buildroot:*
```
$ ./xbps-src -B buildroot-idk binary-bootstrap
$ ls
... buildroot-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... buildroot-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?
- This could be an opportunity to change the name of `masterdir` to something else, like `buildroot` (the containers CI uses are already called `void-buildroot-<libc>`)

### TODO
- [ ] various documentation/other xbps-src changes as needed
- [ ] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 12156 bytes --]

From 5af505e9e6e912e83a9c1ea9b0d675f8988c7ec4 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 64 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91ab..aac74526155960 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -194,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,14 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+else
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+fi
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +623,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +749,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +775,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From c9c9aee9234982ed77aecdac5265ca1a2f634211 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 00000000000000..bb0234f38463d0
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58dab..060a70563aeb76 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From 6c812a3dd226da5a241018bafe338214f6e255a7 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/3] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae19167..bd7fed879019f1 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR REVIEW] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (17 preceding siblings ...)
  2024-01-22 18:00 ` classabbyamp
@ 2024-01-22 19:58 ` ahesford
  2024-01-22 20:15 ` [PR PATCH] [Updated] " classabbyamp
  2024-01-23  3:57 ` [PR PATCH] [Merged]: " the-maldridge
  20 siblings, 0 replies; 22+ messages in thread
From: ahesford @ 2024-01-22 19:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/46263#discussion_r1462351631

Comment:
```suggestion
else
    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
    if [ ! -d "${XBPS_MASTERDIR}" && -d "${XBPS_DISTDIR}/masterdir" ]; then
        XBPS_MASTERDIR="${XBPS_DISTDIR}/masterdir"
    fi
```
This avoids the need to break builds with existing `masterdir`.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (18 preceding siblings ...)
  2024-01-22 19:58 ` [PR REVIEW] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch ahesford
@ 2024-01-22 20:15 ` classabbyamp
  2024-01-23  3:57 ` [PR PATCH] [Merged]: " the-maldridge
  20 siblings, 0 replies; 22+ messages in thread
From: classabbyamp @ 2024-01-22 20:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2494 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages host-arch
https://github.com/void-linux/void-packages/pull/46263

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- ~~By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?~~ buildbot config will be changed
- ~~This could be an opportunity to change the name of `masterdir` to something else, like `masterdir` (the containers CI uses are already called `void-buildroot-<libc>`)~~ if this changes, it will be separate; there's too much to change both coherently

### TODO
- [x] various documentation/other xbps-src changes as needed
- [x] buildbot changes if needed


A patch file from https://github.com/void-linux/void-packages/pull/46263.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-host-arch-46263.patch --]
[-- Type: text/x-diff, Size: 12367 bytes --]

From c571198947e8f4343aa82a2a047d573af271ca42 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:16:39 -0400
Subject: [PATCH 1/3] xbps-src: add -A flag for host arch, create masterdir per
 host arch

---
 xbps-src | 68 +++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 43 insertions(+), 25 deletions(-)

diff --git a/xbps-src b/xbps-src
index 712a578c6f91a..fcc7bb988e12c 100755
--- a/xbps-src
+++ b/xbps-src
@@ -14,14 +14,17 @@ $PROGNAME: [options] <target> [arguments]
 
 Targets: (only one may be specified)
 
-binary-bootstrap [arch]
+binary-bootstrap
     Install bootstrap packages from host repositories into <masterdir>.
-    If the optional 'arch' argument is set, it will install bootstrap packages
-    from this architecture, and its required xbps utilities. The <masterdir>
-    will be initialized for chroot operations.
+    If the optional '-A <arch>' flag is set, it will install bootstrap packages
+    from this architecture, and its required xbps utilities. The <masterdir> will
+    be initialized for chroot operations.
 
 bootstrap
     Build and install from source the bootstrap packages into <masterdir>.
+    If the optional '-A <arch>' flag is set, it will build and install bootstrap
+    packages from this architecture, and its required xbps utilities. The <masterdir>
+    will be initialized for chroot operations.
 
 bootstrap-update
     Updates bootstrap packages with latest versions available from registered
@@ -151,6 +154,13 @@ Options:
 
 -1  If dependencies of target package are missing, fail instead of building them.
 
+-A <host>
+    Use this host machine. Automatically creates masterdir-<host> if it doesn't
+    already exist. Some host machines may require qemu-user-static and
+    binfmt-support if not natively supported by the processor. Supported hosts:
+
+$(print_cross_targets)
+
 -a  <target>
     Cross compile packages for this target machine. Supported targets:
 
@@ -194,7 +204,7 @@ $(print_cross_targets)
 -m  <masterdir>
     Absolute path to a directory to be used as masterdir.
     The masterdir is the main directory to build/store/compile packages.
-    If unset defaults to void-packages/masterdir.
+    If unset defaults to void-packages/masterdir-<host>.
 
 -N  Disable use of remote repositories to resolve dependencies.
 
@@ -290,19 +300,8 @@ check_native_arch() {
         else
             export XBPS_ARCH=$(xbps-uhelper arch)
         fi
-    elif [ "$XBPS_TARGET" = 'binary-bootstrap' ] && [ "$XBPS_TARGET_PKG" ]; then
-        # ^ special case for binary-bootstrap for e.g:
-        # x86_64 -> x86_64-musl
-        # x86_64 -> i686
-        export XBPS_ARCH=$XBPS_TARGET_PKG
     else
-        LDD=$(ldd --version 2>&1|head -1)
-        if [[ $LDD == *musl* ]]; then
-            export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
-        else
-            # XBPS_ARCH == $(uname -m)
-            export XBPS_ARCH=$(uname -m)
-        fi
+        export XBPS_ARCH="$XBPS_MACHINE"
     fi
 }
 
@@ -372,7 +371,7 @@ readonly XBPS_SRC_VERSION="113"
 export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
 
 XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
+XBPS_OPTSTRING="1A:a:bc:CEfgGhH:iIj:Lm:No:p:qsQKr:tV"
 
 # Preprocess arguments in order to allow options before and after XBPS_TARGET.
 eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -383,6 +382,7 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
 while getopts "$XBPS_OPTSTRING" opt; do
     case $opt in
         1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
+        A) XBPS_ARG_MACHINE="$OPTARG"; XBPS_OPTIONS+=" -A $OPTARG";;
         a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
         b) XBPS_ARG_IGNORE_BROKENNESS=yes; XBPS_OPTIONS+=" -b";;
         c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
@@ -493,6 +493,7 @@ fi
 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
 [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
 [ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT"
+[ -n "$XBPS_ARG_MACHINE" ] && XBPS_MACHINE="$XBPS_ARG_MACHINE"
 [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
 [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS"
 [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -527,9 +528,18 @@ if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
     exit 1
 fi
 
-# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
-: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
-[ ! -d $XBPS_MASTERDIR ] &&  mkdir -p $XBPS_MASTERDIR
+# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir-<host machine>
+# unless in a container for simplicity of container/CI usage
+if [ "$XBPS_CHROOT_CMD" = ethereal ]; then
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}"
+else
+    : "${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir-$XBPS_MACHINE}"
+    # but use $XBPS_DISTDIR/masterdir if it exists and the new style doesn't
+    if [ ! -d "${XBPS_MASTERDIR}" ] && [ -d "${XBPS_DISTDIR}/masterdir" ]; then
+        XBPS_MASTERDIR="${XBPS_DISTDIR}/masterdir"
+    fi
+fi
+[ ! -d "$XBPS_MASTERDIR" ] && mkdir -p "$XBPS_MASTERDIR"
 
 # if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
 : ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
@@ -617,10 +627,10 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
         linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
         # reexec itself via linux32
         export XBPS_REINIT=1
-        exec linux32 $0 ${XBPS_OPTIONS} $@
+        exec linux32 $0 ${XBPS_OPTIONS} "$@"
     fi
 fi
-if [ "$XBPS_ARCH" ]; then
+if [ -n "$XBPS_ARCH" ]; then
     export XBPS_MACHINE=$XBPS_ARCH
 fi
 # At this point if XBPS_TARGET_MACHINE isn't defined we assume
@@ -743,13 +753,21 @@ reconfigure_base_chroot
 #
 case "$XBPS_TARGET" in
     binary-bootstrap)
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: binary-bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap)
         if [ -n "$XBPS_CHECK_PKGS" ]; then
             msg_error "xbps-src: disable tests for bootstrap\n"
             exit 1
         fi
+        if [ -n "$XBPS_TARGET_PKG" ]; then
+            msg_error "xbps-src: bootstrap <arch> is no longer supported, use '-A <arch>' instead\n"
+            exit 1
+        fi
         # base-chroot building on host
         # check for required host utils
         check_reqhost_utils bootstrap
@@ -761,7 +779,7 @@ case "$XBPS_TARGET" in
                 base-chroot base-chroot $XBPS_TARGET || exit 1
         ) || exit 1
         [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
-        install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
+        install_base_chroot "$XBPS_MACHINE"
         ;;
     bootstrap-update)
         if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then

From 3701ccc60c01ccc92424cab06564e963a738038e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 26 Sep 2023 03:18:01 -0400
Subject: [PATCH 2/3] xbps: patch xbps-src completions for -A

---
 srcpkgs/xbps/patches/xbps-src-comp.patch | 21 +++++++++++++++++++++
 srcpkgs/xbps/template                    |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/xbps/patches/xbps-src-comp.patch

diff --git a/srcpkgs/xbps/patches/xbps-src-comp.patch b/srcpkgs/xbps/patches/xbps-src-comp.patch
new file mode 100644
index 0000000000000..bb0234f38463d
--- /dev/null
+++ b/srcpkgs/xbps/patches/xbps-src-comp.patch
@@ -0,0 +1,21 @@
+--- a/data/_xbps_src
++++ b/data/_xbps_src
+@@ -26,6 +26,7 @@
+ }
+ 
+ _arguments -s : \
++	'-A[Host architecture]:architecture:($archs)' \
+ 	'-a[Cross compile packages]:architecture:($archs)' \
+ 	'-C[Do not remove build directory/autodeps/destdir]' \
+ 	'-E[Exit immediately when binary package already exists]' \
+@@ -64,9 +65,7 @@
+ 		case $words[1] in
+ 			build|check|configure|extract|fetch|install|patch|pkg|show|show-avail|show-build-deps|show-hostmakedepends|show-makedepends|show-options|update-check)
+ 				_arguments ':package:_xbps_src_all_packages' && ret=0;;
+-			binary-bootstrap)
+-				_arguments '::architecture:($archs)' && ret=0;;
+-			bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
++			binary-bootstrap|bootstrap|bootstrap-update|chroot|clean-repocache|consistency-check|list|purge-distfiles|remove-autodeps|show-repo-updates|show-sys-updates|update-bulk|update-sys|update-hash-cache)
+ 				# no further arguments
+ 				ret=0;;
+ 			clean)
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 5b34b331d58da..060a70563aeb7 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
 version=0.59.2
-revision=1
+revision=2
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"

From af11ee6f1aab718ccfef9cd060b46bcdc7e6ddec Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 16 Jan 2024 23:33:30 -0500
Subject: [PATCH 3/3] README.md: update documentation for new masterdir
 creation

---
 README.md | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8710f20ae1916..bd7fed879019f 100644
--- a/README.md
+++ b/README.md
@@ -217,7 +217,7 @@ The following directory hierarchy is used with a default configuration file:
             |  |- repocache ...
             |  |- sources ...
             |
-            |- masterdir
+            |- masterdir-<arch>
             |  |- builddir -> ...
             |  |- destdir -> ...
             |  |- host -> bind mounted from <hostdir>
@@ -226,7 +226,7 @@ The following directory hierarchy is used with a default configuration file:
 
 The description of these directories is as follows:
 
- - `masterdir`: master directory to be used as rootfs to build/install packages.
+ - `masterdir-<arch>`: master directory to be used as rootfs to build/install packages.
  - `builddir`: to unpack package source tarballs and where packages are built.
  - `destdir`: to install packages, aka **fake destdir**.
  - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled.
@@ -450,7 +450,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
 
     $ ./xbps-src binary-bootstrap
 
-The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
+The default masterdir is created in the current working directory, i.e. `void-packages/masterdir-<arch>`, where `<arch>` for the default masterdir is is the native xbps architecture.
 
 <a name="remaking-masterdir"></a>
 ### Remaking the masterdir
@@ -477,20 +477,21 @@ Two ways are available to build 32bit packages on x86\_64:
 
 The canonical mode (native) needs a new x86 `masterdir`:
 
-    $ ./xbps-src -m masterdir-x86 binary-bootstrap i686
-    $ ./xbps-src -m masterdir-x86 ...
+    $ ./xbps-src -A i686 binary-bootstrap
+    $ ./xbps-src -A i686 ...
 
 <a name="building-for-musl"></a>
 ### Building packages natively for the musl C library
 
-Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
+The canonical way of building packages for same architecture but different C library is through a dedicated masterdir by using the host architecture flag `-A`.
 To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
 
-    $ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
+    $ ./xbps-src -A x86_64-musl binary-bootstrap
 
+This will create and bootstrap a new masterdir called `masterdir-x86_64-musl` that will be used when `-A x86_64-musl` is specified.
 Your new masterdir is now ready to build packages natively for the musl C library:
 
-    $ ./xbps-src -m masterdir-x86_64-musl pkg ...
+    $ ./xbps-src -A x86_64-musl pkg ...
 
 <a name="building-base-system"></a>
 ### Building void base-system from scratch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PR PATCH] [Merged]: [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
  2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
                   ` (19 preceding siblings ...)
  2024-01-22 20:15 ` [PR PATCH] [Updated] " classabbyamp
@ 2024-01-23  3:57 ` the-maldridge
  20 siblings, 0 replies; 22+ messages in thread
From: the-maldridge @ 2024-01-23  3:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]

There's a merged pull request on the void-packages repository

[RFC] xbps-src: add -A flag for host arch, create masterdir per host arch
https://github.com/void-linux/void-packages/pull/46263

Description:
#### Testing the changes
- I tested the changes in this PR: **YES**

### Overview

- default masterdir naming now includes the host `XBPS_ARCH`, e.g. `masterdir-x86_64`
- setting the host `XBPS_ARCH` can be done with `-A <arch>`
    - This will create a new masterdir per host arch automatically
- using an arbitrary masterdir is still supported via `-m <masterdir>`, and overrides whatever `-A` would set
- the invocation of `[binary-]bootstrap` no longer (ab)uses `$XBPS_TARGET_PKG` for setting the masterdir's host architecture

#### Before
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ls
... masterdir-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -m masterdir-musl binary-bootstrap x86_64-musl
$ ./xbps-src -m masterdir-musl -a aarch64-musl pkg foo
```

#### After
*default:*
```
$ ./xbps-src binary-bootstrap
$ ls
... masterdir-x86_64 ...
```
*nondefault masterdir:*
```
$ ./xbps-src -m masterdir-idk binary-bootstrap
$ ls
... masterdir-idk ...
```
*specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ls
... masterdir-x86_64-musl ...
```
*cross with specific host arch:*
```
$ ./xbps-src -A x86_64-musl binary-bootstrap
$ ./xbps-src -A x86_64-musl -a aarch64-musl pkg foo
```

### Thoughts
- ~~By removing the `[binary-]bootstrap [arch]` invocation style, there will be changes needed to buildbot configuration. If left in, should `-A <arch>` take priority over `[arch]` if both are specified?~~ buildbot config will be changed
- ~~This could be an opportunity to change the name of `masterdir` to something else, like `masterdir` (the containers CI uses are already called `void-buildroot-<libc>`)~~ if this changes, it will be separate; there's too much to change both coherently

### TODO
- [x] various documentation/other xbps-src changes as needed
- [x] buildbot changes if needed


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-01-23  3:57 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26  7:52 [PR PATCH] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch classabbyamp
2023-09-26  8:00 ` [PR PATCH] [Updated] " classabbyamp
2023-09-26  8:10 ` classabbyamp
2023-09-26  8:11 ` classabbyamp
2023-09-26  8:13 ` classabbyamp
2023-09-26  8:17 ` classabbyamp
2023-09-26 11:43 ` lemmi
2023-09-26 18:51 ` SpidFightFR
2023-09-26 18:53 ` [PR REVIEW] " classabbyamp
2023-12-26  1:45 ` github-actions
2023-12-26 17:54 ` [PR PATCH] [Updated] " classabbyamp
2024-01-17  4:34 ` classabbyamp
2024-01-17  4:46 ` classabbyamp
2024-01-17  4:50 ` classabbyamp
2024-01-17  4:51 ` classabbyamp
2024-01-17  5:02 ` classabbyamp
2024-01-17  5:44 ` classabbyamp
2024-01-17  6:50 ` [PR PATCH] [Updated] [RFC] xbps-src: add -A flag for host arch, create buildroot per host arch, rename masterdir to buildroot classabbyamp
2024-01-22 18:00 ` classabbyamp
2024-01-22 19:58 ` [PR REVIEW] [RFC] xbps-src: add -A flag for host arch, create masterdir per host arch ahesford
2024-01-22 20:15 ` [PR PATCH] [Updated] " classabbyamp
2024-01-23  3:57 ` [PR PATCH] [Merged]: " the-maldridge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).