Make rpm push handle SRPMs 77/777/2
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 13 Apr 2016 16:21:14 +0000 (09:21 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 13 Apr 2016 16:24:21 +0000 (09:24 -0700)
* Fix the rpm push to search out and push SRPMs

* Fix the rpm push to actually push a file as it was referencing a bad
  variable

* Fix up some minor linting issues

Change-Id: I4d2e66ad52e593b71b969ab1b5faad254cc35e2d
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
jjb/vpp/include-raw-vpp-maven-push.sh

index 924d335..dc75e90 100644 (file)
@@ -72,13 +72,21 @@ function push_rpm ()
     rpmfile=$1
     repoId="${BASEREPOID}yum"
     url="${BASEURL}yum"
-    basefile=$(basename -s .rpm "$rpmfile")
+
+    if grep -q srpm <<<"$rpmfile"
+    then
+        rpmtype=srpm
+        basefile=$(basename -s .srpm "$rpmfile")
+    else
+        rpmtype=rpm
+        basefile=$(basename -s .rpm "$rpmfile")
+    fi
     artifactId=$(echo "$basefile" | cut -f 1 -d '_')
     version=$(echo "$basefile" | cut -f 2- -d '_')
-    push_file "$debfile" "$repoId" "$url" "$version" "$artifactId" rpm
+    push_file "$rpmfile" "$repoId" "$url" "$version" "$artifactId" "$rpmtype"
 }
 
-if [ ${OS} == "ubuntu1404" ]; then
+if [ "${OS}" == "ubuntu1404" ]; then
     # Find the files
     JARS=$(find . -type f -iname '*.jar')
     DEBS=$(find . -type f -iname '*.deb')
@@ -91,10 +99,11 @@ if [ ${OS} == "ubuntu1404" ]; then
     do
         push_deb "$i"
     done
-elif [ ${OS} == "centos7" ]; then
+elif [ "${OS}" == "centos7" ]; then
     # Find the files
     RPMS=$(find . -type f -iname '*.rpm')
-    for i in $RPMS
+    SRPMS=$(find . -type f -iname '*.srpm')
+    for i in $RPMS $SRPMS
     do
         push_rpm "$i"
     done