forked from fengguang/lkp-tests
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathcentos
executable file
·171 lines (125 loc) · 3.69 KB
/
centos
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
#!/bin/bash
shopt -s nullglob
. $LKP_SRC/lib/install.sh
. $LKP_SRC/distro/common
. $LKP_SRC/lib/debug.sh
fixup_distro_mirror()
{
dnf config-manager --set-enabled crb
}
install()
{
local pkg="$1"
rpm --quiet --query "$pkg" || $LKP_SRC/distro/installer/$DISTRO "$pkg"
}
distro_install_depends()
{
local script
local bm="$1"
local script=$(get_dependency_file $bm)
[[ -f $script ]] || {
echo "no depends file found for $bm"
return 0
}
packages=$(get_dependency_packages $DISTRO $bm)
[ -z "$packages" ] && return
echo install packages for $bm: $packages
local ocfs2_tools_name=$(echo "$packages" | grep 'ocfs2-tools')
[ -n "$ocfs2_tools_name" ] && install_ocfs2_tools "$ocfs2_tools_name"
for pkg in $packages
do
install $pkg
done
}
pack_benchmark()
{
setup_proxy
distro_install_depends lkp-dev
# Process each benchmark
for BM_NAME in $benchmark
do
distro_install_depends $BM_NAME-dev || continue
echo $LKP_SRC/sbin/pack -d $DISTRO -f -c -s $PKG_MNT/$pack_to $BM_NAME
(
$LKP_SRC/sbin/pack -d $DISTRO -f -c -s $PKG_MNT/$pack_to $BM_NAME
)
done
}
download()
{
$LKP_SRC/distro/installer/$DISTRO --downloadonly $*
}
pack()
{
# PWD is / and pack opt/rpms by relative path
local target_dir=opt/rpms
local date=$(date +"%Y%m%d")
local downloaded_rpms=$(find /var/ -type f -name "*.rpm")
[ "$downloaded_rpms" ] || return
mkdir -p $target_dir
mv $downloaded_rpms $target_dir
find $target_dir | cpio --quiet -o -H newc --owner=root.root | gzip -n -9 >$pack_to/${BM_NAME}_$date.cgz
ln -sf ${BM_NAME}_$date.cgz $pack_to/${BM_NAME}.cgz || return
chown .lkp $pack_to/${BM_NAME}_$date.cgz $pack_to/${BM_NAME}.cgz || return
echo package installed to $pack_to/${BM_NAME}.cgz
ls $target_dir/*.rpm > $pack_to/.${BM_NAME}.packages
rm -rf $target_dir
}
cleanup_downloaded_rpms()
{
find /var/ -type f -name "*.rpm" -exec rm -f -- '{}' \;
}
pack_benchmark_deps()
{
setup_proxy
for BM_NAME in $benchmark
do
cleanup_downloaded_rpms
check_shared_package $BM_NAME
packages=$(get_dependency_packages $DISTRO $BM_NAME)
local ocfs2_tools_name=$(echo "$packages" | grep 'ocfs2-tools')
[ -n "$ocfs2_tools_name" ] && download_ocfs2_tools "$ocfs2_tools_name"
if download "$packages"; then
pack
else
echo "failed to pack-deps $BM_NAME" >&2
fi
done
}
install_gcc7()
{
if [ $DISTRO = "aliyun" ]; then
wget -O /tmp/centos-release-scl-rh-2-3.el7.centos.noarch.rpm https://rpmfind.net/linux/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
rpm -ivh --ignoresize /tmp/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
else
install centos-release-scl-rh
fi
$LKP_SRC/distro/installer/$DISTRO "devtoolset-7-gcc*"
source /opt/rh/devtoolset-7/enable
}
download_rpm()
{
local rpm=$1
install wget
mkdir -p /opt/rpms
wget -nc -P /opt/rpms $rpm
}
download_ocfs2_tools()
{
local pkgs=$1
download_rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/ocfs2-tools-1.8.6-11.el7.x86_64.rpm
local download_pkgs="/opt/rpms/ocfs2-tools-1.8.6-11.el7.x86_64.rpm"
if echo "$pkgs" | grep -q 'ocfs2-tools-devel'; then
download_rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/ocfs2-tools-devel-1.8.6-11.el7.x86_64.rpm
download_pkgs="$download_pkgs /opt/rpms/ocfs2-tools-devel-1.8.6-11.el7.x86_64.rpm"
fi
# Try to download the dependences of ocfs2-tools/ocfs2-tools-devel
$LKP_SRC/distro/installer/$DISTRO --downloadonly "$download_pkgs"
}
install_ocfs2_tools()
{
local pkgs=$1
download_ocfs2_tools "$pkgs"
$LKP_SRC/distro/installer/$DISTRO /opt/rpms/ocfs2-tools-1.8.6-11.el7.x86_64.rpm
echo "$pkgs" | grep -q 'ocfs2-tools-devel' && $LKP_SRC/distro/installer/$DISTRO /opt/rpms/ocfs2-tools-devel-1.8.6-11.el7.x86_64.rpm
}