xbps-src: implement a 'check' stage

Add another stage 'check' between 'build' and 'install'. It is be enabled using the
variable XBPS_CHECK_PKGS=yes and disabled if unset, set to "0" or "no" in your
local etc/conf.

A new xbps-src option `-q` for `quick` will disable XBPS_CHECK_PKGS by overriding it to 0.
If enabled, `common/xbps-src/shutils/xbps-src-docheck.sh` checks for an existing
`do_check()` function in the package's template and, if it exists, calls it.

A new template variable `checkdepends` may be present and list packages required
to run the `do_check()` function. Example: `checkdepends="bc unittest-cpp"`.
This commit is contained in:
Jürgen Buchmüller 2017-02-23 22:03:31 +01:00
parent f9dface61c
commit c31dd888f6
14 changed files with 156 additions and 13 deletions

View file

@ -4,7 +4,7 @@ consistency_check_existing () {
while IFS=" " read -r dep origname deplabel; do
[ -f "$XBPS_SRCPKGDIR/$dep/template" ] && continue
case "$deplabel" in
makedepends|hostmakedepends)
makedepends|hostmakedepends|checkdepends)
msg_warn "unsatisfied $deplabel in $origname: $dep does not exist\n";
;;
*) printf "%s %s %s\n" "$dep" "$origname" "$deplabel" ;;
@ -16,7 +16,7 @@ consistency_convert_pkgname () {
local origname= pkgname version= revision=
while IFS=" " read -r dep origname deplabel; do
case "$deplabel" in
makedepends|hostmakedepends)
makedepends|hostmakedepends|checkdepends)
printf "%s %s %s\n" "$dep" "$origname" "$deplabel"
continue
;;
@ -41,7 +41,7 @@ consistency_check_smart () {
local pkgname= depdef= dep=
while IFS=" " read -r depdef origname deplabel; do
case "$deplabel" in
makedepends|hostmakedepends)
makedepends|hostmakedepends|checkdepends)
printf "%s %s %s\n" "$depdef" "$origname" "$deplabel"
continue
;;
@ -73,6 +73,7 @@ consistency_check() {
[ -L "$XBPS_SRCPKGDIR/$XBPS_TARGET_PKG" ] && continue
[ "$makedepends" ] && printf "%s $pkgname makedepends\n" $makedepends
[ "$hostmakedepends" ] && printf "%s $pkgname hostmakedepends\n" $hostmakedepends
[ "$checkdepends" ] && printf "%s $pkgname checkdepends\n" $checkdepends
)
done | grep -v "^virtual?" | sed "s/^[^ ]*?//" | consistency_check_existing | \
consistency_convert_pkgname | consistency_check_smart