From afdb5d5ab10a6ae378cb908e4409143ca1066b6e Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Dec 07 2016 08:47:33 +0000 Subject: [PATCH 1/2] Revert "Get target_arch in stable way" This reverts commit 079b9b282efa667178b15fd1d96ae96f3ae2ae82. This change does not work as expected. Original translate_arch should be back and used again. Signed-off-by: Chenxiong Qi --- diff --git a/tests/test_cli.py b/tests/test_cli.py index e61e30c..6ccd39d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,7 +4,6 @@ import gzip import hashlib import logging import os -import platform import rpmfluff import shutil import sys @@ -366,6 +365,18 @@ Building for target i686''', stdout) class TestLocal(CliTestCase): + def translate_arch(self, arch): + """Translate local arch to arch the rpmbuild uses + + This is another workaround for running tests in Copr, where when + building RPM in a i386 target, local arch is i386, but arch in RPM is + "translated" to i686. + """ + translation = { + 'i386': 'i686', + } + return translation.get(arch, arch) + def test_local(self): cli_cmd = ['rpkg', '--path', self.cloned_repo_path, '--release', 'rhel-6', 'local'] @@ -374,10 +385,10 @@ class TestLocal(CliTestCase): cli.local() self.assertTrue(exists(join(self.cloned_repo_path, 'docpkg-1.2-2.el6.src.rpm'))) - # This covers some special cases, e.g. building in copr and Koji, that - # is RPMs are not put in arch subdirectory even if %{_build_name_fmt} + # This covers some special cases, e.g. building in copr, that is + # RPMs are not put in arch subdirectory even if %{_build_name_fmt} # is %{ARCH}/%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm - arch = platform.machine() + arch = self.translate_arch(cli.cmd.localarch) self.assertTrue( exists(join(self.cloned_repo_path, 'docpkg-1.2-2.el6.{0}.rpm'.format(arch))) or exists(join(self.cloned_repo_path, '{0}/docpkg-1.2-2.el6.{0}.rpm'.format(arch)))) From e6fe892cfe756e38beed36c1ddf8c5b7a6c69f96 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Dec 07 2016 10:27:02 +0000 Subject: [PATCH 2/2] Add map from arm to armv7hl so that tests can run on ARM machine Generally, rpkg is not used on ARM machine. This patch is for building packages in Koji, sometimes an ARM builder gets the job to build the packages. Signed-off-by: Chenxiong Qi --- diff --git a/tests/test_cli.py b/tests/test_cli.py index 6ccd39d..f61d22b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -374,6 +374,7 @@ class TestLocal(CliTestCase): """ translation = { 'i386': 'i686', + 'arm': 'armv7hl', } return translation.get(arch, arch)