summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/combo-layer12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 83cfc8e16a..8f019744fc 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -144,6 +144,10 @@ class Configuration(object):
144 if option not in self.repos[name]: 144 if option not in self.repos[name]:
145 msg = "%s\nOption %s is not defined for component %s" %(msg, option, name) 145 msg = "%s\nOption %s is not defined for component %s" %(msg, option, name)
146 missing_options.append(option) 146 missing_options.append(option)
147 # Sanitize dest_dir so that we do not have to deal with edge cases
148 # (empty string, double slashes) in the rest of the code.
149 dest_dir = os.path.normpath(self.repos[name]["dest_dir"])
150 self.repos[name]["dest_dir"] = "." if not dest_dir else dest_dir
147 if msg != "": 151 if msg != "":
148 logger.error("configuration file %s has the following error: %s" % (self.conffile,msg)) 152 logger.error("configuration file %s has the following error: %s" % (self.conffile,msg))
149 if self.localconffile and 'last_revision' in missing_options: 153 if self.localconffile and 'last_revision' in missing_options:
@@ -231,7 +235,7 @@ def action_init(conf, args):
231 pass 235 pass
232 initialrev = rev 236 initialrev = rev
233 dest_dir = repo['dest_dir'] 237 dest_dir = repo['dest_dir']
234 if dest_dir and dest_dir != ".": 238 if dest_dir != ".":
235 extract_dir = os.path.join(os.getcwd(), dest_dir) 239 extract_dir = os.path.join(os.getcwd(), dest_dir)
236 if not os.path.exists(extract_dir): 240 if not os.path.exists(extract_dir):
237 os.makedirs(extract_dir) 241 os.makedirs(extract_dir)
@@ -325,7 +329,7 @@ EOF
325 runcmd('git replace --edit %s' % rev) 329 runcmd('git replace --edit %s' % rev)
326 330
327 # Optional: rewrite history to change commit messages or to move files. 331 # Optional: rewrite history to change commit messages or to move files.
328 if 'hook' in repo or dest_dir and dest_dir != ".": 332 if 'hook' in repo or dest_dir != ".":
329 filter_branch = ['git', 'filter-branch', '--force'] 333 filter_branch = ['git', 'filter-branch', '--force']
330 with tempfile.NamedTemporaryFile() as hookwrapper: 334 with tempfile.NamedTemporaryFile() as hookwrapper:
331 if 'hook' in repo: 335 if 'hook' in repo:
@@ -353,7 +357,7 @@ tail -c +18 $tmpname | head -c -4
353''' % (hook, name)) 357''' % (hook, name))
354 hookwrapper.flush() 358 hookwrapper.flush()
355 filter_branch.extend(['--msg-filter', 'bash %s' % hookwrapper.name]) 359 filter_branch.extend(['--msg-filter', 'bash %s' % hookwrapper.name])
356 if dest_dir and dest_dir != ".": 360 if dest_dir != ".":
357 parent = os.path.dirname(dest_dir) 361 parent = os.path.dirname(dest_dir)
358 if not parent: 362 if not parent:
359 parent = '.' 363 parent = '.'
@@ -371,7 +375,7 @@ tail -c +18 $tmpname | head -c -4
371 if not os.path.exists(extract_dir): 375 if not os.path.exists(extract_dir):
372 os.makedirs(extract_dir) 376 os.makedirs(extract_dir)
373 copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.', 377 copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.',
374 subdir=dest_dir if dest_dir and dest_dir != '.' else '') 378 subdir=dest_dir if dest_dir != '.' else '')
375 runcmd('git add --all --force .') 379 runcmd('git add --all --force .')
376 if runcmd('git status --porcelain'): 380 if runcmd('git status --porcelain'):
377 # Something to commit. 381 # Something to commit.