From 4544eb81de6cea8ef0f81d89531bd3c61673586e Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Fri, 9 Jan 2015 11:25:32 +0000 Subject: Make import tool pass version to to_lorry ext --- baserockimport/mainloop.py | 14 +++++++++----- 1 file 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: -- cgit v1.2.1