Merge "Modify logs publisher"
[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-api-java = ${JVPP_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         # get vpp-api-java package dependencies
27         JVPP_DEPS=`apt-cache show vpp-api-java=${JVPP_VERSION} |grep Depends: | sed "s/Depends: //"`
28         # separate deps with newline, then find VPP dependency and filter out the version
29         VERSION=`echo ${JVPP_DEPS}| sed "s/, /\\n/" |grep "vpp " | sed "s/).*//" |sed "s/.* //"`
30
31         # Write a file that will echo VPP dependencies
32         echo -n 'echo' > vpp_dependencies
33         echo " \"vpp (= ${VERSION}), vpp-plugin-core (= ${VERSION}), vpp-api-java (= ${JVPP_VERSION})\"" >> vpp_dependencies
34         chmod +x vpp_dependencies
35
36         # Overwrite default dependencies file
37         mv vpp_dependencies packaging/deb/common/
38     fi
39 fi
40
41 # Build package
42 if [[ "${OS}" == "centos7" ]]; then
43
44     # Build the rpms
45     ./packaging/rpm/rpmbuild.sh
46
47     # Find the files
48     RPMS=$(find ./packaging/ -type f -iname '*.rpm')
49     SRPMS=$(find ./packaging/ -type f -iname '*.srpm')
50     SRCRPMS=$(find ./packaging/ -type f -name '*.src.rpm')
51
52     # Publish hc2vpp packages
53     for i in ${RPMS} ${SRPMS} ${SRCRPMS}
54     do
55         push_rpm "$i"
56     done
57 elif [[ "${OS}" == "ubuntu1604" ]]; then
58
59     # Build the debs
60     ./packaging/deb/xenial/debuild.sh
61
62     # Find the files
63     DEBS=$(find ./packaging/ -type f -iname '*.deb')
64
65     # Publish hc2vpp packages
66     for i in ${DEBS}
67     do
68         push_deb "$i"
69     done
70 elif [[ "${OS}" == "ubuntu1804" ]]; then
71
72     # Build the debs
73     ./packaging/deb/bionic/debuild.sh
74
75     # Find the files
76     DEBS=$(find ./packaging/ -type f -iname '*.deb')
77
78     # Publish hc2vpp packages
79     for i in ${DEBS}
80     do
81         push_deb "$i"
82     done
83 fi