X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fpackaging%2Ftest-rpm-deps.sh;h=982fb5c27c564d8c12e0a0254cc406ccef895286;hb=10a7971e7547543096f4d540270d1211fe5d2104;hp=2bb0db6dbda972cc7368a4dfee44ae40dd9e008d;hpb=f618ffefcc5a3904f0fdcc2db3bcb88323bcd425;p=releng%2Fbuilder.git diff --git a/jjb/packaging/test-rpm-deps.sh b/jjb/packaging/test-rpm-deps.sh index 2bb0db6db..982fb5c27 100644 --- a/jjb/packaging/test-rpm-deps.sh +++ b/jjb/packaging/test-rpm-deps.sh @@ -7,7 +7,7 @@ set -ex -o pipefail # Verify exactly 1 RPM is in the path we expect -set -- /home/$USER/rpmbuild/RPMS/noarch/*.rpm +set -- $HOME/rpmbuild/RPMS/noarch/*.rpm if [ $# -eq 1 ]; then echo "Found one RPM in build out dir, as expected" else @@ -16,7 +16,7 @@ else fi # If path is globbed (/path/to/*.rpm), expand it -path=$(sudo find / -wholename /home/$USER/rpmbuild/RPMS/noarch/*.rpm) +path=$(sudo find / -wholename $HOME/rpmbuild/RPMS/noarch/*.rpm) # If no RPM found, fail clearly if [ -z $path ]; then @@ -24,18 +24,31 @@ if [ -z $path ]; then exit 1 fi -# Requirements for package where SRPM was built into noarch on CentOS CBS -# rpm -qp opendaylight-8.0.0-0.1.20171125rel2049.el7.noarch.rpm --requires -# shellcheck disable=SC2034 -declare -a expected_deps=( "/bin/bash" - "/bin/sh" - "java >= 1:1.8.0" - "rpmlib(CompressedFileNames) <= 3.0.4-1" - "rpmlib(FileDigests) <= 4.6.0-1" - "rpmlib(PartialHardlinkSets) <= 4.0.4-1" - "rpmlib(PayloadFilesHavePrefix) <= 4.0-1" - "shadow-utils" - "rpmlib(PayloadIsXz) <= 5.2-1" ) + +if [ -f /usr/bin/yum ]; then + # Requirements for package where SRPM was built into noarch on CentOS CBS + # rpm -qp opendaylight-8.0.0-0.1.20171125rel2049.el7.noarch.rpm --requires + # shellcheck disable=SC2034 + declare -a expected_deps=( "/bin/bash" + "/bin/sh" + "java >= 1:1.8.0" + "rpmlib(CompressedFileNames) <= 3.0.4-1" + "rpmlib(FileDigests) <= 4.6.0-1" + "rpmlib(PartialHardlinkSets) <= 4.0.4-1" + "rpmlib(PayloadFilesHavePrefix) <= 4.0-1" + "shadow-utils" + "rpmlib(PayloadIsXz) <= 5.2-1" ) + +elif [ -f /usr/bin/zypper ]; then + declare -a expected_deps=( "/bin/bash" + "/bin/sh" + "java >= 1.8.0" + "rpmlib(CompressedFileNames) <= 3.0.4-1" + "rpmlib(PayloadFilesHavePrefix) <= 4.0-1" + "shadow" + "rpmlib(PayloadIsLzma) <= 4.4.6-1" ) + +fi # Karaf 4 distros also have a /usr/bin/env requirement INTPAK-120 if [[ ! $path == *opendaylight-6* ]]; then @@ -43,12 +56,13 @@ if [[ ! $path == *opendaylight-6* ]]; then fi # shellcheck disable=SC2034 -mapfile -t actual_deps < <( rpm -qp /home/$USER/rpmbuild/RPMS/noarch/*.rpm --requires ) +mapfile -t actual_deps < <( rpm -qp $HOME/rpmbuild/RPMS/noarch/*.rpm --requires ) # shellcheck disable=SC2154 disable=SC2145 printf 'Dependency found: %s\n' "${actual_deps[@]}" # shellcheck disable=SC2154,SC2145,SC2034,SC2207 diff_deps=(`echo "${expected_deps[@]}" "${actual_deps[@]}" | tr ' ' '\n' | sort | uniq -u`) + # shellcheck disable=SC2154 disable=SC2145 disable=SC2068 disable=SC2170 disable=SC1083 if [ ${#diff_deps[*]} -eq 0 ]; then echo "RPM requirements are as expected"