forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
openib.eclass
146 lines (124 loc) · 2.85 KB
/
openib.eclass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: openib.eclass
# @AUTHOR:
# Original Author: Alexey Shvetsov <[email protected]>
# @BLURB: Simplify working with OFED packages
inherit eutils rpm versionator
EXPORT_FUNCTIONS src_unpack
HOMEPAGE="https://www.openfabrics.org/"
LICENSE="|| ( GPL-2 BSD-2 )"
# @ECLASS-VARIABLE: OFED_VER
# @DESCRIPTION:
# Defines OFED version eg 1.4 or 1.4.0.1
# @ECLASS-VARIABLE: OFED_RC
# @DESCRIPTION:
# Sets if this version is RC
# @ECLASS-VARIABLE: OFED_RC_VER
# @DESCRIPTION:
# Sets RC version
# @ECLASS-VARIABLE: OFED_SUFFIX
# @DESCRIPTION:
# Defines OFED package suffix eg -1.ofed1.4
# @ECLASS-VARIABLE: OFED_SNAPSHOT
# @DESCRIPTION:
# Defines if src tarball is git snapshot
SLOT="${OFED_VER}"
# @ECLASS-VARIABLE: OFED_VERSIONS
# @DESCRIPTION:
# Defines array of ofed version supported by eclass
OFED_VERSIONS=(
"3.5"
"3.12"
)
# @FUNCTION: block_other_ofed_versions
# @DESCRIPTION:
# function that creates blockers list for ofed
block_other_ofed_versions() {
local slot
RDEPEND="${RDEPEND} !sys-fabric/${PN}:0"
for slot in ${OFED_VERSIONS[@]}; do
if [[ ${slot} != ${SLOT} ]]; then
RDEPEND+=" !sys-fabric/${PN}:${slot}"
fi
done
}
OFED_BASE_VER=$(get_version_component_range 1-3 ${OFED_VER})
if [ -z $OFED_RC ] ; then
SRC_URI="https://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VER}/OFED-${OFED_VER}.tgz"
else
SRC_URI="https://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VER}/OFED-${OFED_VER}-rc${OFED_RC_VER}.tgz"
fi
case ${PN} in
ofed)
MY_PN="compat-rdma"
;;
*)
MY_PN="${PN}"
;;
esac
case ${PV} in
*p*)
MY_PV="${PV/p/}"
;;
*)
MY_PV="${PV}"
;;
esac
case ${MY_PN} in
ofa_kernel|compat-rdma)
EXT="tgz"
;;
*)
EXT="tar.gz"
;;
esac
if [ -z ${OFED_SRC_SNAPSHOT} ]; then
S="${WORKDIR}/${MY_PN}-${MY_PV}"
else
S="${WORKDIR}/${MY_PN}-${MY_PV}-${OFED_SUFFIX}"
fi
# @FUNCTION: openib_src_unpack
# @DESCRIPTION:
# This function will unpack OFED packages
openib_src_unpack() {
unpack ${A}
if [ -z ${OFED_RC} ]; then
case ${PN} in
ofed)
rpm_unpack "./OFED-${OFED_VER}/SRPMS/${MY_PN}-${OFED_VER}-${OFED_SUFFIX}.src.rpm"
;;
*)
rpm_unpack "./OFED-${OFED_VER}/SRPMS/${MY_PN}-${MY_PV}-${OFED_SUFFIX}.src.rpm"
;;
esac
else
case ${PN} in
ofed)
rpm_unpack "./OFED-${OFED_VER}-rc${OFED_RC_VER}/SRPMS/${MY_PN}-${OFED_VER}-${OFED_SUFFIX}.src.rpm"
;;
*)
rpm_unpack "./OFED-${OFED_VER}-rc${OFED_RC_VER}/SRPMS/${MY_PN}-${MY_PV}-${OFED_SUFFIX}.src.rpm"
;;
esac
fi
if [ -z ${OFED_SNAPSHOT} ]; then
case ${PN} in
ofed)
unpack ./${MY_PN}-${OFED_VER}.${EXT}
;;
*)
unpack ./${MY_PN}-${MY_PV}.${EXT}
;;
esac
else
case ${PN} in
ofed)
unpack ./${MY_PN}-${OFED_VER}-${OFED_SUFFIX}.${EXT}
;;
*)
unpack ./${MY_PN}-${MY_PV}-${OFED_SUFFIX}.${EXT}
;;
esac
fi
}