[csw-maintainers] [GAR] Simple checks for package installation image in PKGROOT

Maciej Bliziński maciej at opencsw.org
Sat Mar 5 09:12:53 CET 2011


Here's an idea I would like to share.  It happened quite a few times
that I saw recurring problems with certain packages, mostly MySQL and
PostgreSQL when working on them.  It was usually as simple as a
missing file, or a surplus file, or a file in a wrong directory.
checkpkg couldn't help, because it only implements global checks - the
ones that apply to all packages in the catalog.  In these cases, I
wanted checks specific to the software I was building.

I first wanted to have support for such checks in GAR, but I've
recently came to a conclusion that it's best to handle such checking
outside of it.

Since the nature of such tests is hard to predict, writing (simple!)
ad-hoc shell scripts looks like the best approach.  I left one
example[1] on GAR issue tracker.

The basic idea is simple: in the post-merge step, when the
installation image is ready, we're calling a shell script.  The shell
script is run with "set -e", meaning that any failed command in the
shell script will abort it with an error exit status code.  In GNU
make, this results in the build being stopped.  I've also used "set
-x" in my example, so in case of failure, it is immediately visible,
what command has failed.

In the GAR build description:

post-merge:
  $(FILEDIR)/check_pkgroot.sh "$(PKGROOT)"

The checking script itself:

#!/opt/csw/bin/bash
declare -r PKGROOT="$1"
if [[ -z "${PKGROOT}" ]]
then
  echo "Please give an argument."
  exit 1
fi
set -u
set -e
set -x
# Look for unexpanded variables
! grep @sysconfdir@ ${PKGROOT}/etc/opt/csw/init.d/cswpostgres_9_0
# This symlink is not supposed to be there
! test -h ${PKGROOT}/opt/csw/lib/postgresql/9.0/lib/libecpg.so

Maciej

[1] http://sourceforge.net/apps/trac/gar/ticket/18#comment:3


More information about the maintainers mailing list