From ff9421c848aa1169924682c3c8155f8c1e7b8909 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 29 Mar 2019 08:45:39 -0700 Subject: [PATCH] lorax-composer: Fix installing files from [[repos.git]] to / rpmfluff was including / in the rpm, which conflicts with filesystem.rpm The rpm globs are pretty limited, and we don't actually know the file paths until later, so we have to use a glob or a directory. So when the destination is / it now uses /* to select all the files and sub-directories in the archive. The limitation of this is that it cannot support dotfiles directly under /, they will cause a rpmbuild error. For destinations other than / it uses the name of the directory, so dotfiles are fine in that situation. (cherry picked from commit 049f68cb600ba6e1c497806f4b6f8c10b073550b) Related: rhbz#1709594 --- src/pylorax/api/gitrpm.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pylorax/api/gitrpm.py b/src/pylorax/api/gitrpm.py index 3efb8a7d..e9f98c01 100644 --- a/src/pylorax/api/gitrpm.py +++ b/src/pylorax/api/gitrpm.py @@ -134,10 +134,17 @@ class GitRpmBuild(SimpleRpmBuild): sourceIndex = self.add_source(GitArchiveTarball(gitRepo)) self.section_build += "tar -xvf %s\n" % self.sources[sourceIndex].sourceName dest = os.path.normpath(gitRepo["destination"]) + # Prevent double slash root + if dest == "/": + dest = "" self.create_parent_dirs(dest) - self.section_install += "cp -r %s $RPM_BUILD_ROOT/%s\n" % (gitRepo["rpmname"], dest) + self.section_install += "cp -r %s/. $RPM_BUILD_ROOT/%s\n" % (gitRepo["rpmname"], dest) sub = self.get_subpackage(None) - sub.section_files += "%s/" % dest + if not dest: + # / is special, we don't want to include / itself, just what's under it + sub.section_files += "/*\n" + else: + sub.section_files += "%s/\n" % dest def make_git_rpm(gitRepo, dest): """ Create an rpm from the specified git repo