xbps-src: add strict mode

This commit is contained in:
Michal Vasilek 2022-03-09 22:12:40 +01:00 committed by Echo
parent 4fec3d6697
commit 769ea65a5e
3 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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 \