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

[Xen-devel] [PATCH v6 09/20] osstest: introduce build helpers for FreeBSD



Some steps of the FreeBSD build process need to be done as root, so
introduce some helpers to perform those steps:
buildcmd_stamped_logged_root and target_cmd_build_root. They behave
exactly the same as the non-root counterparts.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
Changes since v3:
 - New in this version.
---
 Osstest/BuildSupport.pm | 26 ++++++++++++++++++++++----
 Osstest/TestSupport.pm  | 27 +++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/Osstest/BuildSupport.pm b/Osstest/BuildSupport.pm
index 4c2b658b..b96ce766 100644
--- a/Osstest/BuildSupport.pm
+++ b/Osstest/BuildSupport.pm
@@ -36,7 +36,7 @@ BEGIN {
                       $whhost $ho
 
                       builddirsprops
-                      buildcmd_stamped_logged
+                      buildcmd_stamped_logged buildcmd_stamped_logged_root
                       $builddir $makeflags
                      $buildcmd_global_prefix
 
@@ -60,9 +60,9 @@ our ($xendist);
 
 our $buildcmd_global_prefix //= '';
 
-sub buildcmd_stamped_logged ($$$$$$) {
-    my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_;
-    target_cmd_build($ho, $timeout, $builddir, <<END);
+sub buildcmd_stamped_logged_script ($$$$$) {
+    my ($component, $stampname, $prefix, $cmd, $suffix) = @_;
+    my $script = <<END;
         cd $component
         $buildcmd_global_prefix
         $prefix
@@ -73,6 +73,24 @@ sub buildcmd_stamped_logged ($$$$$$) {
         echo ok.
 END
 #/;
+
+    return $script;
+}
+
+sub buildcmd_stamped_logged_root ($$$$$$) {
+    my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_;
+    my $script = buildcmd_stamped_logged_script($component, $stampname,
+                                                $prefix, $cmd, $suffix);
+
+    target_cmd_build_root($ho, $timeout, $builddir, $script);
+}
+
+sub buildcmd_stamped_logged ($$$$$$) {
+    my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_;
+    my $script = buildcmd_stamped_logged_script($component, $stampname,
+                                                $prefix, $cmd, $suffix);
+
+    target_cmd_build($ho, $timeout, $builddir, $script);
 }
 
 sub selectbuildhost {
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 77585562..ab8495a9 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -56,6 +56,7 @@ BEGIN {
 
                       target_cmd_root_status target_cmd_output_root_status
                       target_cmd_root target_cmd target_cmd_build
+                      target_cmd_build_root
                       target_cmd_output_root target_cmd_output
                       target_cmd_inputfh_root sshuho
                       target_getfile target_getfile_root
@@ -669,8 +670,8 @@ sub target_editfile      ($$$;$$) { 
teditfileex('osstest',@_); }
     # my ($ho,$rfile, $lleaf,$rdest) = @_;
     #                 ^^^^^^^^^^^^^ optional
 
-sub target_cmd_build ($$$$) {
-    my ($ho,$timeout,$builddir,$script) = @_;
+sub target_cmd_build_script ($$$) {
+    my ($ho, $builddir, $script) = @_;
 
     my $distcc_hosts = get_host_property($ho,'DistccHosts',undef);
     my $distcc = defined($distcc_hosts) ? <<END : "";
@@ -682,8 +683,8 @@ END
 
     my $httpproxy = http_proxy_envsettings($ho);
 
-    target_cmd($ho, <<END.$distcc.<<END.$script, $timeout);
-       set -xe
+    my $cmd = <<END.$distcc.<<END.$script;
+        set -xe
         LC_ALL=C; export LC_ALL
         PATH=/usr/lib/ccache:\$PATH:/usr/lib/git-core
         $httpproxy
@@ -692,6 +693,24 @@ END
         cd $builddir
         rm -f build-ok-stamp
 END
+
+    return $cmd;
+}
+
+sub target_cmd_build ($$$$) {
+    my ($ho,$timeout,$builddir,$script) = @_;
+
+    my $cmd = target_cmd_build_script($ho, $builddir, $script);
+
+    target_cmd($ho, $cmd, $timeout);
+}
+
+sub target_cmd_build_root ($$$$) {
+    my ($ho,$timeout,$builddir,$script) = @_;
+
+    my $cmd = target_cmd_build_script($ho, $builddir, $script);
+
+    target_cmd_root($ho, $cmd, $timeout);
 }
 
 sub target_ping_check_core {
-- 
2.11.0 (Apple Git-81)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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