Skip to content

Commit

Permalink
Add build.sh --with-console option
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Jun 17, 2021
1 parent a6a24bc commit 81adace
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
21 changes: 17 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ WITH_COMMIT_ID=
DIST=

WITHOUT_TEST=
WITH_CONSOLE=

WITH_PKGS=
WITHOUT_PKGS=
Expand All @@ -39,14 +40,15 @@ usage() {
echo " --with-commit-id Append commit ID to release number."
echo " --dist=<name> Distribution name (e.g. fc28)."
echo " --without-test Do not run unit tests."
echo " --with-console Build console package."
echo " --with-pkgs=<list> Build packages specified in comma-separated list only."
echo " --without-pkgs=<list> Build everything except packages specified in comma-separated list."
echo " -v,--verbose Run in verbose mode."
echo " --debug Run in debug mode."
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."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 4 additions & 6 deletions pki.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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 <package> option (exclusion method).

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 81adace

Please sign in to comment.