[Reproducible-commits] [dpkg] 20/54: Dpkg::Arch: Add a new set_host_gnu_type()

Mattia Rizzolo mattia at debian.org
Fri Jan 15 18:54:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 78b312b01d05471030f58d2c5d550fc068cb84c9
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Nov 7 17:38:40 2015 +0100

    Dpkg::Arch: Add a new set_host_gnu_type()
    
    This function makes it possible to get get_raw_host_arch() out from the
    block containing the local $gcc_host_gnu_type variable, reducing the
    nesting level.
---
 scripts/Dpkg/Arch.pm | 60 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 6afe59f..1c0d468 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -131,6 +131,14 @@ sub get_build_arch()
 	return $gcc_host_gnu_type;
     }
 
+    sub set_host_gnu_type
+    {
+        my ($host_gnu_type) = @_;
+
+        $gcc_host_gnu_type = $host_gnu_type;
+    }
+}
+
 =item $arch = get_raw_host_arch()
 
 Get the raw host Debian architecture, without taking into account variables
@@ -138,37 +146,37 @@ from the environment.
 
 =cut
 
-    sub get_raw_host_arch()
-    {
-        state $host_arch;
-
-	return $host_arch if defined $host_arch;
-
-	$gcc_host_gnu_type = get_gcc_host_gnu_type();
+sub get_raw_host_arch()
+{
+    state $host_arch;
 
-	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);
+    return $host_arch if defined $host_arch;
 
-	    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 = '';
-	    }
-	}
+    $gcc_host_gnu_type = get_gcc_host_gnu_type();
 
-	if (!defined($host_arch)) {
-	    # Switch to native compilation.
-	    $host_arch = get_raw_build_arch();
-	}
+    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 = '';
+        }
+        set_host_gnu_type($gcc_host_gnu_type);
+    }
 
-	return $host_arch;
+    if (!defined($host_arch)) {
+        # Switch to native compilation.
+        $host_arch = get_raw_build_arch();
     }
+
+    return $host_arch;
 }
 
 =item $arch = get_host_arch()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list