From a0d1e21a1edd2b59b9765920d60ee1c12c6fa977 Mon Sep 17 00:00:00 2001 From: amin m Date: Mon, 12 Aug 2019 14:38:59 +0200 Subject: [PATCH] Fixing bash expansion Change-Id: Id1bb352a98cac52aab5eb9ac7621bbeadfd1b373 Signed-off-by: amin m --- jjb/shell/ta-rpm-deploy.sh | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/jjb/shell/ta-rpm-deploy.sh b/jjb/shell/ta-rpm-deploy.sh index eeb1af6..a9c03e3 100644 --- a/jjb/shell/ta-rpm-deploy.sh +++ b/jjb/shell/ta-rpm-deploy.sh @@ -26,36 +26,40 @@ nexus_repo_url="$ALT_NEXUS_URL/repository/$NEXUS_REPO" results_dir="$WORKSPACE/work/results" repo_name=`echo $WORKSPACE | awk -F '/' '{print $4}' | cut -d '-' -f2- | sed 's|\(.*\)-.*|\1|'` -#Creating dir to move duplicate RPMs/SRPMs to avoid re-upload +#Creating dirs to move duplicate RPMs/SRPMs to avoid re-upload and copy the changed RPMs/SRPMs mkdir "$results_dir/repo/duplicates" mkdir "$results_dir/src_repo/duplicates" +mkdir -p "$x86_dir" +mkdir -p "$sources_dir" -#List all RPMs available in Nexus and move the duplicates +#List all RPMs available in Nexus, move the duplicates and copy the changed ones for artifact in \ - `ls $results_dir/repo` + `ls $results_dir/repo/*.rpm` do - if curl --head --fail $nexus_repo_url/$release_path/rpms/x86_64/$artifact + if curl --head --fail $nexus_repo_url/$release_path/rpms/x86_64/$(basename $artifact) then - mv $results_dir/repo/$artifact $results_dir/repo/duplicates/ + echo "RPM - $(basename $artifact) already available in Nexus" + mv $results_dir/repo/$(basename $artifact) $results_dir/repo/duplicates/ + else + echo "RPM - $(basename $artifact) is not available in Nexus. Will be uploaded" + cp $results_dir/repo/$(basename $artifact) $x86_dir fi done -#List all SRPMs available in Nexus and move the duplicates +#List all Source RPMs available in Nexus, move the duplicates and copy the changed ones for artifact in \ - `ls $results_dir/src_repo` + `ls $results_dir/src_repo/*.rpm` do - if curl --head --fail $nexus_repo_url/$release_path/rpms/Sources/$artifact + if curl --head --fail $nexus_repo_url/$release_path/rpms/Sources/$(basename $artifact) then - mv $results_dir/src_repo/$artifact $results_dir/src_repo/duplicates/ + echo "Source RPM - $(basename $artifact) already available in Nexus" + mv $results_dir/src_repo/$(basename $artifact) $results_dir/src_repo/duplicates/ + else + echo "Source RPM - $(basename $artifact) is not available in Nexus. Will be uploaded" + cp $results_dir/src_repo/$(basename $artifact) $sources_dir fi done -mkdir -p "$x86_dir" -mkdir -p "$sources_dir" - -cp "$results_dir/repo/"*.rpm "$x86_dir" -cp "$results_dir/src_repo/"*.rpm "$sources_dir" - echo "-----> Upload RPMs to Nexus" lftools deploy nexus "$nexus_repo_url" "$repo_dir" -- 2.16.6