From 01f35ed9fffde74ce22e7fafb336f49fef4427b3 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 3 Feb 2023 16:12:59 -0500 Subject: sbopkglint: add pre-doinst test. --- sbopkglint | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'sbopkglint') diff --git a/sbopkglint b/sbopkglint index d234e39..7e1638e 100755 --- a/sbopkglint +++ b/sbopkglint @@ -502,6 +502,41 @@ for package in $packages; do VERSION="$( echo $filename | rev | cut -d- -f3 | rev )" PKG="$( mktemp -d $TMP/sbopkglint.XXXXXX )" + totalwarns=0 + foundtests=0 + + # pre-doinst test requires extracting the package *without* + # running its doinst.sh. this is so we can check for e.g. + # /usr/info/dir existing in the package (rather than being + # created by doinst, which would be OK). + echo -n "Exploding $package to $PKG ..." + olddir="$( pwd )" + cd "$PKG" + explodepkg "$PKG" &> $PKG/.tmp.$$ + S="$?" + if [ "$S" != "0" ]; then + echo "FAILED" + echo "explodepkg exited with status $S" + rm -rf $PKG + exit_status=1 + continue + fi + echo "OK" + + echo -n "Running pre-doinst test..." + warncount=0 + source $testdir/pre-doinst.sh + if [ "$warncount" = "0" ]; then + echo "OK" + else + echo "FAILED" + : $(( totalwarns += warncount )) + fi + cd "$olddir" + rm -rf $PKG + mkdir -p $PKG + + # now the "real" tests echo -n "Installing $package to $PKG ..." /sbin/installpkg -root "$PKG" "$package" &> $PKG/.tmp.$$ S="$?" @@ -521,8 +556,6 @@ for package in $packages; do olddir="$( pwd )" cd "$PKG" - totalwarns=0 - foundtests=0 for testscript in $testdir/*.t.sh; do foundtests=1 ( -- cgit v1.2.3