summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-04-01 09:55:52 +0200
committerMihai Moldovan <ionic@ionic.de>2015-04-01 09:55:52 +0200
commit21d86e0dc83df93a30d132a86428c83787f8ef89 (patch)
tree7523fd098396dee9e927378134639ce0e06f9aaa /bin
parent0bfe67fb6cc6e5c5c89ce6c10e087a21ecf0eae8 (diff)
downloadbuildscripts-21d86e0dc83df93a30d132a86428c83787f8ef89.tar.gz
buildscripts-21d86e0dc83df93a30d132a86428c83787f8ef89.tar.bz2
buildscripts-21d86e0dc83df93a30d132a86428c83787f8ef89.zip
bin/build-rpm-package: rewrite the mock part of get_extra_repository() to use create_mock_config().
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-rpm-package58
1 files changed, 23 insertions, 35 deletions
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 5c0f8f9..8be91e7 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -424,45 +424,33 @@ get_extra_repository () {
"redhat")
# Always use -r.
ret="-r "
- if [ -n "${RPM_MOCK_CONFIG_DIR}" ]; then
- # FIXME: these files should probably be autogenerated to lessen maintenance load.
-
- # Itsy-bitsy problem here: mock versions prior to 1.2.0 are buggy in the sense that
- # they *always* prepend /etc/mock/ and append .cfg to any chroot file specified
- # via -r, even if the argument is an absolute path.
- # We have to work around that by specifying ../..//PATH/TO/MOCK-CONFIG and leaving
- # out the ".cfg" part.
- # Find out if we're using a buggy version.
- check_mock_version_atleast "1" "2" "0" && typeset MOCK_BUGGY="0" || typeset MOCK_BUGGY="1"
-
- [ "${MOCK_BUGGY}" -eq "1" ] && ret="${ret}../../"
-
- # Add config base dir if specified.
- ret="${ret}${RPM_MOCK_CONFIG_DIR}/"
-
- # Mock config file names shall follow the format:
- # distname-distversion-arch[-component-extra_repo_base_name[-extra_repo_full_name]]
- # ^------ mandatory ------^^---------------------- optional ----------------------^
- # ^------- default -------^ ^--- for extras ---^^--- for everything ---^
-
- # Add mandatory, default value.
- ret="${ret}${DIST}-${CODENAME}-${ARCH}"
- if [ -n "${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}" ]; then
- ret="${ret}-${COMPONENT}-${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}"
-
- if [ -n "${RPM_EXTRA_REPO_MOCK_CONFIG_FULL_NAME}" ] && [ -z "${PACKAGE_WITHOUT_OTHERMIRROR}" ] || \
- [ "${PACKAGE_WITHOUT_OTHERMIRROR}" != "${PACKAGE}" ]; then
- ret="${ret}-${RPM_EXTRA_REPO_MOCK_CONFIG_FULL_NAME}"
- fi
+
+ # Itsy-bitsy problem here: mock versions prior to 1.2.0 are buggy in the sense that
+ # they *always* prepend /etc/mock/ and append .cfg to any chroot file specified
+ # via -r, even if the argument is an absolute path.
+ # We have to work around that by specifying ../..//PATH/TO/MOCK-CONFIG and leaving
+ # out the ".cfg" part.
+ # Find out if we're using a buggy version.
+ check_mock_version_atleast "1" "2" "0" && typeset MOCK_BUGGY="0" || typeset MOCK_BUGGY="1"
+
+ [ "${MOCK_BUGGY}" -eq "1" ] && ret="${ret}../../"
+
+ if [ "${WANT_EXTRA}" -eq "1" ]; then
+ typeset WANT="base"
+ if [ -z "${PACKAGE_WITHOUT_OTHERMIRROR}" ] || [ "${PACKAGE_WITHOUT_OTHERMIRROR}" != "${PACKAGE}" ]; then
+ WANT="full"
fi
- # Add .cfg extension.
- [ "${MOCK_BUGGY}" -eq "0" ] && ret="${ret}.cfg"
+ typeset GEN_CONFIG="$(create_mock_config "${DIST}-${CODENAME}-${ARCH}" "${COMPONENT}" "${WANT}")"
+
+ # Remove the .cfg extension again... and maybe add it back later.
+ ret="${ret}${GEN_CONFIG%.cfg}"
else
- # As the default directory /etc/mock is non-writable, assume we don't have
- # special mock configs.
- ret="${ret}${DIST}-${CODENAME}-${ARCH}"
+ ret="${ret}${RPM_MOCK_CONFIG_DIR}/${DIST}-${CODENAME}-${ARCH}"
fi
+
+ # Add .cfg extension.
+ [ "${MOCK_BUGGY}" -eq "0" ] && ret="${ret}.cfg"
;;
*)
echo "Error: unknown type passed to ${FUNCNAME}()" >&2