Browse Source

dpkg-architecture: Set DEB_HOST_ARCH and DEB_HOST_GNU_TYPE only once

The variables are set initially once, and then possibly overriden by the
user supplied arguments. Rearrange the code to set these only once.
Guillem Jover 16 years ago
parent
commit
f92a24f349
1 changed files with 10 additions and 5 deletions
  1. 10 5
      scripts/dpkg-architecture.pl

+ 10 - 5
scripts/dpkg-architecture.pl

@@ -134,9 +134,6 @@ my @ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
 $v{DEB_BUILD_ARCH} = get_raw_build_arch();
 $v{DEB_BUILD_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_BUILD_ARCH});
 
-$v{DEB_HOST_ARCH} = get_raw_host_arch();
-$v{DEB_HOST_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_HOST_ARCH});
-
 # Set user values:
 
 if ($req_host_arch ne '' && $req_host_gnu_type eq '') {
@@ -164,8 +161,16 @@ if ($req_host_gnu_type ne '' && $req_host_arch ne '') {
         if $dfl_host_gnu_type ne $req_host_gnu_type;
 }
 
-$v{DEB_HOST_ARCH} = $req_host_arch if $req_host_arch ne '';
-$v{DEB_HOST_GNU_TYPE} = $req_host_gnu_type if $req_host_gnu_type ne '';
+if ($req_host_arch eq '') {
+    $v{DEB_HOST_ARCH} = get_raw_host_arch();
+} else {
+    $v{DEB_HOST_ARCH} = $req_host_arch;
+}
+if ($req_host_gnu_type eq '') {
+    $v{DEB_HOST_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_HOST_ARCH});
+} else {
+    $v{DEB_HOST_GNU_TYPE} = $req_host_gnu_type;
+}
 
 my $gcc = get_gcc_host_gnu_type();