]> xenbits.xensource.com Git - osstest.git/commitdiff
TestSupport: break out target_run_apt
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 10 Feb 2014 16:34:52 +0000 (16:34 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 12 Feb 2014 14:22:47 +0000 (14:22 +0000)
We are going to add some environment variables to the apt invocation,
so centralise where this happens.  No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index a513540bae129adfaa6f03de48d460b4ebb20761..e546dc9182ab94ce0e77f830dfab87fd31737607 100644 (file)
@@ -56,6 +56,7 @@ BEGIN {
                      target_putfilecontents_root_stash
                       target_put_guest_image
                       target_editfile_root target_file_exists
+                      target_run_apt
                       target_install_packages target_install_packages_norec
                       target_extract_jobdistpath target_guest_lv_name
 
@@ -416,16 +417,21 @@ sub target_putfile ($$$$;$) {
 sub target_putfile_root ($$$$;$) {
     tputfileex('root', @_);
 }
+sub target_run_apt {
+    my ($ho, $timeout, @aptopts) = @_;
+    target_cmd_root($ho,
+                    "apt-get @aptopts",
+                    $timeout);
+}
 sub target_install_packages {
     my ($ho, @packages) = @_;
-    target_cmd_root($ho, "apt-get -y install @packages",
-                    300 + 100 * @packages);
+    target_run_apt($ho, 300 + 100 * @packages,
+                  qw(-y install), @packages);
 }
 sub target_install_packages_norec {
     my ($ho, @packages) = @_;
-    target_cmd_root($ho,
-                    "apt-get --no-install-recommends -y install @packages",
-                    300 + 100 * @packages);
+    target_run_apt($ho, 300 + 100 * @packages,
+                  qw(--no-install-recommends -y install), @packages);
 }
 
 sub target_somefile_getleaf ($$$) {