scripts/pkgdep: respect $ID_LIKE

As per os-release(5), if $ID is not recognised, $ID_LIKE can be used
to identify similar systems in preference order. Modify the script to try both
variables.

Also do the same for the RPM build scripts.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I4ed924df01ec678aab232e114d8c9980463c38e0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9260
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
John Levon 2021-08-23 23:00:01 +01:00 committed by Tomasz Zawadzki
parent 1ab3531e20
commit f0b05dd384
3 changed files with 27 additions and 8 deletions

View File

@ -16,7 +16,16 @@ bins=("$rootdir/"build/{bin,examples}/*)
((${#bins[@]} > 0)) || exit 0
source /etc/os-release
[[ $ID == fedora || $ID == centos || $ID == rhel ]] || exit 0
id_ok=no
for id in $ID $ID_LIKE; do
[[ "$id" =~ ^(fedora|centos|rhel) ]] && id_ok=yes
done
if [[ "$id_ok" != "yes" ]]; then
exit 0
fi
declare -A deps=()
for bin in "${bins[@]}"; do

View File

@ -8,7 +8,13 @@ rootdir=$(readlink -f "$specdir/../")
[[ -e /etc/os-release ]]
source /etc/os-release
if [[ $ID != fedora && $ID != centos && $ID != rhel ]]; then
id_ok=no
for id in $ID $ID_LIKE; do
[[ "$id" =~ ^(fedora|centos|rhel) ]] && id_ok=yes
done
if [[ "$id_ok" != "yes" ]]; then
printf '%s not supported\n' "$ID" >&2
exit 1
fi

View File

@ -89,9 +89,13 @@ if [[ ${ID,,} == *"suse"* ]]; then
ID="sles"
fi
if [[ -e $scriptsdir/pkgdep/$ID.sh ]]; then
source "$scriptsdir/pkgdep/$ID.sh"
source "$scriptsdir/pkgdep/common.sh"
else
printf 'Not supported platform detected (%s), aborting\n' "$ID" >&2
fi
for id in $ID $ID_LIKE; do
if [[ -e $scriptsdir/pkgdep/$id.sh ]]; then
source "$scriptsdir/pkgdep/$id.sh"
source "$scriptsdir/pkgdep/common.sh"
exit 0
fi
done
printf 'Not supported platform detected (%s), aborting\n' "$ID" >&2
exit 1