Commit f0b05dd3 authored by John Levon's avatar John Levon Committed by Tomasz Zawadzki
Browse files

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: default avatarJohn 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
parent 1ab3531e
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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
+7 −1
Original line number Diff line number Diff line
@@ -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
+10 −6
Original line number Diff line number Diff line
@@ -89,9 +89,13 @@ if [[ ${ID,,} == *"suse"* ]]; then
	ID="sles"
fi

if [[ -e $scriptsdir/pkgdep/$ID.sh ]]; then
	source "$scriptsdir/pkgdep/$ID.sh"
for id in $ID $ID_LIKE; do
	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
		exit 0
	fi
done

printf 'Not supported platform detected (%s), aborting\n' "$ID" >&2
exit 1