$diff_ignore_default_regexp = '^.*~$|^\..*\.swp|DEADJOE|(?:/CVS|/RCS|/.deps)(?:$|/.*$)';
$sourcestyle = 'X';
-$dscformat = "1.1";
+$dscformat = "1.0";
use POSIX;
use POSIX qw (:errno_h :signal_h);
";
}
+sub handleformat {
+ local $fmt = shift;
+ local $ourfmt = $dscformat;
+
+ $fmt =~ s/(.*)\.\d*/$1/;
+ $ourfmt =~ s/(.*)\.\d*/$1/;
+
+ return ($fmt==$ourfmt);
+}
+
+
$i = 100;
grep ($fieldimps {$_} = $i--,
qw (Format Source Version Binary Origin Maintainer Architecture
for $_ (keys %fi) {
$v= $fi{$_};
if (s/^C //) {
-#print STDERR "G key >$_< value >$v<\n";
if (m/^Source$/) { &setsourcepackage; }
elsif (m/^(Standards-Version|Origin|Maintainer|Uploaders)$/) { $f{$_}= $v; }
elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) { $f{$_}= $v; }
elsif (m/^(Section|Priority|Files|Bugs)$/ || m/^X[BC]+-/i) { }
else { &unknown('general section of control info file'); }
} elsif (s/^C(\d+) //) {
-#print STDERR "P key >$_< value >$v<\n";
$i=$1; $p=$fi{"C$i Package"};
push(@binarypackages,$p) unless $packageadded{$p}++;
if (m/^Architecture$/) {
-#print STDERR "$p >$v< >".join(' ',@sourcearch)."<\n";
if ($v eq 'any') {
@sourcearch= ('any');
} elsif ($v eq 'all') {
@sourcearch= ('any');
}
} else {
+ if (grep($sourcearch[0] eq $_, 'any','all')) {
+ @sourcearch= ('any');
+ } else {
for $a (split(/\s+/,$v)) {
&error("architecture $a only allowed on its own".
" (list for package $p is \`$a')")
push(@sourcearch,$a) unless $archadded{$a}++;
}
}
+ }
$f{'Architecture'}= join(' ',@sourcearch);
} elsif (s/^X[BC]*S[BC]*-//i) {
$f{$_}= $v;
&unknown("package's section of control info file");
}
} elsif (s/^L //) {
-#print STDERR "L key >$_< value >$v<\n";
if (m/^Source$/) {
&setsourcepackage;
} elsif (m/^Version$/) {
$basenamerev= $sourcepackage.'_'.$version;
$basename= $sourcepackage.'_'.$upstreamversion;
$basedirname= $basename;
-#print STDERR ">$basedirname<\n";
$basedirname =~ s/_/-/;
-#print STDERR ">$basedirname<\n";
$origdir= "$dir.orig";
$origtargz= "$basename.orig.tar.gz";
$tarname= "$basenamerev.tar.gz";
}
-#print STDERR ">$dir|$origdir|$origtargz|$sourcestyle<\n";
-
if ($sourcestyle =~ m/[nurUR]/) {
if (stat($tarname)) {
&syserr("unable to check for existence of \`$tarname'");
}
-#print STDERR ">$tarname|$tardirbase|$tardirname<\n";
-
print("$progname: building $sourcepackage in $tarname\n")
|| &syserr("write building tar message");
&forkgzipwrite("$tarname.new");
defined($c2= fork) || &syserr("fork for tar");
if (!$c2) {
chdir($tardirbase) || &syserr("chdir to above (orig) source $tardirbase");
-#system('pwd && ls');
open(STDOUT,">&GZIP") || &syserr("reopen gzip for tar");
# FIXME: put `--' argument back when tar is fixed
exec('tar','-cf','-',$tardirname); &syserr("exec tar");
}
$expectprefix= $origdir; $expectprefix =~ s,^\./,,;
+# tar checking is disabled, there are too many broken tar archives out there
+# which we can still handle anyway.
# checktarsane($origtargz,$expectprefix);
mkdir("$origtargz.tmp-nest",0755) ||
&syserr("unable to create \`$origtargz.tmp-nest'");
}
if (defined $fi{'S Format'}) {
- $dscformat=$fi{'S Format'};
- if (not $dscformat =~ /^1\./) {
+ if (not handleformat($fi{'S Format'})) {
&error("Unsupported format of .dsc file ($dscformat)");
}
+ $dscformat=$fi{'S Format'};
}
+
$sourcepackage =~ m/[^.0-9]/ &&
&error("dsc format contains illegal character \`$&'");
checkstats($tarfile);
checkstats($difffile) if length($difffile);
+# tar checking is disabled, there are too many broken tar archives out there
+# which we can still handle anyway.
# checktarsane("$dscdir/$tarfile",$expectprefix);
if (length($difffile)) {
if ($type ne '-') { $notfileobject{$tarfn} = 1; }
}
close (TAR);
- #$? && subprocerr ("tar -vvtf");
+ $? && subprocerr ("tar -vvtf");
&reapgzip;
my $tarsubst = quotemeta ($tarprefix);
}
sub forkgzipwrite {
-#print STDERR "forkgzipwrite $_[0]\n";
open(GZIPFILE,"> $_[0]") || &syserr("create file $_[0]");
pipe(GZIPREAD,GZIP) || &syserr("pipe for gzip");
defined($cgz= fork) || &syserr("fork for gzip");
}
sub forkgzipread {
-#print STDERR "forkgzipread $_[0]\n";
local $SIG{PIPE} = 'DEFAULT';
open(GZIPFILE,"< $_[0]") || &syserr("read file $_[0]");
pipe(GZIP,GZIPWRITE) || &syserr("pipe for gunzip");
}
sub reapgzip {
-#print STDERR "reapgzip $_[0]\n";
$cgz == waitpid($cgz,0) || &syserr("wait for gzip");
!$? || ($gzipsigpipeok && WIFSIGNALED($?) && WTERMSIG($?)==SIGPIPE) ||
subprocerr("gzip");