From 144f8966608211f85fb492a4cce3c159989dd2eb Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Wed, 11 Sep 2019 23:10:04 +0200 Subject: makechrootpkg: run checkpkg automatically after build Cache previous versions required for checkpkg via pacman to avoid multiple downloads when running multiple times. In case we can't download the packages, like while building out of repo packages, print a warning instead of running checkpkg Signed-off-by: Levente Polyak --- archbuild.in | 2 +- makechrootpkg.in | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/archbuild.in b/archbuild.in index 69bb029..9e32292 100644 --- a/archbuild.in +++ b/archbuild.in @@ -5,7 +5,7 @@ m4_include(lib/common.sh) m4_include(lib/archroot.sh) base_packages=(base-devel) -makechrootpkg_args=(-c -n) +makechrootpkg_args=(-c -n -C) cmd="${0##*/}" if [[ "${cmd%%-*}" == 'multilib' ]]; then diff --git a/makechrootpkg.in b/makechrootpkg.in index 2407115..90a812d 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -28,6 +28,7 @@ keepbuilddir=0 update_first=0 clean_first=0 run_namcap=0 +run_checkpkg=0 temp_chroot=0 bindmounts_ro=() @@ -72,6 +73,7 @@ usage() { echo ' Useful for maintaining multiple copies' echo " Default: $copy" echo '-n Run namcap on the package' + echo '-C Run checkpkg on the package' echo '-T Build in a temporary directory' echo '-U Run makepkg as a specified user' exit 1 @@ -289,7 +291,7 @@ move_products() { } # }}} -while getopts 'hcur:I:l:nTD:d:U:' arg; do +while getopts 'hcur:I:l:nCTD:d:U:' arg; do case "$arg" in c) clean_first=1 ;; D) bindmounts_ro+=("--bind-ro=$OPTARG") ;; @@ -299,6 +301,7 @@ while getopts 'hcur:I:l:nTD:d:U:' arg; do I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; n) run_namcap=1; makepkg_args+=(--install) ;; + C) run_checkpkg=1 ;; T) temp_chroot=1; copy+="-$$" ;; U) makepkg_user="$OPTARG" ;; h|*) usage ;; @@ -385,6 +388,11 @@ if arch-nspawn "$copydir" \ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ /chrootbuild "${makepkg_args[@]}" then + pkgnames=() + for pkgfile in "$copydir"/pkgdest/*; do + pkgfile=${pkgfile##*/}; + pkgnames+=("${pkgfile%-*-*-*}"); + done move_products else (( ret += 1 )) @@ -399,5 +407,15 @@ if (( ret != 0 )); then die "Build failed, check %s/build" "$copydir" fi else + if (( run_checkpkg )); then + msg "Running checkpkg" + msg2 "Downloading current versions" + if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then + msg2 "Checking packages" + sudo -u "$makepkg_user" checkpkg + else + warning "Skipped checkpkg due to missing packages" + fi + fi true fi -- cgit v1.2.3-70-g09d2