From 38077b985a796ecddee4d904e6c18b26d67ee5f4 Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Wed, 13 Apr 2016 10:38:00 -0700 Subject: Query RPM files directly using rpm for upload info Instead of trying to figure out all the maven fields based upon the filename with possible failures that this can cause, instead, use the rpm command itself to query the built artifacts for the needed information. Also, .src.rpm should be the canonical name for source RPM files. Make sure that .srpm and .src.rpm are handled properly and they normalize to .src.rpm in nexus. Change-Id: I6b35c15e8e6b189a2144fe3cfb991e467933ad46 Signed-off-by: Andrew Grimberg --- jjb/vpp/include-raw-vpp-maven-push.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/jjb/vpp/include-raw-vpp-maven-push.sh b/jjb/vpp/include-raw-vpp-maven-push.sh index dc75e907b..a8b03f6e9 100644 --- a/jjb/vpp/include-raw-vpp-maven-push.sh +++ b/jjb/vpp/include-raw-vpp-maven-push.sh @@ -73,17 +73,15 @@ function push_rpm () repoId="${BASEREPOID}yum" url="${BASEURL}yum" - if grep -q srpm <<<"$rpmfile" + if grep -qE '\.s(rc\.)?rpm' <<<"$rpmfile" then - rpmtype=srpm - basefile=$(basename -s .srpm "$rpmfile") + rpmrelease=$(rpm -qp --queryformat="%{release}.src" "$rpmfile") else - rpmtype=rpm - basefile=$(basename -s .rpm "$rpmfile") + rpmrelease=$(rpm -qp --queryformat="%{release}.%{arch}" "$rpmfile") fi - artifactId=$(echo "$basefile" | cut -f 1 -d '_') - version=$(echo "$basefile" | cut -f 2- -d '_') - push_file "$rpmfile" "$repoId" "$url" "$version" "$artifactId" "$rpmtype" + artifactId=$(rpm -qp --queryformat="%{name}" "$rpmfile") + version=$(rpm -qp --queryformat="%{version}" "$rpmfile") + push_file "$rpmfile" "$repoId" "$url" "${version}-${rpmrelease}" "$artifactId" rpm } if [ "${OS}" == "ubuntu1404" ]; then @@ -103,7 +101,8 @@ elif [ "${OS}" == "centos7" ]; then # Find the files RPMS=$(find . -type f -iname '*.rpm') SRPMS=$(find . -type f -iname '*.srpm') - for i in $RPMS $SRPMS + SRCRPMS=$(find . -type f -name '*.src.rpm') + for i in $RPMS $SRPMS $SRCRPMS do push_rpm "$i" done -- cgit 1.2.3-korg