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 <anthraxx@archlinux.org>
This commit is contained in:
parent
bbcff883d5
commit
144f896660
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue