#15 support mixing noarch and archful packages in a yum repo build
Merged 7 years ago by jhutar. Opened 7 years ago by dcallagh.
dcallagh/rpmfluff noarch  into  master

file modified
+18 -2
@@ -1218,8 +1218,9 @@ 

          # Now assemble into a yum repo:

          for pkg in self.rpmBuilds:

              for arch in arches:

-                 for subpackage in pkg.get_subpackage_names():

-                     shutil.copy(pkg.get_built_rpm(arch, name=subpackage), self.repoDir)

+                 if arch in pkg.get_build_archs():

+                     for subpackage in pkg.get_subpackage_names():

+                         shutil.copy(pkg.get_built_rpm(arch, name=subpackage), self.repoDir)

  

          try:

              subprocess.check_output(["createrepo_c", self.repoDir], stderr=subprocess.STDOUT)
@@ -1879,6 +1880,21 @@ 

          self.assert_is_file(os.path.join(repo.repoDir, 'test-multilib-package-0.1-1.i386.rpm'))

          self.assert_is_file(os.path.join(repo.repoDir, 'test-multilib-package-0.1-1.x86_64.rpm'))

  

+     @unittest.skipIf(not shutil.which('createrepo_c'), 'createrepo_c not found in PATH')

+     def test_arch_with_noarch(self):

+         archful_package = SimpleRpmBuild('test-package', '0.1', '1')

+         noarch_package = SimpleRpmBuild('python-package', '0.1', '1', ['noarch'])

+         repo = YumRepoBuild([archful_package, noarch_package])

+         self.addCleanup(shutil.rmtree, archful_package.get_base_dir())

+         self.addCleanup(shutil.rmtree, noarch_package.get_base_dir())

+         self.addCleanup(shutil.rmtree, repo.repoDir)

+ 

+         repo.make(expectedArch, 'noarch')

+ 

+         self.assert_is_dir(os.path.join(repo.repoDir, 'repodata'))

+         self.assert_is_file(os.path.join(repo.repoDir, 'test-package-0.1-1.%s.rpm' % expectedArch))

+         self.assert_is_file(os.path.join(repo.repoDir, 'python-package-0.1-1.noarch.rpm'))

+ 

  if __name__ == "__main__":

      unittest.main()

  

Currently the YumRepoBuild class assumes that every package you pass
to it was built for the requested architecture. But this makes it
impossible to put noarch packages into the repository, because
YumRepoBuild will look for an arch-specific package when only a noarch
package was produced.

Change YumRepoBuild to only copy over packages if they actually produced
the requested arch, otherwise skip them.

Ping @ignatenkobrain ... I need this rpmfluff patch for the libsolv patches in rpmdeplint, and I know you are keen on those. :-)

Pull-Request has been merged by jhutar

7 years ago

Thank you Dan for this and I'm sorry for a delay (wanted to focus on release duties for last few weeks and some other project). Do you want me to build new package version?

Thanks Jan! If you could tag and build a new version when you have time, that would be great.

Btw Jan the python-rpmfluff package (seems to be maintained by David Shea?) has drifted out of date a bit... Version 0.5.2 is packaged but it's missing some spec file changes that were made. For example it's missing Requires: createrepo_c. Do you want me to file an EPEL bug about that?

Sorry I meant to say... the python-rpmfluff package in EPEL7 has drifted compared to Fedora.

:tada: Thanks! Will test those updates tomorrow.

Metadata