From: Ian Campbell Subject: [PATCH OSSTEST v7 1/2] cr-publish-flight-logs: support publishing files from $HOME/public_html Date: Thu, 9 Jul 2015 12:59:24 +0100 Message-ID: <1436443165-13837-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Any arguments given after the flight are assumed to be files or directories relative to $HOME/public_html which should be published to $c{Publish} at the same relative path. Removing the requirement that a flight be provided, by accepting '', allows this to be used even in contexts which have no flight. The results subtree is always published if $c{ResultsPublish} is set, since it doesn't depend on any particular flight. Signed-off-by: Ian Campbell --- v7: New patch --- cr-publish-flight-logs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cr-publish-flight-logs b/cr-publish-flight-logs index 94c74c8..0fdd02d 100755 --- a/cr-publish-flight-logs +++ b/cr-publish-flight-logs @@ -31,10 +31,10 @@ if (@ARGV && $ARGV[0] eq '--push-harness') { $push_harness = 1; } -die "usage: ./cr-publish-flight-logs " unless @ARGV==1; +die "usage: ./cr-publish-flight-logs [public_html files]" unless @ARGV>=1; my $flight= shift @ARGV; -die unless $flight =~ m/^\d+$/; +die unless $flight =~ m/^\d*$/; open LOCK, "> $c{GlobalLockDir}/publish-lock" or die $!; flock LOCK, LOCK_EX or die $!; @@ -49,7 +49,7 @@ if ($push_harness) { system_checked("ssh $githost 'cd $gitdir && git update-server-info'"); } -sub copydir ($$) { +sub copylogs ($$) { my ($src,$dst) = @_; my @cmd= qw(rsync --compress --compress-level=9 --stats --delete -auH); push @cmd, '-e', 'ssh -o batchmode=yes'; @@ -59,5 +59,11 @@ sub copydir ($$) { $!=0; $?=0; system @cmd; die "rsync $? $!" if $? or $!; } -copydir("$c{Logs}/$flight/", "$c{LogsPublish}/$flight") if $c{LogsPublish}; -copydir("$c{Results}/", "$c{ResultsPublish}") if $c{ResultsPublish}; +copylogs("$c{Logs}/$flight/", "$c{LogsPublish}/$flight") + if $flight && $c{LogsPublish}; +copylogs("$c{Results}/", "$c{ResultsPublish}") if $c{ResultsPublish}; + +if ( $c{Publish} ) { + copylogs("$ENV{'HOME'}/public_html/$_", "$c{Publish}/$_") + foreach @ARGV; +} -- 2.1.4