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 049f68cb60)
This commit is contained in:
Brian C. Lane 2019-03-29 08:45:39 -07:00
parent a71ef40dd5
commit 4073dd4e4d
1 changed files with 9 additions and 2 deletions

View File

@ -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