+2008-01-14 Raphael Hertzog <hertzog@debian.org>
+
+ * scripts/dpkg-genchanges.pl, scripts/dpkg-gencontrol.pl,
+ scripts/dpkg-source.pl: Hint Perl into using UTF-8 for output
+ on *.dsc, *.changes and DEBIAN/control files. Updated some open() calls
+ for more consistency and added binmode() calls for filehandles that
+ handle only binary data.
+
2008-01-13 Raphael Hertzog <hertzog@debian.org>
* scripts/Dpkg/Fields.pm: Drop public function
}
$fileslistfile="./$fileslistfile" if $fileslistfile =~ m/^\s/;
-open(Y,"> $fileslistfile.new") || &syserr(_g("open new files list file"));
+open(Y, ">", "$fileslistfile.new") || &syserr(_g("open new files list file"));
binmode(Y);
-if (open(X,"< $fileslistfile")) {
+if (open(X, "<", $fileslistfile)) {
binmode(X);
while (<X>) {
chomp;
rename("$fileslistfile.new",$fileslistfile) || &syserr(_g("install new files list file"));
my $cf;
+my $fh_output;
if (!$stdout) {
$cf= "$packagebuilddir/DEBIAN/control";
$cf= "./$cf" if $cf =~ m/^\s/;
- open(STDOUT,"> $cf.new") ||
+ open($fh_output, ">:utf8", "$cf.new") ||
syserr(_g("cannot open new output control file \`%s'"), "$cf.new");
- binmode(STDOUT);
+} else {
+ $fh_output = \*STDOUT;
+ binmode(STDOUT, ":utf8");
}
tied(%{$fields})->set_field_importance(@control_fields);
-tied(%{$fields})->output(\*STDOUT, $substvars);
+tied(%{$fields})->output($fh_output, $substvars);
if (!$stdout) {
+ close($fh_output);
rename("$cf.new", "$cf") ||
syserr(_g("cannot install output control file \`%s'"), $cf);
}
printf(_g("%s: building %s in %s")."\n",
$progname, $sourcepackage, "$basenamerev.dsc")
|| &syserr(_g("write building message"));
- open(STDOUT, "> $basenamerev.dsc") ||
+ open(DSC, ">:utf8", "$basenamerev.dsc") ||
syserr(_g("create %s"), "$basenamerev.dsc");
$substvars->parse($varlistfile) if -e $varlistfile;
tied(%{$fields})->set_field_importance(@dsc_fields);
- tied(%{$fields})->output(\*STDOUT, $substvars);
+ tied(%{$fields})->output(\*DSC, $substvars);
+ close(DSC);
if ($ur) {
printf(STDERR _g("%s: unrepresentable changes to source")."\n",
}
my $is_signed = 0;
- open(DSC, "< $dsc") || error(_g("cannot open .dsc file %s: %s"), $dsc, $!);
+ open(DSC, "<", $dsc) || error(_g("cannot open .dsc file %s: %s"), $dsc, $!);
while (<DSC>) {
next if /^\s*$/o;
$is_signed = 1 if /^-----BEGIN PGP SIGNED MESSAGE-----$/o;
my ($f) = @_;
my @s;
my $m;
- open(STDIN, "< $dscdir/$f") || syserr(_g("cannot read %s"), "$dscdir/$f");
+ open(STDIN, "<", "$dscdir/$f") || syserr(_g("cannot read %s"), "$dscdir/$f");
(@s = stat(STDIN)) || syserr(_g("cannot fstat %s"), "$dscdir/$f");
$s[7] == $size{$f} || error(_g("file %s has size %s instead of expected %s"),
$f, $s[7], $size{$f});
$m = readmd5sum( $m );
$m eq $md5sum{$f} || error(_g("file %s has md5sum %s instead of expected %s"),
$f, $m, $md5sum{$f});
- open(STDIN,"</dev/null") || &syserr(_g("reopen stdin from /dev/null"));
+ open(STDIN, "<", "/dev/null") || &syserr(_g("reopen stdin from /dev/null"));
}
sub erasedir {
open(GZIPFILE, ">", $_[0]) || syserr(_g("create file %s"), $_[0]);
pipe(GZIPREAD,GZIP) || &syserr(_g("pipe for gzip"));
+ binmode(GZIP);
defined($cgz= fork) || &syserr(_g("fork for gzip"));
if (!$cgz) {
open(STDIN,"<&",\*GZIPREAD) || &syserr(_g("reopen gzip pipe"));
open(GZIPFILE, "<", $_[0]) || syserr(_g("read file %s"), $_[0]);
pipe(GZIP, GZIPWRITE) || syserr(_g("pipe for %s"), $prog);
+ binmode(GZIP);
defined($cgz = fork) || syserr(_g("fork for %s"), $prog);
if (!$cgz) {
open(STDOUT, ">&", \*GZIPWRITE) || syserr(_g("reopen %s pipe"), $prog);