]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
TestSupport: Introduce target_run_pkgmanager_install
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 21 Jun 2018 15:44:10 +0000 (16:44 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 21 Jun 2018 15:56:55 +0000 (16:56 +0100)
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).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Osstest/TestSupport.pm
ts-xen-install

index 53836925984dac37b1fd3a40eb9745cb16a76b3c..5d1f6dc7c7a8eea1a6aae28f0395f15fbafdf282 100644 (file)
@@ -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, $packagelist, $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 ($$$) {
index 3463e172fa9cde34afefc927e001ec3c64bc30d0..8de94ac2de212285eede97546786ac26bcdb3d91 100755 (executable)
@@ -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);
     }
 }