From 4c456023846a424f9d111a223106041314931bd9 Mon Sep 17 00:00:00 2001 From: Dan Callaghan Date: Jun 10 2016 06:23:42 +0000 Subject: [PATCH 1/2] Let yum repos contain multiple arches In my case, I want i386 and x86_64 packages together for multilib testing. --- diff --git a/rpmfluff.py b/rpmfluff.py index cbc3ee6..6579da6 100755 --- a/rpmfluff.py +++ b/rpmfluff.py @@ -1184,14 +1184,15 @@ class YumRepoBuild: self.repoDir = tempfile.mkdtemp() self.rpmBuilds = rpmBuilds - def make(self, arch): + def make(self, *arches): # Build all the packages for pkg in self.rpmBuilds: pkg.make() # Now assemble into a yum repo: for pkg in self.rpmBuilds: - check_call(['cp', pkg.get_built_rpm(arch), self.repoDir]) + for arch in arches: + check_call(['cp', pkg.get_built_rpm(arch), self.repoDir]) check_call(['createrepo', self.repoDir]) From 53ed2ca6efca5a18551d1519347047de0e8a0cb9 Mon Sep 17 00:00:00 2001 From: Dan Callaghan Date: Jun 10 2016 06:23:42 +0000 Subject: [PATCH 2/2] Compile 32-bit binaries in 32-bit packages Currently when .add_simple_compilation() is used, the resulting binary is always built for the architecture of the host, regardless of which arch the package is targetting. Full-on cross compilation is of course not possible, but at least for 32-bit builds on a 64-bit host we can produce a 32-bit binary using gcc -m32. I am using this for multilib testing where I am producing both i386 and x86_64 packages and I want the file color to be correct in each package. --- diff --git a/rpmfluff.py b/rpmfluff.py index 6579da6..b305f05 100755 --- a/rpmfluff.py +++ b/rpmfluff.py @@ -1084,7 +1084,8 @@ class SimpleRpmBuild(RpmBuild): 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 += "gcc %s %s\n"%(compileFlags, sourceFileName) + self.section_build += "%if %{__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) self.section_install += "cp a.out $RPM_BUILD_ROOT/%s\n"%installPath