-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunBuildPrep.basekernel.sh
executable file
·206 lines (168 loc) · 6.52 KB
/
runBuildPrep.basekernel.sh
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/bin/bash
if [[ -v SHS_NEW_BUILD_SYSTEM ]]; then
. ${CE_INCLUDE_PATH}/load.sh
target_branch=$(get_effective_target)
quality_stream=$(get_artifactory_quality_label)
add_repository "${ARTI_URL}/${PRODUCT}-rpm-${quality_stream}-local/${target_branch}/${TARGET_OS}" "${PRODUCT}-${quality_stream}"
install_dependencies "cray-rxe-driver.spec"
if rpm -q kernel-cray_shasta_c; then
rm -f /usr/src/linux-obj/${TARGET_ARCH}/default || true
fi
echo "%include_aux_files 1" >> ~/.rpmmacros
else
# Add OS-appropriate repos for build dependencies
set -x
cat > vars.sh <<- END
ROOT_DIR=`pwd`
PRODUCT=${PRODUCT:-"slingshot"}
EXTRA=${EXTRA:-"slingshot-host-software"}
TARGET_ARCH=${TARGET_ARCH:-"x86_64"}
BRANCH_NAME=${BRANCH_NAME:-"master"}
ARTIFACT_REPO_HOST=${ARTIFACT_REPO_HOST:-"arti.hpc.amslabs.hpecorp.net"}
TARGET_OS=${TARGET_OS:-"sle15_sp5_ncn"}
SPECFILE="cray-rxe-driver.spec"
END
. vars.sh
. zypper-local.sh
if [[ "${BRANCH_NAME}" == release/* ]]; then
ARTI_LOCATION='rpm-stable-local'
ARTI_BRANCH=${BRANCH_NAME}
elif [[ "${CHANGE_TARGET}" == release/* ]]; then
# CHANGE_TARGET is only set for PR builds and points to the PR target branch
ARTI_LOCATION='rpm-stable-local'
ARTI_BRANCH=${CHANGE_TARGET}
else
ARTI_LOCATION='rpm-master-local'
ARTI_BRANCH=dev/master
fi
cat >> vars.sh <<- END
ARTI_URL=${ARTI_URL:-"https://${ARTIFACT_REPO_HOST}/artifactory"}
ARTI_LOCATION=${ARTI_LOCATION:-"rpm-master-local"}
ARTI_BRANCH=${ARTI_BRANCH:-"dev/master"}
OS_TYPE=`cat /etc/os-release | grep "^ID=" | sed "s/\"//g" | cut -d "=" -f 2`
OS_VERSION=`cat /etc/os-release | grep "^VERSION_ID=" | sed "s/\"//g" | cut -d "=" -f 2`
RHEL_GPU_SUPPORTED_VERSIONS="8.8 8.9 9.3"
BRANCH=`git branch --show-current`
END
. vars.sh
OS_TYPE=`cat /etc/os-release | grep "^ID=" | sed "s/\"//g" | cut -d "=" -f 2`
OS_VERSION=`cat /etc/os-release | grep "^VERSION_ID=" | sed "s/\"//g" | cut -d "=" -f 2`
OS_MAJOR_VERSION=`echo ${OS_VERSION} | cut -d "." -f 1`
if [ -d hpc-shs-version ]; then
git -C hpc-shs-version pull
else
if [[ -n "${SHS_LOCAL_BUILD}" ]]; then
git clone [email protected]:hpe/hpc-shs-version.git
else
git clone https://[email protected]/hpe/hpc-shs-version.git
fi
fi
. hpc-shs-version/scripts/get-shs-version.sh
. hpc-shs-version/scripts/get-shs-label.sh
PRODUCT_VERSION=$(get_shs_version)
PRODUCT_LABEL=$(get_shs_label)
cat >> vars.sh <<- END
PRODUCT_VERSION=${PRODUCT_VERSION}
PRODUCT_LABEL=${PRODUCT_LABEL}
END
sed -i -e "s/Release:.*/Release: ${PRODUCT_LABEL}${PRODUCT_VERSION}_%(echo \\\${BUILD_METADATA:-1})/g" ${SPECFILE}
if [ -d ${WORKSPACE} ]; then
rm -rf ${WORKSPACE}
fi
echo "$0: --> BRANCH_NAME: '${BRANCH_NAME}'"
echo "$0: --> CHANGE_TARGET: '${CHANGE_TARGET}'"
echo "$0: --> PRODUCT: '${PRODUCT}'"
echo "$0: --> TARGET_ARCH: '${TARGET_ARCH}'"
echo "$0: --> TARGET_OS: '${TARGET_OS}'"
echo "$0: --> OS_VERSION: '${OS_VERSION}'"
echo "$0: --> OS_MAJOR_VERSION: '${OS_MAJOR_VERSION}'"
echo "$0: --> ARTI_LOCATION: '${ARTI_LOCATION}'"
echo "$0: --> ARTI_BRANCH: '${ARTI_BRANCH}'"
echo "$0: --> WORKSPACE: '${WORKSPACE}'"
repo_remove_add_refresh () {
# $1 - repo name
# $2 - repo_url
${ZYPPER_COMMAND} lr $1
res=$?
if [ $res -eq 0 ]; then
echo "Removing repo \"$1\""
${ZYPPER_COMMAND} rr $1
else
echo "Repo \"$1\" not present"
fi
${ZYPPER_COMMAND} addrepo --no-gpgcheck --check \
--priority 1 --name=$1 \
$2/ \
$1
${ZYPPER_COMMAND} refresh $1
}
if [ "$ZYPPER_COMMAND" ]; then
mkdir -p $ZYPPER_ROOT/etc/zypp/repos.d
mkdir -p $ZYPPER_ROOT/var/cache/zypp
mkdir -p $ZYPPER_ROOT/var/cache/zypp/raw
mkdir -p $ZYPPER_ROOT/var/cache/zypp/solv
mkdir -p $ZYPPER_ROOT/var/cache/zypp/packages
cp -r /etc/zypp ${WORKSPACE}/zypp/etc
cp -r /var/cache/zypp ${WORKSPACE}/zypp/var/cache
repo_remove_add_refresh internal-${ARTI_LOCATION} ${ARTI_URL}/internal-${ARTI_LOCATION}/${ARTI_BRANCH}/${TARGET_OS}
repo_remove_add_refresh internal-${ARTI_LOCATION}-firmware ${ARTI_URL}/internal-${ARTI_LOCATION}/${ARTI_BRANCH}/sle15_sp2
repo_remove_add_refresh ${PRODUCT}-${ARTI_LOCATION} ${ARTI_URL}/${PRODUCT}-${ARTI_LOCATION}/${ARTI_BRANCH}/${TARGET_OS}
# We need to manually install this RPM (rather than let the build process
# install it automatically) since it contains the kernel-module-package
# macros that our specfile uses
V1=$(uname -r | cut -d"-" -f1)
V2=$(uname -r | cut -d"-" -f2)
${ZYPPER_COMMAND} install -y kernel-default-devel kernel-syms lsb-release quilt
exit 0
elif command -v yum > /dev/null; then
yum-config-manager --setopt=gpgcheck=0 --save
KERNEL_DEVEL_PKG=kernel-devel
version_support_file=./hpc-sshot-slingshot-version/shs-kernel-support/${OS_TYPE}${OS_VERSION}.json
if [ -f ${version_support_file} ]; then
yum install -y jq
for repo in $(jq -r '.[].repo | select( . != null)' ${version_support_file}); do
yum-config-manager --add-repo $repo
done
yum -y install $(jq -r '.[].packages[] | select( . != null)' ${version_support_file})
fi
if [ $OS_TYPE = "centos" ]; then
# Pin kernel version to 4.18.0-305 from Centos 8.4
cat > /etc/yum.repos.d/dst-remote-centos8.repo <<- END
[dst-remote-centos8.4.2105]
name=DST remote centos8.4.2105
baseurl=https://arti.hpc.amslabs.hpecorp.net/artifactory/mirror-centos8.4/8.4.2105/BaseOS/x86_64/os/
enabled=1
gpgcheck=0
logfile=/var/log/yum.log
exclude=kernel
[dst-remote-centos8.4.2105-appstream]
name=DST remote centos8.4.2105 AppStream
baseurl=https://arti.hpc.amslabs.hpecorp.net/artifactory/mirror-centos8.4/8.4.2105/AppStream/x86_64/os/
enabled=1
gpgcheck=0
logfile=/var/log/yum.log
[dst-remote-centos8.4.2105-powertools]
name=DST remote centos8.4.2105 PowerTools
baseurl=https://arti.hpc.amslabs.hpecorp.net/artifactory/mirror-centos8.4/8.4.2105/PowerTools/x86_64/os/
enabled=1
gpgcheck=0
logfile=/var/log/yum.log
END
KERNEL_DEVEL_PKG=kernel-devel-4.18.0-305.25.1.el8_4
fi
yum clean all
yum install -y python3-dnf-plugin-versionlock
yum install -y $KERNEL_DEVEL_PKG
yum versionlock 'kernel-*'
yum-config-manager --add-repo=${ARTI_URL}/${PRODUCT}-${ARTI_LOCATION}/${ARTI_BRANCH}/${TARGET_OS}/
# We need to manually install this RPM (rather than let the build process
# install it automatically) since it contains the kernel-module-package
# macros that our specfile uses
yum install -y kernel-rpm-macros
exit 0
else
"Unsupported package manager or package manager not found -- installing nothing"
exit 0
fi
exit 0
fi