| |
@@ -475,6 +475,11 @@
|
| |
|
| |
expectedArch = get_expected_arch()
|
| |
|
| |
+ def can_compile_m32():
|
| |
+ # 64-bit hosts can compile 32-bit binaries by using -m32, but only if the
|
| |
+ # necessary bits are installed (they are often not).
|
| |
+ return os.path.exists('/usr/include/gnu/stubs-32.h') and os.path.exists('/lib/libgcc_s.so.1')
|
| |
+
|
| |
class Trigger:
|
| |
def __init__(self, event, triggerConds, script, program=None):
|
| |
"""For documentation on RPM triggers, see
|
| |
@@ -1102,7 +1107,7 @@
|
| |
subpackageSuffix=None):
|
| |
"""Add a simple source file to the sources, build it, and install it somewhere, using the given compilation flags"""
|
| |
sourceId = self.add_source(SourceFile(sourceFileName, sourceContent))
|
| |
- self.section_build += "%if %{__isa_bits} == 32\n%define mopt -m32\n%endif\n"
|
| |
+ self.section_build += "%if 0%{?__isa_bits} == 32\n%define mopt -m32\n%endif\n"
|
| |
self.section_build += "gcc %%{?mopt} %s %s\n"%(compileFlags, sourceFileName)
|
| |
if createParentDirs:
|
| |
self.create_parent_dirs(installPath)
|
| |
@@ -1695,8 +1700,8 @@
|
| |
"/usr/bin/perl"))
|
| |
self.rpmbuild.make()
|
| |
|
| |
- @unittest.skipIf(expectedArch != 'x86_64',
|
| |
- 'host arch is not x86_64')
|
| |
+ @unittest.skipIf(expectedArch != 'x86_64' or not can_compile_m32(),
|
| |
+ 'host arch is not x86_64 or 32-bit support is missing')
|
| |
def test_multiarch_compilation(self):
|
| |
"""Ensure that building on multiple archs works as expected"""
|
| |
self.rpmbuild.buildArchs = ['i386', 'x86_64']
|
| |
@@ -1844,8 +1849,8 @@
|
| |
self.assert_is_file(os.path.join(repo.repoDir, 'test-package-devel-0.1-1.%s.rpm' % expectedArch))
|
| |
self.assert_is_file(os.path.join(repo.repoDir, 'test-package-python-0.1-1.%s.rpm' % expectedArch))
|
| |
|
| |
- @unittest.skipIf(expectedArch != 'x86_64' or not shutil.which("createrepo_c"),
|
| |
- 'host arch is not x86_64 or createrepo_c not found in PATH')
|
| |
+ @unittest.skipIf(expectedArch != 'x86_64' or not can_compile_m32() or not shutil.which("createrepo_c"),
|
| |
+ 'host arch is not x86_64 or 32-bit support is missing or createrepo_c not found in PATH')
|
| |
def test_multiple_arches(self):
|
| |
package = SimpleRpmBuild('test-multilib-package', '0.1', '1', ['i386', 'x86_64'])
|
| |
repo = YumRepoBuild([package])
|
| |