From 343fcc6cd675a22a36146876b2d94d8e0f4a9cce Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 1 Jul 2022 16:43:16 +0200 Subject: [PATCH] contrib/rpm: untangle setting of bcond_{test,debug} defaults Resolve the defaults in build.sh instead of RPM macros. This looks less terrible maintaining the same defaults as well as options to override it upstream. Moving it to the block that downstreams (Fedora, Red Hat) keep customized makes it possible for them to also maintain customized defaults here. In particular, the downstreams should be able to enable bcond_test at least for their production release (otherwise there's little point in actually running tests at package build time). --- contrib/fedora/rpm/NetworkManager.spec | 14 ++------------ contrib/fedora/rpm/build.sh | 6 ++++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index f31259722c..0170740b1a 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -18,6 +18,8 @@ %global release_version __RELEASE_VERSION__ %global snapshot __SNAPSHOT__ %global git_sha __COMMIT__ +%global bcond_default_debug __BCOND_DEFAULT_DEBUG__ +%global bcond_default_test __BCOND_DEFAULT_TEST__ %global obsoletes_device_plugins 1:0.9.9.95-1 %global obsoletes_ppp_plugin 1:1.5.3 @@ -46,18 +48,6 @@ ############################################################################### -%if "x__BCOND_DEFAULT_DEBUG__" == "x1" || "x__BCOND_DEFAULT_DEBUG__" == "x0" -%global bcond_default_debug __BCOND_DEFAULT_DEBUG__ -%else -%global bcond_default_debug 0 -%endif - -%if "x__BCOND_DEFAULT_TEST__" == "x1" || "x__BCOND_DEFAULT_TEST__" == "x0" -%global bcond_default_test __BCOND_DEFAULT_TEST__ -%else -%global bcond_default_test 0 -%endif - %bcond_with meson %bcond_without adsl %bcond_without bluetooth diff --git a/contrib/fedora/rpm/build.sh b/contrib/fedora/rpm/build.sh index 6157df44ba..e5a3d84468 100755 --- a/contrib/fedora/rpm/build.sh +++ b/contrib/fedora/rpm/build.sh @@ -117,6 +117,8 @@ SNAPSHOT="${SNAPSHOT:-%{nil\}}" VERSION="${VERSION:-$(get_version || die "Could not read $VERSION")}" COMMIT_FULL="${COMMIT_FULL:-$(git rev-parse --verify HEAD || die "Error reading HEAD revision")}" COMMIT="${COMMIT:-$(printf '%s' "$COMMIT_FULL" | sed 's/^\(.\{10\}\).*/\1/' || die "Error reading HEAD revision")}" +BCOND_DEFAULT_DEBUG="${BCOND_DEFAULT_DEBUG:-0}" +BCOND_DEFAULT_TEST="${BCOND_DEFAULT_TEST:-0}" USERNAME="${USERNAME:-"$(git config user.name) <$(git config user.email)>"}" SPECFILE="$(abs_path "$SPECFILE" "$SCRIPTDIR/NetworkManager.spec")" || die "invalid \$SPECFILE argument" SOURCE_FROM_GIT="$(coerce_bool "$SOURCE_FROM_GIT" "")" @@ -177,8 +179,8 @@ LOG "" LOG "UUID=$UUID" LOG "BASEDIR=$TEMP" -in_set "$BCOND_DEFAULT_DEBUG" "" 0 1 || die "Invalid value for \$BCOND_DEFAULT_DEBUG: \"$BCOND_DEFAULT_DEBUG\"" -in_set "$BCOND_DEFAULT_TEST" "" 0 1 || die "Invalid value for \$BCOND_DEFAULT_TEST: \"$BCOND_DEFAULT_TEST\"" +in_set "$BCOND_DEFAULT_DEBUG" 0 1 || die "Invalid value for \$BCOND_DEFAULT_DEBUG: \"$BCOND_DEFAULT_DEBUG\"" +in_set "$BCOND_DEFAULT_TEST" 0 1 || die "Invalid value for \$BCOND_DEFAULT_TEST: \"$BCOND_DEFAULT_TEST\"" ln -snf "$TEMPBASE" ./latest0 ln "$BUILDLOG" "$TEMPBASE/build.log"