The branch, master has been updated
via 08499749543c2557649e8f558e138ea11986d1bb (commit)
from 5f7fdd91180fe5976468d876d6e8476b72826362 (commit)
- Shortlog ------------------------------------------------------------
0849974 Give some hints to Perl on the use of UTF-8 for output
Summary of changes:
ChangeLog | 8 ++++++++
scripts/dpkg-genchanges.pl | 1 +
scripts/dpkg-gencontrol.pl | 14 +++++++++-----
scripts/dpkg-source.pl | 13 ++++++++-----
4 files changed, 26 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
Details of changes:
commit 08499749543c2557649e8f558e138ea11986d1bb
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Fri Jan 11 19:14:15 2008 +0100
Give some hints to Perl on the use of UTF-8 for output
* 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.
diff --git a/ChangeLog b/ChangeLog
index 0679929..013594a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-14 Raphael Hertzog <[EMAIL PROTECTED]>
+
+ * 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 <[EMAIL PROTECTED]>
* scripts/Dpkg/Fields.pm: Drop public function
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 9fb13fc..f6ada09 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -480,6 +480,7 @@ for my $f (keys %remove) {
delete $fields->{$f};
}
+binmode(STDOUT, ":utf8");
$substvars->parse($varlistfile) if -e $varlistfile;
tied(%{$fields})->set_field_importance(@changes_fields);
tied(%{$fields})->output(\*STDOUT, $substvars);
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 04e7fc3..6ae5c72 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -312,9 +312,9 @@ for my $f (keys %remove) {
}
$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;
@@ -342,18 +342,22 @@ close(Y) || &syserr(_g("close new files list file"));
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);
}
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index af4cd57..8c956b0 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -766,12 +766,13 @@ if ($opmode eq 'build') {
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",
@@ -804,7 +805,7 @@ if ($opmode eq 'build') {
}
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;
@@ -1128,7 +1129,7 @@ sub checkstats {
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});
@@ -1136,7 +1137,7 @@ sub checkstats {
$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 {
@@ -1584,6 +1585,7 @@ sub forkgzipwrite {
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"));
@@ -1611,6 +1613,7 @@ sub forkgzipread {
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);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]