TestSupport: Introduce target_run_pkgmanager_install
PATCH v19 8/20 TestSupport: Introduce target_run_pkgmanager_install
This replaces target_run_apt. It takes more abstract options. It also constructs a @cmd, allowing more flexibility, and supports -f.
The use in ts-xen-install, when handling extradebs, is a bit anomalous because of the empty package list, but it is an anomaly inherited from apt (and this is an apt-specific context).
--- Osstest/TestSupport.pm | 22 ++++++++++++++-------- ts-xen-install | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-)
Osstest/TestSupport.pm +14 -8
@@ -68,7 +68,7 @@ BEGIN { http_proxy_envsettings target_editfile_root target_file_exists target_editfile_kvp_replace - target_run_apt + target_run_pkgmanager_install target_install_packages target_install_packages_norec target_jobdir target_extract_jobdistpath_subdir target_extract_jobdistpath target_extract_distpart
@@ -526,19 +526,25 @@ sub target_putfile ($$$$;$) { sub target_putfile_root ($$$$;$) { tputfileex('root', @_); } -sub target_run_apt { - my ($ho, @aptopts) = @_; - target_cmd_root($ho, - "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y \\ - with-lock-ex -w /var/lock/osstest-apt apt-get @aptopts", 3000); + +sub target_run_pkgmanager_install ($$;$$) { + my ($ho, $packageslist, $norec, $force) = @_; + my @cmd; + push @cmd, qw(DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y + with-lock-ex -w /var/lock/osstest-apt apt-get); + push @cmd, qw(-f) if $force; + push @cmd, qw(--no-install-recommends) if $norec; + push @cmd, qw(-y install); + push @cmd, @$packagelist; + target_cmd_root($ho, "@cmd", 3000); } sub target_install_packages ($@) { my ($ho, @packages) = @_; - target_run_apt($ho, qw(-y install), @packages); + target_run_pkgmanager_install($ho,\@packages); } sub target_install_packages_norec ($@) { my ($ho, @packages) = @_; - target_run_apt($ho, qw(--no-install-recommends -y install), @packages); + target_run_pkgmanager_install($ho,\@packages,1); } sub target_somefile_getleaf ($$$) {
ts-xen-install +1 -1
@@ -99,7 +99,7 @@ sub some_extradebs ($) { target_cmd_root($ho, "dpkg --force-confold $dpkgopts $ontarget </dev/null", 300); - target_run_apt($ho, qw(-f install)); + target_run_pkgmanager_install($ho, [], 0,1); } }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v19 9/20 osstest: add support for the FreeBSD package manager
From: Roger Pau Monne <[email protected]>
FreeBSD support is added to target_install_packages and target_install_packages_norec, although there's no equivalent to the --no-install-recommends in the FreeBSD package manager.
---
v19: Rework on top of target_run_pkgmanager_install
Changes since v6:
- Use $ho->{Os} in order to detect the target OS.
Changes since v5:
- Add prototype for package_install_cmd.
- Use $ho->{Ident} instead of hardcoding "host" in get_hostflags.
Changes since v4:
- Unify more code between FreeBSD and Debian: introduce an OS-agnostic package_install_cmd to generate the install cmd.
Changes since v3:
- New in this version.
--- Osstest/TestSupport.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
Osstest/TestSupport.pm +9 -5
@@ -530,11 +530,15 @@ sub target_putfile_root ($$$$;$) { sub target_run_pkgmanager_install ($$;$$) { my ($ho, $packageslist, $norec, $force) = @_; my @cmd; - push @cmd, qw(DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y - with-lock-ex -w /var/lock/osstest-apt apt-get); - push @cmd, qw(-f) if $force; - push @cmd, qw(--no-install-recommends) if $norec; - push @cmd, qw(-y install); + if ($ho->{OS} eq "freebsd") { + push @cmd, qw(lockf /var/run/osstest-pkg-lock pkg-static install); + } else { + push @cmd, qw(DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y + with-lock-ex -w /var/lock/osstest-apt apt-get); + push @cmd, qw(-f) if $force; + push @cmd, qw(--no-install-recommends) if $norec; + push @cmd, qw(-y install); + } push @cmd, @$packagelist; target_cmd_root($ho, "@cmd", 3000); }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel