[arch-projects] [devtools] [PATCH] arch-nspawn should use the correct pacman config file

2019-04-02 Thread arch--- via arch-projects
From: Erich Eckner 

If arch-nspawn is called with -C, pacman inside the chroot will use
the provided configuration file. This should also be the case for
$pacconf_cmd and pacman outside the chroot.

If arch-nspawn is called without -C, pacman inside the chroot will
use $workdir/etc/pacman.conf -- again, $pacconf_cmd and pacman
outside the chroot should use that, too. So lets just set $pac_conf
in that case.

For example, Arch Linux 32 provides separate pacman configurations
inside /usr/share/devtools which use /etc/pacman.d/mirrorlist32 as
mirrorlist for their build commands (extra-i686-build, etc.). This
way, we can build i686 and x86_64 packages on the same x86_64 host
with very minimal changes to devtools.

Signed-off-by: Erich Eckner 
---
 arch-nspawn.in | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch-nspawn.in b/arch-nspawn.in
index e68e2e75..cebeb2ec 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -52,16 +52,17 @@ shift 1
 
 [[ -z $working_dir ]] && die 'Please specify a working directory.'
 
+[[ -z $pac_conf ]] && pac_conf="$working_dir/etc/pacman.conf"
+
 if [[ -z $cache_dir ]]; then
-   cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache 
Dirs:\s*//g'))
+   cache_dirs=($(pacman --config "$pac_conf" -v 2>&1 | grep '^Cache Dirs:' 
| sed 's/Cache Dirs:\s*//g'))
 else
cache_dirs=("$cache_dir")
 fi
 
 pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
 # shellcheck disable=2016
-host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 
's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
-# shellcheck disable=2016
+host_mirrors=($($pacconf_cmd --conf "$pac_conf" --repo extra Server 2> 
/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
 
 # {{{ functions
 build_mount_args() {
-- 
2.21.0


[arch-projects] [devtools] [PATCH] fix whitespace/indentation errors

2019-04-02 Thread arch--- via arch-projects
From: Erich Eckner 

Some lines are indented by spaces, while adjacent lines are indentet by tabs.
We should use tabs on both.

Signed-off-by: Erich Eckner 
---
 archbuild.in| 2 +-
 find-libdeps.in | 2 +-
 mkarchroot.in   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/archbuild.in b/archbuild.in
index bd5706d5..163a1082 100644
--- a/archbuild.in
+++ b/archbuild.in
@@ -71,7 +71,7 @@ else
-C "@pkgdatadir@/pacman-${repo}.conf" \
-M "@pkgdatadir@/makepkg-${arch}.conf" \
"${chroots}/${repo}-${arch}/root" \
-pacman -Syu --noconfirm || abort
+   pacman -Syu --noconfirm || abort
 fi
 
 # Always build official packages reproducibly
diff --git a/find-libdeps.in b/find-libdeps.in
index 07ba3d84..7a3e6f5d 100644
--- a/find-libdeps.in
+++ b/find-libdeps.in
@@ -57,7 +57,7 @@ process_sofile() {
 
 case $script_mode in
deps) find_args=(-perm -u+x);;
-provides) find_args=(-name '*.so*');;
+   provides) find_args=(-name '*.so*');;
 esac
 
 find . -type f "${find_args[@]}" | while read -r filename; do
diff --git a/mkarchroot.in b/mkarchroot.in
index 52e363fc..a9a5a0fe 100644
--- a/mkarchroot.in
+++ b/mkarchroot.in
@@ -84,7 +84,7 @@ while read -r varname; do
 done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i 
'_proxy$')
 env -i "${_env[@]}" \
 pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
-  "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
+   "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all 
packages'
 
 printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
 echo 'LANG=en_US.UTF-8' > "$working_dir/etc/locale.conf"
-- 
2.21.0