On Sun, Jan 30, 2022 at 08:58:23AM +0800, Wang Yong wrote:
>[why]
>install lkp depends before test suite to satisfy lkp-tests
>
>Signed-off-by: Wang Yong <wangyong187(a)huawei.com>
>---
> lib/job2sh.rb | 2 ++
> setup/install_depends | 49 +++++++++++++++++++++++++++++++++++--------
> 2 files changed, 42 insertions(+), 9 deletions(-)
>
>diff --git a/lib/job2sh.rb b/lib/job2sh.rb
>index 4e8bf97fb..32caf2ade 100755
>--- a/lib/job2sh.rb
>+++ b/lib/job2sh.rb
>@@ -316,6 +316,7 @@ class Job2sh < Job
> @monitors = available_programs(:monitors)
> @setups = available_programs(:setup)
> @programs = available_programs(:workload_elements)
>+ @lkp = {"install_depends"=>{}}
how about use '@install_depends'?
Thanks,
Jihui
>
> unless job
> job = (@jobx || @job).clone # a shallow copy so that delete_if won't impact @job
>@@ -336,6 +337,7 @@ class Job2sh < Job
> out_line
> out_line "\texport_top_env"
> out_line
>+ parse_hash [], @lkp
> parse_hash [], job
> out_line "}\n\n"
> @script_lines
>diff --git a/setup/install_depends b/setup/install_depends
>index b5390cad1..8a6da808e 100755
>--- a/setup/install_depends
>+++ b/setup/install_depends
>@@ -1,6 +1,7 @@
> #!/bin/sh
>
> . $LKP_SRC/lib/detect-system.sh
>+. $LKP_SRC/lib/install.sh
>
> detect_system
>
>@@ -16,8 +17,6 @@ set_ubuntu_debian()
> -e "s|http://archive.ubuntu.com|${mirror_addr}|g" \
> -i.bak \
> /etc/apt/sources.list
>-
>- apt-get install -yqm "${packages}"
> }
>
> set_suse()
>@@ -25,8 +24,6 @@ set_suse()
> sed -e "s|^baseurl=http://download.opensuse.org|baseurl=${mirror_addr}/opensuse|g" \
> -i.bak \
> /etc/zypp/repos.d/repo-*.repo
>-
>- zypper -q install -y "${packages}"
> }
>
> set_archlinux()
>@@ -36,8 +33,6 @@ set_archlinux()
> else
> sed -i "1s;^;Server\\ =\\ ${mirror_addr}/archlinux/\$arch/\$repo\\n;" /etc/pacman.d/mirrorlist
> fi
>-
>- pacman -Syq --noconfirm --needed "${packages}"
> }
>
> set_fedora()
>@@ -46,8 +41,6 @@ set_fedora()
> -e "s|^#baseurl=http://download.example/pub/fedora/linux|baseurl=${mirror_addr}/fedora|g" \
> -i.bak \
> /etc/yum.repos.d/fedora*.repo
>-
>- dnf install -y -q "${packages}"
> }
>
> set_centos()
>@@ -74,7 +67,43 @@ set_centos()
> ;;
>
> esac
>- yum install -y -q "${packages}"
>+}
>+
>+adapt_lkp_depends()
>+{
>+ os=$(echo "${_system_name}" | tr '[:upper:]' '[:lower:]')
>+ lkp_depends=$(get_dependency_packages $os lkp | xargs)
>+}
>+
>+get_package_manager()
>+{
>+ has_cmd "yum" && installer="yum"
>+ has_cmd "dnf" && installer="dnf" && return
>+ has_cmd "apt-get" && installer="apt-get" && return
>+ has_cmd "pacman" && installer="pacman" && return
>+ has_cmd "zypper" && installer="zypper" && return
>+}
>+
>+install_depends()
>+{
>+ packages="$1"
>+
>+ get_package_manager
>+ case "$installer" in
>+ apt-get)
>+ export DEBIAN_FRONTEND=noninteractive
>+ "$installer" install -yqm ${packages}
>+ ;;
>+ dnf|yum)
>+ "$installer" install -y -q --skip-broken ${packages}
>+ ;;
>+ pacman)
>+ "$installer" -Sy --noconfirm --needed ${packages}
>+ ;;
>+ zypper)
>+ "$installer" -q install -y ${packages}
>+ ;;
>+ esac
> }
>
> set_local_mirror()
>@@ -104,3 +133,5 @@ set_local_mirror()
> }
>
> set_local_mirror
>+adapt_lkp_depends
>+install_depends "${lkp_depends}"
>--
>2.23.0
>