Here's another patch that allows the use of an svn property 'svn-bp:useOrigUrl' that works the same as the '--svn-use-origurl' option. This patch also adds an '--svn-reconfigure' option to reconfigure the deb-layout, useful in case options keep changing.
-- Regards, Andres Mejia
--- ../svn-buildpackage_released/svn-buildpackage 2007-11-12 14:37:33.000000000 -0500 +++ svn-buildpackage 2008-01-04 17:02:54.000000000 -0500 @@ -6,6 +6,7 @@ use Getopt::Long qw(:config no_ignore_case bundling pass_through); use File::Basename; use Cwd; +use POSIX; #WEXITSTATUS use strict; #use diagnostics; @@ -47,6 +48,8 @@ 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-reconfigure Reconfigure layout for changed svn property values --svn-verbose More verbose program output --svn-noninteractive Turn off interactive mode -h, --help Show this help message @@ -84,6 +87,8 @@ my $package; my $opt_savecfg; my $opt_dbgsdcommon; +my $opt_use_origurl; +my $opt_reconfigure; my %options = ( # "h|help" => \&help, @@ -108,6 +113,8 @@ "svn-postbuild=s" => \$opt_postbuild, "svn-pretag=s" => \$opt_pretag, "svn-posttag=s" => \$opt_posttag, + "svn-use-origurl" => \$opt_use_origurl, + "svn-reconfigure" => \$opt_reconfigure, # and for compatibility with old config directives "pre-tag-action=s" => \$opt_pretag, "post-tag-action=s" => \$opt_posttag, @@ -223,6 +230,12 @@ print "D: Configuration will not be saved.\n" if (defined $opt_verbose && ($SDCommon::opt_nosave=1)); +# Delete and remake the layout configuration +if ($opt_reconfigure) { + print "Reconfiguring deb-layout\n"; + unlink('.svn/deb-layout'); +} + SDCommon::configure; needs_tagsUrl if($opt_tag); my $c=\%SDCommon::c; @@ -320,25 +333,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 an external script to acquire debian orig tarball + # 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 + # property would be set in top level directory using + # 'svn propset svn-bp:debOrigScriptOptions \ + # "(a b c ...)" debian' + # options should be space delimited and enclosed in parantheses + 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); + my $sysret = WEXITSTATUS(system($debScript_abs_path, @args)); # assume a non-interactive script + if (0 != $sysret) { # script failed + 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); + my $sysret = WEXITSTATUS(system($wget_bin, @args)); + if (0 != $sysret) { # downloading orig tarball failed + 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"; --- ../svn-buildpackage_released/doc/svn-buildpackage.sgml 2007-11-12 14:37:33.000000000 -0500 +++ doc/svn-buildpackage.sgml 2008-01-04 17:07:12.000000000 -0500 @@ -284,6 +284,28 @@ <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-reconfigure</option></arg> + </group></cmdsynopsis> + </glossterm> + <glossdef> + <para>Remove the current layout generate a new one. Useful when changing svn property values.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm> + <cmdsynopsis><group> <arg><option>--svn-override=var=value,anothervar=value</option></arg> </group></cmdsynopsis> </glossterm>