Browse code

Expose test build option for RPM `make` targets

Building an RPM with test binaries is off by default, but
users should be able to turn the option back on if they want.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Steve Kuznetsov authored on 2016/10/27 23:35:28
Showing 2 changed files
... ...
@@ -237,24 +237,33 @@ install-travis:
237 237
 
238 238
 # Build RPMs only for the Linux AMD64 target
239 239
 #
240
+# Args:
241
+#   BUILD_TESTS: whether or not to build a test RPM, off by default
242
+#
240 243
 # Example:
241 244
 #   make build-rpms
242 245
 build-rpms:
243
-	OS_ONLY_BUILD_PLATFORMS='linux/amd64' hack/build-rpm-release.sh
246
+	BUILD_TESTS=$(BUILD_TESTS) OS_ONLY_BUILD_PLATFORMS='linux/amd64' hack/build-rpm-release.sh
244 247
 .PHONY: build-rpms
245 248
 
246 249
 # Build RPMs for all architectures
247 250
 #
251
+# Args:
252
+#   BUILD_TESTS: whether or not to build a test RPM, off by default
253
+#
248 254
 # Example:
249 255
 #   make build-rpms-redistributable
250 256
 build-rpms-redistributable:
251
-	hack/build-rpm-release.sh
257
+	BUILD_TESTS=$(BUILD_TESTS) hack/build-rpm-release.sh
252 258
 .PHONY: build-rpms-redistributable
253 259
 
254 260
 # Build a release of OpenShift using tito for linux/amd64 and the images that depend on it.
255 261
 #
262
+# Args:
263
+#   BUILD_TESTS: whether or not to build a test RPM, off by default
264
+#
256 265
 # Example:
257
-#   make release
266
+#   make release-rpms BUILD_TESTS=1
258 267
 release-rpms: clean build-rpms
259 268
 	hack/build-images.sh
260 269
 	hack/extract-release.sh
... ...
@@ -3,7 +3,8 @@
3 3
 # This script generates release zips and RPMs into _output/releases.
4 4
 # tito and other build dependencies are required on the host. We will
5 5
 # be running `hack/build-cross.sh` under the covers, so we transitively
6
-# consume all of the relevant envars.
6
+# consume all of the relevant envars. We also consume:
7
+#  - BUILD_TESTS: whether or not to build a test RPM, off by default
7 8
 source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
8 9
 os::build::setup_env
9 10
 os::util::environment::setup_tmpdir_vars "build-rpm-release"
... ...
@@ -20,7 +21,7 @@ os::log::info 'Building Origin release RPMs with tito...'
20 20
 tito_tmp_dir="${BASETMPDIR}/tito"
21 21
 mkdir -p "${tito_tmp_dir}"
22 22
 tito build --output="${tito_tmp_dir}" --rpm --test --no-cleanup \
23
-           --rpmbuild-options="--define 'make_redistributable ${make_redistributable}'"
23
+           --rpmbuild-options="--define 'make_redistributable ${make_redistributable}' --define 'build_tests ${BUILD_TESTS:-0}'"
24 24
 
25 25
 os::log::info 'Unpacking tito artifacts for reuse...'
26 26
 output_directories=( $( find "${tito_tmp_dir}" -type d -name 'rpmbuild-origin*' ) )