From aea2f01157e82bd5c9d8ff91bebb011023dceac4 Mon Sep 17 00:00:00 2001 From: Quentin Chateau Date: Tue, 22 Dec 2020 12:41:24 +0100 Subject: [PATCH 1/3] [ccb] faster upstream parsing --- ccb/upstream_project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ccb/upstream_project.py b/ccb/upstream_project.py index bd293221..0e81435e 100644 --- a/ccb/upstream_project.py +++ b/ccb/upstream_project.py @@ -126,7 +126,8 @@ async def _clone_and_parse_git_repo(self): env = os.environ.copy() env["GIT_TERMINAL_PROMPT"] = "0" await check_call( - ["git", "clone", "-q", "-n", self.git_url, tmp], env=env + ["git", "clone", "-q", "--filter=tree:0", "-n", self.git_url, tmp], + env=env, ) logger.info("%s: parsing repository", self.recipe.name) await self._parse_git_repo(tmp) From 3794e41a5008bcc0ce79a6b1f17870155fd42877 Mon Sep 17 00:00:00 2001 From: Quentin Chateau Date: Tue, 22 Dec 2020 13:04:56 +0100 Subject: [PATCH 2/3] [ccb] reject version with already applied patches --- ccb/update/auto.py | 3 +++ ccb/update/common.py | 30 ++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ccb/update/auto.py b/ccb/update/auto.py index f9767c61..1863b362 100644 --- a/ccb/update/auto.py +++ b/ccb/update/auto.py @@ -79,6 +79,9 @@ def get_error_category(error): if "Package recipe with version" in error: return "Bad recipe version" + if "Patch already applied" in error: + return "Patch already applied" + if method == "build": if "Failed to apply patch" in error: return "Patch does not apply" diff --git a/ccb/update/common.py b/ccb/update/common.py index 52c9c8cd..0323086d 100644 --- a/ccb/update/common.py +++ b/ccb/update/common.py @@ -29,6 +29,8 @@ re.compile(r"^ERROR:.*(Invalid configuration.*)", re.M | re.S), re.compile(r"^ERROR:\s*(.*)", re.M | re.S), ] +RE_ALREADY_PATCHED = re.compile(r"WARN:\s*(.*):\s*already patched", re.M) +RE_CREATE_ERRORS = [RE_ALREADY_PATCHED] RE_CMAKELISTS_VERSION = re.compile( r"(cmake_minimum_required\s*\(\s*VERSION\s*)([0-9\.]+)(\s*\))", re.I @@ -60,6 +62,12 @@ def get_test_details(output): match = regex.search(output) if match: return match.group(1) + + matches = list(RE_ALREADY_PATCHED.finditer(output)) + if matches: + patches = {m.group(1) for m in matches} + return "Patch already applied:\n" + "\n".join(patches) + return "no details" @@ -164,17 +172,23 @@ async def test_recipe(recipe, version_str): cwd=recipe.folder_path, ) output, _ = await process.communicate() + output = output.decode() code = await process.wait() duration = time.time() - t0 - if code != 0: - output = output.decode() - logger.info(output) - logger.error( - "%s: test failed in %s", - recipe.name, - format_duration(duration), - ) + if code != 0: + logger.info(output) + logger.error( + "%s: test failed in %s", + recipe.name, + format_duration(duration), + ) + return TestStatus( + success=False, duration=duration, error=get_test_details(output) + ) + + for regex in RE_CREATE_ERRORS: + if regex.search(output): return TestStatus( success=False, duration=duration, error=get_test_details(output) ) From 263dc5a9d11c2a0972d780f2c9d566c80133f1a7 Mon Sep 17 00:00:00 2001 From: Quentin Chateau Date: Tue, 22 Dec 2020 13:11:09 +0100 Subject: [PATCH 3/3] [ccb] reject version on warnings --- ccb/update/common.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ccb/update/common.py b/ccb/update/common.py index 0323086d..161943d8 100644 --- a/ccb/update/common.py +++ b/ccb/update/common.py @@ -29,8 +29,10 @@ re.compile(r"^ERROR:.*(Invalid configuration.*)", re.M | re.S), re.compile(r"^ERROR:\s*(.*)", re.M | re.S), ] + RE_ALREADY_PATCHED = re.compile(r"WARN:\s*(.*):\s*already patched", re.M) -RE_CREATE_ERRORS = [RE_ALREADY_PATCHED] +RE_WARNING = re.compile(r"WARN:\s*(.*)", re.M) +RE_CREATE_ERRORS = [RE_WARNING] RE_CMAKELISTS_VERSION = re.compile( r"(cmake_minimum_required\s*\(\s*VERSION\s*)([0-9\.]+)(\s*\))", re.I @@ -68,6 +70,11 @@ def get_test_details(output): patches = {m.group(1) for m in matches} return "Patch already applied:\n" + "\n".join(patches) + matches = list(RE_WARNING.finditer(output)) + if matches: + warnings = [m.group(1) for m in matches] + return "Warnings during conan create:\n" + "\n".join(warnings) + return "no details"