From e0dd3257a8b2c5cbc719b074efbcdf482de64b43 Mon Sep 17 00:00:00 2001 From: Filippo Squillace Date: Sun, 15 Dec 2019 11:55:27 +0000 Subject: [PATCH 1/2] Add support for ARM arch during build and check --- .travis.yml | 8 +++++--- lib/checks/check.sh | 5 +++-- lib/core/build.sh | 17 ++++++++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index dceb835..13c3d4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ script: - sudo -E ${PWD}/bin/junest groot -- ${PWD}/lib/checks/check.sh --run-root-tests - yes | junest setup --delete - # Disable arm because it fails when exiting from check.sh for apparent no reason - #- JUNEST_HOME=~/.junest-arm junest proot -f -- ./lib/checks/check.sh --skip-aur-tests - #- yes | JUNEST_HOME=~/.junest-arm junest setup --delete + - JUNEST_HOME=~/.junest-arm junest proot --fakeroot -- ${PWD}/lib/checks/check.sh + - JUNEST_HOME=~/.junest-arm junest ns -- ${PWD}/lib/checks/check.sh + # Do not run root test because iftop does not work well in arm + - JUNEST_HOME=~/.junest-arm sudo -E ${PWD}/bin/junest groot -- ${PWD}/lib/checks/check.sh + - yes | JUNEST_HOME=~/.junest-arm junest setup --delete diff --git a/lib/checks/check.sh b/lib/checks/check.sh index 9ee7505..55acd1b 100755 --- a/lib/checks/check.sh +++ b/lib/checks/check.sh @@ -64,7 +64,7 @@ pacman --noconfirm -Rsn ${repo_package1} repo_package2=iftop info "Checking ${repo_package2} package from official repo..." pacman --noconfirm -S ${repo_package2} -$RUN_ROOT_TESTS && iftop -t -s 5 +$RUN_ROOT_TESTS && iftop -t -s 5 -i lo pacman --noconfirm -Rsn ${repo_package2} if ! $SKIP_AUR_TESTS @@ -74,7 +74,8 @@ then maindir=$(mktemp -d -t ${CMD}.XXXXXXXXXX) builtin cd ${maindir} curl -L -J -O -k "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=${aur_package}" - /opt/makepkg/bin/makepkg -sfc --noconfirm + # -A allows to ignore arch for ARM + /opt/makepkg/bin/makepkg -Asfc --noconfirm pacman --noconfirm -U ${aur_package}*.pkg.tar.xz pacman --noconfirm -Rsn ${aur_package} diff --git a/lib/core/build.sh b/lib/core/build.sh index faf7f08..898551a 100644 --- a/lib/core/build.sh +++ b/lib/core/build.sh @@ -55,7 +55,9 @@ function build_image_env(){ # The archlinux-keyring and libunistring are due to missing dependencies declaration in ARM archlinux # All the essential executables (ln, mkdir, chown, etc) are in coreutils # unshare command belongs to util-linux - sudo pacstrap -G -M -d ${maindir}/root pacman coreutils libunistring archlinux-keyring util-linux + local arm_keyring="" + [[ $(uname -m) == *"arm"* ]] && arm_keyring="archlinuxarm-keyring" + sudo pacstrap -G -M -d ${maindir}/root pacman coreutils libunistring archlinux-keyring $arm_keyring util-linux sudo bash -c "echo 'Server = $DEFAULT_MIRROR' >> ${maindir}/root/etc/pacman.d/mirrorlist" sudo mkdir -p ${maindir}/root/run/lock @@ -76,8 +78,17 @@ function build_image_env(){ sudo pacman --noconfirm --root ${maindir}/root -Rsn sed gzip info "Setting up the pacman keyring (this might take a while!)..." - sudo ${maindir}/root/opt/junest/bin/groot -b /dev ${maindir}/root bash -c \ - "pacman-key --init; pacman-key --populate archlinux; [ -e /etc/pacman.d/gnupg/S.gpg-agent ] && gpg-connect-agent -S /etc/pacman.d/gnupg/S.gpg-agent killagent /bye" + # gawk command is required for pacman-key + sudo pacman --noconfirm --root ${maindir}/root -S gawk + sudo ${maindir}/root/opt/junest/bin/groot -b /dev ${maindir}/root bash -c ' + pacman-key --init; + for keyring_file in /usr/share/pacman/keyrings/*.gpg; + do + keyring=$(basename $keyring_file | cut -f 1 -d "."); + pacman-key --populate $keyring; + done; + [ -e /etc/pacman.d/gnupg/S.gpg-agent ] && gpg-connect-agent -S /etc/pacman.d/gnupg/S.gpg-agent killagent /bye' + sudo pacman --noconfirm --root ${maindir}/root -Rsn gawk sudo rm ${maindir}/root/var/cache/pacman/pkg/* # This is needed on system with busybox tar command. From 11a439499bfacc85e5b006f41d37237d29be06bc Mon Sep 17 00:00:00 2001 From: Filippo Squillace Date: Sun, 15 Dec 2019 13:05:14 +0000 Subject: [PATCH 2/2] Remove interface lo when checking iftop --- .travis.yml | 3 --- lib/checks/check.sh | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 13c3d4a..38470dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,4 @@ script: - yes | junest setup --delete - JUNEST_HOME=~/.junest-arm junest proot --fakeroot -- ${PWD}/lib/checks/check.sh - - JUNEST_HOME=~/.junest-arm junest ns -- ${PWD}/lib/checks/check.sh - # Do not run root test because iftop does not work well in arm - - JUNEST_HOME=~/.junest-arm sudo -E ${PWD}/bin/junest groot -- ${PWD}/lib/checks/check.sh - yes | JUNEST_HOME=~/.junest-arm junest setup --delete diff --git a/lib/checks/check.sh b/lib/checks/check.sh index 55acd1b..fb60ff0 100755 --- a/lib/checks/check.sh +++ b/lib/checks/check.sh @@ -64,7 +64,7 @@ pacman --noconfirm -Rsn ${repo_package1} repo_package2=iftop info "Checking ${repo_package2} package from official repo..." pacman --noconfirm -S ${repo_package2} -$RUN_ROOT_TESTS && iftop -t -s 5 -i lo +$RUN_ROOT_TESTS && iftop -t -s 5 pacman --noconfirm -Rsn ${repo_package2} if ! $SKIP_AUR_TESTS