diff mbox series

[OSSTEST,07/15] arch replumbing: Replace many $r{arch} with $[g]ho->{Arch}

Message ID 20190426164002.22381-8-ian.jackson@eu.citrix.com (mailing list archive)
State Superseded
Headers show
Series Do armhf kernel builds on amd64 | expand

Commit Message

Ian Jackson April 26, 2019, 4:39 p.m. UTC
No functional change with existing flights.  But the effect is that
now, generally, ts-* scripts and the support code will honour
host_arch, if it is set, in preference to arch.

This patch contains only replacements of $r{arch} with $ho->{Arch} or
$gho->{Arch}.  In fact, perhaps surprisingly, there were no locations
where $gho was wanted rather than $ho (I have double checked this).

Exceptions, where we left $r{arch} alone, are:

 * make-flight: a comment, which we are about to deal with;

 * ts-kernel-build: we are going to support cross building and
    $r{arch} is going to be the architecture of the kernel we want
    rather than of the build host.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/Debian.pm      | 14 +++++++-------
 Osstest/TestSupport.pm |  4 ++--
 ts-freebsd-build       |  2 +-
 ts-host-install        |  6 +++---
 ts-memdisk-try-append  |  2 +-
 ts-xen-build-prep      |  4 ++--
 ts-xen-install         |  8 ++++----
 7 files changed, 20 insertions(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 8abd6aed..911d8905 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -444,7 +444,7 @@  sub setupboot_grub2 ($$$$) {
     # Grub2 on jessie/stretch ARM* doesn't do multiboot, so we must chainload.
     my $need_uefi_chainload =
         get_host_property($ho, "firmware", "") eq "uefi" &&
-        $ho->{Suite} =~ m/jessie|stretch/ && $r{arch} =~ m/^arm/;
+        $ho->{Suite} =~ m/jessie|stretch/ && $ho->{Arch} =~ m/^arm/;
 
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
@@ -749,7 +749,7 @@  END
 sub preseed_microcode($$)
 {
     my ($ho,$sfx) = @_;
-    my $prop = "MicrocodeUpdate".ucfirst($r{arch});
+    my $prop = "MicrocodeUpdate".ucfirst($ho->{Arch});
     return unless $c{$prop};
     logm("ucode=$prop $c{$prop}");
     my $ucode = get_filecontents("$c{Images}/$c{$prop}");
@@ -1134,7 +1134,7 @@  sub di_installer_path ($) {
     # useable for constructing host paths as well as guest paths
     my ($ho) = @_;
 
-    return $ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.
+    return $ho->{Tftp}{DiBase}.'/'.$ho->{Arch}.'/'.
 	($ho->{DiVersion} // cfg_tftp_di_version($ho->{Suite}))
 	.'-'.$ho->{Suite};
 }
@@ -1340,8 +1340,8 @@  END
     #    Userland_setarch  personality to restore using setarch
     my $kern_arch = $kern_arch_info->{Kernel_Debian};
     if ($kern_arch &&
-	$ho->{Flags}{"arch-$r{arch}"} && !$ho->{Flags}{"arch-$kern_arch"}) {
-	# We check the flag for $r{arch} because for various reasons
+	$ho->{Flags}{"arch-$ho->{Arch}"} && !$ho->{Flags}{"arch-$kern_arch"}) {
+	# We check the flag for $ho->{Arch} because for various reasons
 	# it may not be set.  For example, in standalone mode it is
 	# currently not normally necessary to set any arch hostflags.
 	# In that situation we bet that the kern arch can be used;
@@ -1356,7 +1356,7 @@  END
     }
     if ($kern_arch) {
 	my $setarch = "setarch $kern_arch_info->{Userland_setarch}";
-	logm("Using $kern_arch kernel for $r{arch} userland ($setarch)");
+	logm("Using $kern_arch kernel for $ho->{Arch} userland ($setarch)");
 	preseed_hook_command($ho, 'late_command', $sfx, <<END);
 #!/bin/sh
 set -ex
@@ -1366,7 +1366,7 @@  exec $setarch /usr/sbin/sshd.distrib "\$@"
 ENDW
 chmod a+x /target/usr/sbin/sshd.osstest-wrap
 in-target sh -xec '
-    # the $r{arch} kernels end up being the default so shuffle them
+    # the $ho->{Arch} kernels end up being the default so shuffle them
     # where update-grub will not find them
     for f in /boot/vmlinu*; do
         dpkg-divert --rename --divert "/boot/~disable~\${f##*/}" "\$f"
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 16c17e37..18617d98 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -2904,8 +2904,8 @@  sub setup_netboot_local_uefi ($) {
     # i386 is X64 because when we are trying to install i386
     # on a UEFI box, it's actually an amd64-capable UEFI box
     # which expects a 64-bit EFI loader
-    die "EFI arch" unless $efi_archs{ $r{arch} };
-    my $efi = $efi_archs{ $r{arch} };
+    die "EFI arch" unless $efi_archs{ $ho->{Arch} };
+    my $efi = $efi_archs{ $ho->{Arch} };
     setup_netboot_bootcfg($ho, <<END);
 set default=0
 set timeout=5
diff --git a/ts-freebsd-build b/ts-freebsd-build
index bdf666eb..3cdf15cb 100755
--- a/ts-freebsd-build
+++ b/ts-freebsd-build
@@ -83,7 +83,7 @@  sub build () {
     my $target = "bootonly";
     my $prefix = <<END;
 export MAKEOBJDIRPREFIX=$builddir/obj
-export TARGET=$r{arch}
+export TARGET=$ho->{Arch}
 END
 
     # Build process as documented in the handbook:
diff --git a/ts-host-install b/ts-host-install
index 3c14f171..4bfa2f5e 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -61,7 +61,7 @@  our %timeout= qw(ReadPreseed  350
 our $kern_arch_info;
 
 if ($build) {
-    if ($r{arch} eq 'i386') {
+    if ($ho->{Arch} eq 'i386') {
 	$kern_arch_info = {
 	    Kernel_Debian => 'amd64',
 	    Userland_setarch => 'i386',
@@ -262,7 +262,7 @@  END
     push @dicmdline, "domain=$c{TestHostDomain}";
     push @dicmdline,
         get_host_property($ho, "install-append $ho->{Suite}", ''),
-        get_host_property($ho, "install-append $ho->{Suite} $r{arch}", '');
+        get_host_property($ho, "install-append $ho->{Suite} $ho->{Arch}", '');
 
     my $console = get_host_native_linux_console($ho);
 
@@ -280,7 +280,7 @@  END
 
     push @hocmdline,
         get_host_property($ho, "linux-boot-append $ho->{Suite}", ''),
-        get_host_property($ho, "linux-boot-append $ho->{Suite} $r{arch}", '');
+        get_host_property($ho, "linux-boot-append $ho->{Suite} $ho->{Arch}", '');
 
     $xopts{ipappend} = $ipappend;
     setup_netboot_di($ho, $kernel, "/$initrd", \@dicmdline, \@hocmdline,
diff --git a/ts-memdisk-try-append b/ts-memdisk-try-append
index f6ec2fd5..ce39d5a7 100755
--- a/ts-memdisk-try-append
+++ b/ts-memdisk-try-append
@@ -23,7 +23,7 @@  arch=`perl -e '
                 use Osstest::TestSupport;
 
                 tsreadconfig();
-                print $r{arch} or die $!;
+                print $ho->{Arch} or die $!;
               '`
 
 case "$arch" in
diff --git a/ts-xen-build-prep b/ts-xen-build-prep
index c38ab36d..0f07648e 100755
--- a/ts-xen-build-prep
+++ b/ts-xen-build-prep
@@ -246,7 +246,7 @@  END
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
         target_install_packages($ho, 'libfdt-dev');
     }
-    if ($r{arch} eq 'amd64' && $ho->{Suite} !~ m/squeeze|lenny/) {
+    if ($ho->{Arch} eq 'amd64' && $ho->{Suite} !~ m/squeeze|lenny/) {
         target_install_packages($ho, 'libc6-dev-i386');
     }
 }
@@ -269,4 +269,4 @@  if (!$ho->{Flags}{'no-reinstall'}) {
     gitcache_setup($ho);
 }
 
-host_shared_mark_ready($ho, "build-".$ho->{Suite}."-".$r{arch});
+host_shared_mark_ready($ho, "build-".$ho->{Suite}."-".$ho->{Arch});
diff --git a/ts-xen-install b/ts-xen-install
index 9f78a75f..2d3c644d 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -64,7 +64,7 @@  sub packages () {
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
         target_install_packages($ho, qw(libfdt1));
     }
-    if ($r{arch} eq 'i386') {
+    if ($ho->{Arch} eq 'i386') {
 	target_install_packages($ho, qw(libc6-xen));
     }
     target_install_packages($ho, @{toolstack($ho)->{ExtraPackages}})
@@ -92,7 +92,7 @@  sub some_extradebs ($) {
 	    target_install_packages($ho, qw(rsync)) unless $rsync_installed++;
 	    target_putfile_root($ho,300, "$path/.", $ontarget, '-r');
 	} elsif ($path =~ m{\.deb$}) {
-	    $path =~ s{_\.deb}{ "_$r{arch}.deb" }e;
+	    $path =~ s{_\.deb}{ "_$ho->{Arch}.deb" }e;
 	    logm("$cfgvar: installing $path");
 	    $ontarget = basename($path);
 	    $dpkgopts = '-iB';
@@ -115,7 +115,7 @@  sub extradebs () {
 
     # $c{ DebianExtraPackages_<firmware>_<arch>_<suite> }
     my $firmware = get_host_property($ho, "firmware", "bios");
-    some_extradebs([ 'DebianExtraPackages', $firmware, $r{arch}, $suite ]);
+    some_extradebs([ 'DebianExtraPackages', $firmware, $ho->{Arch}, $suite ]);
 }
 
 sub extract () {
@@ -193,7 +193,7 @@  sub setupboot () {
     my $xenhopt= "conswitch=x watchdog noreboot async-show-all";
 
     my $cons= get_host_property($ho, 'XenSerialConsole',
-				$r{arch} =~ m/^arm/ ? 'dtuart'
+				$ho->{Arch} =~ m/^arm/ ? 'dtuart'
 				: 'com1');
 
     if ( $cons eq "com1" ) {