I'm attaching another patch that leaves out the svn-reconfigure stuff,
since it's not needed. Also, this patch places some helpful comments
in the svn-buildpackage script itself. I didn't know where else to put
them, the manpage seemed inappropriate.

-- 
Regards,
Andres Mejia
diff -urN ../svn-buildpackage-0.6.23/doc/svn-buildpackage.sgml ./doc/svn-buildpackage.sgml
--- ../svn-buildpackage-0.6.23/doc/svn-buildpackage.sgml	2007-11-12 14:37:33.000000000 -0500
+++ ./doc/svn-buildpackage.sgml	2008-01-08 21:10:11.000000000 -0500
@@ -284,6 +284,17 @@
       <glossentry>
         <glossterm>
           <cmdsynopsis><group>
+              <arg><option>--svn-use-origurl</option></arg>
+            </group></cmdsynopsis>
+        </glossterm>
+        <glossdef>
+          <para>Download the orig tarball directly instead of using a script.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>
+          <cmdsynopsis><group>
             <arg><option>--svn-override=var=value,anothervar=value</option></arg>
           </group></cmdsynopsis>
         </glossterm>
diff -urN ../svn-buildpackage-0.6.23/svn-buildpackage ./svn-buildpackage
--- ../svn-buildpackage-0.6.23/svn-buildpackage	2007-11-12 14:37:33.000000000 -0500
+++ ./svn-buildpackage	2008-01-08 21:16:54.000000000 -0500
@@ -47,6 +47,7 @@
 Miscelaneous:
   --svn-pkg PACKAGE    Specifies the package name
   --svn-override a=b   Override some config variable (comma separated list)
+  --svn-use-origurl    Download tarball using origUrl instead of debOrigScript
   --svn-verbose        More verbose program output
   --svn-noninteractive Turn off interactive mode
   -h, --help           Show this help message
@@ -84,6 +85,7 @@
 my $package;
 my $opt_savecfg;
 my $opt_dbgsdcommon;
+my $opt_use_origurl;
 
 my %options = (
 #   "h|help"                => \&help,
@@ -108,6 +110,7 @@
    "svn-postbuild=s"       => \$opt_postbuild,
    "svn-pretag=s"          => \$opt_pretag,
    "svn-posttag=s"         => \$opt_posttag,
+   "svn-use-origurl"       => \$opt_use_origurl,
    # and for compatibility with old config directives
    "pre-tag-action=s"      => \$opt_pretag,
    "post-tag-action=s"     => \$opt_posttag,
@@ -320,25 +323,66 @@
 
 my $orig = $package."_".$upVersion.".orig.tar.gz";
 
+# Make use of useOrigUrl property to download tarball directly instead of through
+# debOrigScript. useOrigUrl must be set to 'true'
+# 'svn propset svn-bp:useOrigUrl "true" debian'
+if (($$c{"useOrigUrl"}) && grep(/^true$/, $$c{"useOrigUrl"})) {
+    $opt_use_origurl = 1;
+}
+
 if ($$c{"origDir"}) {
    $origExpect = $$c{"origDir"}."/$orig"; # just for the messages
    if (-f $origExpect) {
-      $origfile = long_path($origExpect); # for the actual operation
-   }
-   else {
-      if ($$c{"origUrl"}) {
-         my $oUrl = $$c{"origUrl"};
-         print "Orig tarball not found (expected $origExpect), fetching from $oUrl...\n";
-         mkdir -p $$c{"origDir"} if (! -d $$c{"origDir"});
-         system "wget -O $origExpect $oUrl" ;
+       $origfile = long_path($origExpect); # for the actual operation
+   } else {
+      # use a script to acquire debian orig tarball (such as 'debian/rules')
+      # property would be set in top level directory using
+      # 'svn propset svn-bp:debOrigScript \
+      # "debian/path-to-script" debian'
+      if (($$c{"debOrigScript"}) && (!$opt_use_origurl)) {
+         my $top_dir = getcwd();
+         my $tar_dir = $$c{"origDir"};
+         my $debScript = $$c{"debOrigScript"};
+         my $debScript_abs_path = long_path($debScript); # use absolute path to script
+         print "Orig tarball not found (expected $origExpect), fetching using script $debScript...\n";
+
+         # pass options to script (such as 'get-orig-source')
+         # property would be set in top level directory using
+         # 'svn propset svn-bp:debOrigScriptOptions \
+         # "(a b c ...)" debian'
+         # options should be space delimited and may be enclosed in
+         # parantheses
+         # NOTE: The use of parantheses is supported in cases where
+         # options begin with '--', which svn would confuse as
+         # another svn option
+         my @args;
+         if ($$c{"debOrigScriptOptions"}) {
+            my $debScriptOptions = $$c{"debOrigScriptOptions"};
+            $debScriptOptions =~ s/^\(//;
+            $debScriptOptions =~ s/\)$//;
+            print "Using options \"$debScriptOptions\" with script\n";
+            @args = split(/\s/, $debScriptOptions);
+         }
+         print "Running script from $tar_dir\n";
+         chdir($tar_dir);
+         system($debScript_abs_path, @args) == 0
+             or die "Fetching of orig tarball using $debScript failed...\n";
          $origfile = long_path($origExpect); # now the file should exist
-      };
-   }
-
+         chdir($top_dir);
+         } elsif ($$c{"origUrl"}) {
+            my $oUrl = $$c{"origUrl"};
+            print "Orig tarball not found (expected $origExpect), fetching from $oUrl...\n";
+            mkdir -p $$c{"origDir"} if (! -d $$c{"origDir"});
+            my $wget_bin = '/usr/bin/wget';
+            my @args = ('-O', $origExpect, $oUrl);
+            system($wget_bin, @args) == 0
+                or die "Fetching of tarball from $oUrl failed\n";
+            $origfile = long_path($origExpect); # now the file should exist
+         } else {
+            $origExpect = "(location unknown, guessed: ../tarballs/$orig)";
+         }
+      }
 }
-else {
-    $origExpect = "(location unknown, guessed: ../tarballs/$orig)";
-};
 
 my $ba=$$c{"buildArea"};
 my $bdir="$ba/$package-$upVersion";
@@ -586,7 +630,7 @@
             else { $destdir=$ba; }
 
             # expand the paths in the list and kick non-binary packages
-	          my $multi=0;
+              my $multi=0;
             map { if(/\.deb$/){ $_=" $destdir/$_"; $multi++}else{$_=""}} @newfiles;
 
             &boldify;

Reply via email to