diff mbox

[v5,10/17] osstest: add support for the FreeBSD package manager

Message ID 20170708074712.44451-11-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné July 8, 2017, 7:47 a.m. UTC
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(-)

Comments

Ian Jackson July 19, 2017, 3:38 p.m. UTC | #1
Roger Pau Monne writes ("[PATCH v5 10/17] osstest: add support for the FreeBSD package manager"):
> 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>
...
> +sub package_install_cmd {
                          ^
                           (;$)

Should have a prototype.  Sorry for not spotting this before.

With that fixed,

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks,
Ian.
diff mbox

Patch

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index ab8495a9..2928a6fa 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -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 ($$$) {