Keep delorean.repo filename consistent in branches
While repo name can be different, we need to keep the filename the same across all branches. It's required for scripts that parses repo files and shouldn't be branch dependent. Change-Id: I6fac85a092ff07e688d0a3f9f851244b4dc2b73c
This commit is contained in:
parent
5609d2e3ae
commit
ceba106857
|
@ -147,11 +147,13 @@ def _get_repo(path, args):
|
|||
r.raise_for_status()
|
||||
|
||||
|
||||
def _write_repo(content, target):
|
||||
m = TITLE_RE.search(content)
|
||||
if not m:
|
||||
raise NoRepoTitle('Could not find repo title in: \n%s' % content)
|
||||
filename = m.group(1) + '.repo'
|
||||
def _write_repo(content, target, name=None):
|
||||
if not name:
|
||||
m = TITLE_RE.search(content)
|
||||
if not m:
|
||||
raise NoRepoTitle('Could not find repo title in: \n%s' % content)
|
||||
name = m.group(1)
|
||||
filename = name + '.repo'
|
||||
filename = os.path.join(target, filename)
|
||||
with open(filename, 'w') as f:
|
||||
f.write(content)
|
||||
|
@ -284,7 +286,7 @@ def _install_repos(args, base_path):
|
|||
content = _get_repo(base_path + 'current/delorean.repo', args)
|
||||
if args.branch != 'master':
|
||||
content = TITLE_RE.sub('[delorean-%s]' % args.branch, content)
|
||||
_write_repo(content, args.output_path)
|
||||
_write_repo(content, args.output_path, name='delorean')
|
||||
install_deps(args, base_path)
|
||||
elif repo == 'deps':
|
||||
install_deps(args, base_path)
|
||||
|
|
|
@ -161,7 +161,8 @@ class TestTripleORepos(testtools.TestCase):
|
|||
mock.call('roads/delorean-deps.repo', args),
|
||||
],
|
||||
mock_get.mock_calls)
|
||||
self.assertEqual([mock.call('[delorean]\nMr. Fusion', 'test'),
|
||||
self.assertEqual([mock.call('[delorean]\nMr. Fusion', 'test',
|
||||
name='delorean'),
|
||||
mock.call('[delorean]\nMr. Fusion', 'test'),
|
||||
],
|
||||
mock_write.mock_calls)
|
||||
|
@ -179,7 +180,8 @@ class TestTripleORepos(testtools.TestCase):
|
|||
mock.call('roads/delorean-deps.repo', args),
|
||||
],
|
||||
mock_get.mock_calls)
|
||||
self.assertEqual([mock.call('[delorean-mitaka]\nMr. Fusion', 'test'),
|
||||
self.assertEqual([mock.call('[delorean-mitaka]\nMr. Fusion', 'test',
|
||||
name='delorean'),
|
||||
mock.call('[delorean]\nMr. Fusion', 'test'),
|
||||
],
|
||||
mock_write.mock_calls)
|
||||
|
|
Loading…
Reference in New Issue