@@ -68,7 +68,6 @@ BEGIN {
http_proxy_envsettings
target_editfile_root target_file_exists
target_editfile_kvp_replace
- target_run_apt
target_install_packages target_install_packages_norec
target_jobdir target_extract_jobdistpath_subdir
target_extract_jobdistpath target_tftp_prefix
@@ -523,19 +522,34 @@ 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 package_install_cmd {
+ my ($norec) = @_;
+ my @hostflags = get_hostflags('host');
+ my @cmd;
+
+ if (grep /^freebsd\b/i, @hostflags) {
+ 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(--no-install-recommends) if $norec;
+ push @cmd, qw(-y install);
+ }
+
+ return @cmd;
}
sub target_install_packages {
my ($ho, @packages) = @_;
- target_run_apt($ho, qw(-y install), @packages);
+ my @cmd = package_install_cmd();
+
+ target_cmd_root($ho,"@cmd @packages", 3000);
}
sub target_install_packages_norec {
my ($ho, @packages) = @_;
- target_run_apt($ho, qw(--no-install-recommends -y install), @packages);
+ my @cmd = package_install_cmd(1);
+
+ target_cmd_root($ho,"@cmd @packages", 3000);
}
sub target_somefile_getleaf ($$$) {
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. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- 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 | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)