Fix aur validation tests and include sudo-fake in codebase

This commit is contained in:
Filippo Squillace 2018-10-29 22:01:09 +11:00
parent cc351f419d
commit 6361522e40
6 changed files with 76 additions and 16 deletions

3
.gitignore vendored
View file

@ -1 +1,4 @@
*.swp
*pkg.tar.xz
*.tar.gz
*.SRCINFO

View file

@ -12,8 +12,6 @@ install:
- PATH=$PWD/bin:$PATH
- junest -- echo "Installing JuNest (\$(uname -m))"
- JUNEST_HOME=~/.junest-arm junest -a arm -- echo "Installing JuNest (\$(uname -m))"
# TODO: Remember to enable x86 tests when fixed
#- JUNEST_HOME=~/.junest-x86 junest -a x86 -- echo "Installing JuNest (\$(uname -m))"
script:
- bash --version
@ -21,10 +19,11 @@ script:
- bash ./tests/unit-tests/unit-tests.sh
# Multiple tests against different execution modes:
- junest -f -- ${PWD}/lib/checks/check.sh
- junest -u -- ${PWD}/lib/checks/check.sh
- sudo -E ${PWD}/bin/junest -g -- ${PWD}/lib/checks/check.sh --run-root-tests
# TODO AUR installation check is currently disabled
- junest -f -- ${PWD}/lib/checks/check.sh --skip-aur-tests
- junest -u -- ${PWD}/lib/checks/check.sh --skip-aur-tests
- sudo -E ${PWD}/bin/junest -g -- ${PWD}/lib/checks/check.sh --skip-aur-tests
- yes | junest --delete
- JUNEST_HOME=~/.junest-arm junest -f -- ./lib/checks/check.sh
- JUNEST_HOME=~/.junest-arm junest -f -- ./lib/checks/check.sh --skip-aur-tests
- yes | JUNEST_HOME=~/.junest-arm junest --delete

View file

@ -265,8 +265,8 @@ As a fallback it tries to run the same executable if it is available in the JuNe
image.
## Automatic building of the JuNest images ##
The JuNest images are built every week so that you can always get the most
updated package versions.
There is not periodic automation build of the JuNest images yet.
This was due to the difficulty to automate builds for arm architecture.
## Static QEMU binaries ##
There are static QEMU binaries included in JuNest image that allows to run JuNest

View file

@ -31,6 +31,10 @@ source "${JUNEST_BASE}/lib/core/common.sh"
info "Validating JuNest located in ${JUNEST_HOME}..."
info "Initial JuNest setup..."
# The following ensures that the gpg agent gets killed (if exists)
# otherwise it is not possible to exit from the session
trap "[[ -e /etc/pacman.d/gnupg/S.gpg-agent ]] && gpg-connect-agent -S /etc/pacman.d/gnupg/S.gpg-agent killagent /bye" QUIT EXIT ABRT KILL TERM INT
echo "Server = ${DEFAULT_MIRROR}" >> /etc/pacman.d/mirrorlist
pacman --noconfirm -Syy
pacman --noconfirm -S archlinux-keyring
@ -59,14 +63,15 @@ pacman --noconfirm -Rsn ${repo_package2}
if ! $SKIP_AUR_TESTS
then
aur_package=tcptraceroute
aur_package=cower
info "Checking ${aur_package} package from AUR repo..."
gpg --recv-key --keyserver hkp://pgp.mit.edu 1EB2638FF56C0C53
yogurt -A --noconfirm -S ${aur_package}
$RUN_ROOT_TESTS && tcptraceroute localhost
${aur_package} --help
pacman --noconfirm -Rsn ${aur_package}
fi
# The following ensure that the gpg agent gets killed (if exists)
# The following ensures that the gpg agent gets killed (if exists)
# otherwise it is not possible to exit from the session
[[ -e /etc/pacman.d/gnupg/S.gpg-agent ]] && gpg-connect-agent -S /etc/pacman.d/gnupg/S.gpg-agent killagent /bye

View file

@ -15,7 +15,7 @@ function _check_package(){
fi
}
function _install_from_aur(){
function _install_pkg_from_aur(){
local maindir=$1
local pkgname=$2
local installname=$3
@ -27,6 +27,14 @@ function _install_from_aur(){
sudo pacman --noconfirm --root ${maindir}/root -U ${pkgname}*.pkg.tar.xz
}
function _install_pkg(){
local maindir=$1
local pkgbuilddir=$2
builtin cd ${pkgbuilddir}
makepkg -sfcd
sudo pacman --noconfirm --root ${maindir}/root -U *.pkg.tar.xz
}
function build_image_env(){
umask 022
@ -55,13 +63,13 @@ function build_image_env(){
# AUR packages requires non-root user to be compiled. proot fakes the user to 10
info "Compiling and installing yaourt..."
_install_from_aur ${maindir} "package-query"
_install_from_aur ${maindir} "yaourt"
_install_from_aur ${maindir} "sudo-fake"
_install_pkg_from_aur ${maindir} "package-query"
_install_pkg_from_aur ${maindir} "yaourt"
_install_pkg ${maindir} "$JUNEST_BASE/pkgs/sudo-fake"
info "Install ${NAME} script..."
sudo pacman --noconfirm --root ${maindir}/root -S git
_install_from_aur ${maindir} "${CMD}-git" "${CMD}.install"
_install_pkg_from_aur ${maindir} "${CMD}-git" "${CMD}.install"
sudo pacman --noconfirm --root ${maindir}/root -Rsn git
info "Generating the locales..."

45
pkgs/sudo-fake/PKGBUILD Normal file
View file

@ -0,0 +1,45 @@
# Maintainer: Filippo Squillace <feel dot sqoox at gmail dot com>
# More details on how to change this file:
# https://wiki.archlinux.org/index.php/PKGBUILD
# https://wiki.archlinux.org/index.php/Creating_packages
# https://wiki.archlinux.org/index.php/Arch_User_Repository#Submitting_packages
pkgname=sudo-fake
pkgver=0.1.0
pkgrel=1
pkgdesc="Simple script that bypasses sudo and execute the actual command. Useful for fakeroot environments."
arch=('any')
url=""
license=('GPL')
groups=()
depends=()
makedepends=()
provides=('sudo')
conflicts=('sudo')
backup=()
options=()
#install=
source=()
md5sums=()
noextract=()
package() {
install -d -m 755 "${pkgdir}/usr/bin/"
cat <<EOF > "${pkgdir}/usr/bin/sudo"
#!/bin/bash
for opt in "\$@"
do
case "\$1" in
--) shift ; break ;;
-*) shift ;;
*) break ;;
esac
done
[[ -z "\${@}" ]] || "\${@}"
EOF
chmod 755 "${pkgdir}/usr/bin/sudo"
}
# vim:set ts=2 sw=2 et: