diff options
-rw-r--r-- | TODO | 12 | ||||
-rwxr-xr-x | sbopkglint | 37 | ||||
-rw-r--r-- | sbopkglint.d/05-basic-sanity.t.sh | 2 | ||||
-rw-r--r-- | sbopkglint.d/pre-doinst.sh | 42 |
4 files changed, 77 insertions, 16 deletions
@@ -11,23 +11,11 @@ Future test ideas: test (doinst can and should create these; they should *not* just be files in the package). -- noarch could recommend a package be made noarch, if it contains no - ELF files and doesn't use lib or lib64 dirs. Should this just - be a recommendation, or should it count as a failed test? - - static libraries? some packages ship these because upstream doesn't support shared libs, though. maybe only complain if libfoo.so.* and libfoo.a both exist (if we have a shared lib, we shouldn't also have a static one). Maybe this should be a disable-able warning? -- icons. Make sure they are what their filename says (I've run into .png - files named .svg, and .gif files named .png, etc). If they're in - /usr/share/icons/<size>x<size>/, make sure they actually are the correct - size (or that they're SVG, if they're in scalable/). Really large icons - in /usr/share/pixmaps are probably useless (most stuff that uses the - old-style icons expects them to be 48x48 or 64x64). Icons must be - readable by everyone, non-executable, and owned by root:root. - - duplicate files, maybe the error message could suggest a "ln -s" command to use if the file really does need to appear in multiple dirs. @@ -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 ( diff --git a/sbopkglint.d/05-basic-sanity.t.sh b/sbopkglint.d/05-basic-sanity.t.sh index 3b98c74..b879729 100644 --- a/sbopkglint.d/05-basic-sanity.t.sh +++ b/sbopkglint.d/05-basic-sanity.t.sh @@ -50,8 +50,6 @@ requiredfiles="usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild" # these files must not exist. badfiles="\ -usr/info/dir \ -usr/info/dir.gz \ usr/lib64/perl5/perllocal.pod \ usr/lib/perl5/perllocal.pod \ usr/share/perl5/perllocal.pod \ diff --git a/sbopkglint.d/pre-doinst.sh b/sbopkglint.d/pre-doinst.sh new file mode 100644 index 0000000..8df1a8c --- /dev/null +++ b/sbopkglint.d/pre-doinst.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# sbopkglint test, must be sourced by sbopkglint (not run standalone). + +# PKG, PRGNAM, VERSION, ARCH are set by sbopkglint. also the current +# directory is the root of the installed package tree. + +# Unlike the rest of the tests (those ending in .t.sh), this one runs +# before the package's doinst.sh does. Purpose for this is to check +# for the existence of stuff in the package tarball that shouldn't be +# there (e.g. /usr/info/dir), but might correctly be created by doinst.sh. + +####################################################################### +badfiles="\ +usr/info/dir \ +usr/info/dir.gz \ +usr/share/icons/hicolor/icon-theme.cache \ +usr/share/glib-2.0/schemas/gschemas.compiled \ +usr/share/mime/mime.cache \ +usr/share/applications/mimeinfo.cache \ +usr/lib/gio/modules/giomodule.cache \ +usr/lib64/gio/modules/giomodule.cache \ +var/cache/fontconfig/CACHEDIR.TAG \ +var/cache/man/usr-man/CACHEDIR.TAG" + +for i in $badfiles; do + if [ -e "$i" ]; then + warn "package contains forbidden file: $i" + fi +done + +if [ -d usr/share/fonts ]; then + badfontstuff="$( find usr/share/fonts -name 'fonts.*' )" + if [ -n "$badfontstuff" ]; then + warn "package contains forbidden file(s): $badfontstuff" + fi +fi + +badlinks="$( find -P . -type l )" +if [ -n "$badfontstuff" ]; then + warn "package contains actual symlinks: $badlinks" +fi |