Przeglądaj źródła

scripts: Rename and deprecate _g function with g_

The old function name was inconsistent with the other gettext family
of short aliases which has already caused some code typos, and functions
starting with underscore are considered by convention private in Perl.
Guillem Jover 11 lat temu
rodzic
commit
6e56dce419
66 zmienionych plików z 783 dodań i 765 usunięć
  1. 1 0
      debian/changelog
  2. 6 6
      scripts/Dpkg/Arch.pm
  3. 3 3
      scripts/Dpkg/BuildFlags.pm
  4. 1 1
      scripts/Dpkg/BuildOptions.pm
  5. 20 20
      scripts/Dpkg/Changelog.pm
  6. 12 12
      scripts/Dpkg/Changelog/Debian.pm
  7. 10 10
      scripts/Dpkg/Changelog/Entry/Debian.pm
  8. 8 8
      scripts/Dpkg/Changelog/Parse.pm
  9. 7 7
      scripts/Dpkg/Checksums.pm
  10. 2 2
      scripts/Dpkg/Compression.pm
  11. 2 2
      scripts/Dpkg/Compression/FileHandle.pm
  12. 3 3
      scripts/Dpkg/Compression/Process.pm
  13. 2 2
      scripts/Dpkg/Conf.pm
  14. 10 10
      scripts/Dpkg/Control.pm
  15. 2 2
      scripts/Dpkg/Control/FieldsCore.pm
  16. 11 11
      scripts/Dpkg/Control/HashCore.pm
  17. 3 3
      scripts/Dpkg/Control/Info.pm
  18. 2 2
      scripts/Dpkg/Deps.pm
  19. 2 2
      scripts/Dpkg/Dist/Files.pm
  20. 9 9
      scripts/Dpkg/ErrorHandling.pm
  21. 3 3
      scripts/Dpkg/File.pm
  22. 22 5
      scripts/Dpkg/Gettext.pm
  23. 14 14
      scripts/Dpkg/IPC.pm
  24. 5 5
      scripts/Dpkg/Interface/Storable.pm
  25. 3 3
      scripts/Dpkg/Package.pm
  26. 1 1
      scripts/Dpkg/Shlibs.pm
  27. 1 1
      scripts/Dpkg/Shlibs/Cppfilt.pm
  28. 4 4
      scripts/Dpkg/Shlibs/Objdump.pm
  29. 2 2
      scripts/Dpkg/Shlibs/Symbol.pm
  30. 5 5
      scripts/Dpkg/Shlibs/SymbolFile.pm
  31. 6 6
      scripts/Dpkg/Source/Archive.pm
  32. 6 6
      scripts/Dpkg/Source/Functions.pm
  33. 22 22
      scripts/Dpkg/Source/Package.pm
  34. 42 42
      scripts/Dpkg/Source/Package/V1.pm
  35. 54 54
      scripts/Dpkg/Source/Package/V2.pm
  36. 16 16
      scripts/Dpkg/Source/Package/V3/Bzr.pm
  37. 3 3
      scripts/Dpkg/Source/Package/V3/Custom.pm
  38. 18 18
      scripts/Dpkg/Source/Package/V3/Git.pm
  39. 9 9
      scripts/Dpkg/Source/Package/V3/Native.pm
  40. 8 8
      scripts/Dpkg/Source/Package/V3/Quilt.pm
  41. 55 55
      scripts/Dpkg/Source/Patch.pm
  42. 21 21
      scripts/Dpkg/Source/Quilt.pm
  43. 5 5
      scripts/Dpkg/Substvars.pm
  44. 2 2
      scripts/Dpkg/Vars.pm
  45. 1 1
      scripts/Dpkg/Vendor.pm
  46. 3 3
      scripts/Dpkg/Vendor/Debian.pm
  47. 5 5
      scripts/Dpkg/Vendor/Ubuntu.pm
  48. 6 6
      scripts/Dpkg/Version.pm
  49. 6 6
      scripts/changelog/debian.pl
  50. 12 12
      scripts/dpkg-architecture.pl
  51. 9 9
      scripts/dpkg-buildflags.pl
  52. 46 46
      scripts/dpkg-buildpackage.pl
  53. 9 9
      scripts/dpkg-checkbuilddeps.pl
  54. 9 9
      scripts/dpkg-distaddfile.pl
  55. 27 27
      scripts/dpkg-genchanges.pl
  56. 30 30
      scripts/dpkg-gencontrol.pl
  57. 21 21
      scripts/dpkg-gensymbols.pl
  58. 8 8
      scripts/dpkg-mergechangelogs.pl
  59. 19 19
      scripts/dpkg-name.pl
  60. 7 7
      scripts/dpkg-parsechangelog.pl
  61. 24 24
      scripts/dpkg-scanpackages.pl
  62. 11 11
      scripts/dpkg-scansources.pl
  63. 36 36
      scripts/dpkg-shlibdeps.pl
  64. 39 39
      scripts/dpkg-source.pl
  65. 11 11
      scripts/dpkg-vendor.pl
  66. 1 1
      scripts/po/Makevars

+ 1 - 0
debian/changelog

@@ -22,6 +22,7 @@ dpkg (1.18.0) UNRELEASED; urgency=low
     independent of the current locale.
   * Add support for arch-bits and arch-endian dpkg-gensymbols tags.
     Closes: #630342
+  * Rename and deprecate Dpkg::Gettext _g function with new g_.
 
  -- Guillem Jover <guillem@debian.org>  Tue, 09 Dec 2014 23:53:18 +0100
 

+ 6 - 6
scripts/Dpkg/Arch.pm

@@ -94,7 +94,7 @@ my %debarch_to_debtriplet;
 	$gcc_host_gnu_type = get_gcc_host_gnu_type();
 
 	if ($gcc_host_gnu_type eq '') {
-	    warning(_g("couldn't determine gcc system type, falling back to " .
+	    warning(g_("couldn't determine gcc system type, falling back to " .
 	               'default (native compilation)'));
 	} else {
 	    my (@host_archtriplet) = gnutriplet_to_debtriplet($gcc_host_gnu_type);
@@ -103,7 +103,7 @@ my %debarch_to_debtriplet;
 	    if (defined $host_arch) {
 		$gcc_host_gnu_type = debtriplet_to_gnutriplet(@host_archtriplet);
 	    } else {
-		warning(_g('unknown gcc system type %s, falling back to ' .
+		warning(g_('unknown gcc system type %s, falling back to ' .
 		           'default (native compilation)'), $gcc_host_gnu_type);
 		$gcc_host_gnu_type = '';
 	    }
@@ -149,7 +149,7 @@ sub read_cputable
     local $/ = "\n";
 
     open my $cputable_fh, '<', "$Dpkg::DATADIR/cputable"
-	or syserr(_g('cannot open %s'), 'cputable');
+	or syserr(g_('cannot open %s'), 'cputable');
     while (<$cputable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
 	    $cputable{$1} = $2;
@@ -173,7 +173,7 @@ sub read_ostable
     local $/ = "\n";
 
     open my $ostable_fh, '<', "$Dpkg::DATADIR/ostable"
-	or syserr(_g('cannot open %s'), 'ostable');
+	or syserr(g_('cannot open %s'), 'ostable');
     while (<$ostable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) {
 	    $ostable{$1} = $2;
@@ -206,7 +206,7 @@ sub abitable_load()
         }
         close $abitable_fh;
     } elsif ($! != ENOENT) {
-        syserr(_g('cannot open %s'), 'abitable');
+        syserr(g_('cannot open %s'), 'abitable');
     }
 
     $abitable_loaded = 1;
@@ -223,7 +223,7 @@ sub read_triplettable()
     local $/ = "\n";
 
     open my $triplettable_fh, '<', "$Dpkg::DATADIR/triplettable"
-	or syserr(_g('cannot open %s'), 'triplettable');
+	or syserr(g_('cannot open %s'), 'triplettable');
     while (<$triplettable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)/) {
 	    my $debtriplet = $1;

+ 3 - 3
scripts/Dpkg/BuildFlags.pm

@@ -313,7 +313,7 @@ sub update_from_conffile {
     local $_;
 
     return unless -e $file;
-    open(my $conf_fh, '<', $file) or syserr(_g('cannot read %s'), $file);
+    open(my $conf_fh, '<', $file) or syserr(g_('cannot read %s'), $file);
     while (<$conf_fh>) {
         chomp;
         next if /^\s*#/; # Skip comments
@@ -321,7 +321,7 @@ sub update_from_conffile {
         if (/^(append|prepend|set|strip)\s+(\S+)\s+(\S.*\S)\s*$/i) {
             my ($op, $flag, $value) = ($1, $2, $3);
             unless (exists $self->{flags}->{$flag}) {
-                warning(_g('line %d of %s mentions unknown flag %s'), $., $file, $flag);
+                warning(g_('line %d of %s mentions unknown flag %s'), $., $file, $flag);
                 $self->{flags}->{$flag} = '';
             }
             if (lc($op) eq 'set') {
@@ -334,7 +334,7 @@ sub update_from_conffile {
                 $self->prepend($flag, $value, $src);
             }
         } else {
-            warning(_g('line %d of %s is invalid, it has been ignored'), $., $file);
+            warning(g_('line %d of %s is invalid, it has been ignored'), $., $file);
         }
     }
     close($conf_fh);

+ 1 - 1
scripts/Dpkg/BuildOptions.pm

@@ -92,7 +92,7 @@ sub merge {
     my $count = 0;
     foreach (split(/\s+/, $content)) {
 	unless (/^([a-z][a-z0-9_-]*)(?:=(\S*))?$/) {
-            warning(_g('invalid flag in %s: %s'), $source, $_);
+            warning(g_('invalid flag in %s: %s'), $source, $_);
             next;
         }
 	$count += $self->set($1, $2, $source);

+ 20 - 20
scripts/Dpkg/Changelog.pm

@@ -167,9 +167,9 @@ sub get_parse_errors {
 	my $res = '';
 	foreach my $e (@{$self->{parse_errors}}) {
 	    if ($e->[3]) {
-		$res .= report(_g('warning'), _g("%s(l%s): %s\nLINE: %s"), @$e);
+		$res .= report(g_('warning'), g_("%s(l%s): %s\nLINE: %s"), @$e);
 	    } else {
-		$res .= report(_g('warning'), _g('%s(l%s): %s'), @$e);
+		$res .= report(g_('warning'), g_('%s(l%s): %s'), @$e);
 	    }
 	}
 	return $res;
@@ -217,7 +217,7 @@ sub __sanity_check_range {
     my $data = $self->{data};
 
     if (defined($r->{offset}) and not defined($r->{count})) {
-	warning(_g("'offset' without 'count' has no effect")) if $self->{verbose};
+	warning(g_("'offset' without 'count' has no effect")) if $self->{verbose};
 	delete $r->{offset};
     }
 
@@ -226,7 +226,7 @@ sub __sanity_check_range {
         (defined($r->{from}) || defined($r->{since}) ||
 	 defined($r->{to}) || defined($r->{until})))
     {
-	warning(_g("you can't combine 'count' or 'offset' with any other " .
+	warning(g_("you can't combine 'count' or 'offset' with any other " .
 		   'range option')) if $self->{verbose};
 	delete $r->{from};
 	delete $r->{since};
@@ -234,12 +234,12 @@ sub __sanity_check_range {
 	delete $r->{until};
     }
     if (defined($r->{from}) && defined($r->{since})) {
-	warning(_g("you can only specify one of 'from' and 'since', using " .
+	warning(g_("you can only specify one of 'from' and 'since', using " .
 		   "'since'")) if $self->{verbose};
 	delete $r->{from};
     }
     if (defined($r->{to}) && defined($r->{until})) {
-	warning(_g("you can only specify one of 'to' and 'until', using " .
+	warning(g_("you can only specify one of 'to' and 'until', using " .
 		   "'until'")) if $self->{verbose};
 	delete $r->{to};
     }
@@ -251,8 +251,8 @@ sub __sanity_check_range {
         push @versions, $entry->get_version()->as_string();
     }
     if ((defined($r->{since}) and not exists $versions{$r->{since}})) {
-        warning(_g("'%s' option specifies non-existing version"), 'since');
-        warning(_g('use newest entry that is earlier than the one specified'));
+        warning(g_("'%s' option specifies non-existing version"), 'since');
+        warning(g_('use newest entry that is earlier than the one specified'));
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_LT, $r->{since})) {
                 $r->{since} = $v;
@@ -261,14 +261,14 @@ sub __sanity_check_range {
         }
         if (not exists $versions{$r->{since}}) {
             # No version was earlier, include all
-            warning(_g('none found, starting from the oldest entry'));
+            warning(g_('none found, starting from the oldest entry'));
             delete $r->{since};
             $r->{from} = $versions[-1];
         }
     }
     if ((defined($r->{from}) and not exists $versions{$r->{from}})) {
-        warning(_g("'%s' option specifies non-existing version"), 'from');
-        warning(_g('use oldest entry that is later than the one specified'));
+        warning(g_("'%s' option specifies non-existing version"), 'from');
+        warning(g_('use oldest entry that is later than the one specified'));
         my $oldest;
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_GT, $r->{from})) {
@@ -278,13 +278,13 @@ sub __sanity_check_range {
         if (defined($oldest)) {
             $r->{from} = $oldest;
         } else {
-            warning(_g("no such entry found, ignoring '%s' parameter"), 'from');
+            warning(g_("no such entry found, ignoring '%s' parameter"), 'from');
             delete $r->{from}; # No version was oldest
         }
     }
     if (defined($r->{until}) and not exists $versions{$r->{until}}) {
-        warning(_g("'%s' option specifies non-existing version"), 'until');
-        warning(_g('use oldest entry that is later than the one specified'));
+        warning(g_("'%s' option specifies non-existing version"), 'until');
+        warning(g_('use oldest entry that is later than the one specified'));
         my $oldest;
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_GT, $r->{until})) {
@@ -294,13 +294,13 @@ sub __sanity_check_range {
         if (defined($oldest)) {
             $r->{until} = $oldest;
         } else {
-            warning(_g("no such entry found, ignoring '%s' parameter"), 'until');
+            warning(g_("no such entry found, ignoring '%s' parameter"), 'until');
             delete $r->{until}; # No version was oldest
         }
     }
     if (defined($r->{to}) and not exists $versions{$r->{to}}) {
-        warning(_g("'%s' option specifies non-existing version"), 'to');
-        warning(_g('use newest entry that is earlier than the one specified'));
+        warning(g_("'%s' option specifies non-existing version"), 'to');
+        warning(g_('use newest entry that is earlier than the one specified'));
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_LT, $r->{to})) {
                 $r->{to} = $v;
@@ -309,17 +309,17 @@ sub __sanity_check_range {
         }
         if (not exists $versions{$r->{to}}) {
             # No version was earlier
-            warning(_g("no such entry found, ignoring '%s' parameter"), 'to');
+            warning(g_("no such entry found, ignoring '%s' parameter"), 'to');
             delete $r->{to};
         }
     }
 
     if (defined($r->{since}) and $data->[0]->get_version() eq $r->{since}) {
-	warning(_g("'since' option specifies most recent version, ignoring"));
+	warning(g_("'since' option specifies most recent version, ignoring"));
 	delete $r->{since};
     }
     if (defined($r->{until}) and $data->[-1]->get_version() eq $r->{until}) {
-	warning(_g("'until' option specifies oldest version, ignoring"));
+	warning(g_("'until' option specifies oldest version, ignoring"));
 	delete $r->{until};
     }
     ## use critic

+ 12 - 12
scripts/Dpkg/Changelog/Debian.pm

@@ -53,10 +53,10 @@ use parent qw(Dpkg::Changelog);
 use Dpkg::Changelog::Entry::Debian qw(match_header match_trailer);
 
 use constant {
-    FIRST_HEADING => _g('first heading'),
-    NEXT_OR_EOF => _g('next heading or eof'),
-    START_CHANGES => _g('start of change data'),
-    CHANGES_OR_TRAILER => _g('more change data or trailer'),
+    FIRST_HEADING => g_('first heading'),
+    NEXT_OR_EOF => g_('next heading or eof'),
+    START_CHANGES => g_('start of change data'),
+    CHANGES_OR_TRAILER => g_('more change data or trailer'),
 };
 
 =over 4
@@ -88,7 +88,7 @@ sub parse {
 	if (match_header($_)) {
 	    unless ($expect eq FIRST_HEADING || $expect eq NEXT_OR_EOF) {
 		$self->parse_error($file, $.,
-		    sprintf(_g('found start of entry where expected %s'),
+		    sprintf(g_('found start of entry where expected %s'),
 		    $expect), "$_");
 	    }
 	    unless ($entry->is_empty) {
@@ -125,11 +125,11 @@ sub parse {
 	    # hit it for the first time
 	    $self->set_unparsed_tail("$_\n" . file_slurp($fh));
 	} elsif (m/^\S/) {
-	    $self->parse_error($file, $., _g('badly formatted heading line'), "$_");
+	    $self->parse_error($file, $., g_('badly formatted heading line'), "$_");
 	} elsif (match_trailer($_)) {
 	    unless ($expect eq CHANGES_OR_TRAILER) {
 		$self->parse_error($file, $.,
-		    sprintf(_g('found trailer where expected %s'), $expect), "$_");
+		    sprintf(g_('found trailer where expected %s'), $expect), "$_");
 	    }
 	    $entry->set_part('trailer', $_);
 	    $entry->extend_part('blank_after_changes', [ @blanklines ]);
@@ -139,10 +139,10 @@ sub parse {
 	    }
 	    $expect = NEXT_OR_EOF;
 	} elsif (m/^ \-\-/) {
-	    $self->parse_error($file, $., _g('badly formatted trailer line'), "$_");
+	    $self->parse_error($file, $., g_('badly formatted trailer line'), "$_");
 	} elsif (m/^\s{2,}(?:\S)/) {
 	    unless ($expect eq START_CHANGES or $expect eq CHANGES_OR_TRAILER) {
-		$self->parse_error($file, $., sprintf(_g('found change data' .
+		$self->parse_error($file, $., sprintf(g_('found change data' .
 		    ' where expected %s'), $expect), "$_");
 		if ($expect eq NEXT_OR_EOF and not $entry->is_empty) {
 		    # lets assume we have missed the actual header line
@@ -164,11 +164,11 @@ sub parse {
 		next;
 	    } elsif ($expect ne CHANGES_OR_TRAILER) {
 		$self->parse_error($file, $.,
-		    sprintf(_g('found blank line where expected %s'), $expect));
+		    sprintf(g_('found blank line where expected %s'), $expect));
 	    }
 	    push @blanklines, $_;
 	} else {
-	    $self->parse_error($file, $., _g('unrecognized line'), "$_");
+	    $self->parse_error($file, $., g_('unrecognized line'), "$_");
 	    unless ($expect eq START_CHANGES or $expect eq CHANGES_OR_TRAILER) {
 		# lets assume change data if we expected it
 		$entry->extend_part('changes', [ @blanklines, $_]);
@@ -179,7 +179,7 @@ sub parse {
     }
 
     unless ($expect eq NEXT_OR_EOF) {
-	$self->parse_error($file, $., sprintf(_g('found eof where expected %s'),
+	$self->parse_error($file, $., sprintf(g_('found eof where expected %s'),
 					      $expect));
     }
     unless ($entry->is_empty) {

+ 10 - 10
scripts/Dpkg/Changelog/Entry/Debian.pm

@@ -123,31 +123,31 @@ sub check_header {
 	my %optdone;
 	foreach my $opt (split(/\s*,\s*/, $options)) {
 	    unless ($opt =~ m/^([-0-9a-z]+)\=\s*(.*\S)$/i) {
-		push @errors, sprintf(_g("bad key-value after \`;': \`%s'"), $opt);
+		push @errors, sprintf(g_("bad key-value after \`;': \`%s'"), $opt);
 		next;
 	    }
 	    my ($k, $v) = (field_capitalize($1), $2);
 	    if ($optdone{$k}) {
-		push @errors, sprintf(_g('repeated key-value %s'), $k);
+		push @errors, sprintf(g_('repeated key-value %s'), $k);
 	    }
 	    $optdone{$k} = 1;
 	    if ($k eq 'Urgency') {
-		push @errors, sprintf(_g('badly formatted urgency value: %s'), $v)
+		push @errors, sprintf(g_('badly formatted urgency value: %s'), $v)
 		    unless ($v =~ m/^([-0-9a-z]+)((\s+.*)?)$/i);
 	    } elsif ($k eq 'Binary-Only') {
-		push @errors, sprintf(_g('bad binary-only value: %s'), $v)
+		push @errors, sprintf(g_('bad binary-only value: %s'), $v)
 		    unless ($v eq 'yes');
 	    } elsif ($k =~ m/^X[BCS]+-/i) {
 	    } else {
-		push @errors, sprintf(_g('unknown key-value %s'), $k);
+		push @errors, sprintf(g_('unknown key-value %s'), $k);
 	    }
 	}
 	my ($ok, $msg) = version_check($version);
 	unless ($ok) {
-	    push @errors, sprintf(_g("version '%s' is invalid: %s"), $version, $msg);
+	    push @errors, sprintf(g_("version '%s' is invalid: %s"), $version, $msg);
 	}
     } else {
-	push @errors, _g("the header doesn't match the expected regex");
+	push @errors, g_("the header doesn't match the expected regex");
     }
     return @errors;
 }
@@ -157,13 +157,13 @@ sub check_trailer {
     my @errors;
     if (defined($self->{trailer}) and $self->{trailer} =~ $regex_trailer) {
 	if ($3 ne '  ') {
-	    push @errors, _g('badly formatted trailer line');
+	    push @errors, g_('badly formatted trailer line');
 	}
 	unless (defined str2time($4)) {
-	    push @errors, sprintf(_g("couldn't parse date %s"), $4);
+	    push @errors, sprintf(g_("couldn't parse date %s"), $4);
 	}
     } else {
-	push @errors, _g("the trailer doesn't match the expected regex");
+	push @errors, g_("the trailer doesn't match the expected regex");
     }
     return @errors;
 }

+ 8 - 8
scripts/Dpkg/Changelog/Parse.pm

@@ -103,11 +103,11 @@ sub changelog_parse {
 	local $_;
 
 	open(my $format_fh, '-|', 'tail', '-n', '40', $changelogfile)
-	    or syserr(_g('cannot create pipe for %s'), 'tail');
+	    or syserr(g_('cannot create pipe for %s'), 'tail');
 	while (<$format_fh>) {
 	    $format = $1 if m/\schangelog-format:\s+([0-9a-z]+)\W/;
 	}
-	close($format_fh) or subprocerr(_g('tail of %s'), $changelogfile);
+	close($format_fh) or subprocerr(g_('tail of %s'), $changelogfile);
     }
 
     # Find the right changelog parser
@@ -119,10 +119,10 @@ sub changelog_parse {
 	    $parser = $candidate;
 	    last;
 	} else {
-	    warning(_g('format parser %s not executable'), $candidate);
+	    warning(g_('format parser %s not executable'), $candidate);
 	}
     }
-    error(_g('changelog format %s is unknown'), $format) if not defined $parser;
+    error(g_('changelog format %s is unknown'), $format) if not defined $parser;
 
     # Create the arguments for the changelog parser
     my @exec = ($parser, "-l$changelogfile");
@@ -139,19 +139,19 @@ sub changelog_parse {
 
     # Fork and call the parser
     my $pid = open(my $parser_fh, '-|');
-    syserr(_g('cannot fork for %s'), $parser) unless defined $pid;
+    syserr(g_('cannot fork for %s'), $parser) unless defined $pid;
     if (not $pid) {
-	exec(@exec) or syserr(_g('cannot exec format parser: %s'), $parser);
+	exec(@exec) or syserr(g_('cannot exec format parser: %s'), $parser);
     }
 
     # Get the output into several Dpkg::Control objects
     my (@res, $fields);
     while (1) {
         $fields = Dpkg::Control::Changelog->new();
-        last unless $fields->parse($parser_fh, _g('output of changelog parser'));
+        last unless $fields->parse($parser_fh, g_('output of changelog parser'));
 	push @res, $fields;
     }
-    close($parser_fh) or subprocerr(_g('changelog parser %s'), $parser);
+    close($parser_fh) or subprocerr(g_('changelog parser %s'), $parser);
     if (wantarray) {
 	return @res;
     } else {

+ 7 - 7
scripts/Dpkg/Checksums.pm

@@ -170,10 +170,10 @@ sub add_from_file {
     }
 
     push @{$self->{files}}, $key unless exists $self->{size}{$key};
-    (my @s = stat($file)) or syserr(_g('cannot fstat file %s'), $file);
+    (my @s = stat($file)) or syserr(g_('cannot fstat file %s'), $file);
     if (not $opts{update} and exists $self->{size}{$key} and
         $self->{size}{$key} != $s[7]) {
-	error(_g('file %s has size %u instead of expected %u'),
+	error(g_('file %s has size %u instead of expected %u'),
 	      $file, $s[7], $self->{size}{$key});
     }
     $self->{size}{$key} = $s[7];
@@ -187,12 +187,12 @@ sub add_from_file {
 	    my $newsum = $1;
 	    if (not $opts{update} and exists $self->{checksums}{$key}{$alg} and
 		$self->{checksums}{$key}{$alg} ne $newsum) {
-		error(_g('file %s has checksum %s instead of expected %s (algorithm %s)'),
+		error(g_('file %s has checksum %s instead of expected %s (algorithm %s)'),
 		      $file, $newsum, $self->{checksums}{$key}{$alg}, $alg);
 	    }
 	    $self->{checksums}{$key}{$alg} = $newsum;
 	} else {
-	    error(_g("checksum program gave bogus output `%s'"), $output);
+	    error(g_("checksum program gave bogus output `%s'"), $output);
 	}
     }
 }
@@ -221,18 +221,18 @@ sub add_from_string {
     for my $checksum (split /\n */, $fieldtext) {
 	next if $checksum eq '';
 	unless ($checksum =~ m/^($regex)\s+(\d+)\s+($rx_fname)$/) {
-	    error(_g('invalid line in %s checksums string: %s'),
+	    error(g_('invalid line in %s checksums string: %s'),
 		  $alg, $checksum);
 	}
 	my ($sum, $size, $file) = ($1, $2, $3);
 	if (not $opts{update} and  exists($checksums->{$file}{$alg})
 	    and $checksums->{$file}{$alg} ne $sum) {
-	    error(_g("conflicting checksums '%s' and '%s' for file '%s'"),
+	    error(g_("conflicting checksums '%s' and '%s' for file '%s'"),
 		  $checksums->{$file}{$alg}, $sum, $file);
 	}
 	if (not $opts{update} and exists $self->{size}{$file}
 	    and $self->{size}{$file} != $size) {
-	    error(_g("conflicting file sizes '%u' and '%u' for file '%s'"),
+	    error(g_("conflicting file sizes '%u' and '%u' for file '%s'"),
 		  $self->{size}{$file}, $size, $file);
 	}
 	push @{$self->{files}}, $file unless exists $self->{size}{$file};

+ 2 - 2
scripts/Dpkg/Compression.pm

@@ -176,7 +176,7 @@ sub compression_get_default {
 
 sub compression_set_default {
     my ($method) = @_;
-    error(_g('%s is not a supported compression'), $method)
+    error(g_('%s is not a supported compression'), $method)
             unless compression_is_supported($method);
     $default_compression = $method;
 }
@@ -205,7 +205,7 @@ sub compression_get_default_level {
 
 sub compression_set_default_level {
     my ($level) = @_;
-    error(_g('%s is not a compression level'), $level)
+    error(g_('%s is not a compression level'), $level)
         if defined($level) and not compression_is_valid_level($level);
     $default_compression_level = $level;
 }

+ 2 - 2
scripts/Dpkg/Compression/FileHandle.pm

@@ -400,7 +400,7 @@ sub open_for_write {
 		to_file => $self->get_filename(), %opts);
     } else {
 	CORE::open($filehandle, '>', $self->get_filename)
-	    or syserr(_g('cannot write %s'), $self->get_filename());
+	    or syserr(g_('cannot write %s'), $self->get_filename());
     }
     *$self->{mode} = 'w';
     *$self->{file} = $filehandle;
@@ -419,7 +419,7 @@ sub open_for_read {
         *$self->{allow_sigpipe} = 1;
     } else {
 	CORE::open($filehandle, '<', $self->get_filename)
-	    or syserr(_g('cannot read %s'), $self->get_filename());
+	    or syserr(g_('cannot read %s'), $self->get_filename());
     }
     *$self->{mode} = 'r';
     *$self->{file} = $filehandle;

+ 3 - 3
scripts/Dpkg/Compression/Process.pm

@@ -70,7 +70,7 @@ B<Dpkg::Compression>).
 
 sub set_compression {
     my ($self, $method) = @_;
-    error(_g('%s is not a supported compression method'), $method)
+    error(g_('%s is not a supported compression method'), $method)
 	    unless compression_is_supported($method);
     $self->{compression} = $method;
 }
@@ -85,7 +85,7 @@ B<Dpkg::Compression>).
 
 sub set_compression_level {
     my ($self, $level) = @_;
-    error(_g('%s is not a compression level'), $level)
+    error(g_('%s is not a compression level'), $level)
 	    unless compression_is_valid_level($level);
     $self->{compression_level} = $level;
 }
@@ -121,7 +121,7 @@ sub get_uncompress_cmdline {
 sub _sanity_check {
     my ($self, %opts) = @_;
     # Check for proper cleaning before new start
-    error(_g('Dpkg::Compression::Process can only start one subprocess at a time'))
+    error(g_('Dpkg::Compression::Process can only start one subprocess at a time'))
 	    if $self->{pid};
     # Check options
     my $to = my $from = 0;

+ 2 - 2
scripts/Dpkg/Conf.pm

@@ -105,7 +105,7 @@ sub parse {
 	# Skip empty lines and comments
 	next if /^#/ or length == 0;
 	if (/^-[^-]/ and not $self->{allow_short}) {
-	    warning(_g('short option not allowed in %s, line %d'), $desc, $.);
+	    warning(g_('short option not allowed in %s, line %d'), $desc, $.);
 	    next;
 	}
 	if (/^([^=]+)(?:=(.*))?$/) {
@@ -119,7 +119,7 @@ sub parse {
 	    }
 	    $count++;
 	} else {
-	    warning(_g('invalid syntax for option in %s, line %d'), $desc, $.);
+	    warning(g_('invalid syntax for option in %s, line %d'), $desc, $.);
 	}
     }
     return $count;

+ 10 - 10
scripts/Dpkg/Control.pm

@@ -150,25 +150,25 @@ sub set_options {
         $$self->{allow_pgp} = ($t & (CTRL_PKG_SRC | CTRL_FILE_CHANGES)) ? 1 : 0;
         $$self->{drop_empty} = ($t & (CTRL_INFO_PKG | CTRL_INFO_SRC)) ?  0 : 1;
         if ($t == CTRL_INFO_SRC) {
-            $$self->{name} = _g('general section of control info file');
+            $$self->{name} = g_('general section of control info file');
         } elsif ($t == CTRL_INFO_PKG) {
-            $$self->{name} = _g("package's section of control info file");
+            $$self->{name} = g_("package's section of control info file");
         } elsif ($t == CTRL_CHANGELOG) {
-            $$self->{name} = _g('parsed version of changelog');
+            $$self->{name} = g_('parsed version of changelog');
         } elsif ($t == CTRL_INDEX_SRC) {
-            $$self->{name} = sprintf(_g("entry in repository's %s file"), 'Sources');
+            $$self->{name} = sprintf(g_("entry in repository's %s file"), 'Sources');
         } elsif ($t == CTRL_INDEX_PKG) {
-            $$self->{name} = sprintf(_g("entry in repository's %s file"), 'Packages');
+            $$self->{name} = sprintf(g_("entry in repository's %s file"), 'Packages');
         } elsif ($t == CTRL_PKG_SRC) {
-            $$self->{name} = sprintf(_g('%s file'), '.dsc');
+            $$self->{name} = sprintf(g_('%s file'), '.dsc');
         } elsif ($t == CTRL_PKG_DEB) {
-            $$self->{name} = _g('control info of a .deb package');
+            $$self->{name} = g_('control info of a .deb package');
         } elsif ($t == CTRL_FILE_CHANGES) {
-            $$self->{name} = sprintf(_g('%s file'), '.changes');
+            $$self->{name} = sprintf(g_('%s file'), '.changes');
         } elsif ($t == CTRL_FILE_VENDOR) {
-            $$self->{name} = _g('vendor file');
+            $$self->{name} = g_('vendor file');
         } elsif ($t == CTRL_FILE_STATUS) {
-            $$self->{name} = _g("entry in dpkg's status file");
+            $$self->{name} = g_("entry in dpkg's status file");
         }
         $self->set_output_order(field_ordered_list($opts{type}));
     }

+ 2 - 2
scripts/Dpkg/Control/FieldsCore.pm

@@ -506,8 +506,8 @@ sub field_transfer_single($$;$) {
 	    return $field;
 	}
     } elsif (not field_is_allowed_in($field, $from_type)) {
-        warning(_g("unknown information field '%s' in input data in %s"),
-                $field, $from->get_option('name') || _g('control information'));
+        warning(g_("unknown information field '%s' in input data in %s"),
+                $field, $from->get_option('name') || g_('control information'));
     }
     return;
 }

+ 11 - 11
scripts/Dpkg/Control/HashCore.pm

@@ -174,7 +174,7 @@ sub parse_error {
     my ($self, $file, $msg) = (shift, shift, shift);
 
     $msg = sprintf($msg, @_) if (@_);
-    error(_g('syntax error in %s at line %d: %s'), $file, $., $msg);
+    error(g_('syntax error in %s at line %d: %s'), $file, $., $msg);
 }
 
 =item $c->parse($fh, $description)
@@ -204,11 +204,11 @@ sub parse {
 	    $parabody = 1;
 	    my ($name, $value) = ($1, $2);
 	    if ($name =~ m/^-/) {
-		$self->parse_error($desc, _g('field cannot start with a hyphen'));
+		$self->parse_error($desc, g_('field cannot start with a hyphen'));
 	    }
 	    if (exists $self->{$name}) {
 		unless ($$self->{allow_duplicate}) {
-		    $self->parse_error($desc, _g('duplicate field %s found'), $name);
+		    $self->parse_error($desc, g_('duplicate field %s found'), $name);
 		}
 	    }
 	    $self->{$name} = $value;
@@ -216,7 +216,7 @@ sub parse {
 	} elsif (m/^\s(\s*\S.*)$/) {
 	    my $line = $1;
 	    unless (defined($cf)) {
-		$self->parse_error($desc, _g('continued value line not in field'));
+		$self->parse_error($desc, g_('continued value line not in field'));
             }
 	    if ($line =~ /^\.+$/) {
 		$line = substr $line, 1;
@@ -230,19 +230,19 @@ sub parse {
 		    last if m/^\s*$/;
 		}
 	    } else {
-		$self->parse_error($desc, _g('OpenPGP signature not allowed here'));
+		$self->parse_error($desc, g_('OpenPGP signature not allowed here'));
 	    }
 	} elsif (length == 0 || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----$/)) {
 	    if ($expect_pgp_sig) {
 		# Skip empty lines
 		$_ = <$fh> while defined && m/^\s*$/;
 		unless (length) {
-		    $self->parse_error($desc, _g('expected OpenPGP signature, ' .
+		    $self->parse_error($desc, g_('expected OpenPGP signature, ' .
 		                                 'found EOF after blank line'));
 		}
 		s/\s*\n$//;
 		unless (m/^-----BEGIN PGP SIGNATURE-----$/) {
-		    $self->parse_error($desc, _g('expected OpenPGP signature, ' .
+		    $self->parse_error($desc, g_('expected OpenPGP signature, ' .
 		                                 "found something else \`%s'"), $_);
                 }
 		# Skip OpenPGP signature
@@ -251,7 +251,7 @@ sub parse {
 		    last if m/^-----END PGP SIGNATURE-----$/;
 		}
 		unless (defined) {
-		    $self->parse_error($desc, _g('unfinished OpenPGP signature'));
+		    $self->parse_error($desc, g_('unfinished OpenPGP signature'));
                 }
 		# This does not mean the signature is correct, that needs to
 		# be verified by gnupg.
@@ -260,12 +260,12 @@ sub parse {
 	    last; # Finished parsing one block
 	} else {
 	    $self->parse_error($desc,
-	                       _g('line with unknown format (not field-colon-value)'));
+	                       g_('line with unknown format (not field-colon-value)'));
 	}
     }
 
     if ($expect_pgp_sig and not $$self->{is_pgp_signed}) {
-	$self->parse_error($desc, _g('unfinished OpenPGP signature'));
+	$self->parse_error($desc, g_('unfinished OpenPGP signature'));
     }
 
     return defined($cf);
@@ -365,7 +365,7 @@ sub output {
 	    # Print it out
             if ($fh) {
 	        print { $fh } $kv
-	            or syserr(_g('write error on control data'));
+	            or syserr(g_('write error on control data'));
             }
 	    $str .= $kv if defined wantarray;
 	}

+ 3 - 3
scripts/Dpkg/Control/Info.pm

@@ -100,18 +100,18 @@ sub parse {
     return if not $cdata->parse($fh, $desc);
     $self->{source} = $cdata;
     unless (exists $cdata->{Source}) {
-	$cdata->parse_error($desc, _g('first block lacks a source field'));
+	$cdata->parse_error($desc, g_('first block lacks a source field'));
     }
     while (1) {
 	$cdata = Dpkg::Control->new(type => CTRL_INFO_PKG);
         last if not $cdata->parse($fh, $desc);
 	push @{$self->{packages}}, $cdata;
 	unless (exists $cdata->{Package}) {
-	    $cdata->parse_error($desc, _g("block lacks the '%s' field"),
+	    $cdata->parse_error($desc, g_("block lacks the '%s' field"),
 	                        'Package');
 	}
 	unless (exists $cdata->{Architecture}) {
-	    $cdata->parse_error($desc, _g("block lacks the '%s' field"),
+	    $cdata->parse_error($desc, g_("block lacks the '%s' field"),
 	                        'Architecture');
 	}
 

+ 2 - 2
scripts/Dpkg/Deps.pm

@@ -270,7 +270,7 @@ sub deps_parse {
 	                                             build_dep =>
 	                                             $options{build_dep});
 	    if (not defined $dep_simple->{package}) {
-		warning(_g("can't parse dependency %s"), $dep_or);
+		warning(g_("can't parse dependency %s"), $dep_or);
 		return;
 	    }
 	    $dep_simple->{arches} = undef if not $options{use_arch};
@@ -302,7 +302,7 @@ sub deps_parse {
     }
     foreach my $dep (@dep_list) {
         if ($options{union} and not $dep->isa('Dpkg::Deps::Simple')) {
-            warning(_g('an union dependency can only contain simple dependencies'));
+            warning(g_('an union dependency can only contain simple dependencies'));
             return;
         }
         $dep_and->add($dep);

+ 2 - 2
scripts/Dpkg/Dist/Files.pm

@@ -67,11 +67,11 @@ sub parse {
             $file{section} = $2;
             $file{priority} = $3;
         } else {
-            error(_g('badly formed line in files list file, line %d'), $.);
+            error(g_('badly formed line in files list file, line %d'), $.);
         }
 
         if (defined $self->{files}->{$file{filename}}) {
-            warning(_g('duplicate files list entry for file %s (line %d)'),
+            warning(g_('duplicate files list entry for file %s (line %d)'),
                     $file{filename}, $.);
         } else {
             $count++;

+ 9 - 9
scripts/Dpkg/ErrorHandling.pm

@@ -51,28 +51,28 @@ sub report(@)
 
 sub info($;@)
 {
-    print { $info_fh } report(_g('info'), @_) if (!$quiet_warnings);
+    print { $info_fh } report(g_('info'), @_) if (!$quiet_warnings);
 }
 
 sub warning($;@)
 {
-    warn report(_g('warning'), @_) if (!$quiet_warnings);
+    warn report(g_('warning'), @_) if (!$quiet_warnings);
 }
 
 sub syserr($;@)
 {
     my $msg = shift;
-    die report(_g('error'), "$msg: $!", @_);
+    die report(g_('error'), "$msg: $!", @_);
 }
 
 sub error($;@)
 {
-    die report(_g('error'), @_);
+    die report(g_('error'), @_);
 }
 
 sub errormsg($;@)
 {
-    print { *STDERR } report(_g('error'), @_);
+    print { *STDERR } report(g_('error'), @_);
 }
 
 sub subprocerr(@)
@@ -84,15 +84,15 @@ sub subprocerr(@)
     require POSIX;
 
     if (POSIX::WIFEXITED($?)) {
-	error(_g('%s gave error exit status %s'), $p, POSIX::WEXITSTATUS($?));
+	error(g_('%s gave error exit status %s'), $p, POSIX::WEXITSTATUS($?));
     } elsif (POSIX::WIFSIGNALED($?)) {
-	error(_g('%s died from signal %s'), $p, POSIX::WTERMSIG($?));
+	error(g_('%s died from signal %s'), $p, POSIX::WTERMSIG($?));
     } else {
-	error(_g('%s failed with unknown exit code %d'), $p, $?);
+	error(g_('%s failed with unknown exit code %d'), $p, $?);
     }
 }
 
-my $printforhelp = _g('Use --help for program usage information.');
+my $printforhelp = g_('Use --help for program usage information.');
 
 sub usageerr(@)
 {

+ 3 - 3
scripts/Dpkg/File.pm

@@ -37,14 +37,14 @@ sub file_lock($$) {
     # be installed alongside.
     eval 'use File::FcntlLock';
     if ($@) {
-        warning(_g('File::FcntlLock not available; using flock which is not NFS-safe'));
+        warning(g_('File::FcntlLock not available; using flock which is not NFS-safe'));
         flock($fh, LOCK_EX)
-            or syserr(_g('failed to get a write lock on %s'), $filename);
+            or syserr(g_('failed to get a write lock on %s'), $filename);
     } else {
         eval q{
             my $fs = File::FcntlLock->new(l_type => F_WRLCK);
             $fs->lock($fh, F_SETLKW)
-                or syserr(_g('failed to get a write lock on %s'), $filename);
+                or syserr(g_('failed to get a write lock on %s'), $filename);
         }
     }
 }

+ 22 - 5
scripts/Dpkg/Gettext.pm

@@ -26,8 +26,8 @@ package Dpkg::Gettext;
 use strict;
 use warnings;
 
-our $VERSION = '1.00';
-our @EXPORT = qw(_g P_ textdomain ngettext);
+our $VERSION = '1.01';
+our @EXPORT = qw(g_ P_ textdomain ngettext _g);
 
 use Exporter qw(import);
 
@@ -47,7 +47,7 @@ some commonly used aliases.
 
 =over 4
 
-=item my $trans = _g($msgid)
+=item my $trans = g_($msgid)
 
 Calls gettext() on the $msgid and returns its translation for the current
 locale. If gettext() is not available, simply returns $msgid.
@@ -66,7 +66,7 @@ BEGIN {
     eval 'use Locale::gettext';
     if ($@) {
         eval q{
-            sub _g {
+            sub g_ {
                 return shift;
             }
             sub textdomain {
@@ -85,7 +85,7 @@ BEGIN {
         };
     } else {
         eval q{
-            sub _g {
+            sub g_ {
                 return gettext(shift);
             }
             sub P_ {
@@ -95,8 +95,25 @@ BEGIN {
     }
 }
 
+# XXX: Backwards compatibility, to be removed on VERSION 2.00.
+sub _g ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
+{
+    my $msgid = shift;
+
+    require Carp;
+    Carp::carp 'obsolete _g() function, please use g_() instead';
+
+    return g_($msgid);
+}
+
 =head1 CHANGES
 
+=head2 Version 1.01
+
+New function: g_().
+
+Deprecated function: _g().
+
 =head2 Version 1.00
 
 Mark the module as public.

+ 14 - 14
scripts/Dpkg/IPC.pm

@@ -230,25 +230,25 @@ sub spawn {
     my ($input_pipe, $output_pipe, $error_pipe);
     if ($opts{from_pipe}) {
 	pipe($opts{from_handle}, $input_pipe)
-	    or syserr(_g('pipe for %s'), "@prog");
+	    or syserr(g_('pipe for %s'), "@prog");
 	${$opts{from_pipe}} = $input_pipe;
 	push @{$opts{close_in_child}}, $input_pipe;
     }
     if ($opts{to_pipe}) {
 	pipe($output_pipe, $opts{to_handle})
-	    or syserr(_g('pipe for %s'), "@prog");
+	    or syserr(g_('pipe for %s'), "@prog");
 	${$opts{to_pipe}} = $output_pipe;
 	push @{$opts{close_in_child}}, $output_pipe;
     }
     if ($opts{error_to_pipe}) {
 	pipe($error_pipe, $opts{error_to_handle})
-	    or syserr(_g('pipe for %s'), "@prog");
+	    or syserr(g_('pipe for %s'), "@prog");
 	${$opts{error_to_pipe}} = $error_pipe;
 	push @{$opts{close_in_child}}, $error_pipe;
     }
     # Fork and exec
     my $pid = fork();
-    syserr(_g('cannot fork for %s'), "@prog") unless defined $pid;
+    syserr(g_('cannot fork for %s'), "@prog") unless defined $pid;
     if (not $pid) {
 	# Define environment variables
 	if ($opts{env}) {
@@ -270,39 +270,39 @@ sub spawn {
 	}
 	# Change the current directory
 	if ($opts{chdir}) {
-	    chdir($opts{chdir}) or syserr(_g('chdir to %s'), $opts{chdir});
+	    chdir($opts{chdir}) or syserr(g_('chdir to %s'), $opts{chdir});
 	}
 	# Redirect STDIN if needed
 	if ($opts{from_file}) {
 	    open(STDIN, '<', $opts{from_file})
-	        or syserr(_g('cannot open %s'), $opts{from_file});
+	        or syserr(g_('cannot open %s'), $opts{from_file});
 	} elsif ($opts{from_handle}) {
 	    open(STDIN, '<&', $opts{from_handle})
-		or syserr(_g('reopen stdin'));
+		or syserr(g_('reopen stdin'));
 	    close($opts{from_handle}); # has been duped, can be closed
 	}
 	# Redirect STDOUT if needed
 	if ($opts{to_file}) {
 	    open(STDOUT, '>', $opts{to_file})
-	        or syserr(_g('cannot write %s'), $opts{to_file});
+	        or syserr(g_('cannot write %s'), $opts{to_file});
 	} elsif ($opts{to_handle}) {
 	    open(STDOUT, '>&', $opts{to_handle})
-		or syserr(_g('reopen stdout'));
+		or syserr(g_('reopen stdout'));
 	    close($opts{to_handle}); # has been duped, can be closed
 	}
 	# Redirect STDERR if needed
 	if ($opts{error_to_file}) {
 	    open(STDERR, '>', $opts{error_to_file})
-	        or syserr(_g('cannot write %s'), $opts{error_to_file});
+	        or syserr(g_('cannot write %s'), $opts{error_to_file});
 	} elsif ($opts{error_to_handle}) {
 	    open(STDERR, '>&', $opts{error_to_handle})
-	        or syserr(_g('reopen stdout'));
+	        or syserr(g_('reopen stdout'));
 	    close($opts{error_to_handle}); # has been duped, can be closed
 	}
 	# Close some inherited filehandles
 	close($_) foreach (@{$opts{close_in_child}});
 	# Execute the program
-	exec({ $prog[0] } @prog) or syserr(_g('unable to execute %s'), "@prog");
+	exec({ $prog[0] } @prog) or syserr(g_('unable to execute %s'), "@prog");
     }
     # Close handle that we can't use any more
     close($opts{from_handle}) if exists $opts{from_handle};
@@ -370,12 +370,12 @@ with an error message.
 
 sub wait_child {
     my ($pid, %opts) = @_;
-    $opts{cmdline} //= _g('child process');
+    $opts{cmdline} //= g_('child process');
     croak 'no PID set, cannot wait end of process' unless $pid;
     eval {
         local $SIG{ALRM} = sub { die "alarm\n" };
         alarm($opts{timeout}) if defined($opts{timeout});
-        $pid == waitpid($pid, 0) or syserr(_g('wait for %s'), $opts{cmdline});
+        $pid == waitpid($pid, 0) or syserr(g_('wait for %s'), $opts{cmdline});
         alarm(0) if defined($opts{timeout});
     };
     if ($@) {

+ 5 - 5
scripts/Dpkg/Interface/Storable.pm

@@ -83,14 +83,14 @@ sub load {
     my ($desc, $fh) = ($file, undef);
     if ($file eq '-') {
 	$fh = \*STDIN;
-	$desc = _g('<standard input>');
+	$desc = g_('<standard input>');
     } else {
 	$fh = Dpkg::Compression::FileHandle->new();
-	open($fh, '<', $file) or syserr(_g('cannot read %s'), $file);
+	open($fh, '<', $file) or syserr(g_('cannot read %s'), $file);
     }
     my $res = $self->parse($fh, $desc, @options);
     if ($file ne '-') {
-	close($fh) or syserr(_g('cannot close %s'), $file);
+	close($fh) or syserr(g_('cannot close %s'), $file);
     }
     return $res;
 }
@@ -114,11 +114,11 @@ sub save {
 	$fh = \*STDOUT;
     } else {
 	$fh = Dpkg::Compression::FileHandle->new();
-	open($fh, '>', $file) or syserr(_g('cannot write %s'), $file);
+	open($fh, '>', $file) or syserr(g_('cannot write %s'), $file);
     }
     $self->output($fh, @options);
     if ($file ne '-') {
-	close($fh) or syserr(_g('cannot close %s'), $file);
+	close($fh) or syserr(g_('cannot close %s'), $file);
     }
 }
 

+ 3 - 3
scripts/Dpkg/Package.pm

@@ -30,13 +30,13 @@ sub pkg_name_is_illegal($) {
     my $name = shift // '';
 
     if ($name eq '') {
-        return _g('may not be empty string');
+        return g_('may not be empty string');
     }
     if ($name =~ m/[^-+.0-9a-z]/op) {
-        return sprintf(_g("character '%s' not allowed"), ${^MATCH});
+        return sprintf(g_("character '%s' not allowed"), ${^MATCH});
     }
     if ($name !~ m/^[0-9a-z]/o) {
-        return _g('must start with an alphanumeric character');
+        return g_('must start with an alphanumeric character');
     }
 
     return;

+ 1 - 1
scripts/Dpkg/Shlibs.pm

@@ -85,7 +85,7 @@ sub parse_ldso_conf {
     my $file = shift;
     local $_;
 
-    open my $fh, '<', $file or syserr(_g('cannot open %s'), $file);
+    open my $fh, '<', $file or syserr(g_('cannot open %s'), $file);
     $visited{$file}++;
     while (<$fh>) {
 	next if /^\s*$/;

+ 1 - 1
scripts/Dpkg/Shlibs/Cppfilt.pm

@@ -47,7 +47,7 @@ sub get_cppfilt {
 	$filt->{pid} = spawn(exec => [ 'c++filt', "--format=$type" ],
 	                     from_pipe => \$filt->{from},
 	                     to_pipe => \$filt->{to});
-	syserr(_g('unable to execute %s'), 'c++filt')
+	syserr(g_('unable to execute %s'), 'c++filt')
 	    unless defined $filt->{from};
 	$filt->{from}->autoflush(1);
 

+ 4 - 4
scripts/Dpkg/Shlibs/Objdump.pm

@@ -122,7 +122,7 @@ sub has_object {
 
 sub is_elf {
     my ($file) = @_;
-    open(my $file_fh, '<', $file) or syserr(_g('cannot read %s'), $file);
+    open(my $file_fh, '<', $file) or syserr(g_('cannot read %s'), $file);
     my ($header, $result) = ('', 0);
     if (read($file_fh, $header, 4) == 4) {
 	$result = 1 if ($header =~ /^\177ELF$/);
@@ -181,7 +181,7 @@ sub analyze {
 
     local $ENV{LC_ALL} = 'C';
     open(my $objdump, '-|', $OBJDUMP, '-w', '-f', '-p', '-T', '-R', $file)
-        or syserr(_g('cannot fork for %s'), $OBJDUMP);
+        or syserr(g_('cannot fork for %s'), $OBJDUMP);
     my $ret = $self->parse_objdump_output($objdump);
     close($objdump);
     return $ret;
@@ -222,7 +222,7 @@ sub parse_objdump_output {
 	    if (/^\S+\s+(\S+)\s+(\S+)\s*$/) {
 		$self->{dynrelocs}{$2} = $1;
 	    } else {
-		warning(_g("couldn't parse dynamic relocation record: %s"), $_);
+		warning(g_("couldn't parse dynamic relocation record: %s"), $_);
 	    }
 	} elsif ($section eq 'dyninfo') {
 	    if (/^\s*NEEDED\s+(\S+)/) {
@@ -341,7 +341,7 @@ sub parse_dynamic_symbol {
 	# Ignore some s390-specific output like
 	# REG_G6           g     R *UND*      0000000000000000              #scratch
     } else {
-	warning(_g("couldn't parse dynamic symbol definition: %s"), $line);
+	warning(g_("couldn't parse dynamic symbol definition: %s"), $line);
     }
 }
 

+ 2 - 2
scripts/Dpkg/Shlibs/Symbol.pm

@@ -105,7 +105,7 @@ sub parse_symbolspec {
 		$rest = $2;
 	    }
 	}
-	error(_g('symbol name unspecified: %s'), $symbolspec) if (!$symbol);
+	error(g_('symbol name unspecified: %s'), $symbolspec) if (!$symbol);
     } else {
 	# No tag specification. Symbol name is up to the first space
 	# foobarsymbol@Base 1.0 1
@@ -162,7 +162,7 @@ sub initialize {
 	# name@version string.
 	$type = (defined $type) ? 'generic' : 'alias-symver';
 	if ($self->get_symbolname() eq 'Base') {
-	    error(_g("you can't use symver tag to catch unversioned symbols: %s"),
+	    error(g_("you can't use symver tag to catch unversioned symbols: %s"),
 	          $self->get_symbolspec(1));
 	}
     }

+ 5 - 5
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -220,7 +220,7 @@ sub parse {
 
 	if (/^(?:\s+|#(?:DEPRECATED|MISSING): ([^#]+)#\s*)(.*)/) {
 	    if (not defined ($$obj_ref)) {
-		error(_g('symbol information must be preceded by a header (file %s, line %s)'), $file, $.);
+		error(g_('symbol information must be preceded by a header (file %s, line %s)'), $file, $.);
 	    }
 	    # Symbol specification
 	    my $deprecated = ($1) ? $1 : 0;
@@ -228,7 +228,7 @@ sub parse {
 	    if ($self->create_symbol($2, base => $sym)) {
 		$self->add_symbol($sym, $$obj_ref);
 	    } else {
-		warning(_g('failed to parse line in %s: %s'), $file, $_);
+		warning(g_('failed to parse line in %s: %s'), $file, $_);
 	    }
 	} elsif (/^(\(.*\))?#include\s+"([^"]+)"/) {
 	    my $tagspec = $1;
@@ -260,7 +260,7 @@ sub parse {
 		$self->create_object($$obj_ref, "$2");
 	    }
 	} else {
-	    warning(_g('failed to parse a line in %s: %s'), $file, $_);
+	    warning(g_('failed to parse a line in %s: %s'), $file, $_);
 	}
     }
     delete $seen->{$file};
@@ -273,7 +273,7 @@ sub merge_object_from_symfile {
     if (not $self->has_object($objid)) {
         $self->{objects}{$objid} = $src->get_object($objid);
     } else {
-        warning(_g('tried to merge the same object (%s) twice in a symfile'), $objid);
+        warning(g_('tried to merge the same object (%s) twice in a symfile'), $objid);
     }
 }
 
@@ -392,7 +392,7 @@ sub merge_symbols {
     my ($self, $object, $minver) = @_;
 
     my $soname = $object->{SONAME};
-    error(_g('cannot merge symbols from objects without SONAME'))
+    error(g_('cannot merge symbols from objects without SONAME'))
         unless $soname;
 
     my %include_groups = ();

+ 6 - 6
scripts/Dpkg/Source/Archive.pm

@@ -61,7 +61,7 @@ sub _add_entry {
     croak 'call create() first' unless *$self->{tar_input};
     $file = $2 if ($file =~ /^\Q$cwd\E\/(.+)$/); # Relative names
     print({ *$self->{tar_input} } "$file\0")
-        or syserr(_g('write on tar input'));
+        or syserr(g_('write on tar input'));
 }
 
 sub add_file {
@@ -88,7 +88,7 @@ sub add_directory {
 
 sub finish {
     my ($self) = @_;
-    close(*$self->{tar_input}) or syserr(_g('close on tar input'));
+    close(*$self->{tar_input}) or syserr(g_('close on tar input'));
     wait_child(*$self->{pid}, cmdline => 'tar -cf -');
     delete *$self->{pid};
     delete *$self->{tar_input};
@@ -113,7 +113,7 @@ sub extract {
         my $template = basename($self->get_filename()) .  '.tmp-extract.XXXXX';
         unless (-e $dest) {
             # Kludge so that realpath works
-            mkdir($dest) or syserr(_g('cannot create directory %s'), $dest);
+            mkdir($dest) or syserr(g_('cannot create directory %s'), $dest);
         }
         $tmp = tempdir($template, DIR => Cwd::realpath("$dest/.."), CLEANUP => 1);
         $spawn_opts{chdir} = $tmp;
@@ -144,18 +144,18 @@ sub extract {
     return if $opts{in_place};
 
     # Rename extracted directory
-    opendir(my $dir_dh, $tmp) or syserr(_g('cannot opendir %s'), $tmp);
+    opendir(my $dir_dh, $tmp) or syserr(g_('cannot opendir %s'), $tmp);
     my @entries = grep { $_ ne '.' && $_ ne '..' } readdir($dir_dh);
     closedir($dir_dh);
     my $done = 0;
     erasedir($dest);
     if (scalar(@entries) == 1 && ! -l "$tmp/$entries[0]" && -d _) {
 	rename("$tmp/$entries[0]", $dest)
-	    or syserr(_g('unable to rename %s to %s'),
+	    or syserr(g_('unable to rename %s to %s'),
 	              "$tmp/$entries[0]", $dest);
     } else {
 	rename($tmp, $dest)
-	    or syserr(_g('unable to rename %s to %s'), $tmp, $dest);
+	    or syserr(g_('unable to rename %s to %s'), $tmp, $dest);
     }
     erasedir($tmp);
 }

+ 6 - 6
scripts/Dpkg/Source/Functions.pm

@@ -31,15 +31,15 @@ sub erasedir {
     my ($dir) = @_;
     if (not lstat($dir)) {
         return if $! == ENOENT;
-        syserr(_g('cannot stat directory %s (before removal)'), $dir);
+        syserr(g_('cannot stat directory %s (before removal)'), $dir);
     }
     system 'rm', '-rf', '--', $dir;
     subprocerr("rm -rf $dir") if $?;
     if (not stat($dir)) {
         return if $! == ENOENT;
-        syserr(_g("unable to check for removal of dir `%s'"), $dir);
+        syserr(g_("unable to check for removal of dir `%s'"), $dir);
     }
-    error(_g("rm -rf failed to remove `%s'"), $dir);
+    error(g_("rm -rf failed to remove `%s'"), $dir);
 }
 
 sub fixperms {
@@ -75,14 +75,14 @@ sub fs_time($) {
     my ($file) = @_;
     my $is_temp = 0;
     if (not -e $file) {
-	open(my $temp_fh, '>', $file) or syserr(_g('cannot write %s'));
+	open(my $temp_fh, '>', $file) or syserr(g_('cannot write %s'));
 	close($temp_fh);
 	$is_temp = 1;
     } else {
 	utime(undef, undef, $file) or
-	    syserr(_g('cannot change timestamp for %s'), $file);
+	    syserr(g_('cannot change timestamp for %s'), $file);
     }
-    stat($file) or syserr(_g('cannot read timestamp from %s'), $file);
+    stat($file) or syserr(g_('cannot read timestamp from %s'), $file);
     my $mtime = (stat(_))[9];
     unlink($file) if $is_temp;
     return $mtime;

+ 22 - 22
scripts/Dpkg/Source/Package.pm

@@ -237,7 +237,7 @@ sub init_options {
 sub initialize {
     my ($self, $filename) = @_;
     my ($fn, $dir) = fileparse($filename);
-    error(_g('%s is not the name of a file'), $filename) unless $fn;
+    error(g_('%s is not the name of a file'), $filename) unless $fn;
     $self->{basedir} = $dir || './';
     $self->{filename} = $fn;
 
@@ -249,7 +249,7 @@ sub initialize {
 
     foreach my $f (qw(Source Version Files)) {
         unless (defined($fields->{$f})) {
-            error(_g('missing critical source control field %s'), $f);
+            error(g_('missing critical source control field %s'), $f);
         }
     }
 
@@ -268,8 +268,8 @@ sub upgrade_object_type {
         my ($version, $variant, $major, $minor) = ($1, $2, $1, undef);
 
         if (defined $variant and $variant ne lc $variant) {
-            error(_g("source package format '%s' is not supported: %s"),
-                  $format, _g('format variant must be in lowercase'));
+            error(g_("source package format '%s' is not supported: %s"),
+                  $format, g_('format variant must be in lowercase'));
         }
 
         $major =~ s/\.[\d\.]+$//;
@@ -282,12 +282,12 @@ sub upgrade_object_type {
             $self->{fields}{'Format'} .= " ($variant)" if defined $variant;
         }
         if ($@) {
-            error(_g("source package format '%s' is not supported: %s"),
+            error(g_("source package format '%s' is not supported: %s"),
                   $format, $@);
         }
         bless $self, $module;
     } else {
-        error(_g("invalid Format field `%s'"), $format);
+        error(g_("invalid Format field `%s'"), $format);
     }
 }
 
@@ -335,7 +335,7 @@ sub get_basename {
     my ($self, $with_revision) = @_;
     my $f = $self->{fields};
     unless (exists $f->{'Source'} and exists $f->{'Version'}) {
-        error(_g('source and version are required to compute the source basename'));
+        error(g_('source and version are required to compute the source basename'));
     }
     my $v = Dpkg::Version->new($f->{'Version'});
     my $vs = $v->as_string(omit_epoch => 1, omit_revision => !$with_revision);
@@ -351,7 +351,7 @@ sub find_original_tarballs {
     my @tar;
     foreach my $dir ('.', $self->{basedir}, $self->{options}{origtardir}) {
         next unless defined($dir) and -d $dir;
-        opendir(my $dir_dh, $dir) or syserr(_g('cannot opendir %s'), $dir);
+        opendir(my $dir_dh, $dir) or syserr(g_('cannot opendir %s'), $dir);
         push @tar, map { "$dir/$_" } grep {
 		($opts{include_main} and
 		 /^\Q$basename\E\.orig\.tar\.$opts{extension}$/) or
@@ -420,18 +420,18 @@ sub check_signature {
             if ($gpg_status == 1 or ($gpg_status &&
                 $self->{options}{require_valid_signature}))
             {
-                error(_g('failed to verify signature on %s'), $dsc);
+                error(g_('failed to verify signature on %s'), $dsc);
             } elsif ($gpg_status) {
-                warning(_g('failed to verify signature on %s'), $dsc);
+                warning(g_('failed to verify signature on %s'), $dsc);
             }
         } else {
             subprocerr("@exec");
         }
     } else {
         if ($self->{options}{require_valid_signature}) {
-            error(_g("could not verify signature on %s since gpg isn't installed"), $dsc);
+            error(g_("could not verify signature on %s since gpg isn't installed"), $dsc);
         } else {
-            warning(_g("could not verify signature on %s since gpg isn't installed"), $dsc);
+            warning(g_("could not verify signature on %s since gpg isn't installed"), $dsc);
         }
     }
 }
@@ -440,7 +440,7 @@ sub parse_cmdline_options {
     my ($self, @opts) = @_;
     foreach my $option (@opts) {
         if (not $self->parse_cmdline_option($option)) {
-            warning(_g('%s is not a valid option for %s'), $option, ref $self);
+            warning(g_('%s is not a valid option for %s'), $option, ref $self);
         }
     }
 }
@@ -502,7 +502,7 @@ sub extract {
 	unless (-e $format_file) {
 	    mkdir($srcdir) unless -e $srcdir;
 	    open(my $format_fh, '>', $format_file)
-	        or syserr(_g('cannot write %s'), $format_file);
+	        or syserr(g_('cannot write %s'), $format_file);
 	    print { $format_fh } $self->{fields}{'Format'} . "\n";
 	    close($format_fh);
 	}
@@ -513,15 +513,15 @@ sub extract {
     my @s = lstat($rules);
     if (not scalar(@s)) {
         unless ($! == ENOENT) {
-            syserr(_g('cannot stat %s'), $rules);
+            syserr(g_('cannot stat %s'), $rules);
         }
-        warning(_g('%s does not exist'), $rules)
+        warning(g_('%s does not exist'), $rules)
             unless $self->{options}{skip_debianization};
     } elsif (-f _) {
         chmod($s[2] | 0111, $rules)
-            or syserr(_g('cannot make %s executable'), $rules);
+            or syserr(g_('cannot make %s executable'), $rules);
     } else {
-        warning(_g('%s is not a plain file'), $rules);
+        warning(g_('%s is not a plain file'), $rules);
     }
 }
 
@@ -581,7 +581,7 @@ sub commit {
 
 sub do_commit {
     my ($self, $dir) = @_;
-    info(_g("'%s' is not supported by the source format '%s'"),
+    info(g_("'%s' is not supported by the source format '%s'"),
          'dpkg-source --commit', $self->{fields}{'Format'});
 }
 
@@ -596,12 +596,12 @@ sub write_dsc {
     unless ($opts{nocheck}) {
         foreach my $f (qw(Source Version)) {
             unless (defined($fields->{$f})) {
-                error(_g('missing information for critical output field %s'), $f);
+                error(g_('missing information for critical output field %s'), $f);
             }
         }
         foreach my $f (qw(Maintainer Architecture Standards-Version)) {
             unless (defined($fields->{$f})) {
-                warning(_g('missing information for output field %s'), $f);
+                warning(g_('missing information for output field %s'), $f);
             }
         }
     }
@@ -613,7 +613,7 @@ sub write_dsc {
     my $filename = $opts{filename};
     $filename //= $self->get_basename(1) . '.dsc';
     open(my $dsc_fh, '>', $filename)
-        or syserr(_g('cannot write %s'), $filename);
+        or syserr(g_('cannot write %s'), $filename);
     $fields->apply_substvars($opts{substvars});
     $fields->output($dsc_fh);
     close($dsc_fh);

+ 42 - 42
scripts/Dpkg/Source/Package/V1.pm

@@ -66,7 +66,7 @@ sub parse_cmdline_option {
     my ($self, $opt) = @_;
     my $o = $self->{options};
     if ($opt =~ m/^-s([akpursnAKPUR])$/) {
-        warning(_g('-s%s option overrides earlier -s%s option'), $1,
+        warning(g_('-s%s option overrides earlier -s%s option'), $1,
                 $o->{sourcestyle}) if $o->{sourcestyle} ne 'X';
         $o->{sourcestyle} = $1;
         $o->{copy_orig_tarballs} = 0 if $1 eq 'n'; # Extract option -sn
@@ -91,7 +91,7 @@ sub do_extract {
 
     $sourcestyle =~ y/X/p/;
     unless ($sourcestyle =~ m/[pun]/) {
-	usageerr(_g('source handling style -s%s not allowed with -x'),
+	usageerr(g_('source handling style -s%s not allowed with -x'),
 	         $sourcestyle);
     }
 
@@ -104,20 +104,20 @@ sub do_extract {
     my ($tarfile, $difffile);
     foreach my $file ($self->get_files()) {
 	if ($file =~ /^(?:\Q$basename\E\.orig|\Q$basenamerev\E)\.tar\.gz$/) {
-            error(_g('multiple tarfiles in v1.0 source package')) if $tarfile;
+            error(g_('multiple tarfiles in v1.0 source package')) if $tarfile;
             $tarfile = $file;
 	} elsif ($file =~ /^\Q$basenamerev\E\.diff\.gz$/) {
 	    $difffile = $file;
 	} else {
-	    error(_g('unrecognized file for a %s source package: %s'),
+	    error(g_('unrecognized file for a %s source package: %s'),
                   'v1.0', $file);
 	}
     }
 
-    error(_g('no tarfile in Files field')) unless $tarfile;
+    error(g_('no tarfile in Files field')) unless $tarfile;
     my $native = $difffile ? 0 : 1;
     if ($native and ($tarfile =~ /\.orig\.tar\.gz$/)) {
-        warning(_g('native package with .orig.tar'));
+        warning(g_('native package with .orig.tar'));
         $native = 0; # V3::Native doesn't handle orig.tar
     }
 
@@ -130,43 +130,43 @@ sub do_extract {
         erasedir($newdirectory);
         if (-e $expectprefix) {
             rename($expectprefix, "$newdirectory.tmp-keep")
-                or syserr(_g("unable to rename `%s' to `%s'"), $expectprefix,
+                or syserr(g_("unable to rename `%s' to `%s'"), $expectprefix,
                           "$newdirectory.tmp-keep");
         }
 
-        info(_g('unpacking %s'), $tarfile);
+        info(g_('unpacking %s'), $tarfile);
         my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
         $tar->extract($expectprefix);
 
         if ($sourcestyle =~ /u/) {
             # -su: keep .orig directory unpacked
             if (-e "$newdirectory.tmp-keep") {
-                error(_g('unable to keep orig directory (already exists)'));
+                error(g_('unable to keep orig directory (already exists)'));
             }
             system('cp', '-ar', '--', $expectprefix, "$newdirectory.tmp-keep");
             subprocerr("cp $expectprefix to $newdirectory.tmp-keep") if $?;
         }
 
 	rename($expectprefix, $newdirectory)
-	    or syserr(_g('failed to rename newly-extracted %s to %s'),
+	    or syserr(g_('failed to rename newly-extracted %s to %s'),
 	              $expectprefix, $newdirectory);
 
 	# rename the copied .orig directory
 	if (-e "$newdirectory.tmp-keep") {
 	    rename("$newdirectory.tmp-keep", $expectprefix)
-	        or syserr(_g('failed to rename saved %s to %s'),
+	        or syserr(g_('failed to rename saved %s to %s'),
 	                  "$newdirectory.tmp-keep", $expectprefix);
         }
     }
 
     if ($difffile and not $self->{options}{skip_debianization}) {
         my $patch = "$dscdir$difffile";
-	info(_g('applying %s'), $difffile);
+	info(g_('applying %s'), $difffile);
 	my $patch_obj = Dpkg::Source::Patch->new(filename => $patch);
 	my $analysis = $patch_obj->apply($newdirectory, force_timestamp => 1);
 	my @files = grep { ! m{^\Q$newdirectory\E/debian/} }
 		    sort keys %{$analysis->{filepatched}};
-	info(_g('upstream files that have been modified: %s'),
+	info(g_('upstream files that have been modified: %s'),
 	     "\n " . join("\n ", @files)) if scalar @files;
     }
 }
@@ -176,7 +176,7 @@ sub can_build {
 
     # As long as we can use gzip, we can do it as we have
     # native packages as fallback
-    return (0, _g('only supports gzip compression'))
+    return (0, g_('only supports gzip compression'))
         unless $self->{options}{compression} eq 'gzip';
     return 1;
 }
@@ -189,13 +189,13 @@ sub do_build {
     my $diff_ignore_regex = $self->{options}{diff_ignore_regex};
 
     if (scalar(@argv) > 1) {
-        usageerr(_g('-b takes at most a directory and an orig source ' .
+        usageerr(g_('-b takes at most a directory and an orig source ' .
                     'argument (with v1.0 source package)'));
     }
 
     $sourcestyle =~ y/X/A/;
     unless ($sourcestyle =~ m/[akpursnAKPUR]/) {
-        usageerr(_g('source handling style -s%s not allowed with -b'),
+        usageerr(g_('source handling style -s%s not allowed with -b'),
                  $sourcestyle);
     }
 
@@ -210,7 +210,7 @@ sub do_build {
     my $origtargz = $self->get_basename() . '.orig.tar.gz';
     if (-e $origtargz) {
         unless (-f $origtargz) {
-            error(_g("packed orig `%s' exists but is not a plain file"), $origtargz);
+            error(g_("packed orig `%s' exists but is not a plain file"), $origtargz);
         }
     } else {
         $origtargz = undef;
@@ -222,13 +222,13 @@ sub do_build {
         my $origarg = shift(@argv);
         if (length($origarg)) {
             stat($origarg)
-                or syserr(_g('cannot stat orig argument %s'), $origarg);
+                or syserr(g_('cannot stat orig argument %s'), $origarg);
             if (-d _) {
                 $origdir = File::Spec->catdir($origarg);
 
                 $sourcestyle =~ y/aA/rR/;
                 unless ($sourcestyle =~ m/[ursURS]/) {
-                    error(_g('orig argument is unpacked but source handling ' .
+                    error(g_('orig argument is unpacked but source handling ' .
                              'style -s%s calls for packed (.orig.tar.<ext>)'),
                           $sourcestyle);
                 }
@@ -236,18 +236,18 @@ sub do_build {
                 $origtargz = $origarg;
                 $sourcestyle =~ y/aA/pP/;
                 unless ($sourcestyle =~ m/[kpsKPS]/) {
-                    error(_g('orig argument is packed but source handling ' .
+                    error(g_('orig argument is packed but source handling ' .
                              'style -s%s calls for unpacked (.orig/)'),
                           $sourcestyle);
                 }
             } else {
-                error(_g('orig argument %s is not a plain file or directory'),
+                error(g_('orig argument %s is not a plain file or directory'),
                       $origarg);
             }
         } else {
             $sourcestyle =~ y/aA/nn/;
             unless ($sourcestyle =~ m/n/) {
-                error(_g('orig argument is empty (means no orig, no diff) ' .
+                error(g_('orig argument is empty (means no orig, no diff) ' .
                          'but source handling style -s%s wants something'),
                       $sourcestyle);
             }
@@ -261,12 +261,12 @@ sub do_build {
 	} else {
 	    if (stat($origdir)) {
 		unless (-d _) {
-                    error(_g("unpacked orig `%s' exists but is not a directory"),
+                    error(g_("unpacked orig `%s' exists but is not a directory"),
 		          $origdir);
                 }
 		$sourcestyle =~ y/aA/rR/; # .orig directory
 	    } elsif ($! != ENOENT) {
-		syserr(_g("unable to stat putative unpacked orig `%s'"), $origdir);
+		syserr(g_("unable to stat putative unpacked orig `%s'"), $origdir);
 	    } else {
 		$sourcestyle =~ y/aA/nn/; # Native tar.gz
 	    }
@@ -275,7 +275,7 @@ sub do_build {
 
     my ($dirname, $dirbase) = fileparse($dir);
     if ($dirname ne $basedirname) {
-	warning(_g("source directory '%s' is not <sourcepackage>" .
+	warning(g_("source directory '%s' is not <sourcepackage>" .
 	           "-<upstreamversion> '%s'"), $dir, $basedirname);
     }
 
@@ -284,7 +284,7 @@ sub do_build {
 	my ($origdirname, $origdirbase) = fileparse($origdir);
 
         if ($origdirname ne "$basedirname.orig") {
-            warning(_g('.orig directory name %s is not <package>' .
+            warning(g_('.orig directory name %s is not <package>' .
 	               '-<upstreamversion> (wanted %s)'),
 	            $origdirname, "$basedirname.orig");
         }
@@ -293,7 +293,7 @@ sub do_build {
 
 	$tarname = $origtargz || "$basename.orig.tar.gz";
 	unless ($tarname =~ /\Q$basename\E\.orig\.tar\.gz/) {
-	    warning(_g('.orig.tar name %s is not <package>_<upstreamversion>' .
+	    warning(g_('.orig.tar name %s is not <package>_<upstreamversion>' .
 	               '.orig.tar (wanted %s)'),
 	            $tarname, "$basename.orig.tar.gz");
 	}
@@ -305,14 +305,14 @@ sub do_build {
     } elsif ($sourcestyle =~ m/[nurUR]/) {
         if (stat($tarname)) {
             unless ($sourcestyle =~ m/[nUR]/) {
-		error(_g("tarfile `%s' already exists, not overwriting, " .
+		error(g_("tarfile `%s' already exists, not overwriting, " .
 		         'giving up; use -sU or -sR to override'), $tarname);
             }
         } elsif ($! != ENOENT) {
-	    syserr(_g("unable to check for existence of `%s'"), $tarname);
+	    syserr(g_("unable to check for existence of `%s'"), $tarname);
         }
 
-	info(_g('building %s in %s'),
+	info(g_('building %s in %s'),
 	     $sourcepackage, $tarname);
 
 	my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX",
@@ -324,12 +324,12 @@ sub do_build {
 	$tar->add_directory($tardirname);
 	$tar->finish();
 	rename($newtar, $tarname)
-	    or syserr(_g("unable to rename `%s' (newly created) to `%s'"),
+	    or syserr(g_("unable to rename `%s' (newly created) to `%s'"),
 	              $newtar, $tarname);
 	chmod(0666 &~ umask(), $tarname)
-	    or syserr(_g("unable to change permission of `%s'"), $tarname);
+	    or syserr(g_("unable to change permission of `%s'"), $tarname);
     } else {
-	info(_g('building %s using existing %s'),
+	info(g_('building %s using existing %s'),
 	     $sourcepackage, $tarname);
     }
 
@@ -338,7 +338,7 @@ sub do_build {
     if ($sourcestyle =~ m/[kpKP]/) {
         if (stat($origdir)) {
             unless ($sourcestyle =~ m/[KP]/) {
-                error(_g("orig dir `%s' already exists, not overwriting, ".
+                error(g_("orig dir `%s' already exists, not overwriting, ".
                          'giving up; use -sA, -sK or -sP to override'),
                       $origdir);
             }
@@ -346,7 +346,7 @@ sub do_build {
             erasedir($origdir);
             pop_exit_handler();
         } elsif ($! != ENOENT) {
-            syserr(_g("unable to check for existence of orig dir `%s'"),
+            syserr(g_("unable to check for existence of orig dir `%s'"),
                     $origdir);
         }
 
@@ -357,7 +357,7 @@ sub do_build {
     my $ur; # Unrepresentable changes
     if ($sourcestyle =~ m/[kpursKPUR]/) {
 	my $diffname = "$basenamerev.diff.gz";
-	info(_g('building %s in %s'),
+	info(g_('building %s in %s'),
 	     $sourcepackage, $diffname);
 	my ($ndfh, $newdiffgz) = tempfile("$diffname.new.XXXXXX",
 					DIR => getcwd(), UNLINK => 0);
@@ -379,19 +379,19 @@ sub do_build {
 		    map { my $file = $_; $file =~ s{^[^/]+/+}{}; $file }
 		    sort keys %{$analysis->{filepatched}};
 	if (scalar @files) {
-	    warning(_g('the diff modifies the following upstream files: %s'),
+	    warning(g_('the diff modifies the following upstream files: %s'),
 	            "\n " . join("\n ", @files));
-	    info(_g("use the '3.0 (quilt)' format to have separate and " .
+	    info(g_("use the '3.0 (quilt)' format to have separate and " .
 	            'documented changes to upstream files, see dpkg-source(1)'));
-	    error(_g('aborting due to --abort-on-upstream-changes'))
+	    error(g_('aborting due to --abort-on-upstream-changes'))
 		if $self->{options}{abort_on_upstream_changes};
 	}
 
 	rename($newdiffgz, $diffname)
-	    or syserr(_g("unable to rename `%s' (newly created) to `%s'"),
+	    or syserr(g_("unable to rename `%s' (newly created) to `%s'"),
 	              $newdiffgz, $diffname);
 	chmod(0666 &~ umask(), $diffname)
-	    or syserr(_g("unable to change permission of `%s'"), $diffname);
+	    or syserr(g_("unable to change permission of `%s'"), $diffname);
 
 	$self->add_file($diffname);
     }
@@ -401,7 +401,7 @@ sub do_build {
     }
 
     if ($ur) {
-        printf { *STDERR } _g('%s: unrepresentable changes to source') . "\n",
+        printf { *STDERR } g_('%s: unrepresentable changes to source') . "\n",
                $Dpkg::PROGNAME;
         exit(1);
     }

+ 54 - 54
scripts/Dpkg/Source/Package/V2.pm

@@ -122,7 +122,7 @@ sub do_extract {
         my $uncompressed = $file;
         $uncompressed =~ s/\.$re_ext$/.*/;
         $uncompressed =~ s/\.$re_ext\.asc$/.*.asc/;
-        error(_g('duplicate files in %s source package: %s'), 'v2.0',
+        error(g_('duplicate files in %s source package: %s'), 'v2.0',
               $uncompressed) if $seen{$uncompressed};
         $seen{$uncompressed} = 1;
         if ($file =~ /^\Q$basename\E\.orig\.tar\.$re_ext$/) {
@@ -136,23 +136,23 @@ sub do_extract {
         } elsif ($file =~ /^\Q$basenamerev\E\.debian\.tar\.$re_ext$/) {
             $debianfile = $file;
         } else {
-            error(_g('unrecognized file for a %s source package: %s'),
+            error(g_('unrecognized file for a %s source package: %s'),
             'v2.0', $file);
         }
     }
 
     unless ($tarfile and $debianfile) {
-        error(_g('missing orig.tar or debian.tar file in v2.0 source package'));
+        error(g_('missing orig.tar or debian.tar file in v2.0 source package'));
     }
     if ($tarsign and $tarfile ne substr $tarsign, 0, -4) {
-        error(_g('mismatched orig.tar %s for signature %s in source package'),
+        error(g_('mismatched orig.tar %s for signature %s in source package'),
               $tarfile, $tarsign);
     }
     foreach my $name (keys %addonsign) {
-        error(_g('missing addon orig.tar for signature %s in source package'),
+        error(g_('missing addon orig.tar for signature %s in source package'),
               $addonsign{$name})
             if not exists $addonfile{$name};
-        error(_g('mismatched addon orig.tar %s for signature %s in source package'),
+        error(g_('mismatched addon orig.tar %s for signature %s in source package'),
               $addonfile{$name}, $addonsign{$name})
             if $addonfile{$name} ne substr $addonsign{$name}, 0, -4;
     }
@@ -160,7 +160,7 @@ sub do_extract {
     erasedir($newdirectory);
 
     # Extract main tarball
-    info(_g('unpacking %s'), $tarfile);
+    info(g_('unpacking %s'), $tarfile);
     my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
     $tar->extract($newdirectory, no_fixperms => 1,
                   options => [ '--anchored', '--no-wildcards-match-slash',
@@ -172,9 +172,9 @@ sub do_extract {
     # Extract additional orig tarballs
     foreach my $subdir (sort keys %addonfile) {
         my $file = $addonfile{$subdir};
-        info(_g('unpacking %s'), $file);
+        info(g_('unpacking %s'), $file);
         if (-e "$newdirectory/$subdir") {
-            warning(_g("required removal of `%s' installed by original tarball"), $subdir);
+            warning(g_("required removal of `%s' installed by original tarball"), $subdir);
             erasedir("$newdirectory/$subdir");
         }
         $tar = Dpkg::Source::Archive->new(filename => "$dscdir$file");
@@ -185,7 +185,7 @@ sub do_extract {
     return if $self->{options}{skip_debianization};
 
     # Extract debian tarball after removing the debian directory
-    info(_g('unpacking %s'), $debianfile);
+    info(g_('unpacking %s'), $debianfile);
     erasedir("$newdirectory/debian");
     # Exclude existing symlinks from extraction of debian.tar.gz as we
     # don't want to overwrite something outside of $newdirectory due to a
@@ -218,7 +218,7 @@ sub get_patches {
     my $pd = "$dir/debian/patches";
     my $auto_patch = $self->get_autopatch_name();
     if (-d $pd) {
-        opendir(my $dir_dh, $pd) or syserr(_g('cannot opendir %s'), $pd);
+        opendir(my $dir_dh, $pd) or syserr(g_('cannot opendir %s'), $pd);
         foreach my $patch (sort readdir($dir_dh)) {
             # patches match same rules as run-parts
             next unless $patch =~ /^[\w-]+$/ and -f "$pd/$patch";
@@ -237,12 +237,12 @@ sub apply_patches {
     return unless scalar(@patches);
     my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied');
     open(my $applied_fh, '>', $applied)
-        or syserr(_g('cannot write %s'), $applied);
+        or syserr(g_('cannot write %s'), $applied);
     print { $applied_fh } "# During $opts{usage}\n";
     my $timestamp = fs_time($applied);
     foreach my $patch ($self->get_patches($dir, %opts)) {
         my $path = File::Spec->catfile($dir, 'debian', 'patches', $patch);
-        info(_g('applying %s'), $patch) unless $opts{skip_auto};
+        info(g_('applying %s'), $patch) unless $opts{skip_auto};
         my $patch_obj = Dpkg::Source::Patch->new(filename => $path);
         $patch_obj->apply($dir, force_timestamp => 1,
                           timestamp => $timestamp,
@@ -260,7 +260,7 @@ sub unapply_patches {
     my $timestamp = fs_time($applied);
     foreach my $patch (@patches) {
         my $path = File::Spec->catfile($dir, 'debian', 'patches', $patch);
-        info(_g('unapplying %s'), $patch) unless $opts{quiet};
+        info(g_('unapplying %s'), $patch) unless $opts{quiet};
         my $patch_obj = Dpkg::Source::Patch->new(filename => $path);
         $patch_obj->apply($dir, force_timestamp => 1, verbose => 0,
                           timestamp => $timestamp,
@@ -283,7 +283,7 @@ sub can_build {
     return 1 if $self->find_original_tarballs(include_supplementary => 0);
     return 1 if $self->{options}{create_empty_orig} and
                 $self->find_original_tarballs(include_main => 0);
-    return (0, sprintf(_g('no upstream tarball found at %s'),
+    return (0, sprintf(g_('no upstream tarball found at %s'),
                        $self->upstream_tarball_template()));
 }
 
@@ -298,7 +298,7 @@ sub after_build {
     my $reason = '';
     if (-e $applied) {
         open(my $applied_fh, '<', $applied)
-            or syserr(_g('cannot read %s'), $applied);
+            or syserr(g_('cannot read %s'), $applied);
         $reason = <$applied_fh>;
         close($applied_fh);
     }
@@ -337,7 +337,7 @@ sub check_patches_applied {
     my ($self, $dir) = @_;
     my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied');
     unless (-e $applied) {
-        info(_g('patches are not applied, applying them now'));
+        info(g_('patches are not applied, applying them now'));
         $self->apply_patches($dir, usage => 'preparation');
     }
 }
@@ -355,7 +355,7 @@ sub generate_patch {
     foreach my $file (sort $self->find_original_tarballs()) {
         if ($file =~ /\.orig\.tar\.$comp_ext_regex$/) {
             if (defined($tarfile)) {
-                error(_g('several orig.tar files found (%s and %s) but only ' .
+                error(g_('several orig.tar files found (%s and %s) but only ' .
                          'one is allowed'), $tarfile, $file);
             }
             $tarfile = $file;
@@ -368,11 +368,11 @@ sub generate_patch {
         }
     }
 
-    error(_g('no upstream tarball found at %s'),
+    error(g_('no upstream tarball found at %s'),
           $self->upstream_tarball_template()) unless $tarfile;
 
     if ($opts{usage} eq 'build') {
-        info(_g('building %s using existing %s'),
+        info(g_('building %s using existing %s'),
              $self->{fields}{'Source'}, "@origtarballs");
     }
 
@@ -394,7 +394,7 @@ sub generate_patch {
     # Copy over the debian directory
     erasedir("$tmp/debian");
     system('cp', '-a', '--', "$dir/debian", "$tmp/");
-    subprocerr(_g('copy of the debian directory')) if $?;
+    subprocerr(g_('copy of the debian directory')) if $?;
 
     # Apply all patches except the last automatic one
     $opts{skip_auto} //= 0;
@@ -419,10 +419,10 @@ sub generate_patch {
             %{$self->{diff_options}},
             handle_binary_func => $opts{handle_binary},
             order_from => $opts{order_from});
-    error(_g('unrepresentable changes to source')) if not $diff->finish();
+    error(g_('unrepresentable changes to source')) if not $diff->finish();
 
     if (-s $tmpdiff) {
-        info(_g('local changes detected, the modified files are:'));
+        info(g_('local changes detected, the modified files are:'));
         my $analysis = $diff->analyze($dir, verbose => 0);
         foreach my $fn (sort keys %{$analysis->{filepatched}}) {
             print " $fn\n";
@@ -441,7 +441,7 @@ sub do_build {
     my ($self, $dir) = @_;
     my @argv = @{$self->{options}{ARGV}};
     if (scalar(@argv)) {
-        usageerr(_g("-b takes only one parameter with format `%s'"),
+        usageerr(g_("-b takes only one parameter with format `%s'"),
                  $self->{fields}{'Format'});
     }
     $self->prepare_build($dir);
@@ -460,7 +460,7 @@ sub do_build {
             my $fn = File::Spec->abs2rel($_, $dir);
             $binaryfiles->new_binary_found($fn);
             unless ($include_binaries or $binaryfiles->binary_is_allowed($fn)) {
-                errormsg(_g('unwanted binary file: %s'), $fn);
+                errormsg(g_('unwanted binary file: %s'), $fn);
                 $unwanted_binaries++;
             }
         }
@@ -478,13 +478,13 @@ sub do_build {
         my $reldir = File::Spec->abs2rel($File::Find::dir, $dir);
         my $cwd = getcwd();
         # Apply the pattern both from the top dir and from the inspected dir
-        chdir($dir) or syserr(_g("unable to chdir to `%s'"), $dir);
+        chdir($dir) or syserr(g_("unable to chdir to `%s'"), $dir);
         $exclude{$_} = 1 foreach glob($tar_ignore_glob);
-        chdir($cwd) or syserr(_g("unable to chdir to `%s'"), $cwd);
+        chdir($cwd) or syserr(g_("unable to chdir to `%s'"), $cwd);
         chdir($File::Find::dir)
-            or syserr(_g("unable to chdir to `%s'"), $File::Find::dir);
+            or syserr(g_("unable to chdir to `%s'"), $File::Find::dir);
         $exclude{$_} = 1 foreach glob($tar_ignore_glob);
-        chdir($cwd) or syserr(_g("unable to chdir to `%s'"), $cwd);
+        chdir($cwd) or syserr(g_("unable to chdir to `%s'"), $cwd);
         my @result;
         foreach my $fn (@_) {
             unless (exists $exclude{$fn} or exists $exclude{"$reldir/$fn"}) {
@@ -509,9 +509,9 @@ sub do_build {
         my $file = $opts{filename};
         $binaryfiles->new_binary_found($file);
         unless ($include_binaries or $binaryfiles->binary_is_allowed($file)) {
-            errormsg(_g('cannot represent change to %s: %s'), $file,
-                     _g('binary file contents changed'));
-            errormsg(_g('add %s in debian/source/include-binaries if you want ' .
+            errormsg(g_('cannot represent change to %s: %s'), $file,
+                     g_('binary file contents changed'));
+            errormsg(g_('add %s in debian/source/include-binaries if you want ' .
                         'to store the modified binary in the debian tarball'),
                      $file);
             $self->register_error();
@@ -527,9 +527,9 @@ sub do_build {
                                         skip_auto => $self->{options}{auto_commit},
                                         usage => 'build');
     unless (-z $tmpdiff or $self->{options}{auto_commit}) {
-        info(_g('you can integrate the local changes with %s'),
+        info(g_('you can integrate the local changes with %s'),
              'dpkg-source --commit');
-        error(_g('aborting due to unexpected upstream changes, see %s'),
+        error(g_('aborting due to unexpected upstream changes, see %s'),
               $tmpdiff);
     }
     push_exit_handler(sub { unlink($tmpdiff) });
@@ -540,16 +540,16 @@ sub do_build {
         mkpath(File::Spec->catdir($dir, 'debian', 'patches'));
         $autopatch = $self->register_patch($dir, $tmpdiff,
                                            $self->get_autopatch_name());
-        info(_g('local changes have been recorded in a new patch: %s'),
+        info(g_('local changes have been recorded in a new patch: %s'),
              $autopatch) if -e $autopatch;
         rmdir(File::Spec->catdir($dir, 'debian', 'patches')); # No check on purpose
     }
-    unlink($tmpdiff) or syserr(_g('cannot remove %s'), $tmpdiff);
+    unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff);
     pop_exit_handler();
 
     # Create the debian.tar
     my $debianfile = "$basenamerev.debian.tar." . $self->{options}{comp_ext};
-    info(_g('building %s in %s'), $sourcepackage, $debianfile);
+    info(g_('building %s in %s'), $sourcepackage, $debianfile);
     my $tar = Dpkg::Source::Archive->new(filename => $debianfile,
                                          compression_level => $self->{options}{comp_level});
     $tar->create(options => \@tar_ignore, chdir => $dir);
@@ -570,7 +570,7 @@ sub get_patch_header {
     }
     my $text;
     if (-f $ph) {
-        open(my $ph_fh, '<', $ph) or syserr(_g('cannot read %s'), $ph);
+        open(my $ph_fh, '<', $ph) or syserr(g_('cannot read %s'), $ph);
         $text = file_slurp($ph_fh);
         close($ph_fh);
         return $text;
@@ -610,16 +610,16 @@ sub register_patch {
     my $patch = File::Spec->catfile($dir, 'debian', 'patches', $patch_name);
     if (-s $patch_file) {
         copy($patch_file, $patch)
-            or syserr(_g('failed to copy %s to %s'), $patch_file, $patch);
+            or syserr(g_('failed to copy %s to %s'), $patch_file, $patch);
         chmod(0666 & ~ umask(), $patch)
-            or syserr(_g("unable to change permission of `%s'"), $patch);
+            or syserr(g_("unable to change permission of `%s'"), $patch);
         my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied');
         open(my $applied_fh, '>>', $applied)
-            or syserr(_g('cannot write %s'), $applied);
+            or syserr(g_('cannot write %s'), $applied);
         print { $applied_fh } "$patch\n";
-        close($applied_fh) or syserr(_g('cannot close %s'), $applied);
+        close($applied_fh) or syserr(g_('cannot close %s'), $applied);
     } elsif (-e $patch) {
-        unlink($patch) or syserr(_g('cannot remove %s'), $patch);
+        unlink($patch) or syserr(g_('cannot remove %s'), $patch);
     }
     return $patch;
 }
@@ -632,7 +632,7 @@ sub _is_bad_patch_name {
 
     my $patch = File::Spec->catfile($dir, 'debian', 'patches', $patch_name);
     if (-e $patch) {
-        warning(_g('cannot register changes in %s, this patch already exists'),
+        warning(g_('cannot register changes in %s, this patch already exists'),
                 $patch);
         return 1;
     }
@@ -649,7 +649,7 @@ sub do_commit {
     if ($tmpdiff and not -e $tmpdiff) {
         $tmpdiff = File::Spec->catfile($dir, $tmpdiff)
             unless File::Spec->file_name_is_absolute($tmpdiff);
-        error(_g("patch file '%s' doesn't exist"), $tmpdiff) if not -e $tmpdiff;
+        error(g_("patch file '%s' doesn't exist"), $tmpdiff) if not -e $tmpdiff;
     }
 
     my $binaryfiles = Dpkg::Source::Package::V2::BinaryFiles->new($dir);
@@ -666,13 +666,13 @@ sub do_commit {
     }
     push_exit_handler(sub { unlink($tmpdiff) });
     unless (-s $tmpdiff) {
-        unlink($tmpdiff) or syserr(_g('cannot remove %s'), $tmpdiff);
-        info(_g('there are no local changes to record'));
+        unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff);
+        info(g_('there are no local changes to record'));
         return;
     }
     while (_is_bad_patch_name($dir, $patch_name)) {
         # Ask the patch name interactively
-        print _g('Enter the desired patch name: ');
+        print g_('Enter the desired patch name: ');
         $patch_name = <STDIN>;
         next unless defined $patch_name;
         chomp $patch_name;
@@ -684,13 +684,13 @@ sub do_commit {
     my @editors = ('sensible-editor', $ENV{VISUAL}, $ENV{EDITOR}, 'vi');
     my $editor = first { find_command($_) } @editors;
     if (not $editor) {
-        error(_g('cannot find an editor'));
+        error(g_('cannot find an editor'));
     }
     system($editor, $patch);
     subprocerr($editor) if $?;
-    unlink($tmpdiff) or syserr(_g('cannot remove %s'), $tmpdiff);
+    unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff);
     pop_exit_handler();
-    info(_g('local changes have been recorded in a new patch: %s'), $patch);
+    info(g_('local changes have been recorded in a new patch: %s'), $patch);
 }
 
 package Dpkg::Source::Package::V2::BinaryFiles;
@@ -727,7 +727,7 @@ sub load_allowed_binaries {
     my $incbin_file = $self->{include_binaries_path};
     if (-f $incbin_file) {
         open(my $incbin_fh, '<', $incbin_file)
-            or syserr(_g('cannot read %s'), $incbin_file);
+            or syserr(g_('cannot read %s'), $incbin_file);
         while (<$incbin_fh>) {
             chomp; s/^\s*//; s/\s*$//;
             next if /^#/ or length == 0;
@@ -752,10 +752,10 @@ sub update_debian_source_include_binaries {
     my $incbin_file = $self->{include_binaries_path};
     mkpath(File::Spec->catdir($self->{dir}, 'debian', 'source'));
     open(my $incbin_fh, '>>', $incbin_file)
-        or syserr(_g('cannot write %s'), $incbin_file);
+        or syserr(g_('cannot write %s'), $incbin_file);
     foreach my $binary (@unknown_binaries) {
         print { $incbin_fh } "$binary\n";
-        info(_g('adding %s to %s'), $binary, 'debian/source/include-binaries');
+        info(g_('adding %s to %s'), $binary, 'debian/source/include-binaries');
         $self->{allowed_binaries}{$binary} = 1;
     }
     close($incbin_fh);

+ 16 - 16
scripts/Dpkg/Source/Package/V3/Bzr.pm

@@ -49,7 +49,7 @@ sub import {
             return 1;
         }
     }
-    error(_g('cannot unpack bzr-format source package because ' .
+    error(g_('cannot unpack bzr-format source package because ' .
              'bzr is not in the PATH'));
 }
 
@@ -57,20 +57,20 @@ sub sanity_check {
     my $srcdir = shift;
 
     if (! -d "$srcdir/.bzr") {
-        error(_g('source directory is not the top directory of a bzr repository (%s/.bzr not present), but Format bzr was specified'),
+        error(g_('source directory is not the top directory of a bzr repository (%s/.bzr not present), but Format bzr was specified'),
               $srcdir);
     }
 
     # Symlinks from .bzr to outside could cause unpack failures, or
     # point to files they shouldn't, so check for and don't allow.
     if (-l "$srcdir/.bzr") {
-        error(_g('%s is a symlink'), "$srcdir/.bzr");
+        error(g_('%s is a symlink'), "$srcdir/.bzr");
     }
     my $abs_srcdir = Cwd::abs_path($srcdir);
     find(sub {
         if (-l) {
             if (Cwd::abs_path(readlink) !~ /^\Q$abs_srcdir\E(?:\/|$)/) {
-                error(_g('%s is a symlink to outside %s'),
+                error(g_('%s is a symlink to outside %s'),
                       $File::Find::name, $srcdir);
             }
         }
@@ -82,7 +82,7 @@ sub sanity_check {
 sub can_build {
     my ($self, $dir) = @_;
 
-    return (0, _g("doesn't contain a bzr repository")) unless -d "$dir/.bzr";
+    return (0, g_("doesn't contain a bzr repository")) unless -d "$dir/.bzr";
     return 1;
 }
 
@@ -97,7 +97,7 @@ sub do_build {
     my ($dirname, $updir) = fileparse($dir);
 
     if (scalar(@argv)) {
-        usageerr(_g("-b takes only one parameter with format `%s'"),
+        usageerr(g_("-b takes only one parameter with format `%s'"),
                  $self->{fields}{'Format'});
     }
 
@@ -110,7 +110,7 @@ sub do_build {
     sanity_check($dir);
 
     my $old_cwd = getcwd();
-    chdir($dir) or syserr(_g("unable to chdir to `%s'"), $dir);
+    chdir($dir) or syserr(g_("unable to chdir to `%s'"), $dir);
 
     local $_;
 
@@ -128,13 +128,13 @@ sub do_build {
             push @files, $_;
         }
     }
-    close($bzr_status_fh) or syserr(_g('bzr status exited nonzero'));
+    close($bzr_status_fh) or syserr(g_('bzr status exited nonzero'));
     if (@files) {
-        error(_g('uncommitted, not-ignored changes in working directory: %s'),
+        error(g_('uncommitted, not-ignored changes in working directory: %s'),
               join(' ', @files));
     }
 
-    chdir($old_cwd) or syserr(_g("unable to chdir to `%s'"), $old_cwd);
+    chdir($old_cwd) or syserr(g_("unable to chdir to `%s'"), $old_cwd);
 
     my $tmp = tempdir("$dirname.bzr.XXXXXX", DIR => $updir);
     push_exit_handler(sub { erasedir($tmp) });
@@ -153,7 +153,7 @@ sub do_build {
 
     # Create the tar file
     my $debianfile = "$basenamerev.bzr.tar." . $self->{options}{comp_ext};
-    info(_g('building %s in %s'),
+    info(g_('building %s in %s'),
          $sourcepackage, $debianfile);
     my $tar = Dpkg::Source::Archive->new(filename => $debianfile,
                                          compression => $self->{options}{compression},
@@ -180,19 +180,19 @@ sub do_extract {
 
     my @files = $self->get_files();
     if (@files > 1) {
-        error(_g('format v3.0 uses only one source file'));
+        error(g_('format v3.0 uses only one source file'));
     }
     my $tarfile = $files[0];
     my $comp_ext_regex = compression_get_file_extension_regex();
     if ($tarfile !~ /^\Q$basenamerev\E\.bzr\.tar\.$comp_ext_regex$/) {
-        error(_g('expected %s, got %s'),
+        error(g_('expected %s, got %s'),
               "$basenamerev.bzr.tar.$comp_ext_regex", $tarfile);
     }
 
     erasedir($newdirectory);
 
     # Extract main tarball
-    info(_g('unpacking %s'), $tarfile);
+    info(g_('unpacking %s'), $tarfile);
     my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
     $tar->extract($newdirectory);
 
@@ -200,13 +200,13 @@ sub do_extract {
 
     my $old_cwd = getcwd();
     chdir($newdirectory)
-        or syserr(_g("unable to chdir to `%s'"), $newdirectory);
+        or syserr(g_("unable to chdir to `%s'"), $newdirectory);
 
     # Reconstitute the working tree.
     system('bzr', 'checkout');
     subprocerr('bzr checkout') if $?;
 
-    chdir($old_cwd) or syserr(_g("unable to chdir to `%s'"), $old_cwd);
+    chdir($old_cwd) or syserr(g_("unable to chdir to `%s'"), $old_cwd);
 }
 
 1;

+ 3 - 3
scripts/Dpkg/Source/Package/V3/Custom.pm

@@ -37,13 +37,13 @@ sub parse_cmdline_option {
     return 0;
 }
 sub do_extract {
-    error(_g("Format `3.0 (custom)' is only used to create source packages"));
+    error(g_("Format `3.0 (custom)' is only used to create source packages"));
 }
 
 sub can_build {
     my ($self, $dir) = @_;
 
-    return (0, _g('no files indicated on command line'))
+    return (0, g_('no files indicated on command line'))
         unless scalar(@{$self->{options}{ARGV}});
     return 1;
 }
@@ -52,7 +52,7 @@ sub do_build {
     my ($self, $dir) = @_;
     # Update real target format
     my $format = $self->{options}{target_format};
-    error(_g('--target-format option is missing')) unless $format;
+    error(g_('--target-format option is missing')) unless $format;
     $self->{fields}{'Format'} = $format;
     # Add all files
     foreach my $file (@{$self->{options}{ARGV}}) {

+ 18 - 18
scripts/Dpkg/Source/Package/V3/Git.pm

@@ -52,7 +52,7 @@ sub import {
             return 1;
         }
     }
-    error(_g('cannot unpack git-format source package because ' .
+    error(g_('cannot unpack git-format source package because ' .
              'git is not in the PATH'));
 }
 
@@ -60,12 +60,12 @@ sub sanity_check {
     my $srcdir = shift;
 
     if (! -d "$srcdir/.git") {
-        error(_g('source directory is not the top directory of a git ' .
+        error(g_('source directory is not the top directory of a git ' .
                  'repository (%s/.git not present), but Format git was ' .
                  'specified'), $srcdir);
     }
     if (-s "$srcdir/.gitmodules") {
-        error(_g('git repository %s uses submodules; this is not yet supported'),
+        error(g_('git repository %s uses submodules; this is not yet supported'),
               $srcdir);
     }
 
@@ -88,7 +88,7 @@ sub parse_cmdline_option {
 sub can_build {
     my ($self, $dir) = @_;
 
-    return (0, _g("doesn't contain a git repository")) unless -d "$dir/.git";
+    return (0, g_("doesn't contain a git repository")) unless -d "$dir/.git";
     return 1;
 }
 
@@ -103,7 +103,7 @@ sub do_build {
     sanity_check($dir);
 
     my $old_cwd = getcwd();
-    chdir($dir) or syserr(_g("unable to chdir to `%s'"), $dir);
+    chdir($dir) or syserr(g_("unable to chdir to `%s'"), $dir);
 
     # Check for uncommitted files.
     # To support dpkg-source -i, get a list of files
@@ -132,9 +132,9 @@ sub do_build {
           }
       }
     }
-    close($git_ls_files_fh) or syserr(_g('git ls-files exited nonzero'));
+    close($git_ls_files_fh) or syserr(g_('git ls-files exited nonzero'));
     if (@files) {
-        error(_g('uncommitted, not-ignored changes in working directory: %s'),
+        error(g_('uncommitted, not-ignored changes in working directory: %s'),
               join(' ', @files));
     }
 
@@ -143,19 +143,19 @@ sub do_build {
     my $tmp;
     my $shallowfile;
     if ($self->{options}{git_depth}) {
-        chdir($old_cwd) or syserr(_g("unable to chdir to `%s'"), $old_cwd);
+        chdir($old_cwd) or syserr(g_("unable to chdir to `%s'"), $old_cwd);
         $tmp = tempdir("$dirname.git.XXXXXX", DIR => $updir);
         push_exit_handler(sub { erasedir($tmp) });
         my $clone_dir = "$tmp/repo.git";
         # file:// is needed to avoid local cloning, which does not
         # create a shallow clone.
-        info(_g('creating shallow clone with depth %s'),
+        info(g_('creating shallow clone with depth %s'),
                 $self->{options}{git_depth});
         system('git', 'clone', '--depth=' . $self->{options}{git_depth},
                '--quiet', '--bare', 'file://' . abs_path($dir), $clone_dir);
         subprocerr('git clone') if $?;
         chdir($clone_dir)
-            or syserr(_g("unable to chdir to `%s'"), $clone_dir);
+            or syserr(g_("unable to chdir to `%s'"), $clone_dir);
         $shallowfile = "$basenamerev.gitshallow";
         system('cp', '-f', 'shallow', "$old_cwd/$shallowfile");
         subprocerr('cp shallow') if $?;
@@ -165,7 +165,7 @@ sub do_build {
     my $bundlefile = "$basenamerev.git";
     my @bundle_arg=$self->{options}{git_ref} ?
         (@{$self->{options}{git_ref}}) : '--all';
-    info(_g('bundling: %s'), join(' ', @bundle_arg));
+    info(g_('bundling: %s'), join(' ', @bundle_arg));
     system('git', 'bundle', 'create', "$old_cwd/$bundlefile",
            @bundle_arg,
            'HEAD', # ensure HEAD is included no matter what
@@ -173,7 +173,7 @@ sub do_build {
     );
     subprocerr('git bundle') if $?;
 
-    chdir($old_cwd) or syserr(_g("unable to chdir to `%s'"), $old_cwd);
+    chdir($old_cwd) or syserr(g_("unable to chdir to `%s'"), $old_cwd);
 
     if (defined $tmp) {
         erasedir($tmp);
@@ -200,33 +200,33 @@ sub do_extract {
             if (! defined $bundle) {
                 $bundle = $file;
             } else {
-                error(_g('format v3.0 (git) uses only one .git file'));
+                error(g_('format v3.0 (git) uses only one .git file'));
             }
         } elsif ($file =~ /^\Q$basenamerev\E\.gitshallow$/) {
             if (! defined $shallow) {
                 $shallow = $file;
             } else {
-                error(_g('format v3.0 (git) uses only one .gitshallow file'));
+                error(g_('format v3.0 (git) uses only one .gitshallow file'));
             }
         } else {
-            error(_g('format v3.0 (git) unknown file: %s', $file));
+            error(g_('format v3.0 (git) unknown file: %s', $file));
         }
     }
     if (! defined $bundle) {
-        error(_g('format v3.0 (git) expected %s'), "$basenamerev.git");
+        error(g_('format v3.0 (git) expected %s'), "$basenamerev.git");
     }
 
     erasedir($newdirectory);
 
     # Extract git bundle.
-    info(_g('cloning %s'), $bundle);
+    info(g_('cloning %s'), $bundle);
     system('git', 'clone', '--quiet', $dscdir . $bundle, $newdirectory);
     subprocerr('git bundle') if $?;
 
     if (defined $shallow) {
         # Move shallow info file into place, so git does not
         # try to follow parents of shallow refs.
-        info(_g('setting up shallow clone'));
+        info(g_('setting up shallow clone'));
         system('cp', '-f',  $dscdir . $shallow, "$newdirectory/.git/shallow");
         subprocerr('cp') if $?;
     }

+ 9 - 9
scripts/Dpkg/Source/Package/V3/Native.pm

@@ -50,17 +50,17 @@ sub do_extract {
     my $comp_ext_regex = compression_get_file_extension_regex();
     foreach my $file ($self->get_files()) {
 	if ($file =~ /^\Q$basenamerev\E\.tar\.$comp_ext_regex$/) {
-            error(_g('multiple tarfiles in v1.0 source package')) if $tarfile;
+            error(g_('multiple tarfiles in v1.0 source package')) if $tarfile;
             $tarfile = $file;
 	} else {
-	    error(_g('unrecognized file for a native source package: %s'), $file);
+	    error(g_('unrecognized file for a native source package: %s'), $file);
 	}
     }
 
-    error(_g('no tarfile in Files field')) unless $tarfile;
+    error(g_('no tarfile in Files field')) unless $tarfile;
 
     erasedir($newdirectory);
-    info(_g('unpacking %s'), $tarfile);
+    info(g_('unpacking %s'), $tarfile);
     my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
     $tar->extract($newdirectory);
 }
@@ -69,7 +69,7 @@ sub can_build {
     my ($self, $dir) = @_;
 
     my $v = Dpkg::Version->new($self->{fields}->{'Version'});
-    return (0, _g('native package version may not have a revision'))
+    return (0, g_('native package version may not have a revision'))
         unless $v->is_native();
 
     return 1;
@@ -81,7 +81,7 @@ sub do_build {
     my @argv = @{$self->{options}{ARGV}};
 
     if (scalar(@argv)) {
-        usageerr(_g("-b takes only one parameter with format `%s'"),
+        usageerr(g_("-b takes only one parameter with format `%s'"),
                  $self->{fields}{'Format'});
     }
 
@@ -89,7 +89,7 @@ sub do_build {
     my $basenamerev = $self->get_basename(1);
     my $tarname = "$basenamerev.tar." . $self->{options}{comp_ext};
 
-    info(_g('building %s in %s'), $sourcepackage, $tarname);
+    info(g_('building %s in %s'), $sourcepackage, $tarname);
 
     my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX",
                                    DIR => getcwd(), UNLINK => 0);
@@ -103,11 +103,11 @@ sub do_build {
     $tar->add_directory($dirname);
     $tar->finish();
     rename($newtar, $tarname)
-        or syserr(_g("unable to rename `%s' (newly created) to `%s'"),
+        or syserr(g_("unable to rename `%s' (newly created) to `%s'"),
                   $newtar, $tarname);
     pop_exit_handler();
     chmod(0666 &~ umask(), $tarname)
-        or syserr(_g("unable to change permission of `%s'"), $tarname);
+        or syserr(g_("unable to change permission of `%s'"), $tarname);
 
     $self->add_file($tarname);
 }

+ 8 - 8
scripts/Dpkg/Source/Package/V3/Quilt.pm

@@ -74,7 +74,7 @@ sub can_build {
     return ($code, $msg) if $code == 0;
 
     my $v = Dpkg::Version->new($self->{fields}->{'Version'});
-    return (0, _g('non-native package version does not contain a revision'))
+    return (0, g_('non-native package version does not contain a revision'))
         if $v->is_native();
 
     my $quilt = $self->build_quilt_object($dir);
@@ -117,7 +117,7 @@ sub apply_patches {
         unlink($dest) if -l $dest;
         unless (-f _) { # Don't overwrite real files
             symlink($basename, $dest)
-                or syserr(_g("can't create symlink %s"), $dest);
+                or syserr(g_("can't create symlink %s"), $dest);
         }
     }
 
@@ -129,7 +129,7 @@ sub apply_patches {
         # them afterwards in --after-build
         my $pc_unapply = $quilt->get_db_file('.dpkg-source-unapply');
         open(my $unapply_fh, '>', $pc_unapply)
-            or syserr(_g('cannot write %s'), $pc_unapply);
+            or syserr(g_('cannot write %s'), $pc_unapply);
         close($unapply_fh);
     }
 
@@ -187,9 +187,9 @@ sub do_build {
         if (any { $version eq $_ }
             @{$self->{options}{allow_version_of_quilt_db}})
         {
-            warning(_g('unsupported version of the quilt metadata: %s'), $version);
+            warning(g_('unsupported version of the quilt metadata: %s'), $version);
         } else {
-            error(_g('unsupported version of the quilt metadata: %s'), $version);
+            error(g_('unsupported version of the quilt metadata: %s'), $version);
         }
     }
 
@@ -229,11 +229,11 @@ sub register_patch {
 
     if (-s $tmpdiff) {
         copy($tmpdiff, $patch)
-            or syserr(_g('failed to copy %s to %s'), $tmpdiff, $patch);
+            or syserr(g_('failed to copy %s to %s'), $tmpdiff, $patch);
         chmod(0666 & ~ umask(), $patch)
-            or syserr(_g("unable to change permission of `%s'"), $patch);
+            or syserr(g_("unable to change permission of `%s'"), $patch);
     } elsif (-e $patch) {
-        unlink($patch) or syserr(_g('cannot remove %s'), $patch);
+        unlink($patch) or syserr(g_('cannot remove %s'), $patch);
     }
 
     if (-e $patch) {

+ 55 - 55
scripts/Dpkg/Source/Patch.pm

@@ -68,7 +68,7 @@ sub add_diff_file {
     my $handle_binary = $opts{handle_binary_func} // sub {
         my ($self, $old, $new, %opts) = @_;
         my $file = $opts{filename};
-        $self->_fail_with_msg($file, _g('binary file contents changed'));
+        $self->_fail_with_msg($file, g_('binary file contents changed'));
     };
     # Optimization to avoid forking diff if unnecessary
     return 1 if compare($old, $new, 4096) == 0;
@@ -118,17 +118,17 @@ sub add_diff_file {
         } elsif (m/^[-+\@ ]/) {
             $difflinefound++;
         } elsif (m/^\\ /) {
-            warning(_g('file %s has no final newline (either ' .
+            warning(g_('file %s has no final newline (either ' .
                        'original or modified version)'), $new);
         } else {
             chomp;
-            error(_g("unknown line from diff -u on %s: `%s'"), $new, $_);
+            error(g_("unknown line from diff -u on %s: `%s'"), $new, $_);
         }
 	if (*$self->{empty} and defined(*$self->{header})) {
-	    $self->print(*$self->{header}) or syserr(_g('failed to write'));
+	    $self->print(*$self->{header}) or syserr(g_('failed to write'));
 	    *$self->{empty} = 0;
 	}
-        print { $self } $_ or syserr(_g('failed to write'));
+        print { $self } $_ or syserr(g_('failed to write'));
     }
     close($diffgen) or syserr('close on diff pipe');
     wait_child($diff_pid, nocheck => 1,
@@ -138,7 +138,7 @@ sub add_diff_file {
     # Ignore error if binary content detected
     my $exit = WEXITSTATUS($?);
     unless (WIFEXITED($?) && ($exit == 0 || $exit == 1 || $binary)) {
-        subprocerr(_g('diff on %s'), $new);
+        subprocerr(g_('diff on %s'), $new);
     }
     return ($exit == 0 || $exit == 1);
 }
@@ -164,7 +164,7 @@ sub add_diff_directory {
         my $fn = (length > length($new)) ? substr($_, length($new) + 1) : '.';
         return if &$diff_ignore($fn);
         $files_in_new{$fn} = 1;
-        lstat("$new/$fn") or syserr(_g('cannot stat file %s'), "$new/$fn");
+        lstat("$new/$fn") or syserr(g_('cannot stat file %s'), "$new/$fn");
         my $mode = S_IMODE((lstat(_))[2]);
         my $size = (lstat(_))[7];
         if (-l _) {
@@ -174,11 +174,11 @@ sub add_diff_directory {
             }
             my $n = readlink("$new/$fn");
             unless (defined $n) {
-                syserr(_g('cannot read link %s'), "$new/$fn");
+                syserr(g_('cannot read link %s'), "$new/$fn");
             }
             my $n2 = readlink("$old/$fn");
             unless (defined $n2) {
-                syserr(_g('cannot read link %s'), "$old/$fn");
+                syserr(g_('cannot read link %s'), "$old/$fn");
             }
             unless ($n eq $n2) {
                 $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
@@ -187,7 +187,7 @@ sub add_diff_directory {
             my $old_file = "$old/$fn";
             if (not lstat("$old/$fn")) {
                 if ($! != ENOENT) {
-                    syserr(_g('cannot stat file %s'), "$old/$fn");
+                    syserr(g_('cannot stat file %s'), "$old/$fn");
                 }
                 $old_file = '/dev/null';
             } elsif (not -f _) {
@@ -207,35 +207,35 @@ sub add_diff_directory {
             }
         } elsif (-b _ || -c _ || -S _) {
             $self->_fail_with_msg("$new/$fn",
-                _g('device or socket is not allowed'));
+                g_('device or socket is not allowed'));
         } elsif (-d _) {
             if (not lstat("$old/$fn")) {
                 if ($! != ENOENT) {
-                    syserr(_g('cannot stat file %s'), "$old/$fn");
+                    syserr(g_('cannot stat file %s'), "$old/$fn");
                 }
             } elsif (not -d _) {
                 $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
             }
         } else {
-            $self->_fail_with_msg("$new/$fn", _g('unknown file type'));
+            $self->_fail_with_msg("$new/$fn", g_('unknown file type'));
         }
     };
     my $scan_old = sub {
         my $fn = (length > length($old)) ? substr($_, length($old) + 1) : '.';
         return if &$diff_ignore($fn);
         return if $files_in_new{$fn};
-        lstat("$old/$fn") or syserr(_g('cannot stat file %s'), "$old/$fn");
+        lstat("$old/$fn") or syserr(g_('cannot stat file %s'), "$old/$fn");
         if (-f _) {
             if ($inc_removal) {
                 push @diff_files, [$fn, 0, 0, "$old/$fn", '/dev/null',
                                    "$basedir.orig/$fn", '/dev/null'];
             } else {
-                warning(_g('ignoring deletion of file %s, use --include-removal to override'), $fn);
+                warning(g_('ignoring deletion of file %s, use --include-removal to override'), $fn);
             }
         } elsif (-d _) {
-            warning(_g('ignoring deletion of directory %s'), $fn);
+            warning(g_('ignoring deletion of directory %s'), $fn);
         } elsif (-l _) {
-            warning(_g('ignoring deletion of symlink %s'), $fn);
+            warning(g_('ignoring deletion of symlink %s'), $fn);
         } else {
             $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
         }
@@ -280,16 +280,16 @@ sub add_diff_directory {
         if ($success and
             $old_file eq '/dev/null' and $new_file ne '/dev/null') {
             if (not $size) {
-                warning(_g("newly created empty file '%s' will not " .
+                warning(g_("newly created empty file '%s' will not " .
                            'be represented in diff'), $fn);
             } else {
                 if ($mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
-                    warning(_g("executable mode %04o of '%s' will " .
+                    warning(g_("executable mode %04o of '%s' will " .
                                'not be represented in diff'), $mode, $fn)
                         unless $fn eq 'debian/rules';
                 }
                 if ($mode & (S_ISUID | S_ISGID | S_ISVTX)) {
-                    warning(_g("special mode %04o of '%s' will not " .
+                    warning(g_("special mode %04o of '%s' will not " .
                                'be represented in diff'), $mode, $fn);
                 }
             }
@@ -299,7 +299,7 @@ sub add_diff_directory {
 
 sub finish {
     my ($self) = @_;
-    close($self) or syserr(_g('cannot close %s'), $self->get_filename());
+    close($self) or syserr(g_('cannot close %s'), $self->get_filename());
     return not *$self->{errors};
 }
 
@@ -309,16 +309,16 @@ sub register_error {
 }
 sub _fail_with_msg {
     my ($self, $file, $msg) = @_;
-    errormsg(_g('cannot represent change to %s: %s'), $file, $msg);
+    errormsg(g_('cannot represent change to %s: %s'), $file, $msg);
     $self->register_error();
 }
 sub _fail_not_same_type {
     my ($self, $old, $new, $file) = @_;
     my $old_type = get_type($old);
     my $new_type = get_type($new);
-    errormsg(_g('cannot represent change to %s:'), $file);
-    errormsg(_g('  new version is %s'), $new_type);
-    errormsg(_g('  old version is %s'), $old_type);
+    errormsg(g_('cannot represent change to %s:'), $file);
+    errormsg(g_('  new version is %s'), $new_type);
+    errormsg(g_('  old version is %s'), $old_type);
     $self->register_error();
 }
 
@@ -343,7 +343,7 @@ sub _fetch_filename {
 
     # Is it a C-style string?
     if ($header =~ m/^"/) {
-        error(_g('diff %s patches file with C-style encoded filename'), $diff);
+        error(g_('diff %s patches file with C-style encoded filename'), $diff);
     } else {
         # Tab is the official separator, it's always used when
         # filename contain spaces. Try it first, otherwise strip on space
@@ -421,22 +421,22 @@ sub analyze {
 	$diff_count++;
 	# read file header (---/+++ pair)
 	unless ($line =~ s/^--- //) {
-	    error(_g("expected ^--- in line %d of diff `%s'"), $., $diff);
+	    error(g_("expected ^--- in line %d of diff `%s'"), $., $diff);
 	}
 	$path{old} = $line = _fetch_filename($diff, $line);
 	if ($line ne '/dev/null' and $line =~ s{^[^/]*/+}{$destdir/}) {
 	    $fn{old} = $line;
 	}
 	if ($line =~ /\.dpkg-orig$/) {
-	    error(_g("diff `%s' patches file with name ending .dpkg-orig"), $diff);
+	    error(g_("diff `%s' patches file with name ending .dpkg-orig"), $diff);
 	}
 
 	$line = _getline($self);
 	unless (defined $line) {
-	    error(_g("diff `%s' finishes in middle of ---/+++ (line %d)"), $diff, $.);
+	    error(g_("diff `%s' finishes in middle of ---/+++ (line %d)"), $diff, $.);
 	}
 	unless ($line =~ s/^\+\+\+ //) {
-	    error(_g("line after --- isn't as expected in diff `%s' (line %d)"), $diff, $.);
+	    error(g_("line after --- isn't as expected in diff `%s' (line %d)"), $diff, $.);
 	}
 	$path{new} = $line = _fetch_filename($diff, $line);
 	if ($line ne '/dev/null' and $line =~ s{^[^/]*/+}{$destdir/}) {
@@ -444,7 +444,7 @@ sub analyze {
 	}
 
 	unless (defined $fn{old} or defined $fn{new}) {
-	    error(_g("none of the filenames in ---/+++ are valid in diff '%s' (line %d)"),
+	    error(g_("none of the filenames in ---/+++ are valid in diff '%s' (line %d)"),
 		  $diff, $.);
 	}
 
@@ -452,12 +452,12 @@ sub analyze {
 	foreach my $key ('old', 'new') {
 	    next unless defined $fn{$key};
 	    if ($path{$key} =~ m{/\.\./}) {
-		error(_g('%s contains an insecure path: %s'), $diff, $path{$key});
+		error(g_('%s contains an insecure path: %s'), $diff, $path{$key});
 	    }
 	    my $path = $fn{$key};
 	    while (1) {
 		if (-l $path) {
-		    error(_g('diff %s modifies file %s through a symlink: %s'),
+		    error(g_('diff %s modifies file %s through a symlink: %s'),
 			  $diff, $fn{$key}, $path);
 		}
 		last unless $path =~ s{/+[^/]*$}{};
@@ -466,13 +466,13 @@ sub analyze {
 	}
 
         if ($path{old} eq '/dev/null' and $path{new} eq '/dev/null') {
-            error(_g("original and modified files are /dev/null in diff `%s' (line %d)"),
+            error(g_("original and modified files are /dev/null in diff `%s' (line %d)"),
                   $diff, $.);
         } elsif ($path{new} eq '/dev/null') {
-            error(_g("file removal without proper filename in diff `%s' (line %d)"),
+            error(g_("file removal without proper filename in diff `%s' (line %d)"),
                   $diff, $. - 1) unless defined $fn{old};
             if ($opts{verbose}) {
-                warning(_g('diff %s removes a non-existing file %s (line %d)'),
+                warning(g_('diff %s removes a non-existing file %s (line %d)'),
                         $diff, $fn{old}, $.) unless -e $fn{old};
             }
         }
@@ -484,11 +484,11 @@ sub analyze {
 	}
 
 	if (-e $fn and not -f _) {
-	    error(_g("diff `%s' patches something which is not a plain file"), $diff);
+	    error(g_("diff `%s' patches something which is not a plain file"), $diff);
 	}
 
 	if ($filepatched{$fn}) {
-	    warning(_g("diff `%s' patches file %s twice"), $diff, $fn)
+	    warning(g_("diff `%s' patches file %s twice"), $diff, $fn)
 		if $opts{verbose};
 	} else {
 	    $filepatched{$fn} = 1;
@@ -506,11 +506,11 @@ sub analyze {
 	    while ($olines || $nlines) {
 		unless (defined($line = _getline($self))) {
                     if (($olines == $nlines) and ($olines < 3)) {
-                        warning(_g("unexpected end of diff `%s'"), $diff)
+                        warning(g_("unexpected end of diff `%s'"), $diff)
                             if $opts{verbose};
                         last;
                     } else {
-                        error(_g("unexpected end of diff `%s'"), $diff);
+                        error(g_("unexpected end of diff `%s'"), $diff);
                     }
 		}
 		next if $line =~ /^\\ /;
@@ -523,19 +523,19 @@ sub analyze {
 		} elsif ($line =~ /^\+/) {
 		    --$nlines;
 		} else {
-		    error(_g("expected [ +-] at start of line %d of diff `%s'"),
+		    error(g_("expected [ +-] at start of line %d of diff `%s'"),
 		          $., $diff);
 		}
 	    }
 	    $hunk++;
 	}
 	unless ($hunk) {
-	    error(_g("expected ^\@\@ at line %d of diff `%s'"), $., $diff);
+	    error(g_("expected ^\@\@ at line %d of diff `%s'"), $., $diff);
 	}
     }
     close($self);
     unless ($diff_count) {
-	warning(_g("diff `%s' doesn't contain any patch"), $diff)
+	warning(g_("diff `%s' doesn't contain any patch"), $diff)
 	    if $opts{verbose};
     }
     *$self->{analysis}{$destdir}{dirtocreate} = \%dirtocreate;
@@ -550,7 +550,7 @@ sub prepare_apply {
     if ($opts{create_dirs}) {
 	foreach my $dir (keys %{$analysis->{dirtocreate}}) {
 	    eval { mkpath($dir, 0, 0777); };
-	    syserr(_g('cannot create directory %s'), $dir) if $@;
+	    syserr(g_('cannot create directory %s'), $dir) if $@;
 	}
     }
 }
@@ -597,11 +597,11 @@ sub apply {
     foreach my $fn (@files) {
 	if ($opts{force_timestamp}) {
 	    utime($now, $now, $fn) or $! == ENOENT
-		or syserr(_g('cannot change timestamp for %s'), $fn);
+		or syserr(g_('cannot change timestamp for %s'), $fn);
 	}
 	if ($opts{remove_backup}) {
 	    $fn .= '.dpkg-orig';
-	    unlink($fn) or syserr(_g('remove patch backup file %s'), $fn);
+	    unlink($fn) or syserr(g_('remove patch backup file %s'), $fn);
 	}
     }
     return $analysis;
@@ -641,16 +641,16 @@ sub check_apply {
 sub get_type {
     my $file = shift;
     if (not lstat($file)) {
-        return _g('nonexistent') if $! == ENOENT;
-        syserr(_g('cannot stat %s'), $file);
+        return g_('nonexistent') if $! == ENOENT;
+        syserr(g_('cannot stat %s'), $file);
     } else {
-        -f _ && return _g('plain file');
-        -d _ && return _g('directory');
-        -l _ && return sprintf(_g('symlink to %s'), readlink($file));
-        -b _ && return _g('block device');
-        -c _ && return _g('character device');
-        -p _ && return _g('named pipe');
-        -S _ && return _g('named socket');
+        -f _ && return g_('plain file');
+        -d _ && return g_('directory');
+        -l _ && return sprintf(g_('symlink to %s'), readlink($file));
+        -b _ && return g_('block device');
+        -c _ && return g_('character device');
+        -p _ && return g_('named pipe');
+        -S _ && return g_('named socket');
     }
 }
 

+ 21 - 21
scripts/Dpkg/Source/Quilt.pm

@@ -52,11 +52,11 @@ sub setup_db {
     my ($self) = @_;
     my $db_dir = $self->get_db_file();
     if (not -d $db_dir) {
-        mkdir $db_dir or syserr(_g('cannot mkdir %s'), $db_dir);
+        mkdir $db_dir or syserr(g_('cannot mkdir %s'), $db_dir);
     }
     my $file = $self->get_db_file('.version');
     if (not -e $file) {
-        open(my $version_fh, '>', $file) or syserr(_g('cannot write %s'), $file);
+        open(my $version_fh, '>', $file) or syserr(g_('cannot write %s'), $file);
         print { $version_fh } "2\n";
         close($version_fh);
     }
@@ -65,13 +65,13 @@ sub setup_db {
     # in Debian).
     $file = $self->get_db_file('.quilt_patches');
     if (not -e $file) {
-        open(my $qpatch_fh, '>', $file) or syserr(_g('cannot write %s'), $file);
+        open(my $qpatch_fh, '>', $file) or syserr(g_('cannot write %s'), $file);
         print { $qpatch_fh } "debian/patches\n";
         close($qpatch_fh);
     }
     $file = $self->get_db_file('.quilt_series');
     if (not -e $file) {
-        open(my $qseries_fh, '>', $file) or syserr(_g('cannot write %s'), $file);
+        open(my $qseries_fh, '>', $file) or syserr(g_('cannot write %s'), $file);
         my $series = $self->get_series_file();
         $series = (File::Spec->splitpath($series))[2];
         print { $qseries_fh } "$series\n";
@@ -173,7 +173,7 @@ sub push {
     my $path = $self->get_patch_file($patch);
     my $obj = Dpkg::Source::Patch->new(filename => $path);
 
-    info(_g('applying %s'), $patch) if $opts{verbose};
+    info(g_('applying %s'), $patch) if $opts{verbose};
     eval {
         $obj->apply($self->{dir}, timestamp => $opts{timestamp},
                     verbose => $opts{verbose},
@@ -183,8 +183,8 @@ sub push {
                                  '-B', ".pc/$patch/", '--reject-file=-' ]);
     };
     if ($@) {
-        info(_g('the patch has fuzz which is not allowed, or is malformed'));
-        info(_g("if patch '%s' is correctly applied by quilt, use '%s' to update it"),
+        info(g_('the patch has fuzz which is not allowed, or is malformed'));
+        info(g_("if patch '%s' is correctly applied by quilt, use '%s' to update it"),
              $patch, 'quilt refresh');
         $self->restore_quilt_backup_files($patch, %opts);
         erasedir($self->get_db_file($patch));
@@ -203,7 +203,7 @@ sub pop {
     my $patch = $self->top();
     return unless defined $patch;
 
-    info(_g('unapplying %s'), $patch) if $opts{verbose};
+    info(g_('unapplying %s'), $patch) if $opts{verbose};
     my $backup_dir = $self->get_db_file($patch);
     if (-d $backup_dir and not $opts{reverse_apply}) {
         # Use the backup copies to restore
@@ -229,7 +229,7 @@ sub get_db_version {
     my ($self) = @_;
     my $pc_ver = $self->get_db_file('.version');
     if (-f $pc_ver) {
-        open(my $ver_fh, '<', $pc_ver) or syserr(_g('cannot read %s'), $pc_ver);
+        open(my $ver_fh, '<', $pc_ver) or syserr(g_('cannot read %s'), $pc_ver);
         my $version = <$ver_fh>;
         chomp $version;
         close($ver_fh);
@@ -242,11 +242,11 @@ sub find_problems {
     my ($self) = @_;
     my $patch_dir = $self->get_patch_file();
     if (-e $patch_dir and not -d _) {
-        return sprintf(_g('%s should be a directory or non-existing'), $patch_dir);
+        return sprintf(g_('%s should be a directory or non-existing'), $patch_dir);
     }
     my $series = $self->get_series_file();
     if (-e $series and not -f _) {
-        return sprintf(_g('%s should be a file or non-existing'), $series);
+        return sprintf(g_('%s should be a file or non-existing'), $series);
     }
     return;
 }
@@ -286,7 +286,7 @@ sub get_patch_dir {
 sub _file_load {
     my ($self, $file) = @_;
 
-    open my $file_fh, '<', $file or syserr(_g('cannot read %s'), $file);
+    open my $file_fh, '<', $file or syserr(g_('cannot read %s'), $file);
     my @lines = <$file_fh>;
     close $file_fh;
 
@@ -301,7 +301,7 @@ sub _file_add_line {
     CORE::push @lines, $line;
     chomp @lines;
 
-    open my $file_fh, '>', $file or syserr(_g('cannot write %s'), $file);
+    open my $file_fh, '>', $file or syserr(g_('cannot write %s'), $file);
     print { $file_fh } "$_\n" foreach @lines;
     close $file_fh;
 }
@@ -310,7 +310,7 @@ sub _file_drop_line {
     my ($self, $file, $re) = @_;
 
     my @lines = $self->_file_load($file);
-    open my $file_fh, '>', $file or syserr(_g('cannot write %s'), $file);
+    open my $file_fh, '>', $file or syserr(g_('cannot write %s'), $file);
     print { $file_fh } $_ foreach grep { not /^\Q$re\E\s*$/ } @lines;
     close $file_fh;
 }
@@ -320,7 +320,7 @@ sub read_patch_list {
     return () if not defined $file or not -f $file;
     $opts{warn_options} //= 0;
     my @patches;
-    open(my $series_fh, '<' , $file) or syserr(_g('cannot read %s'), $file);
+    open(my $series_fh, '<' , $file) or syserr(g_('cannot read %s'), $file);
     while (defined(my $line = <$series_fh>)) {
         chomp $line;
         # Strip leading/trailing spaces
@@ -332,14 +332,14 @@ sub read_patch_list {
         if ($line =~ /^(\S+)\s+(.*)$/) {
             $line = $1;
             if ($2 ne '-p1') {
-                warning(_g('the series file (%s) contains unsupported ' .
+                warning(g_('the series file (%s) contains unsupported ' .
                            "options ('%s', line %s); dpkg-source might " .
                            'fail when applying patches'),
                         $file, $2, $.) if $opts{warn_options};
             }
         }
         if ($line =~ m{(^|/)\.\./}) {
-            error(_g('%s contains an insecure path: %s'), $file, $line);
+            error(g_('%s contains an insecure path: %s'), $file, $line);
         }
         CORE::push @patches, $line;
     }
@@ -350,7 +350,7 @@ sub read_patch_list {
 sub write_patch_list {
     my ($self, $series, $patches) = @_;
 
-    open my $series_fh, '>', $series or syserr(_g('cannot write %s'), $series);
+    open my $series_fh, '>', $series or syserr(g_('cannot write %s'), $series);
     foreach my $patch (@{$patches}) {
         print { $series_fh } "$patch\n";
     }
@@ -361,7 +361,7 @@ sub restore_quilt_backup_files {
     my ($self, $patch, %opts) = @_;
     my $patch_dir = $self->get_db_file($patch);
     return unless -d $patch_dir;
-    info(_g('restoring quilt backup files for %s'), $patch) if $opts{verbose};
+    info(g_('restoring quilt backup files for %s'), $patch) if $opts{verbose};
     find({
         no_chdir => 1,
         wanted => sub {
@@ -373,9 +373,9 @@ sub restore_quilt_backup_files {
                 make_path(dirname($target));
                 unless (link($_, $target)) {
                     copy($_, $target)
-                        or syserr(_g('failed to copy %s to %s'), $_, $target);
+                        or syserr(g_('failed to copy %s to %s'), $_, $target);
                     chmod((stat(_))[2], $target)
-                        or syserr(_g("unable to change permission of `%s'"), $target);
+                        or syserr(g_("unable to change permission of `%s'"), $target);
                 }
             } else {
                 # empty files are "backups" for new files that patch created

+ 5 - 5
scripts/Dpkg/Substvars.pm

@@ -203,7 +203,7 @@ sub parse {
 	next if m/^\s*\#/ || !m/\S/;
 	s/\s*\n$//;
 	if (! m/^(\w[-:0-9A-Za-z]*)\=(.*)$/) {
-	    error(_g('bad line in substvars file %s at line %d'),
+	    error(g_('bad line in substvars file %s at line %d'),
 		  $varlistfile, $.);
 	}
 	$self->set($1, $2);
@@ -280,7 +280,7 @@ sub substvars {
 
         if ($count >= $maxsubsts) {
             error($opts{msg_prefix} .
-	          _g("too many substitutions - recursive ? - in \`%s'"), $v);
+	          g_("too many substitutions - recursive ? - in \`%s'"), $v);
         }
         $lhs = $1; $vn = $2; $rhs = $3;
         if (defined($self->{vars}{$vn})) {
@@ -290,10 +290,10 @@ sub substvars {
 
             if (not $opts{no_warn} and $self->{attr}{$vn} & SUBSTVAR_ATTR_OLD) {
                 warning($opts{msg_prefix} .
-                        _g('deprecated substitution variable ${%s}'), $vn);
+                        g_('deprecated substitution variable ${%s}'), $vn);
             }
         } else {
-            warning($opts{msg_prefix} . _g('unknown substitution variable ${%s}'),
+            warning($opts{msg_prefix} . g_('unknown substitution variable ${%s}'),
 	            $vn) unless $opts{no_warn};
             $v = $lhs . $rhs;
         }
@@ -317,7 +317,7 @@ sub warn_about_unused {
         # that they are not required in the current situation
         # (example: debhelper's misc:Depends in many cases)
         next if $self->{vars}{$vn} eq '';
-        warning($opts{msg_prefix} . _g('unused substitution variable ${%s}'),
+        warning($opts{msg_prefix} . g_('unused substitution variable ${%s}'),
                 $vn);
     }
 }

+ 2 - 2
scripts/Dpkg/Vars.pm

@@ -37,12 +37,12 @@ sub get_source_package {
 sub set_source_package {
     my $v = shift;
     my $err = pkg_name_is_illegal($v);
-    error(_g("source package name '%s' is illegal: %s"), $v, $err) if $err;
+    error(g_("source package name '%s' is illegal: %s"), $v, $err) if $err;
 
     if (not defined($sourcepackage)) {
         $sourcepackage = $v;
     } elsif ($v ne $sourcepackage) {
-        error(_g('source package has two conflicting values - %s and %s'),
+        error(g_('source package has two conflicting values - %s and %s'),
               $sourcepackage, $v);
     }
 }

+ 1 - 1
scripts/Dpkg/Vendor.pm

@@ -89,7 +89,7 @@ sub get_vendor_info(;$) {
     my $file = get_vendor_file($vendor);
     return unless $file;
     my $fields = Dpkg::Control::HashCore->new();
-    $fields->load($file) or error(_g('%s is empty'), $file);
+    $fields->load($file) or error(g_('%s is empty'), $file);
     $VENDOR_CACHE{$vendor} = $fields;
     return $fields;
 }

+ 3 - 3
scripts/Dpkg/Vendor/Debian.pm

@@ -90,12 +90,12 @@ sub _parse_build_options {
 		if (exists $use_feature->{$feature}) {
 		    $use_feature->{$feature} = $value;
 		} else {
-		    warning(_g('unknown %s feature in %s variable: %s'),
+		    warning(g_('unknown %s feature in %s variable: %s'),
 		            $area, $variable, $feature);
 		}
 	    }
 	} else {
-	    warning(_g('incorrect value in %s option of %s variable: %s'),
+	    warning(g_('incorrect value in %s option of %s variable: %s'),
 	            $area, $variable, $feature);
 	}
     }
@@ -174,7 +174,7 @@ sub _add_hardening_flags {
     my ($abi, $os, $cpu) = debarch_to_debtriplet($arch);
 
     unless (defined $abi and defined $os and defined $cpu) {
-        warning(_g("unknown host architecture '%s'"), $arch);
+        warning(g_("unknown host architecture '%s'"), $arch);
         ($abi, $os, $cpu) = ('', '', '');
     }
 

+ 5 - 5
scripts/Dpkg/Vendor/Ubuntu.pm

@@ -59,13 +59,13 @@ sub run_hook {
            $fields->{'Version'} =~ /ubuntu/) {
            if ($fields->{'Maintainer'} !~ /ubuntu/i) {
                if (length $ENV{DEBEMAIL} and $ENV{DEBEMAIL} =~ /\@ubuntu\.com/) {
-                   error(_g('Version number suggests Ubuntu changes, but Maintainer: does not have Ubuntu address'));
+                   error(g_('Version number suggests Ubuntu changes, but Maintainer: does not have Ubuntu address'));
                } else {
-                   warning(_g('Version number suggests Ubuntu changes, but Maintainer: does not have Ubuntu address'));
+                   warning(g_('Version number suggests Ubuntu changes, but Maintainer: does not have Ubuntu address'));
                }
            }
            unless ($fields->{'Original-Maintainer'}) {
-               warning(_g('Version number suggests Ubuntu changes, but there is no XSBC-Original-Maintainer field'));
+               warning(g_('Version number suggests Ubuntu changes, but there is no XSBC-Original-Maintainer field'));
            }
         }
 
@@ -123,7 +123,7 @@ sub run_hook {
 	    my $flag = 'DEB_BUILD_HARDENING';
 	    if ($hardening ne '0') {
 		if (!find_command('hardened-cc')) {
-		    syserr(_g("'hardening' flag found but 'hardening-wrapper' not installed"));
+		    syserr(g_("'hardening' flag found but 'hardening-wrapper' not installed"));
 		}
 		if ($hardening ne '1') {
 		    my @options = split(/,\s*/, $hardening);
@@ -142,7 +142,7 @@ sub run_hook {
 		}
 	    }
 	    if (defined $ENV{$flag}) {
-		info(_g('overriding %s in environment: %s'), $flag, $hardening);
+		info(g_('overriding %s in environment: %s'), $flag, $hardening);
 	    }
 	    $flags->set($flag, $hardening, 'env');
 	}

+ 6 - 6
scripts/Dpkg/Version.pm

@@ -232,9 +232,9 @@ If $a or $b are not valid version numbers, it dies with an error.
 sub version_compare($$) {
     my ($a, $b) = @_;
     my $va = Dpkg::Version->new($a, check => 1);
-    defined($va) || error(_g('%s is not a valid version'), "$a");
+    defined($va) || error(g_('%s is not a valid version'), "$a");
     my $vb = Dpkg::Version->new($b, check => 1);
-    defined($vb) || error(_g('%s is not a valid version'), "$b");
+    defined($vb) || error(g_('%s is not a valid version'), "$b");
     return $va <=> $vb;
 }
 
@@ -402,22 +402,22 @@ sub version_check($) {
         $version = Dpkg::Version->new($str) unless ref($version);
     }
     if (not defined($str) or not length($str)) {
-        my $msg = _g('version number cannot be empty');
+        my $msg = g_('version number cannot be empty');
         return (0, $msg) if wantarray;
         return 0;
     }
     if ($version->version() =~ m/^[^\d]/) {
-        my $msg = _g('version number does not start with digit');
+        my $msg = g_('version number does not start with digit');
         return (0, $msg) if wantarray;
         return 0;
     }
     if ($str =~ m/([^-+:.0-9a-zA-Z~])/o) {
-        my $msg = sprintf(_g("version number contains illegal character `%s'"), $1);
+        my $msg = sprintf(g_("version number contains illegal character `%s'"), $1);
         return (0, $msg) if wantarray;
         return 0;
     }
     if ($version->epoch() !~ /^\d*$/) {
-        my $msg = sprintf(_g('epoch part of the version number ' .
+        my $msg = sprintf(g_('epoch part of the version number ' .
                              "is not a number: '%s'"), $version->epoch());
         return (0, $msg) if wantarray;
         return 0;

+ 6 - 6
scripts/changelog/debian.pl

@@ -34,16 +34,16 @@ textdomain('dpkg-dev');
 $Dpkg::PROGNAME = "parsechangelog/$Dpkg::PROGNAME";
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 "Usage: %s [<option>...] [<changelogfile>]
 
 Options:
@@ -83,7 +83,7 @@ sub set_format {
     my ($opt, $val) = @_;
 
     unless ($allowed_formats{$val}) {
-	usageerr(_g('output format %s not supported'), $val );
+	usageerr(g_('output format %s not supported'), $val );
     }
 
     $format = $val;
@@ -113,7 +113,7 @@ usageerr('too many arguments') if @ARGV > 1;
 
 if (@ARGV) {
     if ($file && ($file ne $ARGV[0])) {
-	usageerr(_g('more than one file specified (%s and %s)'),
+	usageerr(g_('more than one file specified (%s and %s)'),
 		 $file, $ARGV[0] );
     }
     $file = $ARGV[0];
@@ -137,7 +137,7 @@ my $range = {
 my $changes = Dpkg::Changelog::Debian->new(reportfile => $label, range => $range);
 
 $changes->load($file)
-    or error(_g('fatal error occurred while parsing %s'), $file);
+    or error(g_('fatal error occurred while parsing %s'), $file);
 
 eval qq{
     my \$output = \$changes->$format(\$range);

+ 12 - 12
scripts/dpkg-architecture.pl

@@ -35,18 +35,18 @@ use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
 textdomain('dpkg-dev');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] [<command>]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
   -l, --list                list variables (default).
   -L, --list-known          list valid architectures (matching some criteria).
@@ -58,7 +58,7 @@ sub usage {
   -c, --command <command>   set environment and run the command in it.
   -?, --help                show this help message.
       --version             show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   -a, --host-arch <arch>    set host Debian architecture.
   -t, --host-type <type>    set host GNU system type.
@@ -80,24 +80,24 @@ sub check_arch_coherency
 
     if ($arch ne '' && $gnu_type eq '') {
         $gnu_type = debarch_to_gnutriplet($arch);
-        error(_g('unknown Debian architecture %s, you must specify ' .
+        error(g_('unknown Debian architecture %s, you must specify ' .
                  'GNU system type, too'), $arch)
             unless defined $gnu_type;
     }
 
     if ($gnu_type ne '' && $arch eq '') {
         $arch = gnutriplet_to_debarch($gnu_type);
-        error(_g('unknown GNU system type %s, you must specify ' .
+        error(g_('unknown GNU system type %s, you must specify ' .
                  'Debian architecture, too'), $gnu_type)
             unless defined $arch;
     }
 
     if ($gnu_type ne '' && $arch ne '') {
         my $dfl_gnu_type = debarch_to_gnutriplet($arch);
-        error(_g('unknown default GNU system type for Debian architecture %s'),
+        error(g_('unknown default GNU system type for Debian architecture %s'),
               $arch)
             unless defined $dfl_gnu_type;
-        warning(_g('default GNU system type %s for Debian arch %s does not ' .
+        warning(g_('default GNU system type %s for Debian arch %s does not ' .
                    'match specified GNU system type %s'), $dfl_gnu_type,
                 $arch, $gnu_type)
             if $dfl_gnu_type ne $gnu_type;
@@ -208,7 +208,7 @@ while (@ARGV) {
         $force=1;
     } elsif ($arg eq '-q' or $arg eq '--query') {
 	my $varname = shift;
-	error(_g('%s is not a supported variable name'), $varname)
+	error(g_('%s is not a supported variable name'), $varname)
 	    unless (exists $arch_vars{$varname});
 	$req_variable_to_print = "$varname";
 	$req_vars = $arch_vars{$varname};
@@ -226,7 +226,7 @@ while (@ARGV) {
         version();
        exit 0;
     } else {
-        usageerr(_g("unknown option \`%s'"), $arg);
+        usageerr(g_("unknown option \`%s'"), $arg);
     }
 }
 
@@ -282,7 +282,7 @@ if (action_needs(DEB_HOST | DEB_GNU_INFO)) {
 
     my $gcc = get_gcc_host_gnu_type();
 
-    warning(_g('specified GNU system type %s does not match gcc system ' .
+    warning(g_('specified GNU system type %s does not match gcc system ' .
                'type %s, try setting a correct CC environment variable'),
             $v{DEB_HOST_GNU_TYPE}, $gcc)
         if ($gcc ne '') && ($gcc ne $v{DEB_HOST_GNU_TYPE});

+ 9 - 9
scripts/dpkg-buildflags.pl

@@ -30,18 +30,18 @@ use Dpkg::Vendor qw(get_current_vendor);
 textdomain('dpkg-dev');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<command>]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
   --get <flag>       output the requested flag to stdout.
   --origin <flag>    output the origin of the flag to stdout:
@@ -67,20 +67,20 @@ my $load_config = 1;
 while (@ARGV) {
     $_ = shift(@ARGV);
     if (m/^--(get|origin|query-features)$/) {
-        usageerr(_g('two commands specified: --%s and --%s'), $1, $action)
+        usageerr(g_('two commands specified: --%s and --%s'), $1, $action)
             if defined($action);
         $action = $1;
         $param = shift(@ARGV);
-	usageerr(_g('%s needs a parameter'), $_) unless defined $param;
+	usageerr(g_('%s needs a parameter'), $_) unless defined $param;
     } elsif (m/^--export(?:=(sh|make|cmdline|configure))?$/) {
-        usageerr(_g('two commands specified: --%s and --%s'), 'export', $action)
+        usageerr(g_('two commands specified: --%s and --%s'), 'export', $action)
             if defined($action);
         my $type = $1 || 'sh';
         # Map legacy aliases.
         $type = 'cmdline' if $type eq 'configure';
         $action = "export-$type";
     } elsif (m/^--(list|status|dump)$/) {
-        usageerr(_g('two commands specified: --%s and --%s'), $1, $action)
+        usageerr(g_('two commands specified: --%s and --%s'), $1, $action)
             if defined($action);
         $action = $1;
         $load_config = 0 if $action eq 'list';
@@ -91,7 +91,7 @@ while (@ARGV) {
         version();
         exit 0;
     } else {
-	usageerr(_g("unknown option \`%s'"), $_);
+	usageerr(g_("unknown option \`%s'"), $_);
     }
 }
 

+ 46 - 46
scripts/dpkg-buildpackage.pl

@@ -46,18 +46,18 @@ use Dpkg::IPC;
 textdomain('dpkg-dev');
 
 sub showversion {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    print _g('
+    print g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   -F (default)   normal full build (binaries and sources).
   -g             source and arch-indep build.
@@ -98,13 +98,13 @@ sub usage {
                  change the administrative directory.
   -?, --help     show this help message.
       --version  show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options passed to dpkg-architecture:
   -a, --host-arch <arch>    set the host Debian architecture.
   -t, --host-type <type>    set the host GNU system type.
       --target-arch <arch>  set the target Debian architecture.
       --target-type <type>  set the target GNU system type.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options passed to dpkg-genchanges:
   -si (default)  source includes orig, if new upstream.
   -sa            source includes orig, always.
@@ -115,7 +115,7 @@ sub usage {
   -C<descfile>   changes are described in <descfile>.
       --changes-option=<opt>
                  pass option <opt> to dpkg-genchanges.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options passed to dpkg-source:
   -sn            force Debian native source format.
   -s[sAkurKUR]   see dpkg-source for explanation.
@@ -201,7 +201,7 @@ sub set_build_type
 {
     my ($build_type, $build_option) = @_;
 
-    usageerr(_g('cannot combine %s and %s'), build_opt(), $build_option)
+    usageerr(g_('cannot combine %s and %s'), build_opt(), $build_option)
         if not build_is_default and $include != $build_type;
     $include = $build_type;
 }
@@ -242,9 +242,9 @@ while (@ARGV) {
 	push @check_opts, $1;
     } elsif (/^--hook-(.+)=(.*)$/) {
 	my ($hook_name, $hook_cmd) = ($1, $2);
-	usageerr(_g('unknown hook name %s'), $hook_name)
+	usageerr(g_('unknown hook name %s'), $hook_name)
 	    if not exists $hook{$hook_name};
-	usageerr(_g('missing hook %s command'), $hook_name)
+	usageerr(g_('missing hook %s command'), $hook_name)
 	    if not defined $hook_cmd;
 	$hook{$hook_name} = $hook_cmd;
     } elsif (/^-p(.*)$/) {
@@ -255,7 +255,7 @@ while (@ARGV) {
 	$checkbuilddep = ($1 eq 'D');
     } elsif (/^-s(gpg|pgp)$/) {
 	# Deprecated option
-	warning(_g('-s%s is deprecated; always using gpg style interface'), $1);
+	warning(g_('-s%s is deprecated; always using gpg style interface'), $1);
     } elsif (/^--force-sign$/) {
 	$signforce = 1;
     } elsif (/^-us$/) {
@@ -327,12 +327,12 @@ while (@ARGV) {
 	$desc = $1;
     } elsif (m/^-[EW]$/) {
 	# Deprecated option
-	warning(_g('-E and -W are deprecated, they are without effect'));
+	warning(g_('-E and -W are deprecated, they are without effect'));
     } elsif (/^-R(.*)$/) {
 	my $arg = $1;
 	@debian_rules = split /\s+/, $arg;
     } else {
-	usageerr(_g('unknown option or argument %s'), $_);
+	usageerr(g_('unknown option or argument %s'), $_);
     }
 }
 
@@ -353,28 +353,28 @@ if ($noclean) {
 }
 
 if ($< == 0) {
-    warning(_g('using a gain-root-command while being root')) if (@rootcommand);
+    warning(g_('using a gain-root-command while being root')) if (@rootcommand);
 } else {
     push @rootcommand, 'fakeroot' unless @rootcommand;
 }
 
 if (@rootcommand and not find_command($rootcommand[0])) {
     if ($rootcommand[0] eq 'fakeroot' and $< != 0) {
-        error(_g("fakeroot not found, either install the fakeroot\n" .
+        error(g_("fakeroot not found, either install the fakeroot\n" .
                  'package, specify a command with the -r option, ' .
                  'or run this as root'));
     } else {
-        error(_g("gain-root-commmand '%s' not found"), $rootcommand[0]);
+        error(g_("gain-root-commmand '%s' not found"), $rootcommand[0]);
     }
 }
 
 if ($check_command and not find_command($check_command)) {
-    error(_g("check-commmand '%s' not found"), $check_command);
+    error(g_("check-commmand '%s' not found"), $check_command);
 }
 
 if ($signcommand) {
     if (!find_command($signcommand)) {
-        error(_g("sign-commmand '%s' not found"), $signcommand);
+        error(g_("sign-commmand '%s' not found"), $signcommand);
     }
 } elsif (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
          ($ENV{HOME} && -e "$ENV{HOME}/.gnupg")) {
@@ -407,8 +407,8 @@ my $dir = basename($cwd);
 
 my $changelog = changelog_parse();
 
-my $pkg = mustsetvar($changelog->{source}, _g('source package'));
-my $version = mustsetvar($changelog->{version}, _g('source version'));
+my $pkg = mustsetvar($changelog->{source}, g_('source package'));
+my $version = mustsetvar($changelog->{version}, g_('source version'));
 my $v = Dpkg::Version->new($version);
 my ($ok, $error) = version_check($v);
 error($error) unless $ok;
@@ -416,7 +416,7 @@ error($error) unless $ok;
 my $sversion = $v->as_string(omit_epoch => 1);
 my $uversion = $v->version();
 
-my $distribution = mustsetvar($changelog->{distribution}, _g('source distribution'));
+my $distribution = mustsetvar($changelog->{distribution}, g_('source distribution'));
 
 my $maintainer;
 if ($changedby) {
@@ -424,7 +424,7 @@ if ($changedby) {
 } elsif ($maint) {
     $maintainer = $maint;
 } else {
-    $maintainer = mustsetvar($changelog->{maintainer}, _g('source changed by'));
+    $maintainer = mustsetvar($changelog->{maintainer}, g_('source changed by'));
 }
 
 
@@ -449,7 +449,7 @@ if (build_sourceonly) {
 } elsif (build_binaryindep) {
     $arch = 'all';
 } else {
-    $arch = mustsetvar($ENV{DEB_HOST_ARCH}, _g('host architecture'));
+    $arch = mustsetvar($ENV{DEB_HOST_ARCH}, g_('host architecture'));
 }
 
 my $pv = "${pkg}_$sversion";
@@ -478,7 +478,7 @@ if ($signsource && build_binaryonly) {
 run_hook('init', 1);
 
 if (not -x 'debian/rules') {
-    warning(_g('debian/rules is not executable; fixing that'));
+    warning(g_('debian/rules is not executable; fixing that'));
     chmod(0755, 'debian/rules'); # No checks of failures, non fatal
 }
 
@@ -499,11 +499,11 @@ if ($checkbuilddep) {
     if (not WIFEXITED($?)) {
         subprocerr('dpkg-checkbuilddeps');
     } elsif (WEXITSTATUS($?)) {
-	warning(_g('build dependencies/conflicts unsatisfied; aborting'));
-	warning(_g('(Use -d flag to override.)'));
+	warning(g_('build dependencies/conflicts unsatisfied; aborting'));
+	warning(g_('(Use -d flag to override.)'));
 
 	if (build_sourceonly) {
-	    warning(_g('this is currently a non-fatal warning with -S, but ' .
+	    warning(g_('this is currently a non-fatal warning with -S, but ' .
 	               'will probably become fatal in the future'));
 	} else {
 	    exit 3;
@@ -531,7 +531,7 @@ unless ($noclean) {
 run_hook('source', $include & BUILD_SOURCE);
 
 if ($include & BUILD_SOURCE) {
-    warning(_g('building a source package without cleaning up as you asked; ' .
+    warning(g_('building a source package without cleaning up as you asked; ' .
                'it might contain undesired files')) if $noclean;
     chdir('..') or syserr('chdir ..');
     withecho('dpkg-source', @source_opts, '-b', $dir);
@@ -551,7 +551,7 @@ if ($buildtarget ne 'build' and scalar(@debian_rules) == 1) {
     my $exitcode = WEXITSTATUS($?);
     subprocerr($cmdline) unless WIFEXITED($?);
     if ($exitcode == 2) {
-        warning(_g("%s must be updated to support the 'build-arch' and " .
+        warning(g_("%s must be updated to support the 'build-arch' and " .
                    "'build-indep' targets (at least '%s' seems to be " .
                    'missing)'), "@debian_rules", $buildtarget);
         $buildtarget = 'build';
@@ -578,9 +578,9 @@ print { *STDERR } " dpkg-genchanges @changes_opts >$chg\n";
 
 open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts
     or subprocerr('dpkg-genchanges');
-$changes->parse($changes_fh, _g('parse changes file'));
+$changes->parse($changes_fh, g_('parse changes file'));
 $changes->save($chg);
-close $changes_fh or subprocerr(_g('dpkg-genchanges'));
+close $changes_fh or subprocerr(g_('dpkg-genchanges'));
 
 run_hook('postclean', $cleansource);
 
@@ -601,7 +601,7 @@ if ($check_command) {
 }
 
 if ($signpause && ($signchanges || $signsource)) {
-    print _g("Press the return key to start signing process\n");
+    print g_("Press the return key to start signing process\n");
     getc();
 }
 
@@ -609,7 +609,7 @@ run_hook('sign', $signsource || $signchanges);
 
 if ($signsource) {
     if (signfile("$pv.dsc")) {
-        error(_g('failed to sign .dsc and .changes file'));
+        error(g_('failed to sign .dsc and .changes file'));
     }
 
     # Recompute the checksums as the .dsc has changed now.
@@ -628,11 +628,11 @@ if ($signsource) {
     $changes->save($chg);
 }
 if ($signchanges && signfile("$pva.changes")) {
-    error(_g('failed to sign .changes file'));
+    error(g_('failed to sign .changes file'));
 }
 
 if (not $signreleased) {
-    warning(_g('not signing UNRELEASED build; use --force-sign to override'));
+    warning(g_('not signing UNRELEASED build; use --force-sign to override'));
 }
 
 run_hook('done', 1);
@@ -640,7 +640,7 @@ run_hook('done', 1);
 sub mustsetvar {
     my ($var, $text) = @_;
 
-    error(_g('unable to determine %s'), $text)
+    error(g_('unable to determine %s'), $text)
 	unless defined($var);
 
     print "$Dpkg::PROGNAME: $text $var\n";
@@ -676,7 +676,7 @@ sub run_hook {
         if (exists $hook_vars{$var}) {
             return $hook_vars{$var};
         } else {
-            warning(_g('unknown %% substitution in hook: %%%s'), $var);
+            warning(g_('unknown %% substitution in hook: %%%s'), $var);
             return "\%$var";
         }
     };
@@ -696,9 +696,9 @@ sub signfile {
 
     # Make sure the file to sign ends with a newline.
     copy("../$file", $signfile);
-    open my $signfh, '>>', $signfile or syserr(_g('cannot open %s'), $signfile);
+    open my $signfh, '>>', $signfile or syserr(g_('cannot open %s'), $signfile);
     print { $signfh } "\n";
-    close $signfh or syserr(_g('cannot close %s'), $signfile);
+    close $signfh or syserr(g_('cannot close %s'), $signfile);
 
     system($signcommand, '--utf8-strings', '--textmode', '--armor',
            '--local-user', $signkey || $maintainer, '--clearsign',
@@ -727,20 +727,20 @@ sub describe_build {
         # source-only upload
         if (fileomitted($files, qr/\.diff\.$ext/) and
             fileomitted($files, qr/\.debian\.tar\.$ext/)) {
-            return _g('source-only upload: Debian-native package');
+            return g_('source-only upload: Debian-native package');
         } elsif (fileomitted($files, qr/\.orig\.tar\.$ext/)) {
-            return _g('source-only, diff-only upload (original source NOT included)');
+            return g_('source-only, diff-only upload (original source NOT included)');
         } else {
-            return _g('source-only upload (original source is included)');
+            return g_('source-only upload (original source is included)');
         }
     } elsif (fileomitted($files, qr/\.dsc/)) {
-        return _g('binary-only upload (no source included)');
+        return g_('binary-only upload (no source included)');
     } elsif (fileomitted($files, qr/\.diff\.$ext/) and
              fileomitted($files, qr/\.debian\.tar\.$ext/)) {
-        return _g('full upload; Debian-native package (full source is included)');
+        return g_('full upload; Debian-native package (full source is included)');
     } elsif (fileomitted($files, qr/\.orig\.tar\.$ext/)) {
-        return _g('binary and diff upload (original source NOT included)');
+        return g_('binary and diff upload (original source NOT included)');
     } else {
-        return _g('full upload (original source is included)');
+        return g_('full upload (original source is included)');
     }
 }

+ 9 - 9
scripts/dpkg-checkbuilddeps.pl

@@ -36,14 +36,14 @@ textdomain('dpkg-dev');
 
 sub version()
 {
-	printf(_g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION);
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 	exit(0);
 }
 
 sub usage {
-	printf _g(
+    printf g_(
 'Usage: %s [<option>...] [<control-file>]')
-	. "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   -A             ignore Build-Depends-Arch and Build-Conflicts-Arch.
   -B             ignore Build-Depends-Indep and Build-Conflicts-Indep.
@@ -57,7 +57,7 @@ sub usage {
                  change the administrative directory.
   -?, --help     show this help message.
       --version  show the version.')
-	. "\n\n" . _g(
+    . "\n\n" . g_(
 '<control-file> is the control file to process (default: debian/control).')
 	. "\n", $Dpkg::PROGNAME;
 }
@@ -113,7 +113,7 @@ if ($bd_value) {
     my $dep = deps_parse($bd_value, reduce_restrictions => 1,
                          build_dep => 1, build_profiles => \@build_profiles,
                          host_arch => $host_arch);
-    error(_g('error occurred while parsing %s'),
+    error(g_('error occurred while parsing %s'),
           'Build-Depends/Build-Depends-Arch/Build-Depends-Indep')
         unless defined $dep;
     push @unmet, build_depends($dep, $facts);
@@ -122,18 +122,18 @@ if ($bc_value) {
     my $dep = deps_parse($bc_value, reduce_restrictions => 1, union => 1,
                          build_dep => 1, build_profiles => \@build_profiles,
                          host_arch => $host_arch);
-    error(_g('error occurred while parsing %s'),
+    error(g_('error occurred while parsing %s'),
           'Build-Conflicts/Build-Conflicts-Arch/Build-Conflicts-Indep')
         unless defined $dep;
     push @conflicts, build_conflicts($dep, $facts);
 }
 
 if (@unmet) {
-	printf { *STDERR } _g('%s: Unmet build dependencies: '), $Dpkg::PROGNAME;
+	printf { *STDERR } g_('%s: Unmet build dependencies: '), $Dpkg::PROGNAME;
 	print { *STDERR } join(' ', map { $_->output() } @unmet), "\n";
 }
 if (@conflicts) {
-	printf { *STDERR } _g('%s: Build conflicts: '), $Dpkg::PROGNAME;
+	printf { *STDERR } g_('%s: Build conflicts: '), $Dpkg::PROGNAME;
 	print { *STDERR } join(' ', map { $_->output() } @conflicts), "\n";
 }
 exit 1 if @unmet || @conflicts;
@@ -145,7 +145,7 @@ sub parse_status {
 	my $facts = Dpkg::Deps::KnownFacts->new();
 	local $/ = '';
 	open(my $status_fh, '<', $status)
-		or syserr(_g('cannot open %s'), $status);
+		or syserr(g_('cannot open %s'), $status);
 	while (<$status_fh>) {
 		next unless /^Status: .*ok installed$/m;
 

+ 9 - 9
scripts/dpkg-distaddfile.pl

@@ -34,16 +34,16 @@ my $fileslistfile = 'debian/files';
 
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] <filename> <section> <priority>
 
 Options:
@@ -66,22 +66,22 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
     } elsif (m/^--$/) {
         last;
     } else {
-        usageerr(_g("unknown option \`%s'"), $_);
+        usageerr(g_("unknown option \`%s'"), $_);
     }
 }
-usageerr(_g('need exactly a filename, section and priority')) if @ARGV != 3;
+usageerr(g_('need exactly a filename, section and priority')) if @ARGV != 3;
 
 my ($file, $section, $priority) = @ARGV;
 
 ($file =~ m/\s/ || $section =~ m/\s/ || $priority =~ m/\s/) &&
-    error(_g('filename, section and priority may contain no whitespace'));
+    error(g_('filename, section and priority may contain no whitespace'));
 
 # Obtain a lock on debian/control to avoid simultaneous updates
 # of debian/files when parallel building is in use
 my $lockfh;
 my $lockfile = 'debian/control';
 sysopen($lockfh, $lockfile, O_WRONLY)
-    or syserr(_g('cannot write %s'), $lockfile);
+    or syserr(g_('cannot write %s'), $lockfile);
 file_lock($lockfh, $lockfile);
 
 my $dist = Dpkg::Dist::Files->new();
@@ -90,7 +90,7 @@ $dist->add_file($file, $section, $priority);
 $dist->save("$fileslistfile.new");
 
 rename("$fileslistfile.new", $fileslistfile)
-    or syserr(_g('install new files list file'));
+    or syserr(g_('install new files list file'));
 
 # Release the lock
-close($lockfh) or syserr(_g('cannot close %s'), $lockfile);
+close($lockfh) or syserr(g_('cannot close %s'), $lockfile);

+ 27 - 27
scripts/dpkg-genchanges.pl

@@ -112,24 +112,24 @@ sub set_build_type
 {
     my ($build_type, $build_option) = @_;
 
-    usageerr(_g('cannot combine %s and %s'), build_opt(), $build_option)
+    usageerr(g_('cannot combine %s and %s'), build_opt(), $build_option)
         if not build_is_default and $include != $build_type;
     $include = $build_type;
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Options:
   -g                       source and arch-indep build.
   -G                       source and arch-specific build.
@@ -212,7 +212,7 @@ while (@ARGV) {
 	version();
 	exit(0);
     } else {
-        usageerr(_g("unknown option \`%s'"), $_);
+        usageerr(g_("unknown option \`%s'"), $_);
     }
 }
 
@@ -242,7 +242,7 @@ if (defined($prev_changelog) and
     version_compare_relation($changelog->{'Version'}, REL_LT,
                              $prev_changelog->{'Version'}))
 {
-    warning(_g('the current version (%s) is earlier than the previous one (%s)'),
+    warning(g_('the current version (%s) is earlier than the previous one (%s)'),
 	$changelog->{'Version'}, $prev_changelog->{'Version'})
         # ~bpo and ~vola are backports and have lower version number by definition
         unless $changelog->{'Version'} =~ /~(?:bpo|vola)/;
@@ -267,8 +267,8 @@ my $origsrcmsg;
 if ($include & BUILD_SOURCE) {
     my $sec = $sourcedefault{'Section'} // '-';
     my $pri = $sourcedefault{'Priority'} // '-';
-    warning(_g('missing Section for source files')) if $sec eq '-';
-    warning(_g('missing Priority for source files')) if $pri eq '-';
+    warning(g_('missing Section for source files')) if $sec eq '-';
+    warning(g_('missing Priority for source files')) if $pri eq '-';
 
     my $spackage = get_source_package();
     (my $sversion = $substvars->get('source:Version')) =~ s/^\d+://;
@@ -276,7 +276,7 @@ if ($include & BUILD_SOURCE) {
     my $dsc = "${spackage}_${sversion}.dsc";
     my $dsc_pathname = "$uploadfilesdir/$dsc";
     my $dsc_fields = Dpkg::Control->new(type => CTRL_PKG_SRC);
-    $dsc_fields->load($dsc_pathname) or error(_g('%s is empty', $dsc_pathname));
+    $dsc_fields->load($dsc_pathname) or error(g_('%s is empty', $dsc_pathname));
     $checksums->add_from_file($dsc_pathname, key => $dsc);
     $checksums->add_from_control($dsc_fields, use_files_for_md5 => 1);
 
@@ -297,16 +297,16 @@ if ($include & BUILD_SOURCE) {
          $sourcestyle =~ m/d/) &&
         any { m/\.(?:debian\.tar|diff)\.$ext$/ } $checksums->get_files())
     {
-        $origsrcmsg = _g('not including original source code in upload');
+        $origsrcmsg = g_('not including original source code in upload');
         foreach my $f (grep { m/\.orig(-.+)?\.tar\.$ext$/ } $checksums->get_files()) {
             $checksums->remove_file($f);
         }
     } else {
         if ($sourcestyle =~ m/d/ &&
             none { m/\.(?:debian\.tar|diff)\.$ext$/ } $checksums->get_files()) {
-            warning(_g('ignoring -sd option for native Debian package'));
+            warning(g_('ignoring -sd option for native Debian package'));
         }
-        $origsrcmsg = _g('including full source code in upload');
+        $origsrcmsg = g_('including full source code in upload');
     }
 
     # Only add attributes for files being distributed.
@@ -314,13 +314,13 @@ if ($include & BUILD_SOURCE) {
         $dist->add_file($f, $sec, $pri);
     }
 } elsif ($include == BUILD_ARCH_DEP) {
-    $origsrcmsg = _g('binary-only arch-specific upload ' .
+    $origsrcmsg = g_('binary-only arch-specific upload ' .
                      '(source code and arch-indep packages not included)');
 } elsif ($include == BUILD_ARCH_INDEP) {
-    $origsrcmsg = _g('binary-only arch-indep upload ' .
+    $origsrcmsg = g_('binary-only arch-indep upload ' .
                      '(source code and arch-specific packages not included)');
 } else {
-    $origsrcmsg = _g('binary-only upload (no source code included)');
+    $origsrcmsg = g_('binary-only upload (no source code included)');
 }
 
 if ($include & BUILD_BINARY) {
@@ -328,7 +328,7 @@ if ($include & BUILD_BINARY) {
 
     $dist_count = $dist->load($fileslistfile) if -e $fileslistfile;
 
-    error(_g('binary build with no binary artifacts found; cannot distribute'))
+    error(g_('binary build with no binary artifacts found; cannot distribute'))
         if $dist_count == 0;
 
     foreach my $file ($dist->get_files()) {
@@ -373,7 +373,7 @@ foreach my $pkg ($control->get_packages()) {
 	    (@restrictions == 0 or
 	     evaluate_restriction_formula(\@restrictions, \@profiles)))
 	{
-	    warning(_g('package %s in control file but not in files list'),
+	    warning(g_('package %s in control file but not in files list'),
 		    $p);
 	}
 	next; # and skip it
@@ -418,13 +418,13 @@ foreach (keys %{$changelog}) {
 
 if ($changesdescription) {
     open(my $changes_fh, '<', $changesdescription)
-        or syserr(_g('read changesdescription'));
+        or syserr(g_('read changesdescription'));
     $fields->{'Changes'} = "\n" . file_slurp($changes_fh);
     close($changes_fh);
 }
 
 for my $p (keys %p2f) {
-    warning(_g('package %s listed in files list but not in control info'), $p)
+    warning(g_('package %s listed in files list but not in control info'), $p)
         unless defined $control->get_pkg_by_name($p);
 }
 
@@ -436,26 +436,26 @@ for my $p (keys %p2f) {
 
 	my $sec = $f2seccf{$f} || $sourcedefault{'Section'} // '-';
 	if ($sec eq '-') {
-	    warning(_g("missing Section for binary package %s; using '-'"), $p);
+	    warning(g_("missing Section for binary package %s; using '-'"), $p);
 	}
 	if ($sec ne $file->{section}) {
-	    error(_g('package %s has section %s in control file but %s in ' .
+	    error(g_('package %s has section %s in control file but %s in ' .
 	             'files list'), $p, $sec, $file->{section});
 	}
 
 	my $pri = $f2pricf{$f} || $sourcedefault{'Priority'} // '-';
 	if ($pri eq '-') {
-	    warning(_g("missing Priority for binary package %s; using '-'"), $p);
+	    warning(g_("missing Priority for binary package %s; using '-'"), $p);
 	}
 	if ($pri ne $file->{priority}) {
-	    error(_g('package %s has priority %s in control file but %s in ' .
+	    error(g_('package %s has priority %s in control file but %s in ' .
 	             'files list'), $p, $pri, $file->{priority});
 	}
     }
 }
 
 print { *STDERR } "$Dpkg::PROGNAME: $origsrcmsg\n"
-    or syserr(_g('write original source message')) unless $quiet;
+    or syserr(g_('write original source message')) unless $quiet;
 
 $fields->{'Format'} = $substvars->get('Format');
 
@@ -512,12 +512,12 @@ $fields->{'Maintainer'} = $forcemaint if defined($forcemaint);
 $fields->{'Changed-By'} = $forcechangedby if defined($forcechangedby);
 
 for my $f (qw(Version Distribution Maintainer Changes)) {
-    error(_g('missing information for critical output field %s'), $f)
+    error(g_('missing information for critical output field %s'), $f)
         unless defined $fields->{$f};
 }
 
 for my $f (qw(Urgency)) {
-    warning(_g('missing information for output field %s'), $f)
+    warning(g_('missing information for output field %s'), $f)
         unless defined $fields->{$f};
 }
 

+ 30 - 30
scripts/dpkg-gencontrol.pl

@@ -63,18 +63,18 @@ my $substvars_loaded = 0;
 
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   -p<package>              print control file for package.
   -c<control-file>         get control info from this file.
@@ -100,7 +100,7 @@ while (@ARGV) {
     if (m/^-p/p) {
         $oppackage = ${^POSTMATCH};
         my $err = pkg_name_is_illegal($oppackage);
-        error(_g("illegal package name '%s': %s"), $oppackage, $err) if $err;
+        error(g_("illegal package name '%s': %s"), $oppackage, $err) if $err;
     } elsif (m/^-c/p) {
         $controlfile = ${^POSTMATCH};
     } elsif (m/^-l/p) {
@@ -116,7 +116,7 @@ while (@ARGV) {
     } elsif (m/^-O(.+)$/) {
         $outputfile = $1;
     } elsif (m/^-i([sp][sp]?)$/) {
-        warning(_g('-i%s is deprecated; it is without effect'), $1);
+        warning(g_('-i%s is deprecated; it is without effect'), $1);
     } elsif (m/^-F([0-9a-z]+)$/) {
         $changelogformat=$1;
     } elsif (m/^-D([^\=:]+)[=:]/p) {
@@ -137,7 +137,7 @@ while (@ARGV) {
         version();
         exit(0);
     } else {
-        usageerr(_g("unknown option \`%s'"), $_);
+        usageerr(g_("unknown option \`%s'"), $_);
     }
 }
 
@@ -175,19 +175,19 @@ my $pkg;
 if (defined($oppackage)) {
     $pkg = $control->get_pkg_by_name($oppackage);
     if (not defined $pkg) {
-        error(_g('package %s not in control info'), $oppackage)
+        error(g_('package %s not in control info'), $oppackage)
     }
 } else {
     my @packages = map { $_->{'Package'} } $control->get_packages();
     if (@packages == 0) {
-        error(_g('no package stanza found in control info'));
+        error(g_('no package stanza found in control info'));
     } elsif (@packages > 1) {
-        error(_g('must specify package since control info has many (%s)'),
+        error(g_('must specify package since control info has many (%s)'),
               "@packages");
     }
     $pkg = $control->get_pkg_by_idx(1);
 }
-$substvars->set_msg_prefix(sprintf(_g('package %s: '), $pkg->{Package}));
+$substvars->set_msg_prefix(sprintf(g_('package %s: '), $pkg->{Package}));
 
 # Scan source package
 my $src_fields = $control->get_source();
@@ -218,7 +218,7 @@ foreach (keys %{$pkg}) {
 		    join("' `", @invalid_archs))
 		if @invalid_archs >= 1;
 	    if (none { debarch_is($host_arch, $_) } @archlist) {
-		error(_g("current host architecture '%s' does not " .
+		error(g_("current host architecture '%s' does not " .
 			 "appear in package's architecture list (%s)"),
 		      $host_arch, "@archlist");
 	    }
@@ -274,12 +274,12 @@ foreach my $field (field_list_pkg_dep()) {
     if (exists $pkg->{$field}) {
 	my $dep;
 	my $field_value = $substvars->substvars($pkg->{$field},
-	    msg_prefix => sprintf(_g('%s field of package %s: '), $field, $pkg->{Package}));
+	    msg_prefix => sprintf(g_('%s field of package %s: '), $field, $pkg->{Package}));
 	if (field_get_dep_type($field) eq 'normal') {
 	    $dep = deps_parse($field_value, use_arch => 1,
 	                      reduce_arch => $reduce_arch,
 	                      reduce_profiles => 1);
-	    error(_g('error occurred while parsing %s field: %s'), $field,
+	    error(g_('error occurred while parsing %s field: %s'), $field,
                   $field_value) unless defined $dep;
 	    $dep->simplify_deps($facts, @seen_deps);
 	    # Remember normal deps to simplify even further weaker deps
@@ -288,12 +288,12 @@ foreach my $field (field_list_pkg_dep()) {
 	    $dep = deps_parse($field_value, use_arch => 1,
 	                      reduce_arch => $reduce_arch,
 	                      reduce_profiles => 1, union => 1);
-	    error(_g('error occurred while parsing %s field: %s'), $field,
+	    error(g_('error occurred while parsing %s field: %s'), $field,
                   $field_value) unless defined $dep;
 	    $dep->simplify_deps($facts);
             $dep->sort();
 	}
-	error(_g('the %s field contains an arch-specific dependency but the ' .
+	error(g_('the %s field contains an arch-specific dependency but the ' .
 	         'package is architecture all'), $field)
 	    if $dep->has_arch_restriction();
 	$fields->{$field} = $dep->output();
@@ -304,11 +304,11 @@ foreach my $field (field_list_pkg_dep()) {
 $fields->{'Built-For-Profiles'} = join ' ', get_build_profiles();
 
 for my $f (qw(Package Version)) {
-    error(_g('missing information for output field %s'), $f)
+    error(g_('missing information for output field %s'), $f)
         unless defined $fields->{$f};
 }
 for my $f (qw(Maintainer Description Architecture)) {
-    warning(_g('missing information for output field %s'), $f)
+    warning(g_('missing information for output field %s'), $f)
         unless defined $fields->{$f};
 }
 $oppackage = $fields->{'Package'};
@@ -321,7 +321,7 @@ if ($pkg_type eq 'udeb') {
     delete $fields->{'Homepage'};
 } else {
     for my $f (qw(Subarchitecture Kernel-Version Installer-Menu-Item)) {
-        warning(_g('%s package with udeb specific field %s'), $pkg_type, $f)
+        warning(g_('%s package with udeb specific field %s'), $pkg_type, $f)
             if defined($fields->{$f});
     }
 }
@@ -336,22 +336,22 @@ if ($oppackage ne $sourcepackage || $verdiff) {
 if (!defined($substvars->get('Installed-Size'))) {
     my $c = open(my $du_fh, '-|');
     if (not defined $c) {
-        syserr(_g('cannot fork for %s'), 'du');
+        syserr(g_('cannot fork for %s'), 'du');
     }
     if (!$c) {
         chdir("$packagebuilddir")
-            or syserr(_g("chdir for du to \`%s'"), $packagebuilddir);
+            or syserr(g_("chdir for du to \`%s'"), $packagebuilddir);
         exec('du', '-k', '-s', '--apparent-size', '.')
-            or syserr(_g('unable to execute %s'), 'du');
+            or syserr(g_('unable to execute %s'), 'du');
     }
     my $duo = '';
     while (<$du_fh>) {
 	$duo .= $_;
     }
     close($du_fh);
-    subprocerr(_g("du in \`%s'"), $packagebuilddir) if $?;
+    subprocerr(g_("du in \`%s'"), $packagebuilddir) if $?;
     if ($duo !~ m/^(\d+)\s+\.$/) {
-        error(_g("du gave unexpected output \`%s'"), $duo);
+        error(g_("du gave unexpected output \`%s'"), $duo);
     }
     $substvars->set_as_auto('Installed-Size', $1);
 }
@@ -385,7 +385,7 @@ my $lockfile = 'debian/control';
 $lockfile = $controlfile if not -e $lockfile;
 
 sysopen($lockfh, $lockfile, O_WRONLY)
-    or syserr(_g('cannot write %s'), $lockfile);
+    or syserr(g_('cannot write %s'), $lockfile);
 file_lock($lockfh, $lockfile);
 
 my $dist = Dpkg::Dist::Files->new();
@@ -405,17 +405,17 @@ $dist->add_file($forcefilename, $section, $priority);
 $dist->save("$fileslistfile.new");
 
 rename("$fileslistfile.new", $fileslistfile)
-    or syserr(_g('install new files list file'));
+    or syserr(g_('install new files list file'));
 
 # Release the lock
-close($lockfh) or syserr(_g('cannot close %s'), $lockfile);
+close($lockfh) or syserr(g_('cannot close %s'), $lockfile);
 
 my $cf;
 my $fh_output;
 if (!$stdout) {
     $cf = $outputfile // "$packagebuilddir/DEBIAN/control";
     open($fh_output, '>', "$cf.new")
-        or syserr(_g("cannot open new output control file \`%s'"), "$cf.new");
+        or syserr(g_("cannot open new output control file \`%s'"), "$cf.new");
 } else {
     $fh_output = \*STDOUT;
 }
@@ -424,9 +424,9 @@ $fields->apply_substvars($substvars);
 $fields->output($fh_output);
 
 if (!$stdout) {
-    close($fh_output) or syserr(_g('cannot close %s'), "$cf.new");
+    close($fh_output) or syserr(g_('cannot close %s'), "$cf.new");
     rename("$cf.new", "$cf")
-        or syserr(_g("cannot install output control file \`%s'"), $cf);
+        or syserr(g_("cannot install output control file \`%s'"), $cf);
 }
 
 $substvars->warn_about_unused();

+ 21 - 21
scripts/dpkg-gensymbols.pl

@@ -50,18 +50,18 @@ my $debug = 0;
 my $host_arch = get_host_arch();
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   -p<package>              generate symbols file for package.
   -P<package-build-dir>    temporary build dir instead of debian/tmp.
@@ -96,7 +96,7 @@ while (@ARGV) {
     if (m/^-p/p) {
 	$oppackage = ${^POSTMATCH};
 	my $err = pkg_name_is_illegal($oppackage);
-	error(_g("illegal package name '%s': %s"), $oppackage, $err) if $err;
+	error(g_("illegal package name '%s': %s"), $oppackage, $err) if $err;
     } elsif (m/^-c(\d)?$/) {
 	$compare = $1 // 1;
     } elsif (m/^-q$/) {
@@ -112,7 +112,7 @@ while (@ARGV) {
 	} else {
 	    my @to_add = glob($file);
 	    push @files, @to_add;
-	    warning(_g("pattern '%s' did not match any file"), $file)
+	    warning(g_("pattern '%s' did not match any file"), $file)
 		unless scalar(@to_add);
 	}
     } elsif (m/^-P(.+)$/) {
@@ -137,7 +137,7 @@ while (@ARGV) {
 	version();
 	exit(0);
     } else {
-	usageerr(_g("unknown option \`%s'"), $_);
+	usageerr(g_("unknown option \`%s'"), $_);
     }
 }
 
@@ -155,9 +155,9 @@ if (not defined($oppackage)) {
     my $control = Dpkg::Control::Info->new();
     my @packages = map { $_->{'Package'} } $control->get_packages();
     if (@packages == 0) {
-	error(_g('no package stanza found in control info'));
+	error(g_('no package stanza found in control info'));
     } elsif (@packages > 1) {
-	error(_g('must specify package since control info has many (%s)'),
+	error(g_('must specify package since control info has many (%s)'),
 	      "@packages");
     }
     $oppackage = $packages[0];
@@ -193,7 +193,7 @@ if (not scalar @files) {
             next PATH if -l $updir;
         }
 	opendir(my $libdir_dh, "$libdir")
-	    or syserr(_g("can't read directory %s: %s"), $libdir, $!);
+	    or syserr(g_("can't read directory %s: %s"), $libdir, $!);
 	push @files, grep {
 	    /(\.so\.|\.so$)/ && -f &&
 	    Dpkg::Shlibs::Objdump::is_elf($_);
@@ -208,7 +208,7 @@ foreach my $file (@files) {
     print "Scanning $file for symbol information\n" if $debug;
     my $objid = $od->analyze($file);
     unless (defined($objid) && $objid) {
-	warning(_g("Dpkg::Shlibs::Objdump couldn't parse %s\n"), $file);
+	warning(g_("Dpkg::Shlibs::Objdump couldn't parse %s\n"), $file);
 	next;
     }
     my $object = $od->get_object($objid);
@@ -226,7 +226,7 @@ $symfile->clear_except(keys %{$od->{objects}});
 
 # Write out symbols files
 if ($stdout) {
-    $output = _g('<standard output>');
+    $output = g_('<standard output>');
     $symfile->output(\*STDOUT, package => $oppackage,
                      template_mode => $template_mode,
                      with_pattern_matches => $verbose_output,
@@ -254,23 +254,23 @@ my $exitcode = 0;
 if ($compare || ! $quiet) {
     # Compare
     if (my @libs = $symfile->get_new_libs($ref_symfile)) {
-	warning(_g('new libraries appeared in the symbols file: %s'), "@libs")
+	warning(g_('new libraries appeared in the symbols file: %s'), "@libs")
 	    unless $quiet;
 	$exitcode = 4 if ($compare >= 4);
     }
     if (my @libs = $symfile->get_lost_libs($ref_symfile)) {
-	warning(_g('some libraries disappeared in the symbols file: %s'), "@libs")
+	warning(g_('some libraries disappeared in the symbols file: %s'), "@libs")
 	    unless $quiet;
 	$exitcode = 3 if ($compare >= 3);
     }
     if ($symfile->get_new_symbols($ref_symfile)) {
-	warning(_g('some new symbols appeared in the symbols file: %s'),
-		_g('see diff output below')) unless $quiet;
+	warning(g_('some new symbols appeared in the symbols file: %s'),
+		g_('see diff output below')) unless $quiet;
 	$exitcode = 2 if ($compare >= 2);
     }
     if ($symfile->get_lost_symbols($ref_symfile)) {
-	warning(_g('some symbols or patterns disappeared in the symbols file: %s'),
-	        _g('see diff output below')) unless $quiet;
+	warning(g_('some symbols or patterns disappeared in the symbols file: %s'),
+	        g_('see diff output below')) unless $quiet;
 	$exitcode = 1 if ($compare >= 1);
     }
 }
@@ -290,12 +290,12 @@ unless ($quiet) {
     # Output diffs between symbols files if any
     if ($md5_before->hexdigest() ne $md5_after->hexdigest()) {
 	if (not defined($output)) {
-	    warning(_g('the generated symbols file is empty'));
+	    warning(g_('the generated symbols file is empty'));
 	} elsif (defined($ref_symfile->{file})) {
-	    warning(_g("%s doesn't match completely %s"),
+	    warning(g_("%s doesn't match completely %s"),
 		    $output, $ref_symfile->{file});
 	} else {
-	    warning(_g('no debian/symbols file used as basis for generating %s'),
+	    warning(g_('no debian/symbols file used as basis for generating %s'),
 		    $output);
 	}
 	my ($a, $b) = ($before->filename, $after->filename);

+ 8 - 8
scripts/dpkg-mergechangelogs.pl

@@ -51,16 +51,16 @@ BEGIN {
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf "\n" . _g(
+    printf "\n" . g_(
 'This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf(_g(
+    printf g_(
 "Usage: %s [<option>...] <old> <new-a> <new-b> [<out>]
 
 Options:
@@ -68,7 +68,7 @@ Options:
                            after the last '~' in the version.
   -?, --help               show this help message.
       --version            show the version.
-"), $Dpkg::PROGNAME);
+"), $Dpkg::PROGNAME;
 }
 
 my $merge_prereleases;
@@ -87,11 +87,11 @@ my @options_spec = (
 my ($old, $new_a, $new_b, $out_file) = @ARGV;
 unless (defined $old and defined $new_a and defined $new_b)
 {
-    usageerr(_g('needs at least three arguments'));
+    usageerr(g_('needs at least three arguments'));
 }
 unless (-e $old and -e $new_a and -e $new_b)
 {
-    usageerr(_g('file arguments need to exist'));
+    usageerr(g_('file arguments need to exist'));
 }
 
 my ($cho, $cha, $chb);
@@ -135,9 +135,9 @@ while (1) {
 
 if (defined($out_file) and $out_file ne '-') {
     open(my $out_fh, '>', $out_file)
-        or syserr(_g('cannot write %s'), $out_file);
+        or syserr(g_('cannot write %s'), $out_file);
     print { $out_fh } ((blessed $_) ? "$_" : "$_\n") foreach @result;
-    close($out_fh) or syserr(_g('cannot write %s'), $out_file);
+    close($out_fh) or syserr(g_('cannot write %s'), $out_file);
 } else {
     print ((blessed $_) ? "$_" : "$_\n") foreach @result;
 }

+ 19 - 19
scripts/dpkg-name.pl

@@ -43,14 +43,14 @@ my %options = (
 
 sub version()
 {
-    printf(_g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION);
+    printf(g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION);
 }
 
 sub usage()
 {
-    printf(_g("Usage: %s [<option>...] <file>...\n"), $Dpkg::PROGNAME);
+    printf(g_("Usage: %s [<option>...] <file>...\n"), $Dpkg::PROGNAME);
 
-    print(_g("
+    print(g_("
 Options:
   -a, --no-architecture    no architecture part in filename.
   -o, --overwrite          overwrite if file exists.
@@ -72,7 +72,7 @@ sub fileexists($)
     if (-f $filename) {
         return 1;
     } else {
-        warning(_g("cannot find '%s'"), $filename);
+        warning(g_("cannot find '%s'"), $filename);
         return 0;
     }
 }
@@ -93,9 +93,9 @@ sub getfields($)
 
     # Read the fields
     open(my $cdata_fh, '-|', 'dpkg-deb', '-f', '--', $filename)
-        or syserr(_g('cannot open %s'), $filename);
+        or syserr(g_('cannot open %s'), $filename);
     my $fields = Dpkg::Control->new(type => CTRL_PKG_DEB);
-    $fields->parse($cdata_fh, sprintf(_g('binary control file %s'), $filename));
+    $fields->parse($cdata_fh, sprintf(g_('binary control file %s'), $filename));
     close($cdata_fh);
 
     return $fields;
@@ -108,7 +108,7 @@ sub getarch($$)
     my $arch = $fields->{Architecture};
     if (not $fields->{Architecture} and $options{architecture}) {
         $arch = get_host_arch();
-        warning(_g("assuming architecture '%s' for '%s'"), $arch, $filename);
+        warning(g_("assuming architecture '%s' for '%s'"), $arch, $filename);
     }
 
     return $arch;
@@ -130,7 +130,7 @@ sub getname($$$)
     }
     (my $name = $tname) =~ s/ //g;
     if ($tname ne $name) { # control fields have spaces
-        warning(_g("bad package control information for '%s'"), $filename);
+        warning(g_("bad package control information for '%s'"), $filename);
     }
     return $name;
 }
@@ -146,7 +146,7 @@ sub getdir($$$)
             my $section = $fields->{Section};
             if (!$section) {
                 $section = 'no-section';
-                warning(_g("assuming section '%s' for '%s'"), $section,
+                warning(g_("assuming section '%s' for '%s'"), $section,
                         $filename);
             }
             if ($section ne 'non-free' and $section ne 'contrib' and
@@ -171,7 +171,7 @@ sub move($)
         my $fields = getfields($filename);
 
         unless (exists $fields->{Package}) {
-            warning(_g("no Package field found in '%s', skipping it"),
+            warning(g_("no Package field found in '%s', skipping it"),
                     $filename);
             return;
         }
@@ -184,12 +184,12 @@ sub move($)
         if (! -d $dir) {
             if ($options{createdir}) {
                 if (mkpath($dir)) {
-                    info(_g("created directory '%s'"), $dir);
+                    info(g_("created directory '%s'"), $dir);
                 } else {
-                    error(_g("cannot create directory '%s'"), $dir);
+                    error(g_("cannot create directory '%s'"), $dir);
                 }
             } else {
-                error(_g("no such directory '%s', try --create-dir (-c) option"),
+                error(g_("no such directory '%s', try --create-dir (-c) option"),
                       $dir);
             }
         }
@@ -204,13 +204,13 @@ sub move($)
         }
 
         if (filesame($newname, $filename)) {
-            warning(_g("skipping '%s'"), $filename);
+            warning(g_("skipping '%s'"), $filename);
         } elsif (-f $newname and not $options{overwrite}) {
-            warning(_g("cannot move '%s' to existing file"), $filename);
+            warning(g_("cannot move '%s' to existing file"), $filename);
         } elsif (system(@command, $filename, $newname) == 0) {
-            info(_g("moved '%s' to '%s'"), basename($filename), $newname);
+            info(g_("moved '%s' to '%s'"), basename($filename), $newname);
         } else {
-            error(_g('mkdir can be used to create directory'));
+            error(g_('mkdir can be used to create directory'));
         }
     }
 }
@@ -242,13 +242,13 @@ while (@ARGV) {
         push @files, @ARGV;
         last;
     } elsif (m/^-/) {
-        usageerr(_g("unknown option \`%s'"), $_);
+        usageerr(g_("unknown option \`%s'"), $_);
     } else {
         push @files, $_;
     }
 }
 
-@files or usageerr(_g('need at least a filename'));
+@files or usageerr(g_('need at least a filename'));
 
 foreach my $file (@files) {
     move($file);

+ 7 - 7
scripts/dpkg-parsechangelog.pl

@@ -33,18 +33,18 @@ my %options;
 my $fieldname;
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   -l<changelog-file>       get per-version info from this file.
   -F<changelog-format>     force changelog format.
@@ -52,7 +52,7 @@ sub usage {
   -S, --show-field <field> show the values for <field>.
   -?, --help               show this help message.
       --version            show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Parser options:
     --format <output-format>    see man page for list of available
                                 output formats, defaults to 'dpkg'
@@ -114,10 +114,10 @@ while (@ARGV) {
     } elsif (m/^--version$/) {
 	version(); exit(0);
     } else {
-	usageerr(_g("unknown option \`%s'"), $_);
+	usageerr(g_("unknown option \`%s'"), $_);
     }
 }
-usageerr(_g('takes no non-option arguments')) if @ARGV;
+usageerr(g_('takes no non-option arguments')) if @ARGV;
 
 my $count = 0;
 my @fields = changelog_parse(%options);

+ 24 - 24
scripts/dpkg-scanpackages.pl

@@ -66,12 +66,12 @@ my @options_spec = (
 );
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
     exit;
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 "Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Packages
 
 Options:
@@ -112,7 +112,7 @@ sub load_override
 		    my $debmaint = $$package{Maintainer};
 		    if (none { $debmaint eq $_ } split m{\s*//\s*}, $oldmaint) {
 			push(@changedmaint,
-			     sprintf(_g('  %s (package says %s, not %s)'),
+			     sprintf(g_('  %s (package says %s, not %s)'),
 			             $p, $$package{Maintainer}, $oldmaint));
 		    } else {
 			$$package{Maintainer} = $newmaint;
@@ -120,7 +120,7 @@ sub load_override
 		} elsif ($$package{Maintainer} eq $maintainer) {
 		    push(@samemaint, "  $p ($maintainer)");
 		} else {
-		    warning(_g('unconditional maintainer override for %s'), $p);
+		    warning(g_('unconditional maintainer override for %s'), $p);
 		    $$package{Maintainer} = $maintainer;
 		}
 	    }
@@ -161,7 +161,7 @@ sub load_override_extra
 }
 
 if (not (@ARGV >= 1 and @ARGV <= 3)) {
-    usageerr(_g('one to three arguments expected'));
+    usageerr(g_('one to three arguments expected'));
 }
 
 my $type = $options{type} // 'deb';
@@ -170,7 +170,7 @@ my %hash = map { $_ => 1 } split /,/, $options{hash} // '';
 
 foreach my $alg (keys %hash) {
     if (not checksums_is_supported($alg)) {
-        usageerr(_g('unsupported checksum \'%s\''), $alg);
+        usageerr(g_('unsupported checksum \'%s\''), $alg);
     }
 }
 
@@ -186,17 +186,17 @@ else {
 my ($binarydir, $override, $pathprefix) = @ARGV;
 
 if (not -d $binarydir) {
-    error(_g('binary dir %s not found'), $binarydir);
+    error(g_('binary dir %s not found'), $binarydir);
 }
 if (defined $override and not -e $override) {
-    error(_g('override file %s not found'), $override);
+    error(g_('override file %s not found'), $override);
 }
 
 $pathprefix //= '';
 
 my $find_h = IO::Handle->new();
 open($find_h, '-|', 'find', '-L', "$binarydir/", @find_args, '-print')
-     or syserr(_g("couldn't open %s for reading"), $binarydir);
+     or syserr(g_("couldn't open %s for reading"), $binarydir);
 FILE:
     while (my $fn = <$find_h>) {
 	chomp $fn;
@@ -205,16 +205,16 @@ FILE:
 	                to_pipe => \$output);
 	my $fields = Dpkg::Control->new(type => CTRL_INDEX_PKG);
 	$fields->parse($output, $fn)
-	    or error(_g("couldn't parse control information from %s"), $fn);
+	    or error(g_("couldn't parse control information from %s"), $fn);
 	wait_child($pid, nocheck => 1);
 	if ($?) {
-	    warning(_g("\`dpkg-deb -I %s control' exited with %d, skipping package"),
+	    warning(g_("\`dpkg-deb -I %s control' exited with %d, skipping package"),
 	            $fn, $?);
 	    next;
 	}
 
 	defined($fields->{'Package'})
-	    or error(_g('no Package field in control file of %s'), $fn);
+	    or error(g_('no Package field in control file of %s'), $fn);
 	my $p = $fields->{'Package'};
 
 	if (defined($packages{$p}) and not $options{multiversion}) {
@@ -222,20 +222,20 @@ FILE:
 		if (version_compare_relation($fields->{'Version'}, REL_GT,
 		                             $pkg->{'Version'}))
                 {
-		    warning(_g('package %s (filename %s) is repeat but newer version;'),
+		    warning(g_('package %s (filename %s) is repeat but newer version;'),
 		            $p, $fn);
-		    warning(_g('used that one and ignored data from %s!'),
+		    warning(g_('used that one and ignored data from %s!'),
 		            $pkg->{Filename});
 		    $packages{$p} = [];
 		} else {
-		    warning(_g('package %s (filename %s) is repeat;'), $p, $fn);
-		    warning(_g('ignored that one and using data from %s!'),
+		    warning(g_('package %s (filename %s) is repeat;'), $p, $fn);
+		    warning(g_('ignored that one and using data from %s!'),
 		            $pkg->{Filename});
 		    next FILE;
 		}
 	    }
 	}
-	warning(_g('package %s (filename %s) has Filename field!'), $p, $fn)
+	warning(g_('package %s (filename %s) has Filename field!'), $p, $fn)
 	    if defined($fields->{'Filename'});
 
 	$fields->{'Filename'} = "$pathprefix$fn";
@@ -269,27 +269,27 @@ for my $p (sort keys %packages) {
         push @missingover, $p;
     }
     for my $package (@{$packages{$p}}) {
-         print("$package\n") or syserr(_g('failed when writing stdout'));
+         print("$package\n") or syserr(g_('failed when writing stdout'));
          $records_written++;
     }
 }
-close(STDOUT) or syserr(_g("couldn't close stdout"));
+close(STDOUT) or syserr(g_("couldn't close stdout"));
 
 if (@changedmaint) {
-    warning(_g('Packages in override file with incorrect old maintainer value:'));
+    warning(g_('Packages in override file with incorrect old maintainer value:'));
     warning($_) foreach (@changedmaint);
 }
 if (@samemaint) {
-    warning(_g('Packages specifying same maintainer as override file:'));
+    warning(g_('Packages specifying same maintainer as override file:'));
     warning($_) foreach (@samemaint);
 }
 if (@missingover) {
-    warning(_g('Packages in archive but missing from override file:'));
+    warning(g_('Packages in archive but missing from override file:'));
     warning('  %s', join(' ', @missingover));
 }
 if (@spuriousover) {
-    warning(_g('Packages in override file but not in archive:'));
+    warning(g_('Packages in override file but not in archive:'));
     warning('  %s', join(' ', @spuriousover));
 }
 
-info(_g('Wrote %s entries to output Packages file.'), $records_written);
+info(g_('Wrote %s entries to output Packages file.'), $records_written);

+ 11 - 11
scripts/dpkg-scansources.pl

@@ -76,12 +76,12 @@ sub debug {
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
     exit;
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 "Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Sources
 
 Options:
@@ -101,7 +101,7 @@ See the man page for the full documentation.
 
 sub close_msg {
     my $name = shift;
-    return sprintf(_g("error closing %s (\$? %d, \$! `%s')"),
+    return sprintf(g_("error closing %s (\$? %d, \$! `%s')"),
                    $name, $?, $!)."\n";
 }
 
@@ -117,18 +117,18 @@ sub load_override {
 
 	my @data = split ' ', $_, 4;
 	unless (@data == 3 || @data == 4) {
-	    warning(_g('invalid override entry at line %d (%d fields)'),
+	    warning(g_('invalid override entry at line %d (%d fields)'),
 	            $., 0 + @data);
 	    next;
 	}
 	my ($package, $priority, $section, $maintainer) = @data;
 	if (exists $override{$package}) {
-	    warning(_g('ignoring duplicate override entry for %s at line %d'),
+	    warning(g_('ignoring duplicate override entry for %s at line %d'),
 	            $package, $.);
 	    next;
 	}
 	if (!$priority{$priority}) {
-	    warning(_g('ignoring override entry for %s, invalid priority %s'),
+	    warning(g_('ignoring override entry for %s, invalid priority %s'),
 	            $package, $priority);
 	    next;
 	}
@@ -182,7 +182,7 @@ sub load_src_override {
 
 	my @data = split ' ';
 	unless (@data == 2) {
-	    warning(_g('invalid source override entry at line %d (%d fields)'),
+	    warning(g_('invalid source override entry at line %d (%d fields)'),
 	            $., 0 + @data);
 	    next;
 	}
@@ -190,7 +190,7 @@ sub load_src_override {
 	my ($package, $section) = @data;
 	my $key = "source/$package";
 	if (exists $override{$key}) {
-	    warning(_g('ignoring duplicate source override entry for %s at line %d'),
+	    warning(g_('ignoring duplicate source override entry for %s at line %d'),
 	            $package, $.);
 	    next;
 	}
@@ -240,7 +240,7 @@ sub process_dsc {
     my $source = $fields->{Source};
     my @binary = split /\s*,\s*/, $fields->{Binary};
 
-    error(_g('no binary packages specified in %s'), $file) unless (@binary);
+    error(g_('no binary packages specified in %s'), $file) unless (@binary);
 
     # Rename the source field to package.
     $fields->{Package} = $fields->{Source};
@@ -301,7 +301,7 @@ sub main {
         local $SIG{__WARN__} = sub { usageerr($_[0]) };
         GetOptions(@option_spec);
     }
-    usageerr(_g('one to three arguments expected'))
+    usageerr(g_('one to three arguments expected'))
         if @ARGV < 1 or @ARGV > 3;
 
     push @ARGV, undef if @ARGV < 2;
@@ -313,7 +313,7 @@ sub main {
     load_override_extra $extra_override_file if defined $extra_override_file;
 
     open my $find_fh, '-|', "find -L \Q$dir\E -name '*.dsc' -print"
-        or syserr(_g('cannot fork for %s'), 'find');
+        or syserr(g_('cannot fork for %s'), 'find');
     while (<$find_fh>) {
     	chomp;
 	s{^\./+}{};

+ 36 - 36
scripts/dpkg-shlibdeps.pl

@@ -102,13 +102,13 @@ foreach (@ARGV) {
     } elsif (m/^--admindir=(.*)$/) {
 	$admindir = $1;
 	if (not -d $admindir) {
-	    error(_g("administrative directory '%s' does not exist"), $admindir);
+	    error(g_("administrative directory '%s' does not exist"), $admindir);
 	}
 	$ENV{DPKG_ADMINDIR} = $admindir;
     } elsif (m/^-d(.*)$/) {
 	$dependencyfield = field_capitalize($1);
 	if (not defined $depstrength{$dependencyfield}) {
-	    warning(_g("unrecognized dependency field '%s'"), $dependencyfield);
+	    warning(g_("unrecognized dependency field '%s'"), $dependencyfield);
 	}
     } elsif (m/^-e(.*)$/) {
 	if (exists $exec{$1}) {
@@ -130,7 +130,7 @@ foreach (@ARGV) {
     } elsif (m/^-x(.*)$/) {
 	push @exclude, $1;
     } elsif (m/^-/) {
-	usageerr(_g("unknown option \`%s'"), $_);
+	usageerr(g_("unknown option \`%s'"), $_);
     } else {
 	if (exists $exec{$_}) {
 	    # Affect the binary to the most important field
@@ -142,13 +142,13 @@ foreach (@ARGV) {
 	}
     }
 }
-usageerr(_g('need at least one executable')) unless scalar keys %exec;
+usageerr(g_('need at least one executable')) unless scalar keys %exec;
 
 my $control = Dpkg::Control::Info->new();
 my $fields = $control->get_source();
 my $bd_value = deps_concat($fields->{'Build-Depends'}, $fields->{'Build-Depends-Arch'});
 my $build_deps = deps_parse($bd_value, build_dep => 1, reduce_restrictions => 1);
-error(_g('error occurred while parsing %s'), 'Build-Depends/Build-Depends-Arch')
+error(g_('error occurred while parsing %s'), 'Build-Depends/Build-Depends-Arch')
     unless defined $build_deps;
 
 my %dependencies;
@@ -185,7 +185,7 @@ foreach my $file (keys %exec) {
 	unless (defined $lib) {
 	    $soname_notfound{$soname} = 1;
 	    $global_soname_notfound{$soname} = 1;
-	    my $msg = _g("couldn't find library %s needed by %s (ELF " .
+	    my $msg = g_("couldn't find library %s needed by %s (ELF " .
 			 "format: '%s'; RPATH: '%s')");
 	    if (scalar(split_soname($soname))) {
 		errormsg($msg, $soname, $file, $obj->{format}, join(':', @{$obj->{RPATH}}));
@@ -265,7 +265,7 @@ foreach my $file (keys %exec) {
                 my $libobj = $objdump_cache{$lib};
                 my $id = $dumplibs_wo_symfile->add_object($libobj);
 		if (($id ne $soname) and ($id ne $lib)) {
-		    warning(_g('%s has an unexpected SONAME (%s)'), $lib, $id);
+		    warning(g_('%s has an unexpected SONAME (%s)'), $lib, $id);
 		    $alt_soname{$id} = $soname;
 		}
 		push @soname_wo_symfile, $soname;
@@ -286,7 +286,7 @@ foreach my $file (keys %exec) {
 		    $ignore++ unless scalar(split_soname($soname));
 		    # 3/ when we have been asked to do so
 		    $ignore++ if $ignore_missing_info;
-		    error(_g('no dependency information found for %s ' .
+		    error(g_('no dependency information found for %s ' .
 		             "(used by %s)\n" .
 		             'Hint: check if the library actually comes ' .
 		             'from a package.'), $lib, $file)
@@ -319,7 +319,7 @@ foreach my $file (keys %exec) {
         my $parent_dir = '/' . dirname($relname);
         $in_public_dir = any { $parent_dir eq $_ } get_library_paths();
     } else {
-        warning(_g('binaries to analyze should already be ' .
+        warning(g_('binaries to analyze should already be ' .
                    "installed in their package's directory"));
     }
     print "Analyzing all undefined symbols\n" if $debug > 1;
@@ -362,10 +362,10 @@ foreach my $file (keys %exec) {
                             or (not $in_public_dir and $nb_warnings < 1))
                         {
                             if ($in_public_dir) {
-			        warning(_g('symbol %s used by %s found in none of the ' .
+			        warning(g_('symbol %s used by %s found in none of the ' .
 				           'libraries'), $print_name, $file);
                             } else {
-			        warning(_g('%s contains an unresolvable reference to ' .
+			        warning(g_('%s contains an unresolvable reference to ' .
                                            "symbol %s: it's probably a plugin"),
                                         $file, $print_name);
                             }
@@ -414,7 +414,7 @@ foreach my $file (keys %exec) {
 	    next if ($soname =~ /^libm\.so\.\d+$/ and
 	             any { m/^libstdc\+\+\.so\.\d+/ } @sonames);
             next unless ($warnings & WARN_NOT_NEEDED);
-	    warning(_g('%s should not be linked against %s (it uses none of ' .
+	    warning(g_('%s should not be linked against %s (it uses none of ' .
 	               "the library's symbols)"), $file, $soname);
 	}
     }
@@ -438,7 +438,7 @@ foreach my $soname (keys %global_soname_needed) {
 
 # Quit now if any missing libraries
 if ($error_count >= 1) {
-    my $note = _g('Note: libraries are not searched in other binary packages ' .
+    my $note = g_('Note: libraries are not searched in other binary packages ' .
 	"that do not have any shlibs or symbols file.\nTo help dpkg-shlibdeps " .
 	'find private libraries, you might need to use -l.');
     error(P_('cannot continue due to the error above',
@@ -452,14 +452,14 @@ if ($stdout) {
     $fh = \*STDOUT;
 } else {
     open(my $new_fh, '>', "$varlistfile.new")
-        or syserr(_g("open new substvars file \`%s'"), "$varlistfile.new");
+        or syserr(g_("open new substvars file \`%s'"), "$varlistfile.new");
     if (-e $varlistfile) {
 	open(my $old_fh, '<', $varlistfile)
-	    or syserr(_g("open old varlist file \`%s' for reading"), $varlistfile);
+	    or syserr(g_("open old varlist file \`%s' for reading"), $varlistfile);
 	while (my $entry = <$old_fh>) {
 	    next if $entry =~ m/^\Q$varnameprefix\E:/;
 	    print { $new_fh } $entry
-	        or syserr(_g("copy old entry to new varlist file \`%s'"),
+	        or syserr(g_("copy old entry to new varlist file \`%s'"),
 	                  "$varlistfile.new");
 	}
 	close($old_fh);
@@ -524,7 +524,7 @@ foreach my $field (reverse @depfields) {
     }
     if ($dep) {
         my $obj = deps_parse($dep);
-        error(_g('invalid dependency got generated: %s'), $dep) unless defined $obj;
+        error(g_('invalid dependency got generated: %s'), $dep) unless defined $obj;
         $obj->sort();
 	print { $fh } "$varnameprefix:$field=$obj\n";
     }
@@ -532,9 +532,9 @@ foreach my $field (reverse @depfields) {
 
 # Replace old file by new one
 if (!$stdout) {
-    close($fh) or syserr(_g('cannot close %s'), "$varlistfile.new");
+    close($fh) or syserr(g_('cannot close %s'), "$varlistfile.new");
     rename "$varlistfile.new", $varlistfile
-        or syserr(_g("install new varlist file \`%s'"), $varlistfile);
+        or syserr(g_("install new varlist file \`%s'"), $varlistfile);
 }
 
 ##
@@ -542,23 +542,23 @@ if (!$stdout) {
 ##
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] <executable>|-e<executable> [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Positional options (order is significant):
   <executable>             include dependencies for <executable>,
   -e<executable>           (use -e if <executable> starts with '-')
   -d<dependency-field>     next executable(s) set shlibs:<dependency-field>.")
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Options:
   -l<library-dir>          add directory to private shared library search list.
   -p<varname-prefix>       set <varname-prefix>:* instead of shlibs:*.
@@ -575,7 +575,7 @@ sub usage {
   --admindir=<directory>   change the administrative directory.
   -?, --help               show this help message.
       --version            show the version.")
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Dependency fields recognized are:
   %s
 '), $Dpkg::PROGNAME, join('/', @depfields);
@@ -680,19 +680,19 @@ sub extract_from_shlibs {
     # Split soname in name/version
     my ($libname, $libversion) = split_soname($soname);
     unless (defined $libname) {
-	warning(_g("can't extract name and version from library name '%s'"),
+	warning(g_("can't extract name and version from library name '%s'"),
 	        $soname);
 	return;
     }
     # Open shlibs file
     open(my $shlibs_fh, '<', $shlibfile)
-        or syserr(_g("unable to open shared libs info file \`%s'"), $shlibfile);
+        or syserr(g_("unable to open shared libs info file \`%s'"), $shlibfile);
     my $dep;
     while (<$shlibs_fh>) {
 	s/\s*\n$//;
 	next if m/^\#/;
 	if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)(?:\s+(\S.*\S))?\s*$/) {
-	    warning(_g("shared libs info file \`%s' line %d: bad line \`%s'"),
+	    warning(g_("shared libs info file \`%s' line %d: bad line \`%s'"),
 	            $shlibfile, $., $_);
 	    next;
 	}
@@ -751,7 +751,7 @@ sub symfile_has_soname {
     }
 
     open(my $symfile_fh, '<', $file)
-        or syserr(_g('cannot open file %s'), $file);
+        or syserr(g_('cannot open file %s'), $file);
     my $result = 0;
     while (<$symfile_fh>) {
 	if (/^\Q$soname\E /) {
@@ -785,7 +785,7 @@ sub my_find_library {
 		$path =~ s/\$ORIGIN/$origin/g;
 		$path =~ s/\$\{ORIGIN\}/$origin/g;
 	    } else {
-		warning(_g('$ORIGIN is used in RPATH of %s and the corresponding ' .
+		warning(g_('$ORIGIN is used in RPATH of %s and the corresponding ' .
 		'directory could not be identified due to lack of DEBIAN ' .
 		"sub-directory in the root of package's build tree"), $execfile);
 	    }
@@ -838,27 +838,27 @@ sub find_packages {
     return $pkgmatch unless scalar(@files);
 
     my $pid = open(my $dpkg_fh, '-|');
-    syserr(_g('cannot fork for %s'), 'dpkg --search') unless defined($pid);
+    syserr(g_('cannot fork for %s'), 'dpkg --search') unless defined($pid);
     if (!$pid) {
 	# Child process running dpkg --search and discarding errors
 	close STDERR;
 	open STDERR, '>', '/dev/null'
-	    or syserr(_g('cannot open file %s'), '/dev/null');
+	    or syserr(g_('cannot open file %s'), '/dev/null');
 	$ENV{LC_ALL} = 'C';
 	exec('dpkg', '--search', '--', @files)
-	    or syserr(_g('unable to execute %s'), 'dpkg');
+	    or syserr(g_('unable to execute %s'), 'dpkg');
     }
     while (<$dpkg_fh>) {
 	chomp;
 	if (m/^local diversion |^diversion by/) {
-	    warning(_g('diversions involved - output may be incorrect'));
+	    warning(g_('diversions involved - output may be incorrect'));
 	    print { *STDERR } " $_\n"
-		or syserr(_g('write diversion info to stderr'));
+		or syserr(g_('write diversion info to stderr'));
 	} elsif (m/^([-a-z0-9+.:, ]+): (\/.*)$/) {
 	    my ($pkgs, $path) = ($1, $2);
 	    $cached_pkgmatch{$path} = $pkgmatch->{$path} = [ split /, /, $pkgs ];
 	} else {
-	    warning(_g("unknown output from dpkg --search: '%s'"), $_);
+	    warning(g_("unknown output from dpkg --search: '%s'"), $_);
 	}
     }
     close($dpkg_fh);

+ 39 - 39
scripts/dpkg-source.pl

@@ -103,20 +103,20 @@ my $dir;
 if (defined($options{opmode}) &&
     $options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     if (not scalar(@ARGV)) {
-	usageerr(_g('--%s needs a directory'), $options{opmode})
+	usageerr(g_('--%s needs a directory'), $options{opmode})
 	    unless $1 eq 'commit';
 	$dir = '.';
     } else {
 	$dir = File::Spec->catdir(shift(@ARGV));
     }
-    stat($dir) or syserr(_g('cannot stat directory %s'), $dir);
+    stat($dir) or syserr(g_('cannot stat directory %s'), $dir);
     if (not -d $dir) {
-	error(_g('directory argument %s is not a directory'), $dir);
+	error(g_('directory argument %s is not a directory'), $dir);
     }
     if ($dir eq '.') {
 	# . is never correct, adjust automatically
 	$dir = basename(cwd());
-	chdir('..') or syserr(_g("unable to chdir to `%s'"), '..');
+	chdir('..') or syserr(g_("unable to chdir to `%s'"), '..');
     }
     # --format options are not allowed, they would take precedence
     # over real command line options, debian/source/format should be used
@@ -134,7 +134,7 @@ if (defined($options{opmode}) &&
 	$conf->load($optfile);
 	$conf->filter(remove => sub { $_[0] =~ $forbidden_opts_re->{$filename} });
 	if (@$conf) {
-	    info(_g('using options from %s: %s'), $optfile, join(' ', @$conf))
+	    info(g_('using options from %s: %s'), $optfile, join(' ', @$conf))
 		unless $options{opmode} eq 'print-format';
 	    unshift @options, @$conf;
 	}
@@ -148,13 +148,13 @@ while (@options) {
     } elsif (m/^-(?:Z|-compression=)(.*)$/) {
 	my $compression = $1;
 	$options{compression} = $compression;
-	usageerr(_g('%s is not a supported compression'), $compression)
+	usageerr(g_('%s is not a supported compression'), $compression)
 	    unless compression_is_supported($compression);
 	compression_set_default($compression);
     } elsif (m/^-(?:z|-compression-level=)(.*)$/) {
 	my $comp_level = $1;
 	$options{comp_level} = $comp_level;
-	usageerr(_g('%s is not a compression level'), $comp_level)
+	usageerr(g_('%s is not a compression level'), $comp_level)
 	    unless compression_is_valid_level($comp_level);
 	compression_set_default_level($comp_level);
     } elsif (m/^-c(.*)$/) {
@@ -201,7 +201,7 @@ while (@options) {
         exit(0);
     } elsif (m/^-[EW]$/) {
         # Deprecated option
-        warning(_g('-E and -W are deprecated, they are without effect'));
+        warning(g_('-E and -W are deprecated, they are without effect'));
     } elsif (m/^-q$/) {
         report_options(quiet_warnings => 1);
         $options{quiet} = 1;
@@ -213,7 +213,7 @@ while (@options) {
 }
 
 unless (defined($options{opmode})) {
-    usageerr(_g('need an action option'));
+    usageerr(g_('need an action option'));
 }
 
 if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
@@ -237,7 +237,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 
     # Scan control info of source package
     my $src_fields = $control->get_source();
-    error(_g("%s doesn't contain any information about the source package"),
+    error(g_("%s doesn't contain any information about the source package"),
           $controlfile) unless defined $src_fields;
     my $src_sect = $src_fields->{'Section'} || 'unknown';
     my $src_prio = $src_fields->{'Priority'} || 'unknown';
@@ -252,7 +252,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 	    my $dep;
 	    my $type = field_get_dep_type($_);
 	    $dep = deps_parse($v, build_dep => 1, union => $type eq 'union');
-	    error(_g('error occurred while parsing %s'), $_) unless defined $dep;
+	    error(g_('error occurred while parsing %s'), $_) unless defined $dep;
 	    my $facts = Dpkg::Deps::KnownFacts->new();
 	    $dep->simplify_deps($facts);
 	    $dep->sort() if $type eq 'union';
@@ -281,7 +281,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
             # If the string does not contain brackets then it is using the
             # old syntax. Emit a fatal error.
             if ($profile !~ m/^\s*<.*>\s*$/) {
-                error(_g('binary package stanza %s is using an obsolete ' .
+                error(g_('binary package stanza %s is using an obsolete ' .
                          'Build-Profiles field syntax'), $p);
             }
 
@@ -309,10 +309,10 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
                     push(@sourcearch, $v) unless $archadded{$v}++;
                 } else {
                     for my $a (split(/\s+/, $v)) {
-                        error(_g("`%s' is not a legal architecture string"),
+                        error(g_("`%s' is not a legal architecture string"),
                               $a)
                             unless $a =~ /^[\w-]+$/;
-                        error(_g('architecture %s only allowed on its ' .
+                        error(g_('architecture %s only allowed on its ' .
                                  "own (list for package %s is `%s')"),
                               $a, $p, $a)
                             if $a eq 'any' or $a eq 'all';
@@ -327,7 +327,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 	}
     }
     unless (scalar(@pkglist)) {
-	error(_g("%s doesn't list any binary package"), $controlfile);
+	error(g_("%s doesn't list any binary package"), $controlfile);
     }
     if (any { $_ eq 'any' } @sourcearch) {
         # If we encounter one 'any' then the other arches become insignificant
@@ -366,7 +366,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
             error($error) unless $ok;
 	    $fields->{$_} = $v;
 	} elsif (m/^Binary-Only$/) {
-	    error(_g('building source for a binary-only release'))
+	    error(g_('building source for a binary-only release'))
 	        if $v eq 'yes' and $options{opmode} eq 'build';
 	} elsif (m/^Maintainer$/i) {
             # Do not replace the field coming from the source entry
@@ -385,14 +385,14 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     if (not defined $build_format) {
 	if (-e "$dir/debian/source/format") {
 	    open(my $format_fh, '<', "$dir/debian/source/format")
-	        or syserr(_g('cannot read %s'), "$dir/debian/source/format");
+	        or syserr(g_('cannot read %s'), "$dir/debian/source/format");
 	    $build_format = <$format_fh>;
 	    chomp($build_format) if defined $build_format;
-	    error(_g('%s is empty'), "$dir/debian/source/format")
+	    error(g_('%s is empty'), "$dir/debian/source/format")
 		unless defined $build_format and length $build_format;
 	    close($format_fh);
 	} else {
-	    warning(_g('no source format specified in %s, ' .
+	    warning(g_('no source format specified in %s, ' .
 	               'see dpkg-source(1)'), 'debian/source/format')
 		if $options{opmode} eq 'build';
 	    $build_format = '1.0';
@@ -420,17 +420,17 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 
     # Verify pre-requisites are met
     my ($res, $msg) = $srcpkg->can_build($dir);
-    error(_g("can't build with source format '%s': %s"), $build_format, $msg) unless $res;
+    error(g_("can't build with source format '%s': %s"), $build_format, $msg) unless $res;
 
     # Only -b left
-    info(_g("using source format `%s'"), $fields->{'Format'});
+    info(g_("using source format `%s'"), $fields->{'Format'});
     run_vendor_hook('before-source-build', $srcpkg);
     # Build the files (.tar.gz, .diff.gz, etc)
     $srcpkg->build($dir);
 
     # Write the .dsc
     my $dscname = $srcpkg->get_basename(1) . '.dsc';
-    info(_g('building %s in %s'), get_source_package(), $dscname);
+    info(g_('building %s in %s'), get_source_package(), $dscname);
     $srcpkg->write_dsc(filename => $dscname,
 		       remove => \%remove,
 		       override => \%override,
@@ -441,15 +441,15 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 
     # Check command line
     unless (scalar(@ARGV)) {
-        usageerr(_g('--%s needs at least one argument, the .dsc'),
+        usageerr(g_('--%s needs at least one argument, the .dsc'),
                  $options{opmode});
     }
     if (scalar(@ARGV) > 2) {
-        usageerr(_g('--%s takes no more than two arguments'), $options{opmode});
+        usageerr(g_('--%s takes no more than two arguments'), $options{opmode});
     }
     my $dsc = shift(@ARGV);
     if (-d $dsc) {
-        usageerr(_g('--%s needs the .dsc file as first argument, not a directory'),
+        usageerr(g_('--%s needs the .dsc file as first argument, not a directory'),
                  $options{opmode});
     }
 
@@ -466,7 +466,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     if (@ARGV) {
 	$newdirectory = File::Spec->catdir(shift(@ARGV));
 	if (-e $newdirectory) {
-	    error(_g('unpack target exists: %s'), $newdirectory);
+	    error(g_('unpack target exists: %s'), $newdirectory);
 	}
     }
 
@@ -476,16 +476,16 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
             $srcpkg->check_signature();
         } else {
             if ($options{require_valid_signature}) {
-                error(_g("%s doesn't contain a valid OpenPGP signature"), $dsc);
+                error(g_("%s doesn't contain a valid OpenPGP signature"), $dsc);
             } else {
-                warning(_g('extracting unsigned source package (%s)'), $dsc);
+                warning(g_('extracting unsigned source package (%s)'), $dsc);
             }
         }
         $srcpkg->check_checksums();
     }
 
     # Unpack the source package (delegated to Dpkg::Source::Package::*)
-    info(_g('extracting %s in %s'), $srcpkg->{fields}{'Source'}, $newdirectory);
+    info(g_('extracting %s in %s'), $srcpkg->{fields}{'Source'}, $newdirectory);
     $srcpkg->extract($newdirectory);
 
     exit(0);
@@ -500,7 +500,7 @@ sub set_testsuite_field
     if (-e "$dir/debian/tests/control") {
         $testsuite{autopkgtest} = 1;
     } elsif ($testsuite{autopkgtest}) {
-        warning(_g('%s field contains value %s, but no tests control file %s'),
+        warning(g_('%s field contains value %s, but no tests control file %s'),
                 'Testsuite', 'autopkgtest', 'debian/tests/control');
         delete $testsuite{autopkgtest};
     }
@@ -511,25 +511,25 @@ sub setopmode {
     my $opmode = shift;
 
     if (defined($options{opmode})) {
-        usageerr(_g('two commands specified: --%s and --%s'),
+        usageerr(g_('two commands specified: --%s and --%s'),
                  $options{opmode}, $opmode);
     }
     $options{opmode} = $opmode;
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    print _g('
+    print g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] <command>')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
   -x, --extract <filename>.dsc [<output-dir>]
                            extract source package.
@@ -537,7 +537,7 @@ sub usage {
       --print-format <dir> print the format to be used for the source package.
       --commit [<dir> [<patch-name>]]
                            store upstream changes in a new patch.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Build options:
   -c<control-file>         get control info from this file.
   -l<changelog-file>       get per-version info from this file.
@@ -556,17 +556,17 @@ sub usage {
                              supported are: %s).
   -z<level>                compression level to use (defaults to '%d',
                              supported are: '1'-'9', 'best', 'fast')")
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Extract options:
   --no-copy                don't copy .orig tarballs
   --no-check               don't check signature and checksums before unpacking
   --require-valid-signature abort if the package doesn't have a valid signature
   --ignore-bad-version     allow bad source package versions.")
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'General options:
   -?, --help               show this help message.
       --version            show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'More options are available but they depend on the source package format.
 See dpkg-source(1) for more info.') . "\n",
     $Dpkg::PROGNAME,

+ 11 - 11
scripts/dpkg-vendor.pl

@@ -29,25 +29,25 @@ use Dpkg::Vendor qw(get_vendor_dir get_vendor_info get_current_vendor);
 textdomain('dpkg-dev');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
+    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
-    printf _g('
+    printf g_('
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 ');
 }
 
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] [<command>]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
   --is <vendor>           returns true if current vendor is <vendor>.
   --derives-from <vendor> returns true if current vendor derives from <vendor>.
   --query <field>         print the content of the vendor-specific field.
   --help                  show this help message.
   --version               show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
   --vendor <vendor>       assume <vendor> is the current vendor.')
     . "\n", $Dpkg::PROGNAME;
@@ -59,13 +59,13 @@ while (@ARGV) {
     $_ = shift(@ARGV);
     if (m/^--vendor$/) {
         $vendor = shift(@ARGV);
-        usageerr(_g('%s needs a parameter'), $_) unless defined $vendor;
+        usageerr(g_('%s needs a parameter'), $_) unless defined $vendor;
     } elsif (m/^--(is|derives-from|query)$/) {
-        usageerr(_g('two commands specified: --%s and --%s'), $1, $action)
+        usageerr(g_('two commands specified: --%s and --%s'), $1, $action)
             if defined($action);
         $action = $1;
         $param = shift(@ARGV);
-        usageerr(_g('%s needs a parameter'), $_) unless defined $param;
+        usageerr(g_('%s needs a parameter'), $_) unless defined $param;
     } elsif (m/^-(?:\?|-help)$/) {
         usage();
         exit 0;
@@ -73,18 +73,18 @@ while (@ARGV) {
         version();
         exit 0;
     } else {
-	usageerr(_g("unknown option \`%s'"), $_);
+	usageerr(g_("unknown option \`%s'"), $_);
     }
 }
 
-usageerr(_g('need an action option')) unless defined($action);
+usageerr(g_('need an action option')) unless defined($action);
 
 # Uses $ENV{DEB_VENDOR} if set
 $vendor //= get_current_vendor();
 
 my $info = get_vendor_info($vendor);
 unless (defined($info)) {
-    error(_g("vendor %s doesn't exist in %s"), $vendor || 'default',
+    error(g_("vendor %s doesn't exist in %s"), $vendor || 'default',
           get_vendor_dir());
 }
 

+ 1 - 1
scripts/po/Makevars

@@ -8,7 +8,7 @@ subdir = scripts/po
 top_builddir = ../..
 
 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword --keyword=_g --keyword=P_:1,2
+XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword --keyword=g_ --keyword=P_:1,2
 
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding