X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=jjb%2Fshell%2Fta-rpm-deploy.sh;h=a9c03e317c4ea8df2d5124c37da0d31fa40a6dc4;hb=a0d1e21a1edd2b59b9765920d60ee1c12c6fa977;hp=36c7c5b4710b26de58095997568715bc88d0d4b2;hpb=b2d363e0cde9fcc4912ae3e7e09cf273dcb24f18;p=ci-management.git diff --git a/jjb/shell/ta-rpm-deploy.sh b/jjb/shell/ta-rpm-deploy.sh index 36c7c5b..a9c03e3 100644 --- a/jjb/shell/ta-rpm-deploy.sh +++ b/jjb/shell/ta-rpm-deploy.sh @@ -23,12 +23,42 @@ repo_dir="$WORKSPACE/work/nexus/$NEXUS_REPO" x86_dir="$repo_dir/$release_path/rpms/x86_64" sources_dir="$repo_dir/$release_path/rpms/Sources" 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 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" -cp "$WORKSPACE/work/results/repo/"*.rpm "$x86_dir" -cp "$WORKSPACE/work/results/src_repo/"*.rpm "$sources_dir" +#List all RPMs available in Nexus, move the duplicates and copy the changed ones +for artifact in \ + `ls $results_dir/repo/*.rpm` + do + if curl --head --fail $nexus_repo_url/$release_path/rpms/x86_64/$(basename $artifact) + then + 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 Source RPMs available in Nexus, move the duplicates and copy the changed ones +for artifact in \ + `ls $results_dir/src_repo/*.rpm` + do + if curl --head --fail $nexus_repo_url/$release_path/rpms/Sources/$(basename $artifact) + then + 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 echo "-----> Upload RPMs to Nexus" lftools deploy nexus "$nexus_repo_url" "$repo_dir"