include-raw-hc2vpp-pkg-push.sh revision e45df101
1#!/bin/bash
2set -x
3
4# In case of master branch, update vpp_dependencies file
5# to match vpp-api-java and eliminate Java API mismatches (HC2VPP-102).
6#
7# In order to have control of package dependencies in the release artifacts (HC2VPP-282),
8# the vpp_dependencies file is not modified in case of stable branch
9# (after VPP API freeze, Java API mismatches occur very rarely).
10if [ "${STREAM}" == "master" ]; then
11    if [ "${OS}" == "centos7" ]; then
12        # Determine VPP Java API version used in maven build
13        VERSION=`yum list installed vpp-api-java | grep vpp-api-java | awk '{ printf $2; }'`
14
15        # Write a file that will echo VPP dependencies
16        echo -n 'echo' > vpp_dependencies
17        echo " \"vpp = ${VERSION}, vpp-plugins = ${VERSION}\"" >> vpp_dependencies
18        chmod +x vpp_dependencies
19
20        # Overwrite default dependencies file
21        mv vpp_dependencies packaging/rpm/
22    else
23        # Determine VPP Java API version used in maven build
24        VERSION=`apt list --installed | grep vpp-api-java | awk '{ printf $2; }'`
25
26        # Write a file that will echo VPP dependencies
27        echo -n 'echo' > vpp_dependencies
28        echo " \"vpp (= ${VERSION}), vpp-plugins (= ${VERSION})\"" >> vpp_dependencies
29        chmod +x vpp_dependencies
30
31        # Overwrite default dependencies file
32        mv vpp_dependencies packaging/deb/common/
33    fi
34fi
35
36# Build package
37if [ "${OS}" == "centos7" ]; then
38
39    # Build the rpms
40    ./packaging/rpm/rpmbuild.sh
41
42    # Find the files
43    RPMS=$(find . -type f -iname '*.rpm')
44    SRPMS=$(find . -type f -iname '*.srpm')
45    SRCRPMS=$(find . -type f -name '*.src.rpm')
46
47    # Publish hc2vpp packages
48    for i in $RPMS $SRPMS $SRCRPMS
49    do
50        push_rpm "$i"
51    done
52elif [ "${OS}" == "ubuntu1604" ]; then
53
54    # Build the debs
55    ./packaging/deb/xenial/debuild.sh
56
57    # Find the files
58    DEBS=$(find . -type f -iname '*.deb')
59
60    # Publish hc2vpp packages
61    for i in $DEBS
62    do
63        push_deb "$i"
64    done
65fi
66