Просмотр исходного кода

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
Родитель
Сommit
6e56dce419
66 измененных файлов с 783 добавлено и 765 удалено
  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.
     independent of the current locale.
   * Add support for arch-bits and arch-endian dpkg-gensymbols tags.
   * Add support for arch-bits and arch-endian dpkg-gensymbols tags.
     Closes: #630342
     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
  -- 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();
 	$gcc_host_gnu_type = get_gcc_host_gnu_type();
 
 
 	if ($gcc_host_gnu_type eq '') {
 	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)'));
 	               'default (native compilation)'));
 	} else {
 	} else {
 	    my (@host_archtriplet) = gnutriplet_to_debtriplet($gcc_host_gnu_type);
 	    my (@host_archtriplet) = gnutriplet_to_debtriplet($gcc_host_gnu_type);
@@ -103,7 +103,7 @@ my %debarch_to_debtriplet;
 	    if (defined $host_arch) {
 	    if (defined $host_arch) {
 		$gcc_host_gnu_type = debtriplet_to_gnutriplet(@host_archtriplet);
 		$gcc_host_gnu_type = debtriplet_to_gnutriplet(@host_archtriplet);
 	    } else {
 	    } 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);
 		           'default (native compilation)'), $gcc_host_gnu_type);
 		$gcc_host_gnu_type = '';
 		$gcc_host_gnu_type = '';
 	    }
 	    }
@@ -149,7 +149,7 @@ sub read_cputable
     local $/ = "\n";
     local $/ = "\n";
 
 
     open my $cputable_fh, '<', "$Dpkg::DATADIR/cputable"
     open my $cputable_fh, '<', "$Dpkg::DATADIR/cputable"
-	or syserr(_g('cannot open %s'), 'cputable');
+	or syserr(g_('cannot open %s'), 'cputable');
     while (<$cputable_fh>) {
     while (<$cputable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
 	    $cputable{$1} = $2;
 	    $cputable{$1} = $2;
@@ -173,7 +173,7 @@ sub read_ostable
     local $/ = "\n";
     local $/ = "\n";
 
 
     open my $ostable_fh, '<', "$Dpkg::DATADIR/ostable"
     open my $ostable_fh, '<', "$Dpkg::DATADIR/ostable"
-	or syserr(_g('cannot open %s'), 'ostable');
+	or syserr(g_('cannot open %s'), 'ostable');
     while (<$ostable_fh>) {
     while (<$ostable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) {
 	    $ostable{$1} = $2;
 	    $ostable{$1} = $2;
@@ -206,7 +206,7 @@ sub abitable_load()
         }
         }
         close $abitable_fh;
         close $abitable_fh;
     } elsif ($! != ENOENT) {
     } elsif ($! != ENOENT) {
-        syserr(_g('cannot open %s'), 'abitable');
+        syserr(g_('cannot open %s'), 'abitable');
     }
     }
 
 
     $abitable_loaded = 1;
     $abitable_loaded = 1;
@@ -223,7 +223,7 @@ sub read_triplettable()
     local $/ = "\n";
     local $/ = "\n";
 
 
     open my $triplettable_fh, '<', "$Dpkg::DATADIR/triplettable"
     open my $triplettable_fh, '<', "$Dpkg::DATADIR/triplettable"
-	or syserr(_g('cannot open %s'), 'triplettable');
+	or syserr(g_('cannot open %s'), 'triplettable');
     while (<$triplettable_fh>) {
     while (<$triplettable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)/) {
 	if (m/^(?!\#)(\S+)\s+(\S+)/) {
 	    my $debtriplet = $1;
 	    my $debtriplet = $1;

+ 3 - 3
scripts/Dpkg/BuildFlags.pm

@@ -313,7 +313,7 @@ sub update_from_conffile {
     local $_;
     local $_;
 
 
     return unless -e $file;
     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>) {
     while (<$conf_fh>) {
         chomp;
         chomp;
         next if /^\s*#/; # Skip comments
         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) {
         if (/^(append|prepend|set|strip)\s+(\S+)\s+(\S.*\S)\s*$/i) {
             my ($op, $flag, $value) = ($1, $2, $3);
             my ($op, $flag, $value) = ($1, $2, $3);
             unless (exists $self->{flags}->{$flag}) {
             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} = '';
                 $self->{flags}->{$flag} = '';
             }
             }
             if (lc($op) eq 'set') {
             if (lc($op) eq 'set') {
@@ -334,7 +334,7 @@ sub update_from_conffile {
                 $self->prepend($flag, $value, $src);
                 $self->prepend($flag, $value, $src);
             }
             }
         } else {
         } 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);
     close($conf_fh);

+ 1 - 1
scripts/Dpkg/BuildOptions.pm

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

+ 20 - 20
scripts/Dpkg/Changelog.pm

@@ -167,9 +167,9 @@ sub get_parse_errors {
 	my $res = '';
 	my $res = '';
 	foreach my $e (@{$self->{parse_errors}}) {
 	foreach my $e (@{$self->{parse_errors}}) {
 	    if ($e->[3]) {
 	    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 {
 	    } else {
-		$res .= report(_g('warning'), _g('%s(l%s): %s'), @$e);
+		$res .= report(g_('warning'), g_('%s(l%s): %s'), @$e);
 	    }
 	    }
 	}
 	}
 	return $res;
 	return $res;
@@ -217,7 +217,7 @@ sub __sanity_check_range {
     my $data = $self->{data};
     my $data = $self->{data};
 
 
     if (defined($r->{offset}) and not defined($r->{count})) {
     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};
 	delete $r->{offset};
     }
     }
 
 
@@ -226,7 +226,7 @@ sub __sanity_check_range {
         (defined($r->{from}) || defined($r->{since}) ||
         (defined($r->{from}) || defined($r->{since}) ||
 	 defined($r->{to}) || defined($r->{until})))
 	 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};
 		   'range option')) if $self->{verbose};
 	delete $r->{from};
 	delete $r->{from};
 	delete $r->{since};
 	delete $r->{since};
@@ -234,12 +234,12 @@ sub __sanity_check_range {
 	delete $r->{until};
 	delete $r->{until};
     }
     }
     if (defined($r->{from}) && defined($r->{since})) {
     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};
 		   "'since'")) if $self->{verbose};
 	delete $r->{from};
 	delete $r->{from};
     }
     }
     if (defined($r->{to}) && defined($r->{until})) {
     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};
 		   "'until'")) if $self->{verbose};
 	delete $r->{to};
 	delete $r->{to};
     }
     }
@@ -251,8 +251,8 @@ sub __sanity_check_range {
         push @versions, $entry->get_version()->as_string();
         push @versions, $entry->get_version()->as_string();
     }
     }
     if ((defined($r->{since}) and not exists $versions{$r->{since}})) {
     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) {
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_LT, $r->{since})) {
             if (version_compare_relation($v, REL_LT, $r->{since})) {
                 $r->{since} = $v;
                 $r->{since} = $v;
@@ -261,14 +261,14 @@ sub __sanity_check_range {
         }
         }
         if (not exists $versions{$r->{since}}) {
         if (not exists $versions{$r->{since}}) {
             # No version was earlier, include all
             # 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};
             delete $r->{since};
             $r->{from} = $versions[-1];
             $r->{from} = $versions[-1];
         }
         }
     }
     }
     if ((defined($r->{from}) and not exists $versions{$r->{from}})) {
     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;
         my $oldest;
         foreach my $v (@versions) {
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_GT, $r->{from})) {
             if (version_compare_relation($v, REL_GT, $r->{from})) {
@@ -278,13 +278,13 @@ sub __sanity_check_range {
         if (defined($oldest)) {
         if (defined($oldest)) {
             $r->{from} = $oldest;
             $r->{from} = $oldest;
         } else {
         } 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
             delete $r->{from}; # No version was oldest
         }
         }
     }
     }
     if (defined($r->{until}) and not exists $versions{$r->{until}}) {
     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;
         my $oldest;
         foreach my $v (@versions) {
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_GT, $r->{until})) {
             if (version_compare_relation($v, REL_GT, $r->{until})) {
@@ -294,13 +294,13 @@ sub __sanity_check_range {
         if (defined($oldest)) {
         if (defined($oldest)) {
             $r->{until} = $oldest;
             $r->{until} = $oldest;
         } else {
         } 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
             delete $r->{until}; # No version was oldest
         }
         }
     }
     }
     if (defined($r->{to}) and not exists $versions{$r->{to}}) {
     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) {
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_LT, $r->{to})) {
             if (version_compare_relation($v, REL_LT, $r->{to})) {
                 $r->{to} = $v;
                 $r->{to} = $v;
@@ -309,17 +309,17 @@ sub __sanity_check_range {
         }
         }
         if (not exists $versions{$r->{to}}) {
         if (not exists $versions{$r->{to}}) {
             # No version was earlier
             # 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};
             delete $r->{to};
         }
         }
     }
     }
 
 
     if (defined($r->{since}) and $data->[0]->get_version() eq $r->{since}) {
     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};
 	delete $r->{since};
     }
     }
     if (defined($r->{until}) and $data->[-1]->get_version() eq $r->{until}) {
     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};
 	delete $r->{until};
     }
     }
     ## use critic
     ## 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 Dpkg::Changelog::Entry::Debian qw(match_header match_trailer);
 
 
 use constant {
 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
 =over 4
@@ -88,7 +88,7 @@ sub parse {
 	if (match_header($_)) {
 	if (match_header($_)) {
 	    unless ($expect eq FIRST_HEADING || $expect eq NEXT_OR_EOF) {
 	    unless ($expect eq FIRST_HEADING || $expect eq NEXT_OR_EOF) {
 		$self->parse_error($file, $.,
 		$self->parse_error($file, $.,
-		    sprintf(_g('found start of entry where expected %s'),
+		    sprintf(g_('found start of entry where expected %s'),
 		    $expect), "$_");
 		    $expect), "$_");
 	    }
 	    }
 	    unless ($entry->is_empty) {
 	    unless ($entry->is_empty) {
@@ -125,11 +125,11 @@ sub parse {
 	    # hit it for the first time
 	    # hit it for the first time
 	    $self->set_unparsed_tail("$_\n" . file_slurp($fh));
 	    $self->set_unparsed_tail("$_\n" . file_slurp($fh));
 	} elsif (m/^\S/) {
 	} elsif (m/^\S/) {
-	    $self->parse_error($file, $., _g('badly formatted heading line'), "$_");
+	    $self->parse_error($file, $., g_('badly formatted heading line'), "$_");
 	} elsif (match_trailer($_)) {
 	} elsif (match_trailer($_)) {
 	    unless ($expect eq CHANGES_OR_TRAILER) {
 	    unless ($expect eq CHANGES_OR_TRAILER) {
 		$self->parse_error($file, $.,
 		$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->set_part('trailer', $_);
 	    $entry->extend_part('blank_after_changes', [ @blanklines ]);
 	    $entry->extend_part('blank_after_changes', [ @blanklines ]);
@@ -139,10 +139,10 @@ sub parse {
 	    }
 	    }
 	    $expect = NEXT_OR_EOF;
 	    $expect = NEXT_OR_EOF;
 	} elsif (m/^ \-\-/) {
 	} 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)/) {
 	} elsif (m/^\s{2,}(?:\S)/) {
 	    unless ($expect eq START_CHANGES or $expect eq CHANGES_OR_TRAILER) {
 	    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), "$_");
 		    ' where expected %s'), $expect), "$_");
 		if ($expect eq NEXT_OR_EOF and not $entry->is_empty) {
 		if ($expect eq NEXT_OR_EOF and not $entry->is_empty) {
 		    # lets assume we have missed the actual header line
 		    # lets assume we have missed the actual header line
@@ -164,11 +164,11 @@ sub parse {
 		next;
 		next;
 	    } elsif ($expect ne CHANGES_OR_TRAILER) {
 	    } elsif ($expect ne CHANGES_OR_TRAILER) {
 		$self->parse_error($file, $.,
 		$self->parse_error($file, $.,
-		    sprintf(_g('found blank line where expected %s'), $expect));
+		    sprintf(g_('found blank line where expected %s'), $expect));
 	    }
 	    }
 	    push @blanklines, $_;
 	    push @blanklines, $_;
 	} else {
 	} 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) {
 	    unless ($expect eq START_CHANGES or $expect eq CHANGES_OR_TRAILER) {
 		# lets assume change data if we expected it
 		# lets assume change data if we expected it
 		$entry->extend_part('changes', [ @blanklines, $_]);
 		$entry->extend_part('changes', [ @blanklines, $_]);
@@ -179,7 +179,7 @@ sub parse {
     }
     }
 
 
     unless ($expect eq NEXT_OR_EOF) {
     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));
 					      $expect));
     }
     }
     unless ($entry->is_empty) {
     unless ($entry->is_empty) {

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

@@ -123,31 +123,31 @@ sub check_header {
 	my %optdone;
 	my %optdone;
 	foreach my $opt (split(/\s*,\s*/, $options)) {
 	foreach my $opt (split(/\s*,\s*/, $options)) {
 	    unless ($opt =~ m/^([-0-9a-z]+)\=\s*(.*\S)$/i) {
 	    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;
 		next;
 	    }
 	    }
 	    my ($k, $v) = (field_capitalize($1), $2);
 	    my ($k, $v) = (field_capitalize($1), $2);
 	    if ($optdone{$k}) {
 	    if ($optdone{$k}) {
-		push @errors, sprintf(_g('repeated key-value %s'), $k);
+		push @errors, sprintf(g_('repeated key-value %s'), $k);
 	    }
 	    }
 	    $optdone{$k} = 1;
 	    $optdone{$k} = 1;
 	    if ($k eq 'Urgency') {
 	    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);
 		    unless ($v =~ m/^([-0-9a-z]+)((\s+.*)?)$/i);
 	    } elsif ($k eq 'Binary-Only') {
 	    } 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');
 		    unless ($v eq 'yes');
 	    } elsif ($k =~ m/^X[BCS]+-/i) {
 	    } elsif ($k =~ m/^X[BCS]+-/i) {
 	    } else {
 	    } 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);
 	my ($ok, $msg) = version_check($version);
 	unless ($ok) {
 	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 {
     } 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;
     return @errors;
 }
 }
@@ -157,13 +157,13 @@ sub check_trailer {
     my @errors;
     my @errors;
     if (defined($self->{trailer}) and $self->{trailer} =~ $regex_trailer) {
     if (defined($self->{trailer}) and $self->{trailer} =~ $regex_trailer) {
 	if ($3 ne '  ') {
 	if ($3 ne '  ') {
-	    push @errors, _g('badly formatted trailer line');
+	    push @errors, g_('badly formatted trailer line');
 	}
 	}
 	unless (defined str2time($4)) {
 	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 {
     } 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;
     return @errors;
 }
 }

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

@@ -103,11 +103,11 @@ sub changelog_parse {
 	local $_;
 	local $_;
 
 
 	open(my $format_fh, '-|', 'tail', '-n', '40', $changelogfile)
 	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>) {
 	while (<$format_fh>) {
 	    $format = $1 if m/\schangelog-format:\s+([0-9a-z]+)\W/;
 	    $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
     # Find the right changelog parser
@@ -119,10 +119,10 @@ sub changelog_parse {
 	    $parser = $candidate;
 	    $parser = $candidate;
 	    last;
 	    last;
 	} else {
 	} 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
     # Create the arguments for the changelog parser
     my @exec = ($parser, "-l$changelogfile");
     my @exec = ($parser, "-l$changelogfile");
@@ -139,19 +139,19 @@ sub changelog_parse {
 
 
     # Fork and call the parser
     # Fork and call the parser
     my $pid = open(my $parser_fh, '-|');
     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) {
     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
     # Get the output into several Dpkg::Control objects
     my (@res, $fields);
     my (@res, $fields);
     while (1) {
     while (1) {
         $fields = Dpkg::Control::Changelog->new();
         $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;
 	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) {
     if (wantarray) {
 	return @res;
 	return @res;
     } else {
     } else {

+ 7 - 7
scripts/Dpkg/Checksums.pm

@@ -170,10 +170,10 @@ sub add_from_file {
     }
     }
 
 
     push @{$self->{files}}, $key unless exists $self->{size}{$key};
     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
     if (not $opts{update} and exists $self->{size}{$key} and
         $self->{size}{$key} != $s[7]) {
         $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});
 	      $file, $s[7], $self->{size}{$key});
     }
     }
     $self->{size}{$key} = $s[7];
     $self->{size}{$key} = $s[7];
@@ -187,12 +187,12 @@ sub add_from_file {
 	    my $newsum = $1;
 	    my $newsum = $1;
 	    if (not $opts{update} and exists $self->{checksums}{$key}{$alg} and
 	    if (not $opts{update} and exists $self->{checksums}{$key}{$alg} and
 		$self->{checksums}{$key}{$alg} ne $newsum) {
 		$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);
 		      $file, $newsum, $self->{checksums}{$key}{$alg}, $alg);
 	    }
 	    }
 	    $self->{checksums}{$key}{$alg} = $newsum;
 	    $self->{checksums}{$key}{$alg} = $newsum;
 	} else {
 	} 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) {
     for my $checksum (split /\n */, $fieldtext) {
 	next if $checksum eq '';
 	next if $checksum eq '';
 	unless ($checksum =~ m/^($regex)\s+(\d+)\s+($rx_fname)$/) {
 	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);
 		  $alg, $checksum);
 	}
 	}
 	my ($sum, $size, $file) = ($1, $2, $3);
 	my ($sum, $size, $file) = ($1, $2, $3);
 	if (not $opts{update} and  exists($checksums->{$file}{$alg})
 	if (not $opts{update} and  exists($checksums->{$file}{$alg})
 	    and $checksums->{$file}{$alg} ne $sum) {
 	    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);
 		  $checksums->{$file}{$alg}, $sum, $file);
 	}
 	}
 	if (not $opts{update} and exists $self->{size}{$file}
 	if (not $opts{update} and exists $self->{size}{$file}
 	    and $self->{size}{$file} != $size) {
 	    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);
 		  $self->{size}{$file}, $size, $file);
 	}
 	}
 	push @{$self->{files}}, $file unless exists $self->{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 {
 sub compression_set_default {
     my ($method) = @_;
     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);
             unless compression_is_supported($method);
     $default_compression = $method;
     $default_compression = $method;
 }
 }
@@ -205,7 +205,7 @@ sub compression_get_default_level {
 
 
 sub compression_set_default_level {
 sub compression_set_default_level {
     my ($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);
         if defined($level) and not compression_is_valid_level($level);
     $default_compression_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);
 		to_file => $self->get_filename(), %opts);
     } else {
     } else {
 	CORE::open($filehandle, '>', $self->get_filename)
 	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->{mode} = 'w';
     *$self->{file} = $filehandle;
     *$self->{file} = $filehandle;
@@ -419,7 +419,7 @@ sub open_for_read {
         *$self->{allow_sigpipe} = 1;
         *$self->{allow_sigpipe} = 1;
     } else {
     } else {
 	CORE::open($filehandle, '<', $self->get_filename)
 	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->{mode} = 'r';
     *$self->{file} = $filehandle;
     *$self->{file} = $filehandle;

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

@@ -70,7 +70,7 @@ B<Dpkg::Compression>).
 
 
 sub set_compression {
 sub set_compression {
     my ($self, $method) = @_;
     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);
 	    unless compression_is_supported($method);
     $self->{compression} = $method;
     $self->{compression} = $method;
 }
 }
@@ -85,7 +85,7 @@ B<Dpkg::Compression>).
 
 
 sub set_compression_level {
 sub set_compression_level {
     my ($self, $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);
 	    unless compression_is_valid_level($level);
     $self->{compression_level} = $level;
     $self->{compression_level} = $level;
 }
 }
@@ -121,7 +121,7 @@ sub get_uncompress_cmdline {
 sub _sanity_check {
 sub _sanity_check {
     my ($self, %opts) = @_;
     my ($self, %opts) = @_;
     # Check for proper cleaning before new start
     # 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};
 	    if $self->{pid};
     # Check options
     # Check options
     my $to = my $from = 0;
     my $to = my $from = 0;

+ 2 - 2
scripts/Dpkg/Conf.pm

@@ -105,7 +105,7 @@ sub parse {
 	# Skip empty lines and comments
 	# Skip empty lines and comments
 	next if /^#/ or length == 0;
 	next if /^#/ or length == 0;
 	if (/^-[^-]/ and not $self->{allow_short}) {
 	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;
 	    next;
 	}
 	}
 	if (/^([^=]+)(?:=(.*))?$/) {
 	if (/^([^=]+)(?:=(.*))?$/) {
@@ -119,7 +119,7 @@ sub parse {
 	    }
 	    }
 	    $count++;
 	    $count++;
 	} else {
 	} 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;
     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->{allow_pgp} = ($t & (CTRL_PKG_SRC | CTRL_FILE_CHANGES)) ? 1 : 0;
         $$self->{drop_empty} = ($t & (CTRL_INFO_PKG | CTRL_INFO_SRC)) ?  0 : 1;
         $$self->{drop_empty} = ($t & (CTRL_INFO_PKG | CTRL_INFO_SRC)) ?  0 : 1;
         if ($t == CTRL_INFO_SRC) {
         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) {
         } 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) {
         } elsif ($t == CTRL_CHANGELOG) {
-            $$self->{name} = _g('parsed version of changelog');
+            $$self->{name} = g_('parsed version of changelog');
         } elsif ($t == CTRL_INDEX_SRC) {
         } 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) {
         } 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) {
         } elsif ($t == CTRL_PKG_SRC) {
-            $$self->{name} = sprintf(_g('%s file'), '.dsc');
+            $$self->{name} = sprintf(g_('%s file'), '.dsc');
         } elsif ($t == CTRL_PKG_DEB) {
         } 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) {
         } elsif ($t == CTRL_FILE_CHANGES) {
-            $$self->{name} = sprintf(_g('%s file'), '.changes');
+            $$self->{name} = sprintf(g_('%s file'), '.changes');
         } elsif ($t == CTRL_FILE_VENDOR) {
         } elsif ($t == CTRL_FILE_VENDOR) {
-            $$self->{name} = _g('vendor file');
+            $$self->{name} = g_('vendor file');
         } elsif ($t == CTRL_FILE_STATUS) {
         } 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}));
         $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;
 	    return $field;
 	}
 	}
     } elsif (not field_is_allowed_in($field, $from_type)) {
     } 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;
     return;
 }
 }

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

@@ -174,7 +174,7 @@ sub parse_error {
     my ($self, $file, $msg) = (shift, shift, shift);
     my ($self, $file, $msg) = (shift, shift, shift);
 
 
     $msg = sprintf($msg, @_) if (@_);
     $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)
 =item $c->parse($fh, $description)
@@ -204,11 +204,11 @@ sub parse {
 	    $parabody = 1;
 	    $parabody = 1;
 	    my ($name, $value) = ($1, $2);
 	    my ($name, $value) = ($1, $2);
 	    if ($name =~ m/^-/) {
 	    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}) {
 	    if (exists $self->{$name}) {
 		unless ($$self->{allow_duplicate}) {
 		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;
 	    $self->{$name} = $value;
@@ -216,7 +216,7 @@ sub parse {
 	} elsif (m/^\s(\s*\S.*)$/) {
 	} elsif (m/^\s(\s*\S.*)$/) {
 	    my $line = $1;
 	    my $line = $1;
 	    unless (defined($cf)) {
 	    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 =~ /^\.+$/) {
 	    if ($line =~ /^\.+$/) {
 		$line = substr $line, 1;
 		$line = substr $line, 1;
@@ -230,19 +230,19 @@ sub parse {
 		    last if m/^\s*$/;
 		    last if m/^\s*$/;
 		}
 		}
 	    } else {
 	    } 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-----$/)) {
 	} elsif (length == 0 || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----$/)) {
 	    if ($expect_pgp_sig) {
 	    if ($expect_pgp_sig) {
 		# Skip empty lines
 		# Skip empty lines
 		$_ = <$fh> while defined && m/^\s*$/;
 		$_ = <$fh> while defined && m/^\s*$/;
 		unless (length) {
 		unless (length) {
-		    $self->parse_error($desc, _g('expected OpenPGP signature, ' .
+		    $self->parse_error($desc, g_('expected OpenPGP signature, ' .
 		                                 'found EOF after blank line'));
 		                                 'found EOF after blank line'));
 		}
 		}
 		s/\s*\n$//;
 		s/\s*\n$//;
 		unless (m/^-----BEGIN PGP SIGNATURE-----$/) {
 		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'"), $_);
 		                                 "found something else \`%s'"), $_);
                 }
                 }
 		# Skip OpenPGP signature
 		# Skip OpenPGP signature
@@ -251,7 +251,7 @@ sub parse {
 		    last if m/^-----END PGP SIGNATURE-----$/;
 		    last if m/^-----END PGP SIGNATURE-----$/;
 		}
 		}
 		unless (defined) {
 		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
 		# This does not mean the signature is correct, that needs to
 		# be verified by gnupg.
 		# be verified by gnupg.
@@ -260,12 +260,12 @@ sub parse {
 	    last; # Finished parsing one block
 	    last; # Finished parsing one block
 	} else {
 	} else {
 	    $self->parse_error($desc,
 	    $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}) {
     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);
     return defined($cf);
@@ -365,7 +365,7 @@ sub output {
 	    # Print it out
 	    # Print it out
             if ($fh) {
             if ($fh) {
 	        print { $fh } $kv
 	        print { $fh } $kv
-	            or syserr(_g('write error on control data'));
+	            or syserr(g_('write error on control data'));
             }
             }
 	    $str .= $kv if defined wantarray;
 	    $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);
     return if not $cdata->parse($fh, $desc);
     $self->{source} = $cdata;
     $self->{source} = $cdata;
     unless (exists $cdata->{Source}) {
     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) {
     while (1) {
 	$cdata = Dpkg::Control->new(type => CTRL_INFO_PKG);
 	$cdata = Dpkg::Control->new(type => CTRL_INFO_PKG);
         last if not $cdata->parse($fh, $desc);
         last if not $cdata->parse($fh, $desc);
 	push @{$self->{packages}}, $cdata;
 	push @{$self->{packages}}, $cdata;
 	unless (exists $cdata->{Package}) {
 	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');
 	                        'Package');
 	}
 	}
 	unless (exists $cdata->{Architecture}) {
 	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');
 	                        'Architecture');
 	}
 	}
 
 

+ 2 - 2
scripts/Dpkg/Deps.pm

@@ -270,7 +270,7 @@ sub deps_parse {
 	                                             build_dep =>
 	                                             build_dep =>
 	                                             $options{build_dep});
 	                                             $options{build_dep});
 	    if (not defined $dep_simple->{package}) {
 	    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;
 		return;
 	    }
 	    }
 	    $dep_simple->{arches} = undef if not $options{use_arch};
 	    $dep_simple->{arches} = undef if not $options{use_arch};
@@ -302,7 +302,7 @@ sub deps_parse {
     }
     }
     foreach my $dep (@dep_list) {
     foreach my $dep (@dep_list) {
         if ($options{union} and not $dep->isa('Dpkg::Deps::Simple')) {
         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;
             return;
         }
         }
         $dep_and->add($dep);
         $dep_and->add($dep);

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

@@ -67,11 +67,11 @@ sub parse {
             $file{section} = $2;
             $file{section} = $2;
             $file{priority} = $3;
             $file{priority} = $3;
         } else {
         } 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}}) {
         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}, $.);
                     $file{filename}, $.);
         } else {
         } else {
             $count++;
             $count++;

+ 9 - 9
scripts/Dpkg/ErrorHandling.pm

@@ -51,28 +51,28 @@ sub report(@)
 
 
 sub info($;@)
 sub info($;@)
 {
 {
-    print { $info_fh } report(_g('info'), @_) if (!$quiet_warnings);
+    print { $info_fh } report(g_('info'), @_) if (!$quiet_warnings);
 }
 }
 
 
 sub warning($;@)
 sub warning($;@)
 {
 {
-    warn report(_g('warning'), @_) if (!$quiet_warnings);
+    warn report(g_('warning'), @_) if (!$quiet_warnings);
 }
 }
 
 
 sub syserr($;@)
 sub syserr($;@)
 {
 {
     my $msg = shift;
     my $msg = shift;
-    die report(_g('error'), "$msg: $!", @_);
+    die report(g_('error'), "$msg: $!", @_);
 }
 }
 
 
 sub error($;@)
 sub error($;@)
 {
 {
-    die report(_g('error'), @_);
+    die report(g_('error'), @_);
 }
 }
 
 
 sub errormsg($;@)
 sub errormsg($;@)
 {
 {
-    print { *STDERR } report(_g('error'), @_);
+    print { *STDERR } report(g_('error'), @_);
 }
 }
 
 
 sub subprocerr(@)
 sub subprocerr(@)
@@ -84,15 +84,15 @@ sub subprocerr(@)
     require POSIX;
     require POSIX;
 
 
     if (POSIX::WIFEXITED($?)) {
     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($?)) {
     } elsif (POSIX::WIFSIGNALED($?)) {
-	error(_g('%s died from signal %s'), $p, POSIX::WTERMSIG($?));
+	error(g_('%s died from signal %s'), $p, POSIX::WTERMSIG($?));
     } else {
     } 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(@)
 sub usageerr(@)
 {
 {

+ 3 - 3
scripts/Dpkg/File.pm

@@ -37,14 +37,14 @@ sub file_lock($$) {
     # be installed alongside.
     # be installed alongside.
     eval 'use File::FcntlLock';
     eval 'use File::FcntlLock';
     if ($@) {
     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)
         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 {
     } else {
         eval q{
         eval q{
             my $fs = File::FcntlLock->new(l_type => F_WRLCK);
             my $fs = File::FcntlLock->new(l_type => F_WRLCK);
             $fs->lock($fh, F_SETLKW)
             $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 strict;
 use warnings;
 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);
 use Exporter qw(import);
 
 
@@ -47,7 +47,7 @@ some commonly used aliases.
 
 
 =over 4
 =over 4
 
 
-=item my $trans = _g($msgid)
+=item my $trans = g_($msgid)
 
 
 Calls gettext() on the $msgid and returns its translation for the current
 Calls gettext() on the $msgid and returns its translation for the current
 locale. If gettext() is not available, simply returns $msgid.
 locale. If gettext() is not available, simply returns $msgid.
@@ -66,7 +66,7 @@ BEGIN {
     eval 'use Locale::gettext';
     eval 'use Locale::gettext';
     if ($@) {
     if ($@) {
         eval q{
         eval q{
-            sub _g {
+            sub g_ {
                 return shift;
                 return shift;
             }
             }
             sub textdomain {
             sub textdomain {
@@ -85,7 +85,7 @@ BEGIN {
         };
         };
     } else {
     } else {
         eval q{
         eval q{
-            sub _g {
+            sub g_ {
                 return gettext(shift);
                 return gettext(shift);
             }
             }
             sub P_ {
             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
 =head1 CHANGES
 
 
+=head2 Version 1.01
+
+New function: g_().
+
+Deprecated function: _g().
+
 =head2 Version 1.00
 =head2 Version 1.00
 
 
 Mark the module as public.
 Mark the module as public.

+ 14 - 14
scripts/Dpkg/IPC.pm

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

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

@@ -83,14 +83,14 @@ sub load {
     my ($desc, $fh) = ($file, undef);
     my ($desc, $fh) = ($file, undef);
     if ($file eq '-') {
     if ($file eq '-') {
 	$fh = \*STDIN;
 	$fh = \*STDIN;
-	$desc = _g('<standard input>');
+	$desc = g_('<standard input>');
     } else {
     } else {
 	$fh = Dpkg::Compression::FileHandle->new();
 	$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);
     my $res = $self->parse($fh, $desc, @options);
     if ($file ne '-') {
     if ($file ne '-') {
-	close($fh) or syserr(_g('cannot close %s'), $file);
+	close($fh) or syserr(g_('cannot close %s'), $file);
     }
     }
     return $res;
     return $res;
 }
 }
@@ -114,11 +114,11 @@ sub save {
 	$fh = \*STDOUT;
 	$fh = \*STDOUT;
     } else {
     } else {
 	$fh = Dpkg::Compression::FileHandle->new();
 	$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);
     $self->output($fh, @options);
     if ($file ne '-') {
     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 // '';
     my $name = shift // '';
 
 
     if ($name eq '') {
     if ($name eq '') {
-        return _g('may not be empty string');
+        return g_('may not be empty string');
     }
     }
     if ($name =~ m/[^-+.0-9a-z]/op) {
     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) {
     if ($name !~ m/^[0-9a-z]/o) {
-        return _g('must start with an alphanumeric character');
+        return g_('must start with an alphanumeric character');
     }
     }
 
 
     return;
     return;

+ 1 - 1
scripts/Dpkg/Shlibs.pm

@@ -85,7 +85,7 @@ sub parse_ldso_conf {
     my $file = shift;
     my $file = shift;
     local $_;
     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}++;
     $visited{$file}++;
     while (<$fh>) {
     while (<$fh>) {
 	next if /^\s*$/;
 	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" ],
 	$filt->{pid} = spawn(exec => [ 'c++filt', "--format=$type" ],
 	                     from_pipe => \$filt->{from},
 	                     from_pipe => \$filt->{from},
 	                     to_pipe => \$filt->{to});
 	                     to_pipe => \$filt->{to});
-	syserr(_g('unable to execute %s'), 'c++filt')
+	syserr(g_('unable to execute %s'), 'c++filt')
 	    unless defined $filt->{from};
 	    unless defined $filt->{from};
 	$filt->{from}->autoflush(1);
 	$filt->{from}->autoflush(1);
 
 

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

@@ -122,7 +122,7 @@ sub has_object {
 
 
 sub is_elf {
 sub is_elf {
     my ($file) = @_;
     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);
     my ($header, $result) = ('', 0);
     if (read($file_fh, $header, 4) == 4) {
     if (read($file_fh, $header, 4) == 4) {
 	$result = 1 if ($header =~ /^\177ELF$/);
 	$result = 1 if ($header =~ /^\177ELF$/);
@@ -181,7 +181,7 @@ sub analyze {
 
 
     local $ENV{LC_ALL} = 'C';
     local $ENV{LC_ALL} = 'C';
     open(my $objdump, '-|', $OBJDUMP, '-w', '-f', '-p', '-T', '-R', $file)
     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);
     my $ret = $self->parse_objdump_output($objdump);
     close($objdump);
     close($objdump);
     return $ret;
     return $ret;
@@ -222,7 +222,7 @@ sub parse_objdump_output {
 	    if (/^\S+\s+(\S+)\s+(\S+)\s*$/) {
 	    if (/^\S+\s+(\S+)\s+(\S+)\s*$/) {
 		$self->{dynrelocs}{$2} = $1;
 		$self->{dynrelocs}{$2} = $1;
 	    } else {
 	    } else {
-		warning(_g("couldn't parse dynamic relocation record: %s"), $_);
+		warning(g_("couldn't parse dynamic relocation record: %s"), $_);
 	    }
 	    }
 	} elsif ($section eq 'dyninfo') {
 	} elsif ($section eq 'dyninfo') {
 	    if (/^\s*NEEDED\s+(\S+)/) {
 	    if (/^\s*NEEDED\s+(\S+)/) {
@@ -341,7 +341,7 @@ sub parse_dynamic_symbol {
 	# Ignore some s390-specific output like
 	# Ignore some s390-specific output like
 	# REG_G6           g     R *UND*      0000000000000000              #scratch
 	# REG_G6           g     R *UND*      0000000000000000              #scratch
     } else {
     } 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;
 		$rest = $2;
 	    }
 	    }
 	}
 	}
-	error(_g('symbol name unspecified: %s'), $symbolspec) if (!$symbol);
+	error(g_('symbol name unspecified: %s'), $symbolspec) if (!$symbol);
     } else {
     } else {
 	# No tag specification. Symbol name is up to the first space
 	# No tag specification. Symbol name is up to the first space
 	# foobarsymbol@Base 1.0 1
 	# foobarsymbol@Base 1.0 1
@@ -162,7 +162,7 @@ sub initialize {
 	# name@version string.
 	# name@version string.
 	$type = (defined $type) ? 'generic' : 'alias-symver';
 	$type = (defined $type) ? 'generic' : 'alias-symver';
 	if ($self->get_symbolname() eq 'Base') {
 	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));
 	          $self->get_symbolspec(1));
 	}
 	}
     }
     }

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

@@ -220,7 +220,7 @@ sub parse {
 
 
 	if (/^(?:\s+|#(?:DEPRECATED|MISSING): ([^#]+)#\s*)(.*)/) {
 	if (/^(?:\s+|#(?:DEPRECATED|MISSING): ([^#]+)#\s*)(.*)/) {
 	    if (not defined ($$obj_ref)) {
 	    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
 	    # Symbol specification
 	    my $deprecated = ($1) ? $1 : 0;
 	    my $deprecated = ($1) ? $1 : 0;
@@ -228,7 +228,7 @@ sub parse {
 	    if ($self->create_symbol($2, base => $sym)) {
 	    if ($self->create_symbol($2, base => $sym)) {
 		$self->add_symbol($sym, $$obj_ref);
 		$self->add_symbol($sym, $$obj_ref);
 	    } else {
 	    } else {
-		warning(_g('failed to parse line in %s: %s'), $file, $_);
+		warning(g_('failed to parse line in %s: %s'), $file, $_);
 	    }
 	    }
 	} elsif (/^(\(.*\))?#include\s+"([^"]+)"/) {
 	} elsif (/^(\(.*\))?#include\s+"([^"]+)"/) {
 	    my $tagspec = $1;
 	    my $tagspec = $1;
@@ -260,7 +260,7 @@ sub parse {
 		$self->create_object($$obj_ref, "$2");
 		$self->create_object($$obj_ref, "$2");
 	    }
 	    }
 	} else {
 	} 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};
     delete $seen->{$file};
@@ -273,7 +273,7 @@ sub merge_object_from_symfile {
     if (not $self->has_object($objid)) {
     if (not $self->has_object($objid)) {
         $self->{objects}{$objid} = $src->get_object($objid);
         $self->{objects}{$objid} = $src->get_object($objid);
     } else {
     } 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 ($self, $object, $minver) = @_;
 
 
     my $soname = $object->{SONAME};
     my $soname = $object->{SONAME};
-    error(_g('cannot merge symbols from objects without SONAME'))
+    error(g_('cannot merge symbols from objects without SONAME'))
         unless $soname;
         unless $soname;
 
 
     my %include_groups = ();
     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};
     croak 'call create() first' unless *$self->{tar_input};
     $file = $2 if ($file =~ /^\Q$cwd\E\/(.+)$/); # Relative names
     $file = $2 if ($file =~ /^\Q$cwd\E\/(.+)$/); # Relative names
     print({ *$self->{tar_input} } "$file\0")
     print({ *$self->{tar_input} } "$file\0")
-        or syserr(_g('write on tar input'));
+        or syserr(g_('write on tar input'));
 }
 }
 
 
 sub add_file {
 sub add_file {
@@ -88,7 +88,7 @@ sub add_directory {
 
 
 sub finish {
 sub finish {
     my ($self) = @_;
     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 -');
     wait_child(*$self->{pid}, cmdline => 'tar -cf -');
     delete *$self->{pid};
     delete *$self->{pid};
     delete *$self->{tar_input};
     delete *$self->{tar_input};
@@ -113,7 +113,7 @@ sub extract {
         my $template = basename($self->get_filename()) .  '.tmp-extract.XXXXX';
         my $template = basename($self->get_filename()) .  '.tmp-extract.XXXXX';
         unless (-e $dest) {
         unless (-e $dest) {
             # Kludge so that realpath works
             # 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);
         $tmp = tempdir($template, DIR => Cwd::realpath("$dest/.."), CLEANUP => 1);
         $spawn_opts{chdir} = $tmp;
         $spawn_opts{chdir} = $tmp;
@@ -144,18 +144,18 @@ sub extract {
     return if $opts{in_place};
     return if $opts{in_place};
 
 
     # Rename extracted directory
     # 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);
     my @entries = grep { $_ ne '.' && $_ ne '..' } readdir($dir_dh);
     closedir($dir_dh);
     closedir($dir_dh);
     my $done = 0;
     my $done = 0;
     erasedir($dest);
     erasedir($dest);
     if (scalar(@entries) == 1 && ! -l "$tmp/$entries[0]" && -d _) {
     if (scalar(@entries) == 1 && ! -l "$tmp/$entries[0]" && -d _) {
 	rename("$tmp/$entries[0]", $dest)
 	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);
 	              "$tmp/$entries[0]", $dest);
     } else {
     } else {
 	rename($tmp, $dest)
 	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);
     erasedir($tmp);
 }
 }

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

@@ -31,15 +31,15 @@ sub erasedir {
     my ($dir) = @_;
     my ($dir) = @_;
     if (not lstat($dir)) {
     if (not lstat($dir)) {
         return if $! == ENOENT;
         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;
     system 'rm', '-rf', '--', $dir;
     subprocerr("rm -rf $dir") if $?;
     subprocerr("rm -rf $dir") if $?;
     if (not stat($dir)) {
     if (not stat($dir)) {
         return if $! == ENOENT;
         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 {
 sub fixperms {
@@ -75,14 +75,14 @@ sub fs_time($) {
     my ($file) = @_;
     my ($file) = @_;
     my $is_temp = 0;
     my $is_temp = 0;
     if (not -e $file) {
     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);
 	close($temp_fh);
 	$is_temp = 1;
 	$is_temp = 1;
     } else {
     } else {
 	utime(undef, undef, $file) or
 	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];
     my $mtime = (stat(_))[9];
     unlink($file) if $is_temp;
     unlink($file) if $is_temp;
     return $mtime;
     return $mtime;

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

@@ -237,7 +237,7 @@ sub init_options {
 sub initialize {
 sub initialize {
     my ($self, $filename) = @_;
     my ($self, $filename) = @_;
     my ($fn, $dir) = fileparse($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->{basedir} = $dir || './';
     $self->{filename} = $fn;
     $self->{filename} = $fn;
 
 
@@ -249,7 +249,7 @@ sub initialize {
 
 
     foreach my $f (qw(Source Version Files)) {
     foreach my $f (qw(Source Version Files)) {
         unless (defined($fields->{$f})) {
         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);
         my ($version, $variant, $major, $minor) = ($1, $2, $1, undef);
 
 
         if (defined $variant and $variant ne lc $variant) {
         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\.]+$//;
         $major =~ s/\.[\d\.]+$//;
@@ -282,12 +282,12 @@ sub upgrade_object_type {
             $self->{fields}{'Format'} .= " ($variant)" if defined $variant;
             $self->{fields}{'Format'} .= " ($variant)" if defined $variant;
         }
         }
         if ($@) {
         if ($@) {
-            error(_g("source package format '%s' is not supported: %s"),
+            error(g_("source package format '%s' is not supported: %s"),
                   $format, $@);
                   $format, $@);
         }
         }
         bless $self, $module;
         bless $self, $module;
     } else {
     } 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 ($self, $with_revision) = @_;
     my $f = $self->{fields};
     my $f = $self->{fields};
     unless (exists $f->{'Source'} and exists $f->{'Version'}) {
     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 $v = Dpkg::Version->new($f->{'Version'});
     my $vs = $v->as_string(omit_epoch => 1, omit_revision => !$with_revision);
     my $vs = $v->as_string(omit_epoch => 1, omit_revision => !$with_revision);
@@ -351,7 +351,7 @@ sub find_original_tarballs {
     my @tar;
     my @tar;
     foreach my $dir ('.', $self->{basedir}, $self->{options}{origtardir}) {
     foreach my $dir ('.', $self->{basedir}, $self->{options}{origtardir}) {
         next unless defined($dir) and -d $dir;
         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 {
         push @tar, map { "$dir/$_" } grep {
 		($opts{include_main} and
 		($opts{include_main} and
 		 /^\Q$basename\E\.orig\.tar\.$opts{extension}$/) or
 		 /^\Q$basename\E\.orig\.tar\.$opts{extension}$/) or
@@ -420,18 +420,18 @@ sub check_signature {
             if ($gpg_status == 1 or ($gpg_status &&
             if ($gpg_status == 1 or ($gpg_status &&
                 $self->{options}{require_valid_signature}))
                 $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) {
             } elsif ($gpg_status) {
-                warning(_g('failed to verify signature on %s'), $dsc);
+                warning(g_('failed to verify signature on %s'), $dsc);
             }
             }
         } else {
         } else {
             subprocerr("@exec");
             subprocerr("@exec");
         }
         }
     } else {
     } else {
         if ($self->{options}{require_valid_signature}) {
         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 {
         } 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) = @_;
     my ($self, @opts) = @_;
     foreach my $option (@opts) {
     foreach my $option (@opts) {
         if (not $self->parse_cmdline_option($option)) {
         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) {
 	unless (-e $format_file) {
 	    mkdir($srcdir) unless -e $srcdir;
 	    mkdir($srcdir) unless -e $srcdir;
 	    open(my $format_fh, '>', $format_file)
 	    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";
 	    print { $format_fh } $self->{fields}{'Format'} . "\n";
 	    close($format_fh);
 	    close($format_fh);
 	}
 	}
@@ -513,15 +513,15 @@ sub extract {
     my @s = lstat($rules);
     my @s = lstat($rules);
     if (not scalar(@s)) {
     if (not scalar(@s)) {
         unless ($! == ENOENT) {
         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};
             unless $self->{options}{skip_debianization};
     } elsif (-f _) {
     } elsif (-f _) {
         chmod($s[2] | 0111, $rules)
         chmod($s[2] | 0111, $rules)
-            or syserr(_g('cannot make %s executable'), $rules);
+            or syserr(g_('cannot make %s executable'), $rules);
     } else {
     } 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 {
 sub do_commit {
     my ($self, $dir) = @_;
     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'});
          'dpkg-source --commit', $self->{fields}{'Format'});
 }
 }
 
 
@@ -596,12 +596,12 @@ sub write_dsc {
     unless ($opts{nocheck}) {
     unless ($opts{nocheck}) {
         foreach my $f (qw(Source Version)) {
         foreach my $f (qw(Source Version)) {
             unless (defined($fields->{$f})) {
             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)) {
         foreach my $f (qw(Maintainer Architecture Standards-Version)) {
             unless (defined($fields->{$f})) {
             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};
     my $filename = $opts{filename};
     $filename //= $self->get_basename(1) . '.dsc';
     $filename //= $self->get_basename(1) . '.dsc';
     open(my $dsc_fh, '>', $filename)
     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->apply_substvars($opts{substvars});
     $fields->output($dsc_fh);
     $fields->output($dsc_fh);
     close($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 ($self, $opt) = @_;
     my $o = $self->{options};
     my $o = $self->{options};
     if ($opt =~ m/^-s([akpursnAKPUR])$/) {
     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}) if $o->{sourcestyle} ne 'X';
         $o->{sourcestyle} = $1;
         $o->{sourcestyle} = $1;
         $o->{copy_orig_tarballs} = 0 if $1 eq 'n'; # Extract option -sn
         $o->{copy_orig_tarballs} = 0 if $1 eq 'n'; # Extract option -sn
@@ -91,7 +91,7 @@ sub do_extract {
 
 
     $sourcestyle =~ y/X/p/;
     $sourcestyle =~ y/X/p/;
     unless ($sourcestyle =~ m/[pun]/) {
     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);
 	         $sourcestyle);
     }
     }
 
 
@@ -104,20 +104,20 @@ sub do_extract {
     my ($tarfile, $difffile);
     my ($tarfile, $difffile);
     foreach my $file ($self->get_files()) {
     foreach my $file ($self->get_files()) {
 	if ($file =~ /^(?:\Q$basename\E\.orig|\Q$basenamerev\E)\.tar\.gz$/) {
 	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;
             $tarfile = $file;
 	} elsif ($file =~ /^\Q$basenamerev\E\.diff\.gz$/) {
 	} elsif ($file =~ /^\Q$basenamerev\E\.diff\.gz$/) {
 	    $difffile = $file;
 	    $difffile = $file;
 	} else {
 	} else {
-	    error(_g('unrecognized file for a %s source package: %s'),
+	    error(g_('unrecognized file for a %s source package: %s'),
                   'v1.0', $file);
                   '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;
     my $native = $difffile ? 0 : 1;
     if ($native and ($tarfile =~ /\.orig\.tar\.gz$/)) {
     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
         $native = 0; # V3::Native doesn't handle orig.tar
     }
     }
 
 
@@ -130,43 +130,43 @@ sub do_extract {
         erasedir($newdirectory);
         erasedir($newdirectory);
         if (-e $expectprefix) {
         if (-e $expectprefix) {
             rename($expectprefix, "$newdirectory.tmp-keep")
             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");
                           "$newdirectory.tmp-keep");
         }
         }
 
 
-        info(_g('unpacking %s'), $tarfile);
+        info(g_('unpacking %s'), $tarfile);
         my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
         my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
         $tar->extract($expectprefix);
         $tar->extract($expectprefix);
 
 
         if ($sourcestyle =~ /u/) {
         if ($sourcestyle =~ /u/) {
             # -su: keep .orig directory unpacked
             # -su: keep .orig directory unpacked
             if (-e "$newdirectory.tmp-keep") {
             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");
             system('cp', '-ar', '--', $expectprefix, "$newdirectory.tmp-keep");
             subprocerr("cp $expectprefix to $newdirectory.tmp-keep") if $?;
             subprocerr("cp $expectprefix to $newdirectory.tmp-keep") if $?;
         }
         }
 
 
 	rename($expectprefix, $newdirectory)
 	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);
 	              $expectprefix, $newdirectory);
 
 
 	# rename the copied .orig directory
 	# rename the copied .orig directory
 	if (-e "$newdirectory.tmp-keep") {
 	if (-e "$newdirectory.tmp-keep") {
 	    rename("$newdirectory.tmp-keep", $expectprefix)
 	    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);
 	                  "$newdirectory.tmp-keep", $expectprefix);
         }
         }
     }
     }
 
 
     if ($difffile and not $self->{options}{skip_debianization}) {
     if ($difffile and not $self->{options}{skip_debianization}) {
         my $patch = "$dscdir$difffile";
         my $patch = "$dscdir$difffile";
-	info(_g('applying %s'), $difffile);
+	info(g_('applying %s'), $difffile);
 	my $patch_obj = Dpkg::Source::Patch->new(filename => $patch);
 	my $patch_obj = Dpkg::Source::Patch->new(filename => $patch);
 	my $analysis = $patch_obj->apply($newdirectory, force_timestamp => 1);
 	my $analysis = $patch_obj->apply($newdirectory, force_timestamp => 1);
 	my @files = grep { ! m{^\Q$newdirectory\E/debian/} }
 	my @files = grep { ! m{^\Q$newdirectory\E/debian/} }
 		    sort keys %{$analysis->{filepatched}};
 		    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;
 	     "\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
     # As long as we can use gzip, we can do it as we have
     # native packages as fallback
     # native packages as fallback
-    return (0, _g('only supports gzip compression'))
+    return (0, g_('only supports gzip compression'))
         unless $self->{options}{compression} eq 'gzip';
         unless $self->{options}{compression} eq 'gzip';
     return 1;
     return 1;
 }
 }
@@ -189,13 +189,13 @@ sub do_build {
     my $diff_ignore_regex = $self->{options}{diff_ignore_regex};
     my $diff_ignore_regex = $self->{options}{diff_ignore_regex};
 
 
     if (scalar(@argv) > 1) {
     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)'));
                     'argument (with v1.0 source package)'));
     }
     }
 
 
     $sourcestyle =~ y/X/A/;
     $sourcestyle =~ y/X/A/;
     unless ($sourcestyle =~ m/[akpursnAKPUR]/) {
     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);
                  $sourcestyle);
     }
     }
 
 
@@ -210,7 +210,7 @@ sub do_build {
     my $origtargz = $self->get_basename() . '.orig.tar.gz';
     my $origtargz = $self->get_basename() . '.orig.tar.gz';
     if (-e $origtargz) {
     if (-e $origtargz) {
         unless (-f $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 {
     } else {
         $origtargz = undef;
         $origtargz = undef;
@@ -222,13 +222,13 @@ sub do_build {
         my $origarg = shift(@argv);
         my $origarg = shift(@argv);
         if (length($origarg)) {
         if (length($origarg)) {
             stat($origarg)
             stat($origarg)
-                or syserr(_g('cannot stat orig argument %s'), $origarg);
+                or syserr(g_('cannot stat orig argument %s'), $origarg);
             if (-d _) {
             if (-d _) {
                 $origdir = File::Spec->catdir($origarg);
                 $origdir = File::Spec->catdir($origarg);
 
 
                 $sourcestyle =~ y/aA/rR/;
                 $sourcestyle =~ y/aA/rR/;
                 unless ($sourcestyle =~ m/[ursURS]/) {
                 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>)'),
                              'style -s%s calls for packed (.orig.tar.<ext>)'),
                           $sourcestyle);
                           $sourcestyle);
                 }
                 }
@@ -236,18 +236,18 @@ sub do_build {
                 $origtargz = $origarg;
                 $origtargz = $origarg;
                 $sourcestyle =~ y/aA/pP/;
                 $sourcestyle =~ y/aA/pP/;
                 unless ($sourcestyle =~ m/[kpsKPS]/) {
                 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/)'),
                              'style -s%s calls for unpacked (.orig/)'),
                           $sourcestyle);
                           $sourcestyle);
                 }
                 }
             } else {
             } 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);
                       $origarg);
             }
             }
         } else {
         } else {
             $sourcestyle =~ y/aA/nn/;
             $sourcestyle =~ y/aA/nn/;
             unless ($sourcestyle =~ m/n/) {
             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'),
                          'but source handling style -s%s wants something'),
                       $sourcestyle);
                       $sourcestyle);
             }
             }
@@ -261,12 +261,12 @@ sub do_build {
 	} else {
 	} else {
 	    if (stat($origdir)) {
 	    if (stat($origdir)) {
 		unless (-d _) {
 		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);
 		          $origdir);
                 }
                 }
 		$sourcestyle =~ y/aA/rR/; # .orig directory
 		$sourcestyle =~ y/aA/rR/; # .orig directory
 	    } elsif ($! != ENOENT) {
 	    } elsif ($! != ENOENT) {
-		syserr(_g("unable to stat putative unpacked orig `%s'"), $origdir);
+		syserr(g_("unable to stat putative unpacked orig `%s'"), $origdir);
 	    } else {
 	    } else {
 		$sourcestyle =~ y/aA/nn/; # Native tar.gz
 		$sourcestyle =~ y/aA/nn/; # Native tar.gz
 	    }
 	    }
@@ -275,7 +275,7 @@ sub do_build {
 
 
     my ($dirname, $dirbase) = fileparse($dir);
     my ($dirname, $dirbase) = fileparse($dir);
     if ($dirname ne $basedirname) {
     if ($dirname ne $basedirname) {
-	warning(_g("source directory '%s' is not <sourcepackage>" .
+	warning(g_("source directory '%s' is not <sourcepackage>" .
 	           "-<upstreamversion> '%s'"), $dir, $basedirname);
 	           "-<upstreamversion> '%s'"), $dir, $basedirname);
     }
     }
 
 
@@ -284,7 +284,7 @@ sub do_build {
 	my ($origdirname, $origdirbase) = fileparse($origdir);
 	my ($origdirname, $origdirbase) = fileparse($origdir);
 
 
         if ($origdirname ne "$basedirname.orig") {
         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)'),
 	               '-<upstreamversion> (wanted %s)'),
 	            $origdirname, "$basedirname.orig");
 	            $origdirname, "$basedirname.orig");
         }
         }
@@ -293,7 +293,7 @@ sub do_build {
 
 
 	$tarname = $origtargz || "$basename.orig.tar.gz";
 	$tarname = $origtargz || "$basename.orig.tar.gz";
 	unless ($tarname =~ /\Q$basename\E\.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)'),
 	               '.orig.tar (wanted %s)'),
 	            $tarname, "$basename.orig.tar.gz");
 	            $tarname, "$basename.orig.tar.gz");
 	}
 	}
@@ -305,14 +305,14 @@ sub do_build {
     } elsif ($sourcestyle =~ m/[nurUR]/) {
     } elsif ($sourcestyle =~ m/[nurUR]/) {
         if (stat($tarname)) {
         if (stat($tarname)) {
             unless ($sourcestyle =~ m/[nUR]/) {
             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);
 		         'giving up; use -sU or -sR to override'), $tarname);
             }
             }
         } elsif ($! != ENOENT) {
         } 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);
 	     $sourcepackage, $tarname);
 
 
 	my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX",
 	my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX",
@@ -324,12 +324,12 @@ sub do_build {
 	$tar->add_directory($tardirname);
 	$tar->add_directory($tardirname);
 	$tar->finish();
 	$tar->finish();
 	rename($newtar, $tarname)
 	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);
 	              $newtar, $tarname);
 	chmod(0666 &~ umask(), $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 {
     } else {
-	info(_g('building %s using existing %s'),
+	info(g_('building %s using existing %s'),
 	     $sourcepackage, $tarname);
 	     $sourcepackage, $tarname);
     }
     }
 
 
@@ -338,7 +338,7 @@ sub do_build {
     if ($sourcestyle =~ m/[kpKP]/) {
     if ($sourcestyle =~ m/[kpKP]/) {
         if (stat($origdir)) {
         if (stat($origdir)) {
             unless ($sourcestyle =~ m/[KP]/) {
             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'),
                          'giving up; use -sA, -sK or -sP to override'),
                       $origdir);
                       $origdir);
             }
             }
@@ -346,7 +346,7 @@ sub do_build {
             erasedir($origdir);
             erasedir($origdir);
             pop_exit_handler();
             pop_exit_handler();
         } elsif ($! != ENOENT) {
         } 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);
                     $origdir);
         }
         }
 
 
@@ -357,7 +357,7 @@ sub do_build {
     my $ur; # Unrepresentable changes
     my $ur; # Unrepresentable changes
     if ($sourcestyle =~ m/[kpursKPUR]/) {
     if ($sourcestyle =~ m/[kpursKPUR]/) {
 	my $diffname = "$basenamerev.diff.gz";
 	my $diffname = "$basenamerev.diff.gz";
-	info(_g('building %s in %s'),
+	info(g_('building %s in %s'),
 	     $sourcepackage, $diffname);
 	     $sourcepackage, $diffname);
 	my ($ndfh, $newdiffgz) = tempfile("$diffname.new.XXXXXX",
 	my ($ndfh, $newdiffgz) = tempfile("$diffname.new.XXXXXX",
 					DIR => getcwd(), UNLINK => 0);
 					DIR => getcwd(), UNLINK => 0);
@@ -379,19 +379,19 @@ sub do_build {
 		    map { my $file = $_; $file =~ s{^[^/]+/+}{}; $file }
 		    map { my $file = $_; $file =~ s{^[^/]+/+}{}; $file }
 		    sort keys %{$analysis->{filepatched}};
 		    sort keys %{$analysis->{filepatched}};
 	if (scalar @files) {
 	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));
 	            "\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)'));
 	            '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};
 		if $self->{options}{abort_on_upstream_changes};
 	}
 	}
 
 
 	rename($newdiffgz, $diffname)
 	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);
 	              $newdiffgz, $diffname);
 	chmod(0666 &~ umask(), $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);
 	$self->add_file($diffname);
     }
     }
@@ -401,7 +401,7 @@ sub do_build {
     }
     }
 
 
     if ($ur) {
     if ($ur) {
-        printf { *STDERR } _g('%s: unrepresentable changes to source') . "\n",
+        printf { *STDERR } g_('%s: unrepresentable changes to source') . "\n",
                $Dpkg::PROGNAME;
                $Dpkg::PROGNAME;
         exit(1);
         exit(1);
     }
     }

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

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

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

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

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

@@ -37,13 +37,13 @@ sub parse_cmdline_option {
     return 0;
     return 0;
 }
 }
 sub do_extract {
 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 {
 sub can_build {
     my ($self, $dir) = @_;
     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}});
         unless scalar(@{$self->{options}{ARGV}});
     return 1;
     return 1;
 }
 }
@@ -52,7 +52,7 @@ sub do_build {
     my ($self, $dir) = @_;
     my ($self, $dir) = @_;
     # Update real target format
     # Update real target format
     my $format = $self->{options}{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;
     $self->{fields}{'Format'} = $format;
     # Add all files
     # Add all files
     foreach my $file (@{$self->{options}{ARGV}}) {
     foreach my $file (@{$self->{options}{ARGV}}) {

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

@@ -52,7 +52,7 @@ sub import {
             return 1;
             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'));
              'git is not in the PATH'));
 }
 }
 
 
@@ -60,12 +60,12 @@ sub sanity_check {
     my $srcdir = shift;
     my $srcdir = shift;
 
 
     if (! -d "$srcdir/.git") {
     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 ' .
                  'repository (%s/.git not present), but Format git was ' .
                  'specified'), $srcdir);
                  'specified'), $srcdir);
     }
     }
     if (-s "$srcdir/.gitmodules") {
     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);
               $srcdir);
     }
     }
 
 
@@ -88,7 +88,7 @@ sub parse_cmdline_option {
 sub can_build {
 sub can_build {
     my ($self, $dir) = @_;
     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;
     return 1;
 }
 }
 
 
@@ -103,7 +103,7 @@ sub do_build {
     sanity_check($dir);
     sanity_check($dir);
 
 
     my $old_cwd = getcwd();
     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.
     # Check for uncommitted files.
     # To support dpkg-source -i, get a list of 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) {
     if (@files) {
-        error(_g('uncommitted, not-ignored changes in working directory: %s'),
+        error(g_('uncommitted, not-ignored changes in working directory: %s'),
               join(' ', @files));
               join(' ', @files));
     }
     }
 
 
@@ -143,19 +143,19 @@ sub do_build {
     my $tmp;
     my $tmp;
     my $shallowfile;
     my $shallowfile;
     if ($self->{options}{git_depth}) {
     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);
         $tmp = tempdir("$dirname.git.XXXXXX", DIR => $updir);
         push_exit_handler(sub { erasedir($tmp) });
         push_exit_handler(sub { erasedir($tmp) });
         my $clone_dir = "$tmp/repo.git";
         my $clone_dir = "$tmp/repo.git";
         # file:// is needed to avoid local cloning, which does not
         # file:// is needed to avoid local cloning, which does not
         # create a shallow clone.
         # create a shallow clone.
-        info(_g('creating shallow clone with depth %s'),
+        info(g_('creating shallow clone with depth %s'),
                 $self->{options}{git_depth});
                 $self->{options}{git_depth});
         system('git', 'clone', '--depth=' . $self->{options}{git_depth},
         system('git', 'clone', '--depth=' . $self->{options}{git_depth},
                '--quiet', '--bare', 'file://' . abs_path($dir), $clone_dir);
                '--quiet', '--bare', 'file://' . abs_path($dir), $clone_dir);
         subprocerr('git clone') if $?;
         subprocerr('git clone') if $?;
         chdir($clone_dir)
         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";
         $shallowfile = "$basenamerev.gitshallow";
         system('cp', '-f', 'shallow', "$old_cwd/$shallowfile");
         system('cp', '-f', 'shallow', "$old_cwd/$shallowfile");
         subprocerr('cp shallow') if $?;
         subprocerr('cp shallow') if $?;
@@ -165,7 +165,7 @@ sub do_build {
     my $bundlefile = "$basenamerev.git";
     my $bundlefile = "$basenamerev.git";
     my @bundle_arg=$self->{options}{git_ref} ?
     my @bundle_arg=$self->{options}{git_ref} ?
         (@{$self->{options}{git_ref}}) : '--all';
         (@{$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",
     system('git', 'bundle', 'create', "$old_cwd/$bundlefile",
            @bundle_arg,
            @bundle_arg,
            'HEAD', # ensure HEAD is included no matter what
            'HEAD', # ensure HEAD is included no matter what
@@ -173,7 +173,7 @@ sub do_build {
     );
     );
     subprocerr('git bundle') if $?;
     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) {
     if (defined $tmp) {
         erasedir($tmp);
         erasedir($tmp);
@@ -200,33 +200,33 @@ sub do_extract {
             if (! defined $bundle) {
             if (! defined $bundle) {
                 $bundle = $file;
                 $bundle = $file;
             } else {
             } 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$/) {
         } elsif ($file =~ /^\Q$basenamerev\E\.gitshallow$/) {
             if (! defined $shallow) {
             if (! defined $shallow) {
                 $shallow = $file;
                 $shallow = $file;
             } else {
             } else {
-                error(_g('format v3.0 (git) uses only one .gitshallow file'));
+                error(g_('format v3.0 (git) uses only one .gitshallow file'));
             }
             }
         } else {
         } else {
-            error(_g('format v3.0 (git) unknown file: %s', $file));
+            error(g_('format v3.0 (git) unknown file: %s', $file));
         }
         }
     }
     }
     if (! defined $bundle) {
     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);
     erasedir($newdirectory);
 
 
     # Extract git bundle.
     # Extract git bundle.
-    info(_g('cloning %s'), $bundle);
+    info(g_('cloning %s'), $bundle);
     system('git', 'clone', '--quiet', $dscdir . $bundle, $newdirectory);
     system('git', 'clone', '--quiet', $dscdir . $bundle, $newdirectory);
     subprocerr('git bundle') if $?;
     subprocerr('git bundle') if $?;
 
 
     if (defined $shallow) {
     if (defined $shallow) {
         # Move shallow info file into place, so git does not
         # Move shallow info file into place, so git does not
         # try to follow parents of shallow refs.
         # 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");
         system('cp', '-f',  $dscdir . $shallow, "$newdirectory/.git/shallow");
         subprocerr('cp') if $?;
         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();
     my $comp_ext_regex = compression_get_file_extension_regex();
     foreach my $file ($self->get_files()) {
     foreach my $file ($self->get_files()) {
 	if ($file =~ /^\Q$basenamerev\E\.tar\.$comp_ext_regex$/) {
 	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;
             $tarfile = $file;
 	} else {
 	} 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);
     erasedir($newdirectory);
-    info(_g('unpacking %s'), $tarfile);
+    info(g_('unpacking %s'), $tarfile);
     my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
     my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile");
     $tar->extract($newdirectory);
     $tar->extract($newdirectory);
 }
 }
@@ -69,7 +69,7 @@ sub can_build {
     my ($self, $dir) = @_;
     my ($self, $dir) = @_;
 
 
     my $v = Dpkg::Version->new($self->{fields}->{'Version'});
     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();
         unless $v->is_native();
 
 
     return 1;
     return 1;
@@ -81,7 +81,7 @@ sub do_build {
     my @argv = @{$self->{options}{ARGV}};
     my @argv = @{$self->{options}{ARGV}};
 
 
     if (scalar(@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->{fields}{'Format'});
     }
     }
 
 
@@ -89,7 +89,7 @@ sub do_build {
     my $basenamerev = $self->get_basename(1);
     my $basenamerev = $self->get_basename(1);
     my $tarname = "$basenamerev.tar." . $self->{options}{comp_ext};
     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",
     my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX",
                                    DIR => getcwd(), UNLINK => 0);
                                    DIR => getcwd(), UNLINK => 0);
@@ -103,11 +103,11 @@ sub do_build {
     $tar->add_directory($dirname);
     $tar->add_directory($dirname);
     $tar->finish();
     $tar->finish();
     rename($newtar, $tarname)
     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);
                   $newtar, $tarname);
     pop_exit_handler();
     pop_exit_handler();
     chmod(0666 &~ umask(), $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);
 
 
     $self->add_file($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;
     return ($code, $msg) if $code == 0;
 
 
     my $v = Dpkg::Version->new($self->{fields}->{'Version'});
     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();
         if $v->is_native();
 
 
     my $quilt = $self->build_quilt_object($dir);
     my $quilt = $self->build_quilt_object($dir);
@@ -117,7 +117,7 @@ sub apply_patches {
         unlink($dest) if -l $dest;
         unlink($dest) if -l $dest;
         unless (-f _) { # Don't overwrite real files
         unless (-f _) { # Don't overwrite real files
             symlink($basename, $dest)
             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
         # them afterwards in --after-build
         my $pc_unapply = $quilt->get_db_file('.dpkg-source-unapply');
         my $pc_unapply = $quilt->get_db_file('.dpkg-source-unapply');
         open(my $unapply_fh, '>', $pc_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);
         close($unapply_fh);
     }
     }
 
 
@@ -187,9 +187,9 @@ sub do_build {
         if (any { $version eq $_ }
         if (any { $version eq $_ }
             @{$self->{options}{allow_version_of_quilt_db}})
             @{$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 {
         } 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) {
     if (-s $tmpdiff) {
         copy($tmpdiff, $patch)
         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)
         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) {
     } elsif (-e $patch) {
-        unlink($patch) or syserr(_g('cannot remove %s'), $patch);
+        unlink($patch) or syserr(g_('cannot remove %s'), $patch);
     }
     }
 
 
     if (-e $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 $handle_binary = $opts{handle_binary_func} // sub {
         my ($self, $old, $new, %opts) = @_;
         my ($self, $old, $new, %opts) = @_;
         my $file = $opts{filename};
         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
     # Optimization to avoid forking diff if unnecessary
     return 1 if compare($old, $new, 4096) == 0;
     return 1 if compare($old, $new, 4096) == 0;
@@ -118,17 +118,17 @@ sub add_diff_file {
         } elsif (m/^[-+\@ ]/) {
         } elsif (m/^[-+\@ ]/) {
             $difflinefound++;
             $difflinefound++;
         } elsif (m/^\\ /) {
         } 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);
                        'original or modified version)'), $new);
         } else {
         } else {
             chomp;
             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})) {
 	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;
 	    *$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');
     close($diffgen) or syserr('close on diff pipe');
     wait_child($diff_pid, nocheck => 1,
     wait_child($diff_pid, nocheck => 1,
@@ -138,7 +138,7 @@ sub add_diff_file {
     # Ignore error if binary content detected
     # Ignore error if binary content detected
     my $exit = WEXITSTATUS($?);
     my $exit = WEXITSTATUS($?);
     unless (WIFEXITED($?) && ($exit == 0 || $exit == 1 || $binary)) {
     unless (WIFEXITED($?) && ($exit == 0 || $exit == 1 || $binary)) {
-        subprocerr(_g('diff on %s'), $new);
+        subprocerr(g_('diff on %s'), $new);
     }
     }
     return ($exit == 0 || $exit == 1);
     return ($exit == 0 || $exit == 1);
 }
 }
@@ -164,7 +164,7 @@ sub add_diff_directory {
         my $fn = (length > length($new)) ? substr($_, length($new) + 1) : '.';
         my $fn = (length > length($new)) ? substr($_, length($new) + 1) : '.';
         return if &$diff_ignore($fn);
         return if &$diff_ignore($fn);
         $files_in_new{$fn} = 1;
         $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 $mode = S_IMODE((lstat(_))[2]);
         my $size = (lstat(_))[7];
         my $size = (lstat(_))[7];
         if (-l _) {
         if (-l _) {
@@ -174,11 +174,11 @@ sub add_diff_directory {
             }
             }
             my $n = readlink("$new/$fn");
             my $n = readlink("$new/$fn");
             unless (defined $n) {
             unless (defined $n) {
-                syserr(_g('cannot read link %s'), "$new/$fn");
+                syserr(g_('cannot read link %s'), "$new/$fn");
             }
             }
             my $n2 = readlink("$old/$fn");
             my $n2 = readlink("$old/$fn");
             unless (defined $n2) {
             unless (defined $n2) {
-                syserr(_g('cannot read link %s'), "$old/$fn");
+                syserr(g_('cannot read link %s'), "$old/$fn");
             }
             }
             unless ($n eq $n2) {
             unless ($n eq $n2) {
                 $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
                 $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
@@ -187,7 +187,7 @@ sub add_diff_directory {
             my $old_file = "$old/$fn";
             my $old_file = "$old/$fn";
             if (not lstat("$old/$fn")) {
             if (not lstat("$old/$fn")) {
                 if ($! != ENOENT) {
                 if ($! != ENOENT) {
-                    syserr(_g('cannot stat file %s'), "$old/$fn");
+                    syserr(g_('cannot stat file %s'), "$old/$fn");
                 }
                 }
                 $old_file = '/dev/null';
                 $old_file = '/dev/null';
             } elsif (not -f _) {
             } elsif (not -f _) {
@@ -207,35 +207,35 @@ sub add_diff_directory {
             }
             }
         } elsif (-b _ || -c _ || -S _) {
         } elsif (-b _ || -c _ || -S _) {
             $self->_fail_with_msg("$new/$fn",
             $self->_fail_with_msg("$new/$fn",
-                _g('device or socket is not allowed'));
+                g_('device or socket is not allowed'));
         } elsif (-d _) {
         } elsif (-d _) {
             if (not lstat("$old/$fn")) {
             if (not lstat("$old/$fn")) {
                 if ($! != ENOENT) {
                 if ($! != ENOENT) {
-                    syserr(_g('cannot stat file %s'), "$old/$fn");
+                    syserr(g_('cannot stat file %s'), "$old/$fn");
                 }
                 }
             } elsif (not -d _) {
             } elsif (not -d _) {
                 $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
                 $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
             }
             }
         } else {
         } 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 $scan_old = sub {
         my $fn = (length > length($old)) ? substr($_, length($old) + 1) : '.';
         my $fn = (length > length($old)) ? substr($_, length($old) + 1) : '.';
         return if &$diff_ignore($fn);
         return if &$diff_ignore($fn);
         return if $files_in_new{$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 (-f _) {
             if ($inc_removal) {
             if ($inc_removal) {
                 push @diff_files, [$fn, 0, 0, "$old/$fn", '/dev/null',
                 push @diff_files, [$fn, 0, 0, "$old/$fn", '/dev/null',
                                    "$basedir.orig/$fn", '/dev/null'];
                                    "$basedir.orig/$fn", '/dev/null'];
             } else {
             } 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 _) {
         } elsif (-d _) {
-            warning(_g('ignoring deletion of directory %s'), $fn);
+            warning(g_('ignoring deletion of directory %s'), $fn);
         } elsif (-l _) {
         } elsif (-l _) {
-            warning(_g('ignoring deletion of symlink %s'), $fn);
+            warning(g_('ignoring deletion of symlink %s'), $fn);
         } else {
         } else {
             $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
             $self->_fail_not_same_type("$old/$fn", "$new/$fn", $fn);
         }
         }
@@ -280,16 +280,16 @@ sub add_diff_directory {
         if ($success and
         if ($success and
             $old_file eq '/dev/null' and $new_file ne '/dev/null') {
             $old_file eq '/dev/null' and $new_file ne '/dev/null') {
             if (not $size) {
             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);
                            'be represented in diff'), $fn);
             } else {
             } else {
                 if ($mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
                 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)
                                'not be represented in diff'), $mode, $fn)
                         unless $fn eq 'debian/rules';
                         unless $fn eq 'debian/rules';
                 }
                 }
                 if ($mode & (S_ISUID | S_ISGID | S_ISVTX)) {
                 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);
                                'be represented in diff'), $mode, $fn);
                 }
                 }
             }
             }
@@ -299,7 +299,7 @@ sub add_diff_directory {
 
 
 sub finish {
 sub finish {
     my ($self) = @_;
     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};
     return not *$self->{errors};
 }
 }
 
 
@@ -309,16 +309,16 @@ sub register_error {
 }
 }
 sub _fail_with_msg {
 sub _fail_with_msg {
     my ($self, $file, $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();
     $self->register_error();
 }
 }
 sub _fail_not_same_type {
 sub _fail_not_same_type {
     my ($self, $old, $new, $file) = @_;
     my ($self, $old, $new, $file) = @_;
     my $old_type = get_type($old);
     my $old_type = get_type($old);
     my $new_type = get_type($new);
     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();
     $self->register_error();
 }
 }
 
 
@@ -343,7 +343,7 @@ sub _fetch_filename {
 
 
     # Is it a C-style string?
     # Is it a C-style string?
     if ($header =~ m/^"/) {
     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 {
     } else {
         # Tab is the official separator, it's always used when
         # Tab is the official separator, it's always used when
         # filename contain spaces. Try it first, otherwise strip on space
         # filename contain spaces. Try it first, otherwise strip on space
@@ -421,22 +421,22 @@ sub analyze {
 	$diff_count++;
 	$diff_count++;
 	# read file header (---/+++ pair)
 	# read file header (---/+++ pair)
 	unless ($line =~ s/^--- //) {
 	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);
 	$path{old} = $line = _fetch_filename($diff, $line);
 	if ($line ne '/dev/null' and $line =~ s{^[^/]*/+}{$destdir/}) {
 	if ($line ne '/dev/null' and $line =~ s{^[^/]*/+}{$destdir/}) {
 	    $fn{old} = $line;
 	    $fn{old} = $line;
 	}
 	}
 	if ($line =~ /\.dpkg-orig$/) {
 	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);
 	$line = _getline($self);
 	unless (defined $line) {
 	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/^\+\+\+ //) {
 	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);
 	$path{new} = $line = _fetch_filename($diff, $line);
 	if ($line ne '/dev/null' and $line =~ s{^[^/]*/+}{$destdir/}) {
 	if ($line ne '/dev/null' and $line =~ s{^[^/]*/+}{$destdir/}) {
@@ -444,7 +444,7 @@ sub analyze {
 	}
 	}
 
 
 	unless (defined $fn{old} or defined $fn{new}) {
 	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, $.);
 		  $diff, $.);
 	}
 	}
 
 
@@ -452,12 +452,12 @@ sub analyze {
 	foreach my $key ('old', 'new') {
 	foreach my $key ('old', 'new') {
 	    next unless defined $fn{$key};
 	    next unless defined $fn{$key};
 	    if ($path{$key} =~ m{/\.\./}) {
 	    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};
 	    my $path = $fn{$key};
 	    while (1) {
 	    while (1) {
 		if (-l $path) {
 		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);
 			  $diff, $fn{$key}, $path);
 		}
 		}
 		last unless $path =~ s{/+[^/]*$}{};
 		last unless $path =~ s{/+[^/]*$}{};
@@ -466,13 +466,13 @@ sub analyze {
 	}
 	}
 
 
         if ($path{old} eq '/dev/null' and $path{new} eq '/dev/null') {
         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, $.);
                   $diff, $.);
         } elsif ($path{new} eq '/dev/null') {
         } 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};
                   $diff, $. - 1) unless defined $fn{old};
             if ($opts{verbose}) {
             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};
                         $diff, $fn{old}, $.) unless -e $fn{old};
             }
             }
         }
         }
@@ -484,11 +484,11 @@ sub analyze {
 	}
 	}
 
 
 	if (-e $fn and not -f _) {
 	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}) {
 	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};
 		if $opts{verbose};
 	} else {
 	} else {
 	    $filepatched{$fn} = 1;
 	    $filepatched{$fn} = 1;
@@ -506,11 +506,11 @@ sub analyze {
 	    while ($olines || $nlines) {
 	    while ($olines || $nlines) {
 		unless (defined($line = _getline($self))) {
 		unless (defined($line = _getline($self))) {
                     if (($olines == $nlines) and ($olines < 3)) {
                     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};
                             if $opts{verbose};
                         last;
                         last;
                     } else {
                     } else {
-                        error(_g("unexpected end of diff `%s'"), $diff);
+                        error(g_("unexpected end of diff `%s'"), $diff);
                     }
                     }
 		}
 		}
 		next if $line =~ /^\\ /;
 		next if $line =~ /^\\ /;
@@ -523,19 +523,19 @@ sub analyze {
 		} elsif ($line =~ /^\+/) {
 		} elsif ($line =~ /^\+/) {
 		    --$nlines;
 		    --$nlines;
 		} else {
 		} else {
-		    error(_g("expected [ +-] at start of line %d of diff `%s'"),
+		    error(g_("expected [ +-] at start of line %d of diff `%s'"),
 		          $., $diff);
 		          $., $diff);
 		}
 		}
 	    }
 	    }
 	    $hunk++;
 	    $hunk++;
 	}
 	}
 	unless ($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);
     close($self);
     unless ($diff_count) {
     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};
 	    if $opts{verbose};
     }
     }
     *$self->{analysis}{$destdir}{dirtocreate} = \%dirtocreate;
     *$self->{analysis}{$destdir}{dirtocreate} = \%dirtocreate;
@@ -550,7 +550,7 @@ sub prepare_apply {
     if ($opts{create_dirs}) {
     if ($opts{create_dirs}) {
 	foreach my $dir (keys %{$analysis->{dirtocreate}}) {
 	foreach my $dir (keys %{$analysis->{dirtocreate}}) {
 	    eval { mkpath($dir, 0, 0777); };
 	    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) {
     foreach my $fn (@files) {
 	if ($opts{force_timestamp}) {
 	if ($opts{force_timestamp}) {
 	    utime($now, $now, $fn) or $! == ENOENT
 	    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}) {
 	if ($opts{remove_backup}) {
 	    $fn .= '.dpkg-orig';
 	    $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;
     return $analysis;
@@ -641,16 +641,16 @@ sub check_apply {
 sub get_type {
 sub get_type {
     my $file = shift;
     my $file = shift;
     if (not lstat($file)) {
     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 {
     } 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 ($self) = @_;
     my $db_dir = $self->get_db_file();
     my $db_dir = $self->get_db_file();
     if (not -d $db_dir) {
     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');
     my $file = $self->get_db_file('.version');
     if (not -e $file) {
     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";
         print { $version_fh } "2\n";
         close($version_fh);
         close($version_fh);
     }
     }
@@ -65,13 +65,13 @@ sub setup_db {
     # in Debian).
     # in Debian).
     $file = $self->get_db_file('.quilt_patches');
     $file = $self->get_db_file('.quilt_patches');
     if (not -e $file) {
     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";
         print { $qpatch_fh } "debian/patches\n";
         close($qpatch_fh);
         close($qpatch_fh);
     }
     }
     $file = $self->get_db_file('.quilt_series');
     $file = $self->get_db_file('.quilt_series');
     if (not -e $file) {
     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();
         my $series = $self->get_series_file();
         $series = (File::Spec->splitpath($series))[2];
         $series = (File::Spec->splitpath($series))[2];
         print { $qseries_fh } "$series\n";
         print { $qseries_fh } "$series\n";
@@ -173,7 +173,7 @@ sub push {
     my $path = $self->get_patch_file($patch);
     my $path = $self->get_patch_file($patch);
     my $obj = Dpkg::Source::Patch->new(filename => $path);
     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 {
     eval {
         $obj->apply($self->{dir}, timestamp => $opts{timestamp},
         $obj->apply($self->{dir}, timestamp => $opts{timestamp},
                     verbose => $opts{verbose},
                     verbose => $opts{verbose},
@@ -183,8 +183,8 @@ sub push {
                                  '-B', ".pc/$patch/", '--reject-file=-' ]);
                                  '-B', ".pc/$patch/", '--reject-file=-' ]);
     };
     };
     if ($@) {
     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');
              $patch, 'quilt refresh');
         $self->restore_quilt_backup_files($patch, %opts);
         $self->restore_quilt_backup_files($patch, %opts);
         erasedir($self->get_db_file($patch));
         erasedir($self->get_db_file($patch));
@@ -203,7 +203,7 @@ sub pop {
     my $patch = $self->top();
     my $patch = $self->top();
     return unless defined $patch;
     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);
     my $backup_dir = $self->get_db_file($patch);
     if (-d $backup_dir and not $opts{reverse_apply}) {
     if (-d $backup_dir and not $opts{reverse_apply}) {
         # Use the backup copies to restore
         # Use the backup copies to restore
@@ -229,7 +229,7 @@ sub get_db_version {
     my ($self) = @_;
     my ($self) = @_;
     my $pc_ver = $self->get_db_file('.version');
     my $pc_ver = $self->get_db_file('.version');
     if (-f $pc_ver) {
     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>;
         my $version = <$ver_fh>;
         chomp $version;
         chomp $version;
         close($ver_fh);
         close($ver_fh);
@@ -242,11 +242,11 @@ sub find_problems {
     my ($self) = @_;
     my ($self) = @_;
     my $patch_dir = $self->get_patch_file();
     my $patch_dir = $self->get_patch_file();
     if (-e $patch_dir and not -d _) {
     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();
     my $series = $self->get_series_file();
     if (-e $series and not -f _) {
     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;
     return;
 }
 }
@@ -286,7 +286,7 @@ sub get_patch_dir {
 sub _file_load {
 sub _file_load {
     my ($self, $file) = @_;
     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>;
     my @lines = <$file_fh>;
     close $file_fh;
     close $file_fh;
 
 
@@ -301,7 +301,7 @@ sub _file_add_line {
     CORE::push @lines, $line;
     CORE::push @lines, $line;
     chomp @lines;
     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;
     print { $file_fh } "$_\n" foreach @lines;
     close $file_fh;
     close $file_fh;
 }
 }
@@ -310,7 +310,7 @@ sub _file_drop_line {
     my ($self, $file, $re) = @_;
     my ($self, $file, $re) = @_;
 
 
     my @lines = $self->_file_load($file);
     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;
     print { $file_fh } $_ foreach grep { not /^\Q$re\E\s*$/ } @lines;
     close $file_fh;
     close $file_fh;
 }
 }
@@ -320,7 +320,7 @@ sub read_patch_list {
     return () if not defined $file or not -f $file;
     return () if not defined $file or not -f $file;
     $opts{warn_options} //= 0;
     $opts{warn_options} //= 0;
     my @patches;
     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>)) {
     while (defined(my $line = <$series_fh>)) {
         chomp $line;
         chomp $line;
         # Strip leading/trailing spaces
         # Strip leading/trailing spaces
@@ -332,14 +332,14 @@ sub read_patch_list {
         if ($line =~ /^(\S+)\s+(.*)$/) {
         if ($line =~ /^(\S+)\s+(.*)$/) {
             $line = $1;
             $line = $1;
             if ($2 ne '-p1') {
             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 " .
                            "options ('%s', line %s); dpkg-source might " .
                            'fail when applying patches'),
                            'fail when applying patches'),
                         $file, $2, $.) if $opts{warn_options};
                         $file, $2, $.) if $opts{warn_options};
             }
             }
         }
         }
         if ($line =~ m{(^|/)\.\./}) {
         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;
         CORE::push @patches, $line;
     }
     }
@@ -350,7 +350,7 @@ sub read_patch_list {
 sub write_patch_list {
 sub write_patch_list {
     my ($self, $series, $patches) = @_;
     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}) {
     foreach my $patch (@{$patches}) {
         print { $series_fh } "$patch\n";
         print { $series_fh } "$patch\n";
     }
     }
@@ -361,7 +361,7 @@ sub restore_quilt_backup_files {
     my ($self, $patch, %opts) = @_;
     my ($self, $patch, %opts) = @_;
     my $patch_dir = $self->get_db_file($patch);
     my $patch_dir = $self->get_db_file($patch);
     return unless -d $patch_dir;
     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({
     find({
         no_chdir => 1,
         no_chdir => 1,
         wanted => sub {
         wanted => sub {
@@ -373,9 +373,9 @@ sub restore_quilt_backup_files {
                 make_path(dirname($target));
                 make_path(dirname($target));
                 unless (link($_, $target)) {
                 unless (link($_, $target)) {
                     copy($_, $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)
                     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 {
             } else {
                 # empty files are "backups" for new files that patch created
                 # 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/;
 	next if m/^\s*\#/ || !m/\S/;
 	s/\s*\n$//;
 	s/\s*\n$//;
 	if (! m/^(\w[-:0-9A-Za-z]*)\=(.*)$/) {
 	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, $.);
 		  $varlistfile, $.);
 	}
 	}
 	$self->set($1, $2);
 	$self->set($1, $2);
@@ -280,7 +280,7 @@ sub substvars {
 
 
         if ($count >= $maxsubsts) {
         if ($count >= $maxsubsts) {
             error($opts{msg_prefix} .
             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;
         $lhs = $1; $vn = $2; $rhs = $3;
         if (defined($self->{vars}{$vn})) {
         if (defined($self->{vars}{$vn})) {
@@ -290,10 +290,10 @@ sub substvars {
 
 
             if (not $opts{no_warn} and $self->{attr}{$vn} & SUBSTVAR_ATTR_OLD) {
             if (not $opts{no_warn} and $self->{attr}{$vn} & SUBSTVAR_ATTR_OLD) {
                 warning($opts{msg_prefix} .
                 warning($opts{msg_prefix} .
-                        _g('deprecated substitution variable ${%s}'), $vn);
+                        g_('deprecated substitution variable ${%s}'), $vn);
             }
             }
         } else {
         } else {
-            warning($opts{msg_prefix} . _g('unknown substitution variable ${%s}'),
+            warning($opts{msg_prefix} . g_('unknown substitution variable ${%s}'),
 	            $vn) unless $opts{no_warn};
 	            $vn) unless $opts{no_warn};
             $v = $lhs . $rhs;
             $v = $lhs . $rhs;
         }
         }
@@ -317,7 +317,7 @@ sub warn_about_unused {
         # that they are not required in the current situation
         # that they are not required in the current situation
         # (example: debhelper's misc:Depends in many cases)
         # (example: debhelper's misc:Depends in many cases)
         next if $self->{vars}{$vn} eq '';
         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);
                 $vn);
     }
     }
 }
 }

+ 2 - 2
scripts/Dpkg/Vars.pm

@@ -37,12 +37,12 @@ sub get_source_package {
 sub set_source_package {
 sub set_source_package {
     my $v = shift;
     my $v = shift;
     my $err = pkg_name_is_illegal($v);
     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)) {
     if (not defined($sourcepackage)) {
         $sourcepackage = $v;
         $sourcepackage = $v;
     } elsif ($v ne $sourcepackage) {
     } 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);
               $sourcepackage, $v);
     }
     }
 }
 }

+ 1 - 1
scripts/Dpkg/Vendor.pm

@@ -89,7 +89,7 @@ sub get_vendor_info(;$) {
     my $file = get_vendor_file($vendor);
     my $file = get_vendor_file($vendor);
     return unless $file;
     return unless $file;
     my $fields = Dpkg::Control::HashCore->new();
     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;
     $VENDOR_CACHE{$vendor} = $fields;
     return $fields;
     return $fields;
 }
 }

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

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

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

@@ -59,13 +59,13 @@ sub run_hook {
            $fields->{'Version'} =~ /ubuntu/) {
            $fields->{'Version'} =~ /ubuntu/) {
            if ($fields->{'Maintainer'} !~ /ubuntu/i) {
            if ($fields->{'Maintainer'} !~ /ubuntu/i) {
                if (length $ENV{DEBEMAIL} and $ENV{DEBEMAIL} =~ /\@ubuntu\.com/) {
                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 {
                } 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'}) {
            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';
 	    my $flag = 'DEB_BUILD_HARDENING';
 	    if ($hardening ne '0') {
 	    if ($hardening ne '0') {
 		if (!find_command('hardened-cc')) {
 		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') {
 		if ($hardening ne '1') {
 		    my @options = split(/,\s*/, $hardening);
 		    my @options = split(/,\s*/, $hardening);
@@ -142,7 +142,7 @@ sub run_hook {
 		}
 		}
 	    }
 	    }
 	    if (defined $ENV{$flag}) {
 	    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');
 	    $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($$) {
 sub version_compare($$) {
     my ($a, $b) = @_;
     my ($a, $b) = @_;
     my $va = Dpkg::Version->new($a, check => 1);
     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);
     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;
     return $va <=> $vb;
 }
 }
 
 
@@ -402,22 +402,22 @@ sub version_check($) {
         $version = Dpkg::Version->new($str) unless ref($version);
         $version = Dpkg::Version->new($str) unless ref($version);
     }
     }
     if (not defined($str) or not length($str)) {
     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, $msg) if wantarray;
         return 0;
         return 0;
     }
     }
     if ($version->version() =~ m/^[^\d]/) {
     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, $msg) if wantarray;
         return 0;
         return 0;
     }
     }
     if ($str =~ m/([^-+:.0-9a-zA-Z~])/o) {
     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, $msg) if wantarray;
         return 0;
         return 0;
     }
     }
     if ($version->epoch() !~ /^\d*$/) {
     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());
                              "is not a number: '%s'"), $version->epoch());
         return (0, $msg) if wantarray;
         return (0, $msg) if wantarray;
         return 0;
         return 0;

+ 6 - 6
scripts/changelog/debian.pl

@@ -34,16 +34,16 @@ textdomain('dpkg-dev');
 $Dpkg::PROGNAME = "parsechangelog/$Dpkg::PROGNAME";
 $Dpkg::PROGNAME = "parsechangelog/$Dpkg::PROGNAME";
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 "Usage: %s [<option>...] [<changelogfile>]
 "Usage: %s [<option>...] [<changelogfile>]
 
 
 Options:
 Options:
@@ -83,7 +83,7 @@ sub set_format {
     my ($opt, $val) = @_;
     my ($opt, $val) = @_;
 
 
     unless ($allowed_formats{$val}) {
     unless ($allowed_formats{$val}) {
-	usageerr(_g('output format %s not supported'), $val );
+	usageerr(g_('output format %s not supported'), $val );
     }
     }
 
 
     $format = $val;
     $format = $val;
@@ -113,7 +113,7 @@ usageerr('too many arguments') if @ARGV > 1;
 
 
 if (@ARGV) {
 if (@ARGV) {
     if ($file && ($file ne $ARGV[0])) {
     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] );
     }
     }
     $file = $ARGV[0];
     $file = $ARGV[0];
@@ -137,7 +137,7 @@ my $range = {
 my $changes = Dpkg::Changelog::Debian->new(reportfile => $label, range => $range);
 my $changes = Dpkg::Changelog::Debian->new(reportfile => $label, range => $range);
 
 
 $changes->load($file)
 $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{
 eval qq{
     my \$output = \$changes->$format(\$range);
     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');
 textdomain('dpkg-dev');
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] [<command>]')
 'Usage: %s [<option>...] [<command>]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
 'Commands:
   -l, --list                list variables (default).
   -l, --list                list variables (default).
   -L, --list-known          list valid architectures (matching some criteria).
   -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.
   -c, --command <command>   set environment and run the command in it.
   -?, --help                show this help message.
   -?, --help                show this help message.
       --version             show the version.')
       --version             show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
 'Options:
   -a, --host-arch <arch>    set host Debian architecture.
   -a, --host-arch <arch>    set host Debian architecture.
   -t, --host-type <type>    set host GNU system type.
   -t, --host-type <type>    set host GNU system type.
@@ -80,24 +80,24 @@ sub check_arch_coherency
 
 
     if ($arch ne '' && $gnu_type eq '') {
     if ($arch ne '' && $gnu_type eq '') {
         $gnu_type = debarch_to_gnutriplet($arch);
         $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)
                  'GNU system type, too'), $arch)
             unless defined $gnu_type;
             unless defined $gnu_type;
     }
     }
 
 
     if ($gnu_type ne '' && $arch eq '') {
     if ($gnu_type ne '' && $arch eq '') {
         $arch = gnutriplet_to_debarch($gnu_type);
         $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)
                  'Debian architecture, too'), $gnu_type)
             unless defined $arch;
             unless defined $arch;
     }
     }
 
 
     if ($gnu_type ne '' && $arch ne '') {
     if ($gnu_type ne '' && $arch ne '') {
         my $dfl_gnu_type = debarch_to_gnutriplet($arch);
         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)
               $arch)
             unless defined $dfl_gnu_type;
             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,
                    'match specified GNU system type %s'), $dfl_gnu_type,
                 $arch, $gnu_type)
                 $arch, $gnu_type)
             if $dfl_gnu_type ne $gnu_type;
             if $dfl_gnu_type ne $gnu_type;
@@ -208,7 +208,7 @@ while (@ARGV) {
         $force=1;
         $force=1;
     } elsif ($arg eq '-q' or $arg eq '--query') {
     } elsif ($arg eq '-q' or $arg eq '--query') {
 	my $varname = shift;
 	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});
 	    unless (exists $arch_vars{$varname});
 	$req_variable_to_print = "$varname";
 	$req_variable_to_print = "$varname";
 	$req_vars = $arch_vars{$varname};
 	$req_vars = $arch_vars{$varname};
@@ -226,7 +226,7 @@ while (@ARGV) {
         version();
         version();
        exit 0;
        exit 0;
     } else {
     } 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();
     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'),
                'type %s, try setting a correct CC environment variable'),
             $v{DEB_HOST_GNU_TYPE}, $gcc)
             $v{DEB_HOST_GNU_TYPE}, $gcc)
         if ($gcc ne '') && ($gcc ne $v{DEB_HOST_GNU_TYPE});
         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');
 textdomain('dpkg-dev');
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<command>]')
 'Usage: %s [<command>]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
 'Commands:
   --get <flag>       output the requested flag to stdout.
   --get <flag>       output the requested flag to stdout.
   --origin <flag>    output the origin of the flag to stdout:
   --origin <flag>    output the origin of the flag to stdout:
@@ -67,20 +67,20 @@ my $load_config = 1;
 while (@ARGV) {
 while (@ARGV) {
     $_ = shift(@ARGV);
     $_ = shift(@ARGV);
     if (m/^--(get|origin|query-features)$/) {
     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);
             if defined($action);
         $action = $1;
         $action = $1;
         $param = shift(@ARGV);
         $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))?$/) {
     } 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);
             if defined($action);
         my $type = $1 || 'sh';
         my $type = $1 || 'sh';
         # Map legacy aliases.
         # Map legacy aliases.
         $type = 'cmdline' if $type eq 'configure';
         $type = 'cmdline' if $type eq 'configure';
         $action = "export-$type";
         $action = "export-$type";
     } elsif (m/^--(list|status|dump)$/) {
     } 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);
             if defined($action);
         $action = $1;
         $action = $1;
         $load_config = 0 if $action eq 'list';
         $load_config = 0 if $action eq 'list';
@@ -91,7 +91,7 @@ while (@ARGV) {
         version();
         version();
         exit 0;
         exit 0;
     } else {
     } 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');
 textdomain('dpkg-dev');
 
 
 sub showversion {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
 'Options:
   -F (default)   normal full build (binaries and sources).
   -F (default)   normal full build (binaries and sources).
   -g             source and arch-indep build.
   -g             source and arch-indep build.
@@ -98,13 +98,13 @@ sub usage {
                  change the administrative directory.
                  change the administrative directory.
   -?, --help     show this help message.
   -?, --help     show this help message.
       --version  show the version.')
       --version  show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options passed to dpkg-architecture:
 'Options passed to dpkg-architecture:
   -a, --host-arch <arch>    set the host Debian architecture.
   -a, --host-arch <arch>    set the host Debian architecture.
   -t, --host-type <type>    set the host GNU system type.
   -t, --host-type <type>    set the host GNU system type.
       --target-arch <arch>  set the target Debian architecture.
       --target-arch <arch>  set the target Debian architecture.
       --target-type <type>  set the target GNU system type.')
       --target-type <type>  set the target GNU system type.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options passed to dpkg-genchanges:
 'Options passed to dpkg-genchanges:
   -si (default)  source includes orig, if new upstream.
   -si (default)  source includes orig, if new upstream.
   -sa            source includes orig, always.
   -sa            source includes orig, always.
@@ -115,7 +115,7 @@ sub usage {
   -C<descfile>   changes are described in <descfile>.
   -C<descfile>   changes are described in <descfile>.
       --changes-option=<opt>
       --changes-option=<opt>
                  pass option <opt> to dpkg-genchanges.')
                  pass option <opt> to dpkg-genchanges.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options passed to dpkg-source:
 'Options passed to dpkg-source:
   -sn            force Debian native source format.
   -sn            force Debian native source format.
   -s[sAkurKUR]   see dpkg-source for explanation.
   -s[sAkurKUR]   see dpkg-source for explanation.
@@ -201,7 +201,7 @@ sub set_build_type
 {
 {
     my ($build_type, $build_option) = @_;
     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;
         if not build_is_default and $include != $build_type;
     $include = $build_type;
     $include = $build_type;
 }
 }
@@ -242,9 +242,9 @@ while (@ARGV) {
 	push @check_opts, $1;
 	push @check_opts, $1;
     } elsif (/^--hook-(.+)=(.*)$/) {
     } elsif (/^--hook-(.+)=(.*)$/) {
 	my ($hook_name, $hook_cmd) = ($1, $2);
 	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};
 	    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;
 	    if not defined $hook_cmd;
 	$hook{$hook_name} = $hook_cmd;
 	$hook{$hook_name} = $hook_cmd;
     } elsif (/^-p(.*)$/) {
     } elsif (/^-p(.*)$/) {
@@ -255,7 +255,7 @@ while (@ARGV) {
 	$checkbuilddep = ($1 eq 'D');
 	$checkbuilddep = ($1 eq 'D');
     } elsif (/^-s(gpg|pgp)$/) {
     } elsif (/^-s(gpg|pgp)$/) {
 	# Deprecated option
 	# 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$/) {
     } elsif (/^--force-sign$/) {
 	$signforce = 1;
 	$signforce = 1;
     } elsif (/^-us$/) {
     } elsif (/^-us$/) {
@@ -327,12 +327,12 @@ while (@ARGV) {
 	$desc = $1;
 	$desc = $1;
     } elsif (m/^-[EW]$/) {
     } elsif (m/^-[EW]$/) {
 	# Deprecated option
 	# 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(.*)$/) {
     } elsif (/^-R(.*)$/) {
 	my $arg = $1;
 	my $arg = $1;
 	@debian_rules = split /\s+/, $arg;
 	@debian_rules = split /\s+/, $arg;
     } else {
     } else {
-	usageerr(_g('unknown option or argument %s'), $_);
+	usageerr(g_('unknown option or argument %s'), $_);
     }
     }
 }
 }
 
 
@@ -353,28 +353,28 @@ if ($noclean) {
 }
 }
 
 
 if ($< == 0) {
 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 {
 } else {
     push @rootcommand, 'fakeroot' unless @rootcommand;
     push @rootcommand, 'fakeroot' unless @rootcommand;
 }
 }
 
 
 if (@rootcommand and not find_command($rootcommand[0])) {
 if (@rootcommand and not find_command($rootcommand[0])) {
     if ($rootcommand[0] eq 'fakeroot' and $< != 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, ' .
                  'package, specify a command with the -r option, ' .
                  'or run this as root'));
                  'or run this as root'));
     } else {
     } 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)) {
 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 ($signcommand) {
     if (!find_command($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}) ||
 } elsif (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
          ($ENV{HOME} && -e "$ENV{HOME}/.gnupg")) {
          ($ENV{HOME} && -e "$ENV{HOME}/.gnupg")) {
@@ -407,8 +407,8 @@ my $dir = basename($cwd);
 
 
 my $changelog = changelog_parse();
 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 $v = Dpkg::Version->new($version);
 my ($ok, $error) = version_check($v);
 my ($ok, $error) = version_check($v);
 error($error) unless $ok;
 error($error) unless $ok;
@@ -416,7 +416,7 @@ error($error) unless $ok;
 my $sversion = $v->as_string(omit_epoch => 1);
 my $sversion = $v->as_string(omit_epoch => 1);
 my $uversion = $v->version();
 my $uversion = $v->version();
 
 
-my $distribution = mustsetvar($changelog->{distribution}, _g('source distribution'));
+my $distribution = mustsetvar($changelog->{distribution}, g_('source distribution'));
 
 
 my $maintainer;
 my $maintainer;
 if ($changedby) {
 if ($changedby) {
@@ -424,7 +424,7 @@ if ($changedby) {
 } elsif ($maint) {
 } elsif ($maint) {
     $maintainer = $maint;
     $maintainer = $maint;
 } else {
 } 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) {
 } elsif (build_binaryindep) {
     $arch = 'all';
     $arch = 'all';
 } else {
 } else {
-    $arch = mustsetvar($ENV{DEB_HOST_ARCH}, _g('host architecture'));
+    $arch = mustsetvar($ENV{DEB_HOST_ARCH}, g_('host architecture'));
 }
 }
 
 
 my $pv = "${pkg}_$sversion";
 my $pv = "${pkg}_$sversion";
@@ -478,7 +478,7 @@ if ($signsource && build_binaryonly) {
 run_hook('init', 1);
 run_hook('init', 1);
 
 
 if (not -x 'debian/rules') {
 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
     chmod(0755, 'debian/rules'); # No checks of failures, non fatal
 }
 }
 
 
@@ -499,11 +499,11 @@ if ($checkbuilddep) {
     if (not WIFEXITED($?)) {
     if (not WIFEXITED($?)) {
         subprocerr('dpkg-checkbuilddeps');
         subprocerr('dpkg-checkbuilddeps');
     } elsif (WEXITSTATUS($?)) {
     } 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) {
 	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'));
 	               'will probably become fatal in the future'));
 	} else {
 	} else {
 	    exit 3;
 	    exit 3;
@@ -531,7 +531,7 @@ unless ($noclean) {
 run_hook('source', $include & BUILD_SOURCE);
 run_hook('source', $include & BUILD_SOURCE);
 
 
 if ($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;
                'it might contain undesired files')) if $noclean;
     chdir('..') or syserr('chdir ..');
     chdir('..') or syserr('chdir ..');
     withecho('dpkg-source', @source_opts, '-b', $dir);
     withecho('dpkg-source', @source_opts, '-b', $dir);
@@ -551,7 +551,7 @@ if ($buildtarget ne 'build' and scalar(@debian_rules) == 1) {
     my $exitcode = WEXITSTATUS($?);
     my $exitcode = WEXITSTATUS($?);
     subprocerr($cmdline) unless WIFEXITED($?);
     subprocerr($cmdline) unless WIFEXITED($?);
     if ($exitcode == 2) {
     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 " .
                    "'build-indep' targets (at least '%s' seems to be " .
                    'missing)'), "@debian_rules", $buildtarget);
                    'missing)'), "@debian_rules", $buildtarget);
         $buildtarget = 'build';
         $buildtarget = 'build';
@@ -578,9 +578,9 @@ print { *STDERR } " dpkg-genchanges @changes_opts >$chg\n";
 
 
 open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts
 open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts
     or subprocerr('dpkg-genchanges');
     or subprocerr('dpkg-genchanges');
-$changes->parse($changes_fh, _g('parse changes file'));
+$changes->parse($changes_fh, g_('parse changes file'));
 $changes->save($chg);
 $changes->save($chg);
-close $changes_fh or subprocerr(_g('dpkg-genchanges'));
+close $changes_fh or subprocerr(g_('dpkg-genchanges'));
 
 
 run_hook('postclean', $cleansource);
 run_hook('postclean', $cleansource);
 
 
@@ -601,7 +601,7 @@ if ($check_command) {
 }
 }
 
 
 if ($signpause && ($signchanges || $signsource)) {
 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();
     getc();
 }
 }
 
 
@@ -609,7 +609,7 @@ run_hook('sign', $signsource || $signchanges);
 
 
 if ($signsource) {
 if ($signsource) {
     if (signfile("$pv.dsc")) {
     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.
     # Recompute the checksums as the .dsc has changed now.
@@ -628,11 +628,11 @@ if ($signsource) {
     $changes->save($chg);
     $changes->save($chg);
 }
 }
 if ($signchanges && signfile("$pva.changes")) {
 if ($signchanges && signfile("$pva.changes")) {
-    error(_g('failed to sign .changes file'));
+    error(g_('failed to sign .changes file'));
 }
 }
 
 
 if (not $signreleased) {
 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);
 run_hook('done', 1);
@@ -640,7 +640,7 @@ run_hook('done', 1);
 sub mustsetvar {
 sub mustsetvar {
     my ($var, $text) = @_;
     my ($var, $text) = @_;
 
 
-    error(_g('unable to determine %s'), $text)
+    error(g_('unable to determine %s'), $text)
 	unless defined($var);
 	unless defined($var);
 
 
     print "$Dpkg::PROGNAME: $text $var\n";
     print "$Dpkg::PROGNAME: $text $var\n";
@@ -676,7 +676,7 @@ sub run_hook {
         if (exists $hook_vars{$var}) {
         if (exists $hook_vars{$var}) {
             return $hook_vars{$var};
             return $hook_vars{$var};
         } else {
         } else {
-            warning(_g('unknown %% substitution in hook: %%%s'), $var);
+            warning(g_('unknown %% substitution in hook: %%%s'), $var);
             return "\%$var";
             return "\%$var";
         }
         }
     };
     };
@@ -696,9 +696,9 @@ sub signfile {
 
 
     # Make sure the file to sign ends with a newline.
     # Make sure the file to sign ends with a newline.
     copy("../$file", $signfile);
     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";
     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',
     system($signcommand, '--utf8-strings', '--textmode', '--armor',
            '--local-user', $signkey || $maintainer, '--clearsign',
            '--local-user', $signkey || $maintainer, '--clearsign',
@@ -727,20 +727,20 @@ sub describe_build {
         # source-only upload
         # source-only upload
         if (fileomitted($files, qr/\.diff\.$ext/) and
         if (fileomitted($files, qr/\.diff\.$ext/) and
             fileomitted($files, qr/\.debian\.tar\.$ext/)) {
             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/)) {
         } 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 {
         } else {
-            return _g('source-only upload (original source is included)');
+            return g_('source-only upload (original source is included)');
         }
         }
     } elsif (fileomitted($files, qr/\.dsc/)) {
     } 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
     } elsif (fileomitted($files, qr/\.diff\.$ext/) and
              fileomitted($files, qr/\.debian\.tar\.$ext/)) {
              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/)) {
     } 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 {
     } 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()
 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);
 	exit(0);
 }
 }
 
 
 sub usage {
 sub usage {
-	printf _g(
+    printf g_(
 'Usage: %s [<option>...] [<control-file>]')
 'Usage: %s [<option>...] [<control-file>]')
-	. "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
 'Options:
   -A             ignore Build-Depends-Arch and Build-Conflicts-Arch.
   -A             ignore Build-Depends-Arch and Build-Conflicts-Arch.
   -B             ignore Build-Depends-Indep and Build-Conflicts-Indep.
   -B             ignore Build-Depends-Indep and Build-Conflicts-Indep.
@@ -57,7 +57,7 @@ sub usage {
                  change the administrative directory.
                  change the administrative directory.
   -?, --help     show this help message.
   -?, --help     show this help message.
       --version  show the version.')
       --version  show the version.')
-	. "\n\n" . _g(
+    . "\n\n" . g_(
 '<control-file> is the control file to process (default: debian/control).')
 '<control-file> is the control file to process (default: debian/control).')
 	. "\n", $Dpkg::PROGNAME;
 	. "\n", $Dpkg::PROGNAME;
 }
 }
@@ -113,7 +113,7 @@ if ($bd_value) {
     my $dep = deps_parse($bd_value, reduce_restrictions => 1,
     my $dep = deps_parse($bd_value, reduce_restrictions => 1,
                          build_dep => 1, build_profiles => \@build_profiles,
                          build_dep => 1, build_profiles => \@build_profiles,
                          host_arch => $host_arch);
                          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')
           'Build-Depends/Build-Depends-Arch/Build-Depends-Indep')
         unless defined $dep;
         unless defined $dep;
     push @unmet, build_depends($dep, $facts);
     push @unmet, build_depends($dep, $facts);
@@ -122,18 +122,18 @@ if ($bc_value) {
     my $dep = deps_parse($bc_value, reduce_restrictions => 1, union => 1,
     my $dep = deps_parse($bc_value, reduce_restrictions => 1, union => 1,
                          build_dep => 1, build_profiles => \@build_profiles,
                          build_dep => 1, build_profiles => \@build_profiles,
                          host_arch => $host_arch);
                          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')
           'Build-Conflicts/Build-Conflicts-Arch/Build-Conflicts-Indep')
         unless defined $dep;
         unless defined $dep;
     push @conflicts, build_conflicts($dep, $facts);
     push @conflicts, build_conflicts($dep, $facts);
 }
 }
 
 
 if (@unmet) {
 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";
 	print { *STDERR } join(' ', map { $_->output() } @unmet), "\n";
 }
 }
 if (@conflicts) {
 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";
 	print { *STDERR } join(' ', map { $_->output() } @conflicts), "\n";
 }
 }
 exit 1 if @unmet || @conflicts;
 exit 1 if @unmet || @conflicts;
@@ -145,7 +145,7 @@ sub parse_status {
 	my $facts = Dpkg::Deps::KnownFacts->new();
 	my $facts = Dpkg::Deps::KnownFacts->new();
 	local $/ = '';
 	local $/ = '';
 	open(my $status_fh, '<', $status)
 	open(my $status_fh, '<', $status)
-		or syserr(_g('cannot open %s'), $status);
+		or syserr(g_('cannot open %s'), $status);
 	while (<$status_fh>) {
 	while (<$status_fh>) {
 		next unless /^Status: .*ok installed$/m;
 		next unless /^Status: .*ok installed$/m;
 
 

+ 9 - 9
scripts/dpkg-distaddfile.pl

@@ -34,16 +34,16 @@ my $fileslistfile = 'debian/files';
 
 
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] <filename> <section> <priority>
 'Usage: %s [<option>...] <filename> <section> <priority>
 
 
 Options:
 Options:
@@ -66,22 +66,22 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
     } elsif (m/^--$/) {
     } elsif (m/^--$/) {
         last;
         last;
     } else {
     } 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;
 my ($file, $section, $priority) = @ARGV;
 
 
 ($file =~ m/\s/ || $section =~ m/\s/ || $priority =~ m/\s/) &&
 ($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
 # Obtain a lock on debian/control to avoid simultaneous updates
 # of debian/files when parallel building is in use
 # of debian/files when parallel building is in use
 my $lockfh;
 my $lockfh;
 my $lockfile = 'debian/control';
 my $lockfile = 'debian/control';
 sysopen($lockfh, $lockfile, O_WRONLY)
 sysopen($lockfh, $lockfile, O_WRONLY)
-    or syserr(_g('cannot write %s'), $lockfile);
+    or syserr(g_('cannot write %s'), $lockfile);
 file_lock($lockfh, $lockfile);
 file_lock($lockfh, $lockfile);
 
 
 my $dist = Dpkg::Dist::Files->new();
 my $dist = Dpkg::Dist::Files->new();
@@ -90,7 +90,7 @@ $dist->add_file($file, $section, $priority);
 $dist->save("$fileslistfile.new");
 $dist->save("$fileslistfile.new");
 
 
 rename("$fileslistfile.new", $fileslistfile)
 rename("$fileslistfile.new", $fileslistfile)
-    or syserr(_g('install new files list file'));
+    or syserr(g_('install new files list file'));
 
 
 # Release the lock
 # 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) = @_;
     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;
         if not build_is_default and $include != $build_type;
     $include = $build_type;
     $include = $build_type;
 }
 }
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...]')
 'Usage: %s [<option>...]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Options:
 "Options:
   -g                       source and arch-indep build.
   -g                       source and arch-indep build.
   -G                       source and arch-specific build.
   -G                       source and arch-specific build.
@@ -212,7 +212,7 @@ while (@ARGV) {
 	version();
 	version();
 	exit(0);
 	exit(0);
     } else {
     } 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,
     version_compare_relation($changelog->{'Version'}, REL_LT,
                              $prev_changelog->{'Version'}))
                              $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'})
 	$changelog->{'Version'}, $prev_changelog->{'Version'})
         # ~bpo and ~vola are backports and have lower version number by definition
         # ~bpo and ~vola are backports and have lower version number by definition
         unless $changelog->{'Version'} =~ /~(?:bpo|vola)/;
         unless $changelog->{'Version'} =~ /~(?:bpo|vola)/;
@@ -267,8 +267,8 @@ my $origsrcmsg;
 if ($include & BUILD_SOURCE) {
 if ($include & BUILD_SOURCE) {
     my $sec = $sourcedefault{'Section'} // '-';
     my $sec = $sourcedefault{'Section'} // '-';
     my $pri = $sourcedefault{'Priority'} // '-';
     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 $spackage = get_source_package();
     (my $sversion = $substvars->get('source:Version')) =~ s/^\d+://;
     (my $sversion = $substvars->get('source:Version')) =~ s/^\d+://;
@@ -276,7 +276,7 @@ if ($include & BUILD_SOURCE) {
     my $dsc = "${spackage}_${sversion}.dsc";
     my $dsc = "${spackage}_${sversion}.dsc";
     my $dsc_pathname = "$uploadfilesdir/$dsc";
     my $dsc_pathname = "$uploadfilesdir/$dsc";
     my $dsc_fields = Dpkg::Control->new(type => CTRL_PKG_SRC);
     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_file($dsc_pathname, key => $dsc);
     $checksums->add_from_control($dsc_fields, use_files_for_md5 => 1);
     $checksums->add_from_control($dsc_fields, use_files_for_md5 => 1);
 
 
@@ -297,16 +297,16 @@ if ($include & BUILD_SOURCE) {
          $sourcestyle =~ m/d/) &&
          $sourcestyle =~ m/d/) &&
         any { m/\.(?:debian\.tar|diff)\.$ext$/ } $checksums->get_files())
         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()) {
         foreach my $f (grep { m/\.orig(-.+)?\.tar\.$ext$/ } $checksums->get_files()) {
             $checksums->remove_file($f);
             $checksums->remove_file($f);
         }
         }
     } else {
     } else {
         if ($sourcestyle =~ m/d/ &&
         if ($sourcestyle =~ m/d/ &&
             none { m/\.(?:debian\.tar|diff)\.$ext$/ } $checksums->get_files()) {
             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.
     # Only add attributes for files being distributed.
@@ -314,13 +314,13 @@ if ($include & BUILD_SOURCE) {
         $dist->add_file($f, $sec, $pri);
         $dist->add_file($f, $sec, $pri);
     }
     }
 } elsif ($include == BUILD_ARCH_DEP) {
 } 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)');
                      '(source code and arch-indep packages not included)');
 } elsif ($include == BUILD_ARCH_INDEP) {
 } 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)');
                      '(source code and arch-specific packages not included)');
 } else {
 } else {
-    $origsrcmsg = _g('binary-only upload (no source code included)');
+    $origsrcmsg = g_('binary-only upload (no source code included)');
 }
 }
 
 
 if ($include & BUILD_BINARY) {
 if ($include & BUILD_BINARY) {
@@ -328,7 +328,7 @@ if ($include & BUILD_BINARY) {
 
 
     $dist_count = $dist->load($fileslistfile) if -e $fileslistfile;
     $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;
         if $dist_count == 0;
 
 
     foreach my $file ($dist->get_files()) {
     foreach my $file ($dist->get_files()) {
@@ -373,7 +373,7 @@ foreach my $pkg ($control->get_packages()) {
 	    (@restrictions == 0 or
 	    (@restrictions == 0 or
 	     evaluate_restriction_formula(\@restrictions, \@profiles)))
 	     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);
 		    $p);
 	}
 	}
 	next; # and skip it
 	next; # and skip it
@@ -418,13 +418,13 @@ foreach (keys %{$changelog}) {
 
 
 if ($changesdescription) {
 if ($changesdescription) {
     open(my $changes_fh, '<', $changesdescription)
     open(my $changes_fh, '<', $changesdescription)
-        or syserr(_g('read changesdescription'));
+        or syserr(g_('read changesdescription'));
     $fields->{'Changes'} = "\n" . file_slurp($changes_fh);
     $fields->{'Changes'} = "\n" . file_slurp($changes_fh);
     close($changes_fh);
     close($changes_fh);
 }
 }
 
 
 for my $p (keys %p2f) {
 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);
         unless defined $control->get_pkg_by_name($p);
 }
 }
 
 
@@ -436,26 +436,26 @@ for my $p (keys %p2f) {
 
 
 	my $sec = $f2seccf{$f} || $sourcedefault{'Section'} // '-';
 	my $sec = $f2seccf{$f} || $sourcedefault{'Section'} // '-';
 	if ($sec eq '-') {
 	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}) {
 	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});
 	             'files list'), $p, $sec, $file->{section});
 	}
 	}
 
 
 	my $pri = $f2pricf{$f} || $sourcedefault{'Priority'} // '-';
 	my $pri = $f2pricf{$f} || $sourcedefault{'Priority'} // '-';
 	if ($pri eq '-') {
 	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}) {
 	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});
 	             'files list'), $p, $pri, $file->{priority});
 	}
 	}
     }
     }
 }
 }
 
 
 print { *STDERR } "$Dpkg::PROGNAME: $origsrcmsg\n"
 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');
 $fields->{'Format'} = $substvars->get('Format');
 
 
@@ -512,12 +512,12 @@ $fields->{'Maintainer'} = $forcemaint if defined($forcemaint);
 $fields->{'Changed-By'} = $forcechangedby if defined($forcechangedby);
 $fields->{'Changed-By'} = $forcechangedby if defined($forcechangedby);
 
 
 for my $f (qw(Version Distribution Maintainer Changes)) {
 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};
         unless defined $fields->{$f};
 }
 }
 
 
 for my $f (qw(Urgency)) {
 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};
         unless defined $fields->{$f};
 }
 }
 
 

+ 30 - 30
scripts/dpkg-gencontrol.pl

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

+ 21 - 21
scripts/dpkg-gensymbols.pl

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

+ 8 - 8
scripts/dpkg-mergechangelogs.pl

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

+ 19 - 19
scripts/dpkg-name.pl

@@ -43,14 +43,14 @@ my %options = (
 
 
 sub version()
 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()
 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:
 Options:
   -a, --no-architecture    no architecture part in filename.
   -a, --no-architecture    no architecture part in filename.
   -o, --overwrite          overwrite if file exists.
   -o, --overwrite          overwrite if file exists.
@@ -72,7 +72,7 @@ sub fileexists($)
     if (-f $filename) {
     if (-f $filename) {
         return 1;
         return 1;
     } else {
     } else {
-        warning(_g("cannot find '%s'"), $filename);
+        warning(g_("cannot find '%s'"), $filename);
         return 0;
         return 0;
     }
     }
 }
 }
@@ -93,9 +93,9 @@ sub getfields($)
 
 
     # Read the fields
     # Read the fields
     open(my $cdata_fh, '-|', 'dpkg-deb', '-f', '--', $filename)
     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);
     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);
     close($cdata_fh);
 
 
     return $fields;
     return $fields;
@@ -108,7 +108,7 @@ sub getarch($$)
     my $arch = $fields->{Architecture};
     my $arch = $fields->{Architecture};
     if (not $fields->{Architecture} and $options{architecture}) {
     if (not $fields->{Architecture} and $options{architecture}) {
         $arch = get_host_arch();
         $arch = get_host_arch();
-        warning(_g("assuming architecture '%s' for '%s'"), $arch, $filename);
+        warning(g_("assuming architecture '%s' for '%s'"), $arch, $filename);
     }
     }
 
 
     return $arch;
     return $arch;
@@ -130,7 +130,7 @@ sub getname($$$)
     }
     }
     (my $name = $tname) =~ s/ //g;
     (my $name = $tname) =~ s/ //g;
     if ($tname ne $name) { # control fields have spaces
     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;
     return $name;
 }
 }
@@ -146,7 +146,7 @@ sub getdir($$$)
             my $section = $fields->{Section};
             my $section = $fields->{Section};
             if (!$section) {
             if (!$section) {
                 $section = 'no-section';
                 $section = 'no-section';
-                warning(_g("assuming section '%s' for '%s'"), $section,
+                warning(g_("assuming section '%s' for '%s'"), $section,
                         $filename);
                         $filename);
             }
             }
             if ($section ne 'non-free' and $section ne 'contrib' and
             if ($section ne 'non-free' and $section ne 'contrib' and
@@ -171,7 +171,7 @@ sub move($)
         my $fields = getfields($filename);
         my $fields = getfields($filename);
 
 
         unless (exists $fields->{Package}) {
         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);
                     $filename);
             return;
             return;
         }
         }
@@ -184,12 +184,12 @@ sub move($)
         if (! -d $dir) {
         if (! -d $dir) {
             if ($options{createdir}) {
             if ($options{createdir}) {
                 if (mkpath($dir)) {
                 if (mkpath($dir)) {
-                    info(_g("created directory '%s'"), $dir);
+                    info(g_("created directory '%s'"), $dir);
                 } else {
                 } else {
-                    error(_g("cannot create directory '%s'"), $dir);
+                    error(g_("cannot create directory '%s'"), $dir);
                 }
                 }
             } else {
             } else {
-                error(_g("no such directory '%s', try --create-dir (-c) option"),
+                error(g_("no such directory '%s', try --create-dir (-c) option"),
                       $dir);
                       $dir);
             }
             }
         }
         }
@@ -204,13 +204,13 @@ sub move($)
         }
         }
 
 
         if (filesame($newname, $filename)) {
         if (filesame($newname, $filename)) {
-            warning(_g("skipping '%s'"), $filename);
+            warning(g_("skipping '%s'"), $filename);
         } elsif (-f $newname and not $options{overwrite}) {
         } 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) {
         } 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 {
         } 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;
         push @files, @ARGV;
         last;
         last;
     } elsif (m/^-/) {
     } elsif (m/^-/) {
-        usageerr(_g("unknown option \`%s'"), $_);
+        usageerr(g_("unknown option \`%s'"), $_);
     } else {
     } else {
         push @files, $_;
         push @files, $_;
     }
     }
 }
 }
 
 
-@files or usageerr(_g('need at least a filename'));
+@files or usageerr(g_('need at least a filename'));
 
 
 foreach my $file (@files) {
 foreach my $file (@files) {
     move($file);
     move($file);

+ 7 - 7
scripts/dpkg-parsechangelog.pl

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

+ 24 - 24
scripts/dpkg-scanpackages.pl

@@ -66,12 +66,12 @@ my @options_spec = (
 );
 );
 
 
 sub version {
 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;
     exit;
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 "Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Packages
 "Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Packages
 
 
 Options:
 Options:
@@ -112,7 +112,7 @@ sub load_override
 		    my $debmaint = $$package{Maintainer};
 		    my $debmaint = $$package{Maintainer};
 		    if (none { $debmaint eq $_ } split m{\s*//\s*}, $oldmaint) {
 		    if (none { $debmaint eq $_ } split m{\s*//\s*}, $oldmaint) {
 			push(@changedmaint,
 			push(@changedmaint,
-			     sprintf(_g('  %s (package says %s, not %s)'),
+			     sprintf(g_('  %s (package says %s, not %s)'),
 			             $p, $$package{Maintainer}, $oldmaint));
 			             $p, $$package{Maintainer}, $oldmaint));
 		    } else {
 		    } else {
 			$$package{Maintainer} = $newmaint;
 			$$package{Maintainer} = $newmaint;
@@ -120,7 +120,7 @@ sub load_override
 		} elsif ($$package{Maintainer} eq $maintainer) {
 		} elsif ($$package{Maintainer} eq $maintainer) {
 		    push(@samemaint, "  $p ($maintainer)");
 		    push(@samemaint, "  $p ($maintainer)");
 		} else {
 		} else {
-		    warning(_g('unconditional maintainer override for %s'), $p);
+		    warning(g_('unconditional maintainer override for %s'), $p);
 		    $$package{Maintainer} = $maintainer;
 		    $$package{Maintainer} = $maintainer;
 		}
 		}
 	    }
 	    }
@@ -161,7 +161,7 @@ sub load_override_extra
 }
 }
 
 
 if (not (@ARGV >= 1 and @ARGV <= 3)) {
 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';
 my $type = $options{type} // 'deb';
@@ -170,7 +170,7 @@ my %hash = map { $_ => 1 } split /,/, $options{hash} // '';
 
 
 foreach my $alg (keys %hash) {
 foreach my $alg (keys %hash) {
     if (not checksums_is_supported($alg)) {
     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;
 my ($binarydir, $override, $pathprefix) = @ARGV;
 
 
 if (not -d $binarydir) {
 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) {
 if (defined $override and not -e $override) {
-    error(_g('override file %s not found'), $override);
+    error(g_('override file %s not found'), $override);
 }
 }
 
 
 $pathprefix //= '';
 $pathprefix //= '';
 
 
 my $find_h = IO::Handle->new();
 my $find_h = IO::Handle->new();
 open($find_h, '-|', 'find', '-L', "$binarydir/", @find_args, '-print')
 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:
 FILE:
     while (my $fn = <$find_h>) {
     while (my $fn = <$find_h>) {
 	chomp $fn;
 	chomp $fn;
@@ -205,16 +205,16 @@ FILE:
 	                to_pipe => \$output);
 	                to_pipe => \$output);
 	my $fields = Dpkg::Control->new(type => CTRL_INDEX_PKG);
 	my $fields = Dpkg::Control->new(type => CTRL_INDEX_PKG);
 	$fields->parse($output, $fn)
 	$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);
 	wait_child($pid, nocheck => 1);
 	if ($?) {
 	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, $?);
 	            $fn, $?);
 	    next;
 	    next;
 	}
 	}
 
 
 	defined($fields->{'Package'})
 	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'};
 	my $p = $fields->{'Package'};
 
 
 	if (defined($packages{$p}) and not $options{multiversion}) {
 	if (defined($packages{$p}) and not $options{multiversion}) {
@@ -222,20 +222,20 @@ FILE:
 		if (version_compare_relation($fields->{'Version'}, REL_GT,
 		if (version_compare_relation($fields->{'Version'}, REL_GT,
 		                             $pkg->{'Version'}))
 		                             $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);
 		            $p, $fn);
-		    warning(_g('used that one and ignored data from %s!'),
+		    warning(g_('used that one and ignored data from %s!'),
 		            $pkg->{Filename});
 		            $pkg->{Filename});
 		    $packages{$p} = [];
 		    $packages{$p} = [];
 		} else {
 		} 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});
 		            $pkg->{Filename});
 		    next FILE;
 		    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'});
 	    if defined($fields->{'Filename'});
 
 
 	$fields->{'Filename'} = "$pathprefix$fn";
 	$fields->{'Filename'} = "$pathprefix$fn";
@@ -269,27 +269,27 @@ for my $p (sort keys %packages) {
         push @missingover, $p;
         push @missingover, $p;
     }
     }
     for my $package (@{$packages{$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++;
          $records_written++;
     }
     }
 }
 }
-close(STDOUT) or syserr(_g("couldn't close stdout"));
+close(STDOUT) or syserr(g_("couldn't close stdout"));
 
 
 if (@changedmaint) {
 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);
     warning($_) foreach (@changedmaint);
 }
 }
 if (@samemaint) {
 if (@samemaint) {
-    warning(_g('Packages specifying same maintainer as override file:'));
+    warning(g_('Packages specifying same maintainer as override file:'));
     warning($_) foreach (@samemaint);
     warning($_) foreach (@samemaint);
 }
 }
 if (@missingover) {
 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));
     warning('  %s', join(' ', @missingover));
 }
 }
 if (@spuriousover) {
 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));
     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 {
 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;
     exit;
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 "Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Sources
 "Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Sources
 
 
 Options:
 Options:
@@ -101,7 +101,7 @@ See the man page for the full documentation.
 
 
 sub close_msg {
 sub close_msg {
     my $name = shift;
     my $name = shift;
-    return sprintf(_g("error closing %s (\$? %d, \$! `%s')"),
+    return sprintf(g_("error closing %s (\$? %d, \$! `%s')"),
                    $name, $?, $!)."\n";
                    $name, $?, $!)."\n";
 }
 }
 
 
@@ -117,18 +117,18 @@ sub load_override {
 
 
 	my @data = split ' ', $_, 4;
 	my @data = split ' ', $_, 4;
 	unless (@data == 3 || @data == 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);
 	            $., 0 + @data);
 	    next;
 	    next;
 	}
 	}
 	my ($package, $priority, $section, $maintainer) = @data;
 	my ($package, $priority, $section, $maintainer) = @data;
 	if (exists $override{$package}) {
 	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, $.);
 	            $package, $.);
 	    next;
 	    next;
 	}
 	}
 	if (!$priority{$priority}) {
 	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);
 	            $package, $priority);
 	    next;
 	    next;
 	}
 	}
@@ -182,7 +182,7 @@ sub load_src_override {
 
 
 	my @data = split ' ';
 	my @data = split ' ';
 	unless (@data == 2) {
 	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);
 	            $., 0 + @data);
 	    next;
 	    next;
 	}
 	}
@@ -190,7 +190,7 @@ sub load_src_override {
 	my ($package, $section) = @data;
 	my ($package, $section) = @data;
 	my $key = "source/$package";
 	my $key = "source/$package";
 	if (exists $override{$key}) {
 	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, $.);
 	            $package, $.);
 	    next;
 	    next;
 	}
 	}
@@ -240,7 +240,7 @@ sub process_dsc {
     my $source = $fields->{Source};
     my $source = $fields->{Source};
     my @binary = split /\s*,\s*/, $fields->{Binary};
     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.
     # Rename the source field to package.
     $fields->{Package} = $fields->{Source};
     $fields->{Package} = $fields->{Source};
@@ -301,7 +301,7 @@ sub main {
         local $SIG{__WARN__} = sub { usageerr($_[0]) };
         local $SIG{__WARN__} = sub { usageerr($_[0]) };
         GetOptions(@option_spec);
         GetOptions(@option_spec);
     }
     }
-    usageerr(_g('one to three arguments expected'))
+    usageerr(g_('one to three arguments expected'))
         if @ARGV < 1 or @ARGV > 3;
         if @ARGV < 1 or @ARGV > 3;
 
 
     push @ARGV, undef if @ARGV < 2;
     push @ARGV, undef if @ARGV < 2;
@@ -313,7 +313,7 @@ sub main {
     load_override_extra $extra_override_file if defined $extra_override_file;
     load_override_extra $extra_override_file if defined $extra_override_file;
 
 
     open my $find_fh, '-|', "find -L \Q$dir\E -name '*.dsc' -print"
     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>) {
     while (<$find_fh>) {
     	chomp;
     	chomp;
 	s{^\./+}{};
 	s{^\./+}{};

+ 36 - 36
scripts/dpkg-shlibdeps.pl

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

+ 39 - 39
scripts/dpkg-source.pl

@@ -103,20 +103,20 @@ my $dir;
 if (defined($options{opmode}) &&
 if (defined($options{opmode}) &&
     $options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     $options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     if (not scalar(@ARGV)) {
     if (not scalar(@ARGV)) {
-	usageerr(_g('--%s needs a directory'), $options{opmode})
+	usageerr(g_('--%s needs a directory'), $options{opmode})
 	    unless $1 eq 'commit';
 	    unless $1 eq 'commit';
 	$dir = '.';
 	$dir = '.';
     } else {
     } else {
 	$dir = File::Spec->catdir(shift(@ARGV));
 	$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) {
     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 '.') {
     if ($dir eq '.') {
 	# . is never correct, adjust automatically
 	# . is never correct, adjust automatically
 	$dir = basename(cwd());
 	$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
     # --format options are not allowed, they would take precedence
     # over real command line options, debian/source/format should be used
     # over real command line options, debian/source/format should be used
@@ -134,7 +134,7 @@ if (defined($options{opmode}) &&
 	$conf->load($optfile);
 	$conf->load($optfile);
 	$conf->filter(remove => sub { $_[0] =~ $forbidden_opts_re->{$filename} });
 	$conf->filter(remove => sub { $_[0] =~ $forbidden_opts_re->{$filename} });
 	if (@$conf) {
 	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';
 		unless $options{opmode} eq 'print-format';
 	    unshift @options, @$conf;
 	    unshift @options, @$conf;
 	}
 	}
@@ -148,13 +148,13 @@ while (@options) {
     } elsif (m/^-(?:Z|-compression=)(.*)$/) {
     } elsif (m/^-(?:Z|-compression=)(.*)$/) {
 	my $compression = $1;
 	my $compression = $1;
 	$options{compression} = $compression;
 	$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);
 	    unless compression_is_supported($compression);
 	compression_set_default($compression);
 	compression_set_default($compression);
     } elsif (m/^-(?:z|-compression-level=)(.*)$/) {
     } elsif (m/^-(?:z|-compression-level=)(.*)$/) {
 	my $comp_level = $1;
 	my $comp_level = $1;
 	$options{comp_level} = $comp_level;
 	$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);
 	    unless compression_is_valid_level($comp_level);
 	compression_set_default_level($comp_level);
 	compression_set_default_level($comp_level);
     } elsif (m/^-c(.*)$/) {
     } elsif (m/^-c(.*)$/) {
@@ -201,7 +201,7 @@ while (@options) {
         exit(0);
         exit(0);
     } elsif (m/^-[EW]$/) {
     } elsif (m/^-[EW]$/) {
         # Deprecated option
         # 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$/) {
     } elsif (m/^-q$/) {
         report_options(quiet_warnings => 1);
         report_options(quiet_warnings => 1);
         $options{quiet} = 1;
         $options{quiet} = 1;
@@ -213,7 +213,7 @@ while (@options) {
 }
 }
 
 
 unless (defined($options{opmode})) {
 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)$/) {
 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
     # Scan control info of source package
     my $src_fields = $control->get_source();
     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;
           $controlfile) unless defined $src_fields;
     my $src_sect = $src_fields->{'Section'} || 'unknown';
     my $src_sect = $src_fields->{'Section'} || 'unknown';
     my $src_prio = $src_fields->{'Priority'} || '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 $dep;
 	    my $type = field_get_dep_type($_);
 	    my $type = field_get_dep_type($_);
 	    $dep = deps_parse($v, build_dep => 1, union => $type eq 'union');
 	    $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();
 	    my $facts = Dpkg::Deps::KnownFacts->new();
 	    $dep->simplify_deps($facts);
 	    $dep->simplify_deps($facts);
 	    $dep->sort() if $type eq 'union';
 	    $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
             # If the string does not contain brackets then it is using the
             # old syntax. Emit a fatal error.
             # old syntax. Emit a fatal error.
             if ($profile !~ m/^\s*<.*>\s*$/) {
             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);
                          '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}++;
                     push(@sourcearch, $v) unless $archadded{$v}++;
                 } else {
                 } else {
                     for my $a (split(/\s+/, $v)) {
                     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)
                               $a)
                             unless $a =~ /^[\w-]+$/;
                             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')"),
                                  "own (list for package %s is `%s')"),
                               $a, $p, $a)
                               $a, $p, $a)
                             if $a eq 'any' or $a eq 'all';
                             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)) {
     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 (any { $_ eq 'any' } @sourcearch) {
         # If we encounter one 'any' then the other arches become insignificant
         # 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;
             error($error) unless $ok;
 	    $fields->{$_} = $v;
 	    $fields->{$_} = $v;
 	} elsif (m/^Binary-Only$/) {
 	} 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';
 	        if $v eq 'yes' and $options{opmode} eq 'build';
 	} elsif (m/^Maintainer$/i) {
 	} elsif (m/^Maintainer$/i) {
             # Do not replace the field coming from the source entry
             # 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 (not defined $build_format) {
 	if (-e "$dir/debian/source/format") {
 	if (-e "$dir/debian/source/format") {
 	    open(my $format_fh, '<', "$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>;
 	    $build_format = <$format_fh>;
 	    chomp($build_format) if defined $build_format;
 	    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;
 		unless defined $build_format and length $build_format;
 	    close($format_fh);
 	    close($format_fh);
 	} else {
 	} else {
-	    warning(_g('no source format specified in %s, ' .
+	    warning(g_('no source format specified in %s, ' .
 	               'see dpkg-source(1)'), 'debian/source/format')
 	               'see dpkg-source(1)'), 'debian/source/format')
 		if $options{opmode} eq 'build';
 		if $options{opmode} eq 'build';
 	    $build_format = '1.0';
 	    $build_format = '1.0';
@@ -420,17 +420,17 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 
 
     # Verify pre-requisites are met
     # Verify pre-requisites are met
     my ($res, $msg) = $srcpkg->can_build($dir);
     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
     # 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);
     run_vendor_hook('before-source-build', $srcpkg);
     # Build the files (.tar.gz, .diff.gz, etc)
     # Build the files (.tar.gz, .diff.gz, etc)
     $srcpkg->build($dir);
     $srcpkg->build($dir);
 
 
     # Write the .dsc
     # Write the .dsc
     my $dscname = $srcpkg->get_basename(1) . '.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,
     $srcpkg->write_dsc(filename => $dscname,
 		       remove => \%remove,
 		       remove => \%remove,
 		       override => \%override,
 		       override => \%override,
@@ -441,15 +441,15 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 
 
     # Check command line
     # Check command line
     unless (scalar(@ARGV)) {
     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});
                  $options{opmode});
     }
     }
     if (scalar(@ARGV) > 2) {
     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);
     my $dsc = shift(@ARGV);
     if (-d $dsc) {
     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});
                  $options{opmode});
     }
     }
 
 
@@ -466,7 +466,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
     if (@ARGV) {
     if (@ARGV) {
 	$newdirectory = File::Spec->catdir(shift(@ARGV));
 	$newdirectory = File::Spec->catdir(shift(@ARGV));
 	if (-e $newdirectory) {
 	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();
             $srcpkg->check_signature();
         } else {
         } else {
             if ($options{require_valid_signature}) {
             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 {
             } else {
-                warning(_g('extracting unsigned source package (%s)'), $dsc);
+                warning(g_('extracting unsigned source package (%s)'), $dsc);
             }
             }
         }
         }
         $srcpkg->check_checksums();
         $srcpkg->check_checksums();
     }
     }
 
 
     # Unpack the source package (delegated to Dpkg::Source::Package::*)
     # 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);
     $srcpkg->extract($newdirectory);
 
 
     exit(0);
     exit(0);
@@ -500,7 +500,7 @@ sub set_testsuite_field
     if (-e "$dir/debian/tests/control") {
     if (-e "$dir/debian/tests/control") {
         $testsuite{autopkgtest} = 1;
         $testsuite{autopkgtest} = 1;
     } elsif ($testsuite{autopkgtest}) {
     } 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');
                 'Testsuite', 'autopkgtest', 'debian/tests/control');
         delete $testsuite{autopkgtest};
         delete $testsuite{autopkgtest};
     }
     }
@@ -511,25 +511,25 @@ sub setopmode {
     my $opmode = shift;
     my $opmode = shift;
 
 
     if (defined($options{opmode})) {
     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);
     }
     }
     $options{opmode} = $opmode;
     $options{opmode} = $opmode;
 }
 }
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] <command>')
 'Usage: %s [<option>...] <command>')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
 'Commands:
   -x, --extract <filename>.dsc [<output-dir>]
   -x, --extract <filename>.dsc [<output-dir>]
                            extract source package.
                            extract source package.
@@ -537,7 +537,7 @@ sub usage {
       --print-format <dir> print the format to be used for the source package.
       --print-format <dir> print the format to be used for the source package.
       --commit [<dir> [<patch-name>]]
       --commit [<dir> [<patch-name>]]
                            store upstream changes in a new patch.')
                            store upstream changes in a new patch.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Build options:
 "Build options:
   -c<control-file>         get control info from this file.
   -c<control-file>         get control info from this file.
   -l<changelog-file>       get per-version info from this file.
   -l<changelog-file>       get per-version info from this file.
@@ -556,17 +556,17 @@ sub usage {
                              supported are: %s).
                              supported are: %s).
   -z<level>                compression level to use (defaults to '%d',
   -z<level>                compression level to use (defaults to '%d',
                              supported are: '1'-'9', 'best', 'fast')")
                              supported are: '1'-'9', 'best', 'fast')")
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 "Extract options:
 "Extract options:
   --no-copy                don't copy .orig tarballs
   --no-copy                don't copy .orig tarballs
   --no-check               don't check signature and checksums before unpacking
   --no-check               don't check signature and checksums before unpacking
   --require-valid-signature abort if the package doesn't have a valid signature
   --require-valid-signature abort if the package doesn't have a valid signature
   --ignore-bad-version     allow bad source package versions.")
   --ignore-bad-version     allow bad source package versions.")
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'General options:
 'General options:
   -?, --help               show this help message.
   -?, --help               show this help message.
       --version            show the version.')
       --version            show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'More options are available but they depend on the source package format.
 'More options are available but they depend on the source package format.
 See dpkg-source(1) for more info.') . "\n",
 See dpkg-source(1) for more info.') . "\n",
     $Dpkg::PROGNAME,
     $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');
 textdomain('dpkg-dev');
 
 
 sub version {
 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
 This is free software; see the GNU General Public License version 2 or
 later for copying conditions. There is NO warranty.
 later for copying conditions. There is NO warranty.
 ');
 ');
 }
 }
 
 
 sub usage {
 sub usage {
-    printf _g(
+    printf g_(
 'Usage: %s [<option>...] [<command>]')
 'Usage: %s [<option>...] [<command>]')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Commands:
 'Commands:
   --is <vendor>           returns true if current vendor is <vendor>.
   --is <vendor>           returns true if current vendor is <vendor>.
   --derives-from <vendor> returns true if current vendor derives from <vendor>.
   --derives-from <vendor> returns true if current vendor derives from <vendor>.
   --query <field>         print the content of the vendor-specific field.
   --query <field>         print the content of the vendor-specific field.
   --help                  show this help message.
   --help                  show this help message.
   --version               show the version.')
   --version               show the version.')
-    . "\n\n" . _g(
+    . "\n\n" . g_(
 'Options:
 'Options:
   --vendor <vendor>       assume <vendor> is the current vendor.')
   --vendor <vendor>       assume <vendor> is the current vendor.')
     . "\n", $Dpkg::PROGNAME;
     . "\n", $Dpkg::PROGNAME;
@@ -59,13 +59,13 @@ while (@ARGV) {
     $_ = shift(@ARGV);
     $_ = shift(@ARGV);
     if (m/^--vendor$/) {
     if (m/^--vendor$/) {
         $vendor = shift(@ARGV);
         $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)$/) {
     } 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);
             if defined($action);
         $action = $1;
         $action = $1;
         $param = shift(@ARGV);
         $param = shift(@ARGV);
-        usageerr(_g('%s needs a parameter'), $_) unless defined $param;
+        usageerr(g_('%s needs a parameter'), $_) unless defined $param;
     } elsif (m/^-(?:\?|-help)$/) {
     } elsif (m/^-(?:\?|-help)$/) {
         usage();
         usage();
         exit 0;
         exit 0;
@@ -73,18 +73,18 @@ while (@ARGV) {
         version();
         version();
         exit 0;
         exit 0;
     } else {
     } 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
 # Uses $ENV{DEB_VENDOR} if set
 $vendor //= get_current_vendor();
 $vendor //= get_current_vendor();
 
 
 my $info = get_vendor_info($vendor);
 my $info = get_vendor_info($vendor);
 unless (defined($info)) {
 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());
           get_vendor_dir());
 }
 }
 
 

+ 1 - 1
scripts/po/Makevars

@@ -8,7 +8,7 @@ subdir = scripts/po
 top_builddir = ../..
 top_builddir = ../..
 
 
 # These options get passed to xgettext.
 # 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
 # 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
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding