From c31c9642be6384400854096f19c46baa2fc6d0aa Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Fri, 12 Jul 2019 16:31:17 +0200 Subject: [PATCH] [IMP] runbot: add read_source on commit --- runbot/common.py | 9 +++++++++ runbot/models/build_config.py | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/runbot/common.py b/runbot/common.py index 9b61beae..0ac783df 100644 --- a/runbot/common.py +++ b/runbot/common.py @@ -28,9 +28,18 @@ class Commit(): def export(self): return self.repo._git_export(self.sha) + def read_source(self, file, mode='r'): + file_path = self._source_path(file) + try: + with open(file_path, mode) as f: + return f.read() + except: + return False + def __str__(self): return '%s:%s' % (self.repo.short_name, self.sha) + def fqdn(): return socket.getfqdn() diff --git a/runbot/models/build_config.py b/runbot/models/build_config.py index cbe19569..619f4ec3 100644 --- a/runbot/models/build_config.py +++ b/runbot/models/build_config.py @@ -337,8 +337,7 @@ class ConfigStep(models.Model): docker_source_folder = build._docker_source_folder(commit) for manifest_file in commit.repo.manifest_files.split(','): pattern_to_omit.add('*%s' % manifest_file) - for (addons_path, module, manifest_file_name) in build._get_available_modules(commit): - module = os.path.basename(module_path) + for (addons_path, module, _) in build._get_available_modules(commit): if module not in modules_to_install: # we want to omit docker_source_folder/[addons/path/]module/* module_path_in_docker = os.path.join(docker_source_folder, addons_path, module)