aboutsummaryrefslogtreecommitdiff
path: root/sbopkglint
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-02-03 16:12:59 -0500
committerB. Watson <urchlay@slackware.uk>2023-02-03 16:12:59 -0500
commit01f35ed9fffde74ce22e7fafb336f49fef4427b3 (patch)
treed2a295d24a7ce5648db7b84e91d630a3b322fefe /sbopkglint
parent92f98a10b4b07885ce48556e94ae476c54057226 (diff)
downloadsbo-maintainer-tools-01f35ed9fffde74ce22e7fafb336f49fef4427b3.tar.gz
sbopkglint: add pre-doinst test.
Diffstat (limited to 'sbopkglint')
-rwxr-xr-xsbopkglint37
1 files changed, 35 insertions, 2 deletions
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
(