summaryrefslogtreecommitdiff
path: root/pbr/hooks
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-07-04 22:30:22 -0400
committerMonty Taylor <mordred@inaugust.com>2013-07-24 15:45:53 -0700
commit761b27fee6ed0d3082d043dff2a7c61436a7aab9 (patch)
treedb3f157f85cef2693014d369487ec6211366575d /pbr/hooks
parent904f79c867ac689df387f276b0a9c2afb02ddebf (diff)
downloadpbr-761b27fee6ed0d3082d043dff2a7c61436a7aab9.tar.gz
Add support for globbing in data files
Similar to the work in the packages argument, allow the specification of a directory to recursively include as part of the install. Change-Id: Ife0414af468e7fcd4fc419eafc3e19e29efcfc7b
Diffstat (limited to 'pbr/hooks')
-rw-r--r--pbr/hooks/files.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/pbr/hooks/files.py b/pbr/hooks/files.py
index fb6a9bf..ba24aac 100644
--- a/pbr/hooks/files.py
+++ b/pbr/hooks/files.py
@@ -50,6 +50,25 @@ class FilesConfig(base.BaseConfig):
self.config['data_files'] = self.data_files
super(FilesConfig, self).save()
+ def expand_globs(self):
+ finished = []
+ for line in self.data_files.split("\n"):
+ if line.rstrip().endswith('*') and '=' in line:
+ (target, source_glob) = line.split('=')
+ source_prefix = source_glob.strip()[:-1]
+ target = target.strip()
+ if not target.endswith(os.path.sep):
+ target += os.path.sep
+ for (dirpath, dirnames, fnames) in os.walk(source_prefix):
+ finished.append(
+ "%s = " % dirpath.replace(source_prefix, target))
+ finished.extend(
+ [" %s" % os.path.join(dirpath, f) for f in fnames])
+ else:
+ finished.append(line)
+
+ self.data_files = "\n".join(finished)
+
def add_man_path(self, man_path):
self.data_files = "%s\n%s =" % (self.data_files, man_path)
@@ -71,6 +90,8 @@ class FilesConfig(base.BaseConfig):
if os.path.isdir(package):
self.config['packages'] = find_package.smart_find_packages(package)
+ self.expand_globs()
+
if 'manpages' in self.pbr_config:
man_sections = self.get_man_sections()
for (section, pages) in man_sections.items():