summaryrefslogtreecommitdiff
path: root/debtransform
diff options
context:
space:
mode:
authorMichael Schröder <mls@suse.de>2007-06-20 17:14:26 +0000
committerMichael Schröder <mls@suse.de>2007-06-20 17:14:26 +0000
commitc4737b6bc7f5e0893609bd0fbcb7d1af6d3a4d6d (patch)
tree18918a3939ea699d6fd2f1fbb3ef0402fcfba4aa /debtransform
parent3c81d0100e5cb48b0435aa81104753e767a91d26 (diff)
- make debtransfrom configurable via the dsc file
- print error and abort if debtransform fails - add new setdeps function to Build.pm - support macros in config files - remove cp call from init_buildsystem (cp may depend on libacl)
Diffstat (limited to 'debtransform')
-rwxr-xr-xdebtransform41
1 files changed, 30 insertions, 11 deletions
diff --git a/debtransform b/debtransform
index d1533cb..480661f 100755
--- a/debtransform
+++ b/debtransform
@@ -180,25 +180,37 @@ my $out = $ARGV[2];
die("$out: $!\n") unless -d $out;
+my $tags = parsedsc($dsc);
+
opendir(D, $dir) || die("$dir: $!\n");
my @dir = grep {$_ ne '.' && $_ ne '..'} readdir(D);
closedir(D);
my %dir = map {$_ => 1} @dir;
-my @tars = grep {/\.tar(?:\.gz|\.bz2)?$/} @dir;
-my @debtars = grep {/^debian\.tar(?:\.gz|\.bz2)?$/} @tars;
-@tars = grep {!/^debian\.tar(?:\.gz|\.bz2)?$/} @tars;
-die("package contains no tar file\n") unless @tars;
-die("package contains more than one tar file: @tars\n") if @tars > 1;
-die("package contains more than one debian tar file\n") if @debtars > 1;
-my $tarfile = $tars[0];
-my $debtarfile = $debtars[0];
+my $tarfile = $tags->{'DEBTRANSFORM-TAR'};
+my $debtarfile = $tags->{'DEBTRANSFORM-FILES-TAR'};
+
+if (!$tarfile || !$debtarfile) {
+ my @tars = grep {/\.tar(?:\.gz|\.bz2)?$/} @dir;
+ my @debtars = grep {/^debian\.tar(?:\.gz|\.bz2)?$/} @tars;
+ if (!$tarfile) {
+ @tars = grep {!/^debian\.tar(?:\.gz|\.bz2)?$/} @tars;
+ @tars = grep {$_ ne $debtarfile} @tars if $debtarfile;
+ die("package contains no tar file\n") unless @tars;
+ die("package contains more than one tar file: @tars\n") if @tars > 1;
+ $tarfile = $tars[0];
+ }
+ if (!exists($tags->{'DEBTRANSFORM-FILES-TAR'})) {
+ die("package contains more than one debian tar file\n") if @debtars > 1;
+ $debtarfile = $debtars[0];
+ }
+}
-my $tags = parsedsc($dsc);
my $name = $tags->{'SOURCE'};
die("dsc file contains no source\n") unless defined($name);
my $version = $tags->{'VERSION'};
die("dsc file contains no version\n") unless defined($version);
+$version =~ s/^\d+://; # no epoch in version, please
my $tardir = $tarfile;
$tardir =~ s/\.orig\.tar/\.tar/;
@@ -230,12 +242,15 @@ if ($debtarfile) {
dofile($changelog, $tardir, "debian/changelog") if defined $changelog;
for my $file (grep {/^debian\./} @dir) {
- next if $file =~ /^debian\.tar/;
next if $file eq 'debian.series';
+ next if $file =~ /\.tar$/;
+ next if $file =~ /\.tar\./;
dofile("$dir/$file", $tardir);
}
-if ($dir{"debian.series"}) {
+if ($tags->{'DEBTRANSFORM-SERIES'}) {
+ doseries("$dir/$tags->{'DEBTRANSFORM-SERIES'}", $tardir);
+} elsif ($dir{"debian.series"}) {
doseries("$dir/debian.series", $tardir);
} elsif ($dir{"patches.series"}) {
doseries("$dir/patches.series", $tardir);
@@ -255,4 +270,8 @@ if (! -s "$out/${name}_$version.diff") {
}
$tags->{'FILES'} = "\n".join("\n", @files);
+delete $tags->{'DEBTRANSFORM-SERIES'};
+delete $tags->{'DEBTRANSFORM-TAR'};
+delete $tags->{'DEBTRANSFORM-FILES-TAR'};
writedsc("$out/${name}_$version.dsc", $tags);
+exit(0);