Parcourir la source

Merge branch 'master' of git://git.debian.org/git/dpkg/dpkg into sourcev3

Joey Hess il y a 18 ans
Parent
commit
7bb2e749d9
8 fichiers modifiés avec 165 ajouts et 60 suppressions
  1. 45 0
      ChangeLog
  2. 1 1
      TODO
  3. 2 0
      debian/changelog
  4. 78 6
      scripts/Dpkg/Arch.pm
  5. 1 1
      scripts/Makefile.am
  6. 28 49
      scripts/dpkg-architecture.pl
  7. 5 0
      scripts/po/ChangeLog
  8. 5 3
      scripts/po/pl.po

+ 45 - 0
ChangeLog

@@ -1,3 +1,48 @@
+2007-11-15  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/Arch.pm (read_cputable): Force a sane input record
+	separator.
+	(read_ostable): Likewise.
+	(read_triplettable): Likewise.
+
+2007-11-04  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Makefile.am (clean): Set PERL5LIB to force use of shipped
+	modules instead of system ones.
+
+2007-11-04  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-architecture.pl: Move host and build arch detection
+	to ...
+	* scripts/Dpkg/Arch.pm (get_host_arch): ... here.
+	(get_build_arch, get_gcc_host_gnu_type): Likewise. New function.
+
+2007-11-04  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-architecture.pl: Wrap long strings for die calls
+	at less than 80 chars.
+
+2007-11-04  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/Arch.pm (debarch_to_gnutriplet): New function.
+	(gnutriplet_to_debarch): Likewise.
+	* scripts/dpkg-architecture.pl: Use debarch_to_gnutriplet and
+	gnutriplet_to_debarch instead of nested calls to
+	debtriplet_to_gnutriplet and debarch_to_debtriplet,
+	debtriplet_to_debarch and gnutriplet_to_debtriplet.
+
+2007-11-04  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-architecture.pl: Move setting of host and build arch
+	variables after argument processing. Call list_arches from argument
+	processing loop. Move architecture listing to ...
+	(list_arches): ... here. New function.
+
+2007-11-04  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/Arch.pm (get_valid_arches): Return an array instead of
+	printing the architectures.
+
 2007-10-18  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/Dpkg/Deps.pm: new module to handle dependencies, to

+ 1 - 1
TODO

@@ -12,7 +12,7 @@ lenny
 1.14.x
 ------
 
- * Make dpkg bootstrappable (modularize dpkg-architecture).
+ * Make dpkg bootstrappable.
 
  * Support udeb natively:
    - Add field Package-Type and friends.

+ 2 - 0
debian/changelog

@@ -54,6 +54,8 @@ dpkg (1.14.8) UNRELEASED; urgency=low
   * Switch perl programs to use the new Dpkg/ErrorHandling module.
   * Switch perl programs to use the new Dpkg/Arch module.
   * Add support for format strings in Dpkg::ErrorHandling functions.
+  * Move build and host arch detection code from dpkg-architecture to
+    Dpkg::Arch.
 
   [ Updated dselect translations ]
   * Czech (Miroslav Kure).

+ 78 - 6
scripts/Dpkg/Arch.pm

@@ -5,12 +5,15 @@ use warnings;
 
 use Exporter;
 our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(get_host_arch get_valid_arches debarch_eq debarch_is
+our @EXPORT_OK = qw(get_build_arch get_host_arch get_gcc_host_gnu_type
+                    get_valid_arches debarch_eq debarch_is
+                    debarch_to_gnutriplet gnutriplet_to_debarch
                     debtriplet_to_gnutriplet gnutriplet_to_debtriplet
                     debtriplet_to_debarch debarch_to_debtriplet);
 
 use Dpkg;
-use Dpkg::ErrorHandling qw(syserr subprocerr);
+use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(syserr subprocerr warning);
 
 my (@cpu, @os);
 my (%cputable, %ostable);
@@ -20,15 +23,63 @@ my %debtriplet_to_debarch;
 my %debarch_to_debtriplet;
 
 {
+    my $build_arch;
     my $host_arch;
+    my $gcc_host_gnu_type;
+
+    sub get_build_arch()
+    {
+	return $build_arch if defined $build_arch;
+
+	my $build_arch = `dpkg --print-architecture`;
+	# FIXME: Handle bootstrapping
+	syserr("dpkg --print-architecture failed") if $? >> 8;
+
+	chomp $build_arch;
+	return $build_arch;
+    }
+
+    sub get_gcc_host_gnu_type()
+    {
+	return $gcc_host_gnu_type if defined $gcc_host_gnu_type;
+
+	my $gcc_host_gnu_type = `\${CC:-gcc} -dumpmachine`;
+	if ($? >> 8) {
+	    $gcc_host_gnu_type = '';
+	} else {
+	    chomp $gcc_host_gnu_type;
+	}
+
+	return $gcc_host_gnu_type;
+    }
 
     sub get_host_arch()
     {
 	return $host_arch if defined $host_arch;
 
-	$host_arch = `dpkg-architecture -qDEB_HOST_ARCH`;
-	$? && subprocerr("dpkg-architecture -qDEB_HOST_ARCH");
-	chomp $host_arch;
+	my $gcc_host_gnu_type = get_gcc_host_gnu_type();
+
+	if ($gcc_host_gnu_type eq '') {
+	    warning(_g("Couldn't determine gcc system type, falling back to " .
+	               "default (native compilation)"));
+	} else {
+	    my (@host_archtriplet) = gnutriplet_to_debtriplet($gcc_host_gnu_type);
+	    $host_arch = debtriplet_to_debarch(@host_archtriplet);
+
+	    if (defined $host_arch) {
+		$gcc_host_gnu_type = debtriplet_to_gnutriplet(@host_archtriplet);
+	    } else {
+		warning(_g("Unknown gcc system type %s, falling back to " .
+		           "default (native compilation)"), $gcc_host_gnu_type);
+		$gcc_host_gnu_type = '';
+	    }
+	}
+
+	if (!defined($host_arch)) {
+	    # Switch to native compilation.
+	    $host_arch = get_build_arch();
+	}
+
 	return $host_arch;
     }
 }
@@ -38,17 +89,22 @@ sub get_valid_arches()
     read_cputable() if (!@cpu);
     read_ostable() if (!@os);
 
+    my @arches;
+
     foreach my $os (@os) {
 	foreach my $cpu (@cpu) {
 	    my $arch = debtriplet_to_debarch(split(/-/, $os, 2), $cpu);
-	    print $arch."\n" if defined($arch);
+	    push @arches, $arch if defined($arch);
 	}
     }
+
+    return @arches;
 }
 
 sub read_cputable
 {
     local $_;
+    local $/ = "\n";
 
     open CPUTABLE, "$pkgdatadir/cputable"
 	or syserr(_g("unable to open cputable"));
@@ -65,6 +121,7 @@ sub read_cputable
 sub read_ostable
 {
     local $_;
+    local $/ = "\n";
 
     open OSTABLE, "$pkgdatadir/ostable"
 	or syserr(_g("unable to open ostable"));
@@ -83,6 +140,7 @@ sub read_triplettable()
     read_cputable() if (!@cpu);
 
     local $_;
+    local $/ = "\n";
 
     open TRIPLETTABLE, "$pkgdatadir/triplettable"
 	or syserr(_g("unable to open triplettable"));
@@ -188,6 +246,20 @@ sub debarch_to_debtriplet($)
     }
 }
 
+sub debarch_to_gnutriplet($)
+{
+    my ($arch) = @_;
+
+    return debtriplet_to_gnutriplet(debarch_to_debtriplet($arch));
+}
+
+sub gnutriplet_to_debarch($)
+{
+    my ($gnu) = @_;
+
+    return debtriplet_to_debarch(gnutriplet_to_debtriplet($gnu));
+}
+
 sub debwildcard_to_debtriplet($)
 {
     local ($_) = @_;

+ 1 - 1
scripts/Makefile.am

@@ -147,4 +147,4 @@ check: $(TEST_FILES) $(wildcard $(srcdir)/t/200_Dpkg_Shlibs/ld.so.conf*)
 # a bit hacky...
 	$(mkdir_p) t.tmp
 	cp -dRl $(srcdir)/t/200_Dpkg_Shlibs/ld.so.conf* t.tmp/
-	srcdir=$(srcdir) PERL_DL_NONLAZY=1 $(PERL) -I$(srcdir) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '.')" $(TEST_FILES)
+	srcdir=$(srcdir) PERL5LIB=$(srcdir) PERL_DL_NONLAZY=1 $(PERL) -I$(srcdir) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '.')" $(TEST_FILES)

+ 28 - 49
scripts/dpkg-architecture.pl

@@ -25,9 +25,9 @@ use warnings;
 use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning syserr usageerr);
-use Dpkg::Arch qw(get_valid_arches debarch_eq debarch_is
-                  debtriplet_to_gnutriplet gnutriplet_to_debtriplet
-                  debtriplet_to_debarch debarch_to_debtriplet);
+use Dpkg::Arch qw(get_build_arch get_host_arch get_gcc_host_gnu_type
+                  get_valid_arches debarch_eq debarch_is debarch_to_debtriplet
+                  debarch_to_gnutriplet gnutriplet_to_debarch);
 
 textdomain("dpkg-dev");
 
@@ -67,47 +67,11 @@ Actions:
 "), $progname;
 }
 
-# Check for -L
-if (grep { m/^-L$/ } @ARGV) {
+sub list_arches()
+{
     foreach my $arch (get_valid_arches()) {
 	print "$arch\n";
     }
-    exit unless $#ARGV;
-}
-
-# Set default values:
-
-chomp (my $deb_build_arch = `dpkg --print-architecture`);
-&syserr("dpkg --print-architecture failed") if $?>>8;
-my $deb_build_gnu_type = debtriplet_to_gnutriplet(debarch_to_debtriplet($deb_build_arch));
-
-# Default host: Current gcc.
-my $gcc = `\${CC:-gcc} -dumpmachine`;
-if ($?>>8) {
-    warning(_g("Couldn't determine gcc system type, falling back to default (native compilation)"));
-    $gcc = '';
-} else {
-    chomp $gcc;
-}
-
-my $deb_host_arch = undef;
-my $deb_host_gnu_type;
-
-if ($gcc ne '') {
-    my (@deb_host_archtriplet) = gnutriplet_to_debtriplet($gcc);
-    $deb_host_arch = debtriplet_to_debarch(@deb_host_archtriplet);
-    unless (defined $deb_host_arch) {
-	warning(_g("Unknown gcc system type %s, falling back to default " .
-	           "(native compilation)"), $gcc);
-	$gcc = '';
-    } else {
-	$gcc = $deb_host_gnu_type = debtriplet_to_gnutriplet(@deb_host_archtriplet);
-    }
-}
-if (!defined($deb_host_arch)) {
-    # Default host: Native compilation.
-    $deb_host_arch = $deb_build_arch;
-    $deb_host_gnu_type = $deb_build_gnu_type;
 }
 
 
@@ -144,7 +108,8 @@ while (@ARGV) {
        $action = 'c';
        last;
     } elsif (m/^-L$/) {
-       # Handled already
+        list_arches();
+        exit unless @ARGV;
     } elsif (m/^-(h|-help)$/) {
        &usage;
        exit 0;
@@ -156,18 +121,32 @@ while (@ARGV) {
     }
 }
 
+# Set default values:
+
+my $deb_build_arch = get_build_arch();
+my $deb_build_gnu_type = debarch_to_gnutriplet($deb_build_arch);
+
+my $deb_host_arch = get_host_arch();
+my $deb_host_gnu_type = debarch_to_gnutriplet($deb_host_arch);
+
+# Set user values:
+
 if ($req_host_arch ne '' && $req_host_gnu_type eq '') {
-    $req_host_gnu_type = debtriplet_to_gnutriplet(debarch_to_debtriplet($req_host_arch));
-    die (sprintf(_g("unknown Debian architecture %s, you must specify GNU system type, too"), $req_host_arch)) unless defined $req_host_gnu_type;
+    $req_host_gnu_type = debarch_to_gnutriplet($req_host_arch);
+    die (sprintf(_g("unknown Debian architecture %s, you must specify " .
+                    "GNU system type, too"), $req_host_arch))
+        unless defined $req_host_gnu_type;
 }
 
 if ($req_host_gnu_type ne '' && $req_host_arch eq '') {
-    $req_host_arch = debtriplet_to_debarch(gnutriplet_to_debtriplet($req_host_gnu_type));
-    die (sprintf(_g("unknown GNU system type %s, you must specify Debian architecture, too"), $req_host_gnu_type)) unless defined $req_host_arch;
+    $req_host_arch = gnutriplet_to_debarch($req_host_gnu_type);
+    die (sprintf(_g("unknown GNU system type %s, you must specify " .
+                    "Debian architecture, too"), $req_host_gnu_type))
+        unless defined $req_host_arch;
 }
 
 if ($req_host_gnu_type ne '' && $req_host_arch ne '') {
-    my $dfl_host_gnu_type = debtriplet_to_gnutriplet(debarch_to_debtriplet($req_host_arch));
+    my $dfl_host_gnu_type = debarch_to_gnutriplet($req_host_arch);
     die (sprintf(_g("unknown default GNU system type for Debian architecture %s"),
                  $req_host_arch))
 	unless defined $dfl_host_gnu_type;
@@ -180,8 +159,8 @@ if ($req_host_gnu_type ne '' && $req_host_arch ne '') {
 $deb_host_arch = $req_host_arch if $req_host_arch ne '';
 $deb_host_gnu_type = $req_host_gnu_type if $req_host_gnu_type ne '';
 
-#$gcc = `\${CC:-gcc} --print-libgcc-file-name`;
-#$gcc =~ s!^.*gcc-lib/(.*)/\d+(?:.\d+)*/libgcc.*$!$1!s;
+my $gcc = get_gcc_host_gnu_type();
+
 warning(_g("Specified GNU system type %s does not match gcc system type %s."),
         $deb_host_gnu_type, $gcc)
     if !($req_is_arch or $req_eq_arch) &&

+ 5 - 0
scripts/po/ChangeLog

@@ -1,3 +1,8 @@
+2007-11-15  Guillem Jover  <guillem@debian.org>
+
+	* pl.po: Mark two bogus translations as fuzzy. Fix one format
+	parameter from 's' to '%s' and another from '%d' to '%s'.
+
 2007-11-11  Helge Kreutzmann  <debian@helgefjell.de>
 
 	* de.po: Updated to 172t0f306u.

+ 5 - 3
scripts/po/pl.po

@@ -5,7 +5,7 @@ msgid ""
 msgstr "Project-Id-Version: dpkg 1.14.17\n"
 "Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
 "POT-Creation-Date: 2007-10-26 08:47+0100\n"
-"PO-Revision-Date: 2007-11-04 11:33+0100\n"
+"PO-Revision-Date: 2007-11-15 20:15+0200\n"
 "Last-Translator: Robert Luberda <robert@debian.org>\n"
 "Language-Team: Polish <debian-l10n-polish@lists.debian.org>\n"
 "Content-Type: text/plain; charset=ISO-8859-2\n"
@@ -1612,7 +1612,7 @@ msgstr ""
 #: scripts/dpkg-shlibdeps.pl:367
 #, perl-format
 msgid "shared libs info file `%s' line %d: bad line `%s'"
-msgstr "plik bibliotek wspó³dzielonych %s, linia %s: niepoprawna linia `%s'"
+msgstr "plik bibliotek wspó³dzielonych %s, linia %d: niepoprawna linia `%s'"
 
 #: scripts/dpkg-shlibdeps.pl:407
 #, perl-format
@@ -1650,6 +1650,7 @@ msgstr ""
 
 #: scripts/dpkg-source.pl:155
 #, perl-format
+#, fuzzy
 msgid ""
 "Usage: %s [<option> ...] <command>\n"
 "\n"
@@ -2515,7 +2516,7 @@ msgstr "archiwum tar `%s' zawiera obiekt 'debian', kt
 msgid ""
 "tarfile `%s' contains object `%s' but its containing directory `%s' does not "
 "precede it"
-msgstr "archiwum tar `%s' zawiera obiekt `s', niepoprzedzony katalogiem `%s', w którym siê znajduje"
+msgstr "archiwum tar `%s' zawiera obiekt `%s', niepoprzedzony katalogiem `%s', w którym siê znajduje"
 
 #: scripts/dpkg-source.pl:1372 scripts/dpkg-source.pl:1417
 #: scripts/dpkg-source.pl:1428
@@ -2776,6 +2777,7 @@ msgstr "niepoprawnie sformatowana warto
 
 #: scripts/changelog/debian.pl:112
 #, perl-format
+#, fuzzy
 msgid "unknown urgency value %s - comparing very low"
 msgstr "nieznana warto¶æ pola urgency - porównywanie bardzo nisko"