From aa83569fcbd0c9475f49915baa83567eefd2bd7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= Date: Tue, 20 Apr 2021 00:05:49 +0200 Subject: [PATCH] xbps-src: add make_check=ci-skip --- Manual.md | 14 +++++++++----- common/travis/prepare.sh | 1 + common/xbps-src/libexec/xbps-src-docheck.sh | 6 ++++++ etc/defaults.conf | 6 ++++++ xbps-src | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Manual.md b/Manual.md index 8c2afbaca71..73cd9088f9b 100644 --- a/Manual.md +++ b/Manual.md @@ -176,9 +176,8 @@ can be used to perform other operations before configuring the package. - `check` This optional phase checks the result of the `build` phase by running the testsuite provided by the package. If the default `do_check` function provided by the build style doesn't do anything, the template should set `make_check_target` and/or `make_check_args` appropriately or define its own `do_check` function. If tests take too long -or can't run in all environments, they should be run only if `XBPS_CHECK_PKGS` is `full`, which means they should either -be under a `[ "$XBPS_CHECK_PKGS" = full ]` conditional (especially useful with custom `do_check`) or `make_check=extended` -should be set in the template. +or can't run in all environments, `make_check` should be set to fitting value or +`do_check` should be customized to limit testsuite unless `XBPS_CHECK_PKGS` is `full`. - `install` This phase installs the `package files` into the package destdir `/destdir/-`, via `make install` or any other compatible method. @@ -606,10 +605,15 @@ patches to the package sources during `do_patch()`. Patches are stored in - `disable_parallel_build` If set the package won't be built in parallel and `XBPS_MAKEJOBS` has no effect. -- `make_check` Sets the cases in which the `check` phase is run. Can be `yes` (the default) to run if -`XBPS_CHECK_PKGS` is set, `extended` to run if `XBPS_CHECK_PKGS` is `full` and `no` to never run. +- `make_check` Sets the cases in which the `check` phase is run. This option should usually be accompanied by a comment explaining why it was set, especially when set to `no`. +Allowed values: + - `yes` (the default) to run if `XBPS_CHECK_PKGS` is set. + - `extended` to run if `XBPS_CHECK_PKGS` is `full`. + - `ci-skip` to run locally if `XBPS_CHECK_PKGS` is set, but not as part of pull request checks. + - `no` to never run. + - `keep_libtool_archives` If enabled the `GNU Libtool` archives won't be removed. By default those files are always removed automatically. diff --git a/common/travis/prepare.sh b/common/travis/prepare.sh index 1e17be97545..550fbd7598d 100755 --- a/common/travis/prepare.sh +++ b/common/travis/prepare.sh @@ -5,6 +5,7 @@ [ "$XLINT" ] && exit 0 /bin/echo -e '\x1b[32mUpdating etc/conf...\x1b[0m' +echo XBPS_BUILD_ENVIRONMENT=void-packages-ci >> etc/conf echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf /bin/echo -e '\x1b[32mEnabling ethereal chroot-style...\x1b[0m' diff --git a/common/xbps-src/libexec/xbps-src-docheck.sh b/common/xbps-src/libexec/xbps-src-docheck.sh index 1cb9f6ab13a..1e82c1a3739 100755 --- a/common/xbps-src/libexec/xbps-src-docheck.sh +++ b/common/xbps-src/libexec/xbps-src-docheck.sh @@ -43,6 +43,12 @@ if [ "$make_check" = extended -a "$XBPS_CHECK_PKGS" != full ]; then exit 0 fi +if [ "$make_check" = ci-skip ] && [ "$XBPS_BUILD_ENVIRONMENT" = void-packages-ci ]; then + msg_warn \ + "${pkgname}-${version}_${revision}: skipping here because of make_check=ci-skip. Tests should be run locally.\n" + exit 0 +fi + for f in $XBPS_COMMONDIR/environment/check/*.sh; do source_file "$f" done diff --git a/etc/defaults.conf b/etc/defaults.conf index 133449a150d..6147954a18a 100644 --- a/etc/defaults.conf +++ b/etc/defaults.conf @@ -136,6 +136,12 @@ XBPS_SUCMD="sudo /bin/sh -c" # #XBPS_USE_BUILD_MTIME=yes +# [OPTIONAL] +# Enable continuous integration specific mode of operation. Currently this +# disables do_check for some packages. +# +#XBPS_BUILD_ENVIRONMENT=void-packages-ci + # [OPTIONAL] # When using the 'ethereal' chroot-style this switch must be activated, it is # meant as safeguard against users casually destroying their systems diff --git a/xbps-src b/xbps-src index 9d88873ab2c..c3cd7e5db10 100755 --- a/xbps-src +++ b/xbps-src @@ -635,7 +635,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \ XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \ XBPS_LIBEXECDIR XBPS_DISTDIR XBPS_DISTFILES_MIRROR XBPS_ALLOW_RESTRICTED \ XBPS_USE_GIT_COMMIT_DATE XBPS_PKG_COMPTYPE XBPS_REPO_COMPTYPE \ - XBPS_BUILDHELPERDIR XBPS_USE_BUILD_MTIME + XBPS_BUILDHELPERDIR XBPS_USE_BUILD_MTIME XBPS_BUILD_ENVIRONMENT for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do eval val="\$XBPS_$i"