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

[Xen-devel] [OSSTEST PATCH 2/4] TestSupport: Break out build_url_vcs



This encapsulates discovery of the tree url and the applicable VCS,
in a form useable separately (ie, outside build_clone).

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 9e6479a..485a29a 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -77,7 +77,9 @@ BEGIN {
                       propname_massage propname_check
          
                       get_stashed open_unique_stashfile compress_stashed
-                      dir_identify_vcs build_clone built_stash built_stash_file
+                      dir_identify_vcs
+                      build_url_vcs build_clone
+                      built_stash built_stash_file
                       built_compress_stashed
                       hg_dir_revision git_dir_revision vcs_dir_revision
                       store_revision store_vcs_revision
@@ -1267,15 +1269,14 @@ sub git_massage_url ($;@) {
     return $url;
 }
 
-sub build_clone ($$$$) {
-    my ($ho, $which, $builddir, $subdir) = @_;
-
-    need_runvars("tree_$which", "revision_$which");
+sub build_url_vcs ($) {
+    my ($which) = @_;
 
     my $tree= $r{"tree_$which"};
-    my $timeout= 4000;
+    return () unless $tree;
 
     my $vcs = $r{"treevcs_$which"};
+    
     if (!defined $vcs) {
        my $effurl = $tree;
        $effurl =~ s#\%20[^/]*$##;
@@ -1283,11 +1284,22 @@ sub build_clone ($$$$) {
            $vcs= 'hg';
        } elsif ($effurl =~ m/\.git$/) {
            $vcs= 'git';
-       } else {
-           die "unknown vcs for $which $tree ";
        }
     }
 
+    return ($tree, $vcs);
+}
+
+sub build_clone ($$$$) {
+    my ($ho, $which, $builddir, $subdir) = @_;
+
+    need_runvars("tree_$which", "revision_$which");
+
+    my ($tree, $vcs) = build_url_vcs($which);
+    die "unknown vcs for $which $tree" unless defined $vcs;
+
+    my $timeout= 4000;
+
     my $rm = "rm -rf $subdir";
 
     if ($vcs eq 'hg') {
-- 
2.1.4


_______________________________________________
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®.