32
32
--svn-move-to XYZ move package files to XYZ, implies --svn-move
33
33
--svn-only-tag Tags the current trunk directory without building
34
34
--svn-tag Final build: Export && build && tag && dch -i
35
--svn-retag replace an existing tag directory if found while tagging
35
36
--svn-lintian Run lintian in the build area when done
36
37
--svn-pkg PACKAGE Specifies the package name
38
--svn-export Just prepares the build directory and exits
39
--svn-reuse Reuse an existing build directory, copy trunk over it
38
41
If the debian directory has the mergeWithUpstream property, svn-buildpackage
39
42
will extract .orig.tar.gz file first and add the Debian files to it.
64
69
"h|help" => \$opt_help,
65
70
"svn-verbose" => \$opt_verbose,
66
"svn-ignore-new" => \$opt_ignnew,
71
"svn-ignore-new|svn-ignore" => \$opt_ignnew,
67
72
"svn-dont-clean" => \$opt_dontclean,
73
"svn-export" => \$opt_export,
68
74
"svn-dont-purge" => \$opt_dontpurge,
75
"svn-reuse" => \$opt_reuse,
69
76
"svn-only-tag" => \$opt_only_tag,
70
77
"svn-tag-only" => \$opt_only_tag,
71
78
"svn-tag" => \$opt_tag,
79
"svn-retag" => \$opt_retag,
72
80
"svn-lintian" => \$opt_lintian,
73
81
"svn-no-links" => \$opt_nolinks,
74
82
"svn-pass-diff" => \$opt_pass_diff,
88
96
"svn-pkg=s" => \$package
99
use lib "/usr/share/svn-buildpackage";
105
return 0 if(!defined($val));
106
print "ENV: $key=$val\n" if $opt_verbose;
111
$tagVersion=$SDCommon::tagVersion;
112
$upVersion=$SDCommon::upVersion;
113
$tagVersionNonEpoch = $tagVersion;
114
$tagVersionNonEpoch =~ s/^[^:]*://;
116
#this sucks but the config file needs to be processed before the options and there should be reasonable default
117
setenv("PACKAGE", defined($package) ? $package : $SDCommon::package);
118
setenv("package", defined($package) ? $package : $SDCommon::package);
119
setenv "TAG_VERSION", $tagVersion;
120
setenv "debian_version", $tagVersion;
121
setenv "non_epoch_version", $tagVersionNonEpoch;
122
setenv "upstream_version", $upVersion;
123
setenv "SVN_BUILDPACKAGE", $SDCommon::version;
124
setenv "guess_loc", ( ($package=~/^(lib.)/)?$1:substr($package,0,1))."/$package"."_$upVersion.orig.tar.gz";
91
129
if(open($rc, "<".$ENV{"HOME"}."/.svn-buildpackage.conf")) {
92
130
SKIP: while(<$rc>) {
116
155
# if opt_only_tag is used, set opt_tag too. Should not hurt because the
117
156
# real function of opt_tag at the end of the script is never reached
118
157
$opt_tag = 1 if($opt_only_tag);
120
158
$opt_move=1 if $opt_move_to;
121
159
$destdir=long_path($opt_move_to ? $opt_move_to : "$startdir/..");
123
use lib "/usr/share/svn-buildpackage";
125
160
$SDCommon::opt_verbose=$opt_verbose;
161
$package = $SDCommon::package if(!$package);
126
163
withecho "fakeroot debian/rules clean || debian/rules clean" if(!$opt_dontclean);
127
164
SDCommon::check_uncommited if(!$opt_ignnew);
167
needs_tagsUrl if($opt_tag);
170
#some things may have been overriden by user options
174
if($opt_buildcmd || $opt_export) {
130
175
@builder = split / /, $opt_buildcmd;
176
if($opt_buildcmd=~/;|\||&/) {
177
print "I: Looks like a shell construct in the build command, running trough the shell\n";
178
#@builder = (join(" ", @builder, @ARGV));
179
# become a single command again and let perl run it trough the shell
180
$cmd=$opt_buildcmd." ".join(" ", @ARGV);
181
#print "wtf, $cmd\n";
133
187
push(@builder, "dpkg-buildpackage");
134
188
# a simple "helper". Only executed if no custom command is choosen and
220
283
$upsVersUrl=$$c{"upsTagUrl"}."/$upVersion";
221
284
defined($$c{"upsCurrentUrl"}) || print STDERR "upsCurrentUrl not set and not located, expect problems...\n";
222
285
withecho("rm", "-rf", "$bdir.orig");
223
withecho "svn","export",$$c{"upsCurrentUrl"},"$bdir.orig";
286
withecho "svn", "export",$$c{"upsCurrentUrl"},"$bdir.orig";
289
# non-Debian-native package detected, needing some kind of upstream source for
290
# dpkg-buildpackage (most likely, spew error messages but continue on native
291
# packages with dashes)
226
292
if($tagVersion =~ /-/) {
227
293
my $abs_origfile=long_path($origfile);
228
294
my $orig_target="$ba/".$orig;
281
347
print STDERR "FILE: $_\n" if $opt_verbose;
357
# for(@dirs) {$_="$from/$_"}
358
# for(@files){$_="$from/$_"}
360
# system "cd $bdir && mkdir -p ".join(' ',@dirs)) +
361
# system "cp", "--parents", "-laf", @files), "$bdir/") ;
287
364
if(`svn proplist debian` =~ /mergeWithUpstream/i) {
288
# debian is the only directory or during-build-merging is wanted
289
365
print STDERR "I: mergeWithUpstream property set, looking for upstream source tarball...\n";
290
366
die "E: Could not find the origDir directory, please check the settings!\n" if(! -e $$c{"origDir"});
291
367
die "E: Could not find the upstream source file! (should be $origExpect)\n" if(! ($origfile && -e $origfile));
293
369
mkdir "$ba/tmp-$mod";
294
withecho "tar", "zxf", $origfile, "-C", "$ba/tmp-$mod";
295
withecho "mv $ba/tmp-$mod/* $bdir";
296
withecho "rm", "-rf", "$ba/tmp-$mod";
370
if($opt_reuse && -d $bdir) {
371
print "Reusing old build directory\n" if $opt_verbose;
374
withecho "tar", "zxf", $origfile, "-C", "$ba/tmp-$mod";
375
withecho "mv", (<$ba/tmp-$mod/*>), $bdir;
297
377
if($opt_nolinks || $opt_ignnew) {
298
withecho ("svn", "export", $$c{"trunkDir"},"$ba/tmp-$mod");
299
withecho "cp", "-af", "$ba/tmp-$mod/.", "$bdir/";
378
withecho ("svn", "--force", "export", $$c{"trunkDir"},"$bdir");
302
if( (system "cd $bdir && mkdir -p ".join(' ',@dirs)) +
303
system "cp --parents -laf ".join(' ',@files)." $bdir/") {
304
# 0=good; but if pure copy failed...
305
withecho ("svn", "export", $$c{"trunkDir"},"$ba/tmp-$mod");
306
withecho "cp", "-af", "$ba/tmp-$mod/.", "$bdir/";
382
#fixme maybe rewrite to withecho
383
if( system("mkdir","-p", map { "$bdir/$_" } @dirs) + system ("cp", "--parents", "-laf", @files, $bdir) )
385
withecho "svn", "--force", "export", $$c{"trunkDir"},"$bdir";
309
388
withecho "rm", "-rf", "$ba/tmp-$mod";
312
391
if($opt_nolinks) {
313
withecho "svn","export",$$c{"trunkDir"},"$bdir";
392
withecho "svn","--force", "export",$$c{"trunkDir"},"$bdir";
316
if(system("mkdir", "$bdir") +
317
system("cp","--parents","-laf",@files,$bdir) )
319
# 0=good; but if pure copy failed, export it
396
#fixme maybe rewrite to withecho
397
if(system("mkdir","-p", map { "$bdir/$_" } @dirs) + system ("cp", "--parents", "-laf", @files, $bdir) )
320
399
system "rm", "-rf", $bdir;
321
withecho "svn","export",$$c{"trunkDir"},"$bdir";
400
withecho "svn", "--force", "export",$$c{"trunkDir"},$bdir;
326
406
if($opt_pass_diff) {
327
407
$dirname="$package-$upVersion";
328
408
needs_upsCurrentUrl;
414
496
if($opt_lintian) {
415
withecho "lintian $destdir/$chfile";
497
withecho "lintian", "$destdir/$chfile";
419
501
system "$opt_pretag" if($opt_pretag);
420
503
withecho ("svn", "-m", "$scriptname Tagging $package ($tagVersion)", "cp", $$c{"trunkUrl"}, $$c{"tagsUrl"}."/$tagVersion");
421
504
system "$opt_posttag" if($opt_posttag);
422
505
chdir $$c{"trunkDir"};
423
withecho "dch -D UNRELEASED -i \"NOT RELEASED YET\"";
424
print "\nI: Done! Last commit pending, please execute manually.\n";
506
withecho "dch", "-D", "UNRELEASED", "-i", "NOT RELEASED YET";
507
print "\nI: Done! Created the next changelog entry, please commit later or revert.\n";
427
510
SDCommon::sd_exit 0+$retval;