From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 06/13] TestSupport: Break out target_extract_jobdistpath_subdir Date: Fri, 16 May 2014 19:01:33 +0100 Message-ID: <1400263300-22903-7-git-send-email-ian.jackson@eu.citrix.com> References: <1400263300-22903-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WlMSf-0002E3-Ab for xen-devel@lists.xenproject.org; Fri, 16 May 2014 18:02:25 +0000 In-Reply-To: <1400263300-22903-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org This is the meat of what was Osstest::BuildSupport::xendist, which now becomes a simple convenience wrapper. No functional change. Signed-off-by: Ian Jackson --- Osstest/BuildSupport.pm | 9 ++------- Osstest/TestSupport.pm | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Osstest/BuildSupport.pm b/Osstest/BuildSupport.pm index d5fb677..bd79b4b 100644 --- a/Osstest/BuildSupport.pm +++ b/Osstest/BuildSupport.pm @@ -79,13 +79,8 @@ sub prepbuilddirs { } sub xendist () { - $xendist= "$builddir/xendist"; - target_cmd($ho,"rm -rf $xendist && mkdir $xendist",60); - - my $path = get_stashed("path_dist", $r{"buildjob"}); - my $distcopy= "$builddir/dist.tar.gz"; - target_putfile($ho, 300, $path, $distcopy); - target_cmd($ho, "tar -C $xendist -hzxf $distcopy", 300); + $xendist = target_extract_jobdistpath_subdir + ($ho, 'xendist', '', $r{"buildjob"}); } #----- submodules ----- diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 96454d3..d72a02c 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -58,7 +58,7 @@ BEGIN { target_editfile_root target_file_exists target_run_apt target_install_packages target_install_packages_norec - target_jobdir + target_jobdir target_extract_jobdistpath_subdir target_extract_jobdistpath target_guest_lv_name poll_loop tcpconnect await_tcp @@ -1714,6 +1714,24 @@ sub target_jobdir ($) { return "$homedir/$leaf"; } +sub target_extract_jobdistpath_subdir ($$$$) { + my ($ho, $subdir, $distpart, $buildjob) = @_; + # Extracts dist part $distpart from job $buildjob into an + # job-specific directory with leafname $subdir on $ho, and returns + # the directory's pathname. Does not need root. + + my $jobdir = target_jobdir($ho); + my $distdir = "$jobdir/$subdir"; + target_cmd($ho,"rm -rf $distdir && mkdir $distdir",60); + + my $path = get_stashed("path_${distpart}dist", $buildjob); + my $distcopy= "$jobdir/${subdir}.tar.gz"; + target_putfile($ho, 300, $path, $distcopy); + target_cmd($ho, "tar -C $distdir -hzxf $distcopy", 300); + + return $distdir; +} + sub target_extract_jobdistpath ($$$$$) { my ($ho, $part, $path, $job, $distpath) = @_; $distpath->{$part}= get_stashed($path, $job); -- 1.7.10.4