summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-01-09 11:25:32 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2015-01-12 11:57:46 +0000
commit4544eb81de6cea8ef0f81d89531bd3c61673586e (patch)
tree5bbbaef1cdbc4178f0a647198e1eca0aa2fe927a
parent5bcb22616579cff9707324063f9310dfe51d9108 (diff)
downloadimport-4544eb81de6cea8ef0f81d89531bd3c61673586e.tar.gz
Make import tool pass version to to_lorry ext
-rw-r--r--baserockimport/mainloop.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/baserockimport/mainloop.py b/baserockimport/mainloop.py
index b9f1b9b..8a7ae26 100644
--- a/baserockimport/mainloop.py
+++ b/baserockimport/mainloop.py
@@ -202,7 +202,7 @@ class ImportLoop(object):
# 1. Make the source code available.
- lorry = self._find_or_create_lorry_file(kind, name)
+ lorry = self._find_or_create_lorry_file(kind, name, version)
source_repo, url = self._fetch_or_update_source(lorry)
checked_out_version, ref = self._checkout_source_version_for_package(
@@ -288,7 +288,7 @@ class ImportLoop(object):
dep_package.set_is_build_dep(True)
processed.add_edge(dep_package, current_item)
- def _find_or_create_lorry_file(self, kind, name):
+ def _find_or_create_lorry_file(self, kind, name, version):
# Note that the lorry file may already exist for 'name', but lorry
# files are named for project name rather than package name. In this
# case we will generate the lorry, and try to add it to the set, at
@@ -303,7 +303,7 @@ class ImportLoop(object):
lorry = self.lorry_set.find_lorry_for_package(kind, name, comp)
if lorry is None:
- lorry = self._generate_lorry_for_package(kind, name)
+ lorry = self._generate_lorry_for_package(kind, name, version)
if len(lorry) != 1:
raise Exception(
@@ -330,14 +330,18 @@ class ImportLoop(object):
return lorry
- def _generate_lorry_for_package(self, kind, name):
+ def _generate_lorry_for_package(self, kind, name, version):
tool = '%s.to_lorry' % kind
if kind not in self.importers:
raise Exception('Importer for %s was not enabled.' % kind)
extra_args = self.importers[kind]['extra_args']
self.app.status(
'%s: calling %s to generate lorry', name, tool)
- lorry_text = run_extension(tool, extra_args + [name])
+
+ args = extra_args + [name]
+ if version != 'master':
+ args.append(version)
+ lorry_text = run_extension(tool, args)
try:
lorry = json.loads(lorry_text)
except ValueError: