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

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
Родитель
Сommit
f92a24f349
1 измененных файлов с 10 добавлено и 5 удалено
  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();