From 7be4a438b8e798ee6c4e0596845cda5d01c7ba72 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Wed, 9 Mar 2022 22:12:40 +0100 Subject: [PATCH] xbps-src: add strict mode --- common/environment/setup/vsed.sh | 7 ++++++- common/travis/build.sh | 2 +- xbps-src | 11 ++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/common/environment/setup/vsed.sh b/common/environment/setup/vsed.sh index 5b5bf427c239..c74c086a4ce8 100644 --- a/common/environment/setup/vsed.sh +++ b/common/environment/setup/vsed.sh @@ -57,8 +57,13 @@ vsed() { newdigest="$($XBPS_DIGEST_CMD "$f")" newdigest="${newdigest%% *}" + msgfunc=msg_warn + if [ -n "$XBPS_STRICT" ]; then + msgfunc=msg_error + fi + if [ "$olddigest" = "$newdigest" ]; then - msg_warn "$pkgver: vsed: regex \"$rx\" didn't change file \"$f\"\n" + $msgfunc "$pkgver: vsed: regex \"$rx\" didn't change file \"$f\"\n" fi olddigest="${newdigest}" done diff --git a/common/travis/build.sh b/common/travis/build.sh index f5cf9cffc064..007a61f994d7 100755 --- a/common/travis/build.sh +++ b/common/travis/build.sh @@ -13,7 +13,7 @@ fi PKGS=$(/hostrepo/xbps-src sort-dependencies $(cat /tmp/templates)) for pkg in ${PKGS}; do - /hostrepo/xbps-src -j$(nproc) -H "$HOME"/hostdir $arch $test pkg "$pkg" + /hostrepo/xbps-src -j$(nproc) -s -H "$HOME"/hostdir $arch $test pkg "$pkg" [ $? -eq 1 ] && exit 1 done diff --git a/xbps-src b/xbps-src index ff249015ed02..8488c5a3a49c 100755 --- a/xbps-src +++ b/xbps-src @@ -216,6 +216,9 @@ $(print_cross_targets) This alternative repository will also be used to resolve dependencies with highest priority order than others. +-s + Make vsed warnings errors. + -t Create a temporary masterdir to not pollute the current one. Note that the existing masterdir must be fully populated with binary-bootstrap first. Once the target has finished, this temporary masterdir will be removed. @@ -357,7 +360,7 @@ readonly XBPS_SRC_VERSION="113" export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch) XBPS_OPTIONS= -XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:p:qQKr:tV" +XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:p:qsQKr:tV" # Preprocess arguments in order to allow options before and after XBPS_TARGET. eval set -- $(getopt "$XBPS_OPTSTRING" "$@"); @@ -389,6 +392,7 @@ while getopts "$XBPS_OPTSTRING" opt; do Q) XBPS_ARG_CHECK_PKGS=yes; XBPS_OPTIONS+=" -Q";; K) XBPS_ARG_CHECK_PKGS=full; XBPS_OPTIONS+=" -K";; r) XBPS_ARG_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";; + s) XBPS_ARG_STRICT=yes; XBPS_OPTIONS+=" -s";; t) XBPS_ARG_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";; V) echo "xbps-src-$XBPS_SRC_VERSION $(xbps-uhelper -V)" && exit 0;; --) shift; break;; @@ -471,6 +475,7 @@ fi [ -n "$XBPS_ARG_QUIET" ] && XBPS_QUIET=1 [ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES" [ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY" +[ -n "$XBPS_ARG_STRICT" ] && XBPS_STRICT="$XBPS_ARG_STRICT" [ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD" [ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS="$XBPS_ARG_CHECK_PKGS" [ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS" @@ -478,7 +483,7 @@ fi export XBPS_BUILD_ONLY_ONE_PKG XBPS_SKIP_REMOTEREPOS XBPS_BUILD_FORCEMODE \ XBPS_INFORMATIVE_RUN XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \ XBPS_USE_GIT_REVS XBPS_CHECK_PKGS XBPS_DEBUG_PKGS XBPS_SKIP_DEPS \ - XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_CROSS_BUILD \ + XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_STRICT XBPS_CROSS_BUILD \ XBPS_MAKEJOBS XBPS_PRINT_VARIABLES # The masterdir/hostdir variables are forced and readonly in chroot @@ -626,7 +631,7 @@ readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver" export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \ XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR \ - XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \ + XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_STRICT XBPS_SRCDISTDIR XBPS_DIGEST_CMD \ XBPS_UHELPER_CMD XBPS_INSTALL_CMD XBPS_QUERY_CMD XBPS_BUILD_ONLY_ONE_PKG \ XBPS_RINDEX_CMD XBPS_RECONFIGURE_CMD XBPS_REMOVE_CMD XBPS_CHECKVERS_CMD \ XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \