xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH] TestSupport: stash installer files etc.
Date: Mon, 12 May 2014 11:50:34 +0100	[thread overview]
Message-ID: <1399891834-15334-1-git-send-email-ian.jackson@eu.citrix.com> (raw)

Stash the pxeboot config file, the preseed file, et al.  This is done
centrally in file_link_contents.

We don't stash things whose $contents is actually a coderef because
(a) doing so would be inconvenient and (b) many of them are large and
not very interesting.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/TestSupport.pm |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 6558fc8..d5875b3 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1833,17 +1833,18 @@ sub await_webspace_fetch_byleaf ($$$$$) {
 
 sub create_webfile ($$$) {
     my ($ho, $tail, $contents) = @_; # $contents as for file_link_contents
-    my $wf_common= $c{WebspaceCommon}.$ho->{Name}."_".$tail;
+    my $wf_rhs= $ho->{Name}."_".$tail;
+    my $wf_common= $c{WebspaceCommon}.$wf_rhs;
     my $wf_url= $c{WebspaceUrl}.$wf_common;
     my $wf_file= $c{WebspaceFile}.$wf_common;
-    file_link_contents($wf_file, $contents);
+    file_link_contents($wf_file, $contents, "webspace-$wf_rhs");
     return $wf_url;
 }
 
 #---------- pxe handling ----------
 
-sub file_link_contents ($$) {
-    my ($fn, $contents) = @_;
+sub file_link_contents ($$$) {
+    my ($fn, $contents, $stash) = @_;
     # $contents as for file_write_contents
     my ($dir, $base, $ext) =
         $fn =~ m,^( (?: .*/ )? )( [^/]+? )( (?: \.[^./]+ )? )$,x
@@ -1851,6 +1852,14 @@ sub file_link_contents ($$) {
     my $real= "$dir$base--osstest$ext";
     my $linktarg= "$base--osstest$ext";
 
+    if (ref $contents) { $stash = undef; }
+
+    if (defined $stash) {
+	my $stashh= open_unique_stashfile(\$stash);
+	print $stashh $contents or die "$stash: $!";
+	close $stashh or die "$stash: $!";
+    }
+
     file_simple_write_contents($real, $contents);
 
     my $newlink= "$dir$base--newlink$ext";
@@ -1863,7 +1872,7 @@ sub file_link_contents ($$) {
     }
     symlink $linktarg, $newlink or die "$newlink $!";
     rename $newlink, $fn or die "$newlink $fn $!";
-    logm("wrote $fn");
+    logm("wrote $fn". (defined $stash ? " (stashed as $stash)" : ""));
 }
 
 sub host_pxefile ($) {
@@ -1901,7 +1910,8 @@ sub host_pxefile ($) {
 sub setup_pxeboot ($$) {
     my ($ho, $bootfile) = @_;
     my $f= host_pxefile($ho);
-    file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile);
+    file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile,
+	"$ho->{Name}-pxelinux.cfg");
 }
 
 sub setup_pxeboot_local ($) {
-- 
1.7.10.4

                 reply	other threads:[~2014-05-12 10:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399891834-15334-1-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).