From 81adacee802bbcf53b7a5381dd5e350ad62f3976 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 16 Jun 2021 19:17:30 -0500 Subject: [PATCH] Add build.sh --with-console option --- build.sh | 21 +++++++++++++++++---- pki.spec | 10 ++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index 67cf339cab8..7a980831804 100755 --- a/build.sh +++ b/build.sh @@ -20,6 +20,7 @@ WITH_COMMIT_ID= DIST= WITHOUT_TEST= +WITH_CONSOLE= WITH_PKGS= WITHOUT_PKGS= @@ -39,6 +40,7 @@ usage() { echo " --with-commit-id Append commit ID to release number." echo " --dist= Distribution name (e.g. fc28)." echo " --without-test Do not run unit tests." + echo " --with-console Build console package." echo " --with-pkgs= Build packages specified in comma-separated list only." echo " --without-pkgs= Build everything except packages specified in comma-separated list." echo " -v,--verbose Run in verbose mode." @@ -46,7 +48,7 @@ usage() { echo " --help Show help message." echo echo "Packages:" - echo " base, server, acme, ca, kra, ocsp, tks, tps, javadoc, console, theme, meta, tests, debug" + echo " base, server, acme, ca, kra, ocsp, tks, tps, javadoc, theme, meta, tests, debug" echo echo "Target:" echo " src Generate RPM sources." @@ -151,10 +153,14 @@ generate_rpm_spec() { commands="${commands}; s/# Patch: pki-VERSION-RELEASE.patch/Patch: $PATCH/g" fi - # hard-code test option if [ "$WITHOUT_TEST" = true ] ; then - # convert bcond_without into bcond_with such that unit tests do not run by default - commands="${commands}; s/%\(bcond_without *test\)\$/# \1\n%bcond_with test/g" + # convert bcond_without into bcond_with to skip unit tests by default + commands="${commands}; s/%bcond_without *test\$/%bcond_with test/g" + fi + + if [ "$WITH_CONSOLE" = true ] ; then + # convert bcond_with into bcond_without to build console by default + commands="${commands}; s/%bcond_with *console\$/%bcond_without console/g" fi # hard-code packages to build @@ -240,6 +246,9 @@ while getopts v-: arg ; do without-test) WITHOUT_TEST=true ;; + with-console) + WITH_CONSOLE=true + ;; with-pkgs=?*) if [ "$WITHOUT_PKGS" != "" ]; then echo "ERROR: The --with-pkgs and --without-pkgs options are mutually exclusive" >&2 @@ -443,6 +452,10 @@ if [ "$WITHOUT_TEST" = true ] ; then OPTIONS+=(--without test) fi +if [ "$WITH_CONSOLE" = true ] ; then + OPTIONS+=(--with console) +fi + if [ "$WITH_PKGS" != "" ] ; then # Build specified packages only. diff --git a/pki.spec b/pki.spec index 14ee86d1916..9423d640936 100644 --- a/pki.spec +++ b/pki.spec @@ -74,11 +74,12 @@ ExcludeArch: i686 # PKI ################################################################################ -# By default the build will execute unit tests unless --without test -# option is specified. - +# Execute unit tests unless --without test is specified. %bcond_without test +# Don't build console unless --with console is specified. +%bcond_with console + # By default all packages will be built except the ones specified with # --without option (exclusion method). @@ -108,9 +109,6 @@ ExcludeArch: i686 %package_option tks %package_option tps %package_option javadoc -%if 0%{?fedora} && 0%{?fedora} <= 34 || 0%{?rhel} && 0%{?rhel} <= 8 -%package_option console -%endif %package_option theme %package_option meta %package_option tests