[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH v19 08/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).

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 22 ++++++++++++++--------
 ts-xen-install         |  2 +-
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 5383692..0ac41e2 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -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 ($$$) {
diff --git a/ts-xen-install b/ts-xen-install
index 3463e17..8de94ac 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -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);
     }
 }
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.