From 91c32a47f32b7269fb52a20813696148c74413da Mon Sep 17 00:00:00 2001 From: Murilo Belluzzo Date: Wed, 27 Nov 2019 10:47:35 -0800 Subject: [PATCH] [content] Move fetching bundles to 'Content' stage Mixer step should only worry about consuming inputs prepared by the previous stage ('Content'), so this patch formalizes that 'BUNDLES_DIR' is the place where 'mixer.sh' is expected to find a bundle git repository already fetched and that BUNDLE_REPO_SRC_DIR is the path inside that folder where it can find bundle definitions files (**and only those files**). Signed-off-by: Murilo Belluzzo --- release/content.sh | 7 +++++++ release/mixer.sh | 24 +++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/release/content.sh b/release/content.sh index bdce7a0..589d2b6 100755 --- a/release/content.sh +++ b/release/content.sh @@ -32,3 +32,10 @@ fi log_line # Output too verbose createrepo_c "${REPO_DIR}/x86_64/os" # TODO: log create_repo output and only print its result log_line + +section "Fetching Bundles" +if [[ -n "${BUNDLES_REPO}" ]]; then + fetch_git_repo "${BUNDLES_REPO}" "${BUNDLES_DIR}" +else + info "Local bundles not found" "'BUNDLES_REPO' is empty" +fi diff --git a/release/mixer.sh b/release/mixer.sh index 5a557a5..0a31dee 100755 --- a/release/mixer.sh +++ b/release/mixer.sh @@ -23,14 +23,6 @@ if "${IS_UPSTREAM}" && [[ ${MIXER_OPTS} != *"--offline"* ]]; then MIXER_OPTS="${MIXER_OPTS} --offline" fi -fetch_bundles() { - log_line "Fetching bundles:" - git clone --quiet "${BUNDLES_REPO}" "${BUNDLES_DIR}" - rm -rf ./local-bundles - cp -r "${BUNDLES_DIR}/${BUNDLES_REPO_SRC_DIR}" ./local-bundles - log_line "OK!" 1 -} - build_bundles() { section "Bundles" log_line "Updating Bundles List:" @@ -218,14 +210,20 @@ fi MCA_VERSIONS="${DS_LATEST}" -section "Preparing Mixer Content" -if [[ -z "${BUNDLES_REPO}" ]]; then - info "Custom bundles not found" "'BUNDLES_REPO' is empty" +section "Preparing Mix Content" + +log_line "Checking Bundles:" +rm -rf ./local-bundles +if [[ -d "${BUNDLES_DIR}/${BUNDLES_REPO_SRC_DIR}" ]] \ + && [[ -n "$(ls -A "${BUNDLES_DIR}/${BUNDLES_REPO_SRC_DIR}")" ]]; then + cp -r "${BUNDLES_DIR}/${BUNDLES_REPO_SRC_DIR}" ./local-bundles + log_line "Bundles found. Adding it to the mix!" 1 else - fetch_bundles # Download the Downstream Bundles Repository + mkdir ./local-bundles + log_line "Bundles not found. Skipping it." 1 fi -log_line "Checking Downstream Repo:" +log_line "Checking Packages Repo:" if [[ -n "$(ls -A "${PKGS_DIR}")" ]];then mixer_cmd config set Mixer.LOCAL_RPM_DIR "${PKGS_DIR}" mixer_cmd add-rpms > /dev/null