Modify HC2VPP node
[ci-management.git] / jjb / hc2vpp / include-raw-hc2vpp-pkg-push.sh
1 #!/bin/bash
2 set -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).
10 if [[ "${STREAM}" == "master" ]]; then
11     if [[ "${OS}" == "centos7" ]]; then
12         # Determine VPP Java API version used in maven build
13         JVPP_VERSION=`yum list installed vpp-api-java | grep vpp-api-java | awk '{ printf $2; }'`
14         VERSION=`yum deplist vpp-api-java |grep vpp-lib |head -1 | awk '{ print $3}'`
15
16         # Write a file that will echo VPP dependencies
17         echo -n 'echo' > vpp_dependencies
18         echo " \"vpp = ${VERSION}, vpp-plugins = ${VERSION}\"" >> vpp_dependencies
19         chmod +x vpp_dependencies
20
21         # Overwrite default dependencies file
22         mv vpp_dependencies packaging/rpm/
23     else
24         # Determine VPP Java API version used in maven build
25         JVPP_VERSION=`apt list --installed | grep vpp-api-java | awk '{ printf $2; }'`
26         VERSION=`apt-cache showpkg vpp-api-java |grep "$JVPP_VERSION" |grep vpp | sed "s/.*(. //" | sed "s/).*//"`
27
28         # Write a file that will echo VPP dependencies
29         echo -n 'echo' > vpp_dependencies
30         echo " \"vpp (= ${VERSION}), vpp-plugin-core (= ${VERSION})\"" >> vpp_dependencies
31         chmod +x vpp_dependencies
32
33         # Overwrite default dependencies file
34         mv vpp_dependencies packaging/deb/common/
35     fi
36 fi
37
38 # Build package
39 if [[ "${OS}" == "centos7" ]]; then
40
41     # Build the rpms
42     ./packaging/rpm/rpmbuild.sh
43
44     # Find the files
45     RPMS=$(find ./packaging/ -type f -iname '*.rpm')
46     SRPMS=$(find ./packaging/ -type f -iname '*.srpm')
47     SRCRPMS=$(find ./packaging/ -type f -name '*.src.rpm')
48
49     # Publish hc2vpp packages
50     for i in ${RPMS} ${SRPMS} ${SRCRPMS}
51     do
52         push_rpm "$i"
53     done
54 elif [[ "${OS}" == "ubuntu1604" ]]; then
55
56     # Build the debs
57     ./packaging/deb/xenial/debuild.sh
58
59     # Find the files
60     DEBS=$(find ./packaging/ -type f -iname '*.deb')
61
62     # Publish hc2vpp packages
63     for i in ${DEBS}
64     do
65         push_deb "$i"
66     done
67 elif [[ "${OS}" == "ubuntu1804" ]]; then
68
69     # Build the debs
70     ./packaging/deb/bionic/debuild.sh
71
72     # Find the files
73     DEBS=$(find ./packaging/ -type f -iname '*.deb')
74
75     # Publish hc2vpp packages
76     for i in ${DEBS}
77     do
78         push_deb "$i"
79     done
80 fi