From 5700080edcaba0cc3b4e1e3876a05fb3ff3311b8 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Wed, 1 Apr 2015 12:21:52 +0200 Subject: bin/build-rpm-package: only create a new temporary mock config directory if not already existing. Fix replacement of releasever. --- bin/build-rpm-package | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 1e77075..c344dc9 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -313,11 +313,14 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET exit -1 fi - # Create temporary directory for our soon-to-be temporary mock config file. - TMP_MOCK_CFG_DIR="$(mktemp -d --tmpdir="${TEMP_BASE}" "${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}-mock-$(repeat_str "X" "24")")" - if [ "$?" -ne "0" ]; then - echo "Error: creating mock temporary config directory failed. Aborting." >&2 - exit -1 + # Create temporary directory for our soon-to-be temporary mock config file, + # if it does not already exist. + if [ -z "${TMP_MOCK_CFG_DIR}" ]; then + TMP_MOCK_CFG_DIR="$(mktemp -d --tmpdir="${TEMP_BASE}" "${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}-mock-$(repeat_str "X" "24")")" + if [ "$?" -ne "0" ]; then + echo "Error: creating mock temporary config directory failed. Aborting." >&2 + exit -1 + fi fi TMP_MOCK_CFG_FILE="$(mktemp --tmpdir="${TEMP_BASE}" "$(basename "${TMP_MOCK_CFG_DIR}")/${MOCK_BASE%.cfg}-${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}-${COMPONENT}-${TARGET}.$(repeat_str "X" "24").cfg")" @@ -360,7 +363,7 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET fi case "${line}" in - (*'$releasever'*) line="${line/'$releasever'/"${VERSION}"}" + (*'$releasever'*) line="${line/'$releasever'/${VERSION}}" ;; (*) ;; esac -- cgit v1.2.3