Package: svn-buildpackage
Version: 0.6.14
Severity: wishlist

Hi,

The attached patch allow the use of http of ftp URL for the origDir.
e.g: --svn-override=origDir=http://pkg-games.alioth.debian.org/tarballs
We need it since we (Debian Games Team) use to deal with big tarballs
and we prefere to keep them on you http space to avoid a wast of
resource.

Regards,

       Goneri
--- /usr/bin/svn-buildpackage	2005-10-23 04:24:32.000000000 +0200
+++ svn-buildpackage	2006-09-03 04:14:19.000000000 +0200
@@ -8,6 +8,7 @@
 use File::Basename;
 use Cwd;
 use SVN::Client;
+use LWP::Simple;
 #use diagnostics;
 
 $startdir=getcwd;
@@ -262,7 +263,11 @@
 
 if ($$c{"origDir"}) {
    $origExpect = $$c{"origDir"}."/$orig";
-   $origfile = long_path($origExpect) if (-f $origExpect);
+   if (-f $origExpect) {
+      $origfile = long_path($origExpect);
+   } elsif ($origExpect =~ /^http/) {
+      $origfile = $origExpect;
+   }
 }
 else { $origExpect = "(location unknown)" };
 
@@ -298,17 +303,34 @@
 # dpkg-buildpackage (most likely, spew error messages but continue on native
 # packages with dashes)
 if($tagVersion =~ /-/) {
-   my $abs_origfile=long_path($origfile);
    my $orig_target="$ba/".$orig;
-   if($opt_verbose) {
-      print "Trying different methods to export the upstream source:\n";
-      print " - making hard or symbolic link from $origExpect\n" if (!$opt_nolinks);
-      print " - copying the tarball to the expected destination file\n";
-   }
-   else {
-      print "W: $abs_origfile not found, expect problems...\n" if(! -e $abs_origfile);
+   my $abs_origfile=long_path($origfile);
+
+   if ($origfile =~ /^(http|ftp)/) { # remote location
+      if (-e $orig_target) {
+         my @stat = head($origfile);
+         if(($stat[1]) != ((stat($orig_target))[7]))
+         {
+            die "$orig_target exists but differs from $origfile!\nAborting, fix this manually...";
+         }
+      } else {
+         my $http_err_code = getstore($origfile, $orig_target);
+         if(!(is_success($http_err_code) && $orig_target)) {
+            die "Failed to retrieve $origfile ($http_err_code)";
+         }
+      }
    }
-   if($origfile && -e $abs_origfile) {
+   elsif($origfile && -e $abs_origfile) { # local
+      if($opt_verbose) {
+         print "Trying different methods to export the upstream source:\n";
+         print " - making hard or symbolic link from $origExpect\n" if (!$opt_nolinks);
+         print " - copying the tarball to the expected destination file\n";
+      }
+      else {
+         print "W: $abs_origfile not found, expect problems...\n" if(! -e $abs_origfile);
+      }
+   
+   
       if(-e $orig_target) {
          if(((stat($abs_origfile))[7]) != ((stat($orig_target))[7]))
          {
@@ -379,15 +401,16 @@
 
 if(`svn proplist debian` =~ /mergeWithUpstream/i) {
    print STDERR "I: mergeWithUpstream property set, looking for upstream source tarball...\n";
-   die "E: Could not find the origDir directory, please check the settings!\n" if(! -e $$c{"origDir"});
-   die "E: Could not find the upstream source file! (should be $origExpect)\n" if(! ($origfile && -e $origfile));
+#   die "E: Could not find the origDir directory, please check the settings!\n" if(! -e $$c{"origDir"});
+   die "E: Could not find the upstream source file! (should be $ba/$orig)\n" if(! (-e "$ba/$orig"));
+   
    $mod=rand;
    mkdir "$ba/tmp-$mod";
    if($opt_reuse && -d $bdir) {
       print "Reusing old build directory\n" if $opt_verbose;
    }
    else {
-      withecho "tar", "zxf", $origfile, "-C", "$ba/tmp-$mod";
+      withecho "tar", "zxf", "$ba/$orig", "-C", "$ba/tmp-$mod";
       my @entries = (<$ba/tmp-$mod/*>);
       if (@entries == 1) {
          # The files are stored in the archive under a top directory, we

Reply via email to