From 391aa4e6621986518ac3597f23af2b8916dd891a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 2 Aug 2018 23:45:33 -0400 Subject: chcleanup: Consider _$CARCH deps Also, don't parse PKGBUILD ourself; use .SRCINFO to extract information from the PKGBUILD. --- src/chroot-tools/chcleanup.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in index 411fc4b..06f3eda 100644 --- a/src/chroot-tools/chcleanup.in +++ b/src/chroot-tools/chcleanup.in @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Copyright (C) 2011-2012 Nicolás Reynolds -# Copyright (C) 2012-2013, 2015, 2017 Luke Shumaker +# Copyright (C) 2012-2013, 2015, 2017-2018 Luke Shumaker # # If you don't see m4_include(...) below, but see function definitions # for msg() et al., then this is a generated file, and contains some @@ -54,13 +54,13 @@ fi # intentionally hard-coded. source /etc/libretools.d/chroot.conf # If we're running makepkg -if [[ -f PKGBUILD ]]; then +if [[ -f ./PKGBUILD ]]; then + if [[ ! -f ./.SRCINFO || ./PKGBUILD -nt ./.SRCINFO ]]; then + sudo -u "#$(stat -c %u -- ./PKGBUILD)" sh -c 'makepkg --printsrcinfo > .SRCINFO' + fi CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")" - export CARCH - source ./PKGBUILD - CHROOTEXTRAPKG+=("${depends[@]}" - "${makedepends[@]}" - "${checkdepends[@]}") + mapfile -t all_depends < <(sed -nE "s/^\\s+(|make|check)depends(|_${CARCH}) = //p" < .SRCINFO) + CHROOTEXTRAPKG+=("${all_depends[@]}") fi msg "Cleaning chroot..." -- cgit v1.2.2