From 7a24564bd8d89e8965b7b7ec60fe4ce21b287c4a Mon Sep 17 00:00:00 2001 From: Razvan-Liviu Varzaru Date: Fri, 10 Jan 2025 14:35:45 +0200 Subject: [PATCH 1/2] ls2string should append if the line is not empty This is a fix for https://github.com/MariaDB/buildbot/commit/c270d1a779f58a1c2ec168d98cfaf62d5979ee97 where the condition has been reversed. --- utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.py b/utils.py index 8077cb91..86fbaab8 100644 --- a/utils.py +++ b/utils.py @@ -322,7 +322,7 @@ def ls2string(rc: int, stdout: str, stderr: str) -> dict[str, str]: ls_filenames = [] for line in stdout.strip().split("\n"): line = line.strip() - if not line: + if line: ls_filenames.append(line) return {"packages": " ".join(ls_filenames)} From 29b3e53094d42e98ad6fa4e6c29b2ed82867427a Mon Sep 17 00:00:00 2001 From: Razvan-Liviu Varzaru Date: Fri, 10 Jan 2025 15:00:39 +0200 Subject: [PATCH 2/2] Renamed hasFiles function to highlight its purpose The function is used only for checking that packages were generated for both RPM and DEB. Returns True if "packages" property is not empty. If the packages are generated, several further actions can take place: -> publish the packages on CI -> trigger Install / Upgrade builders which in turn install the packages from CI --- common_factories.py | 8 ++++---- master.cfg | 4 ++-- utils.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common_factories.py b/common_factories.py index 09ef8096..579c37bb 100644 --- a/common_factories.py +++ b/common_factories.py @@ -23,9 +23,9 @@ hasDockerLibrary, hasEco, hasFailed, - hasFiles, hasGalera, hasInstall, + hasPackagesGenerated, hasRpmLint, hasS3, hasUpgrade, @@ -755,7 +755,7 @@ def getRpmAutobakeFactory(mtrDbPool): """ ), doStepIf=( - lambda step: hasFiles(step) + lambda step: hasPackagesGenerated(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) ), descriptionDone=util.Interpolate( @@ -797,7 +797,7 @@ def getRpmAutobakeFactory(mtrDbPool): doStepIf=( lambda step: hasInstall(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) - and hasFiles(step) + and hasPackagesGenerated(step) ), ) ) @@ -816,7 +816,7 @@ def getRpmAutobakeFactory(mtrDbPool): doStepIf=( lambda step: hasUpgrade(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) - and hasFiles(step) + and hasPackagesGenerated(step) ), ) ) diff --git a/master.cfg b/master.cfg index af0579d7..27dc0b7b 100644 --- a/master.cfg +++ b/master.cfg @@ -258,7 +258,7 @@ f_deb_autobake.addStep( doStepIf=( lambda step: hasInstall(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) - and hasFiles(step) + and hasPackagesGenerated(step) ), ) ) @@ -277,7 +277,7 @@ f_deb_autobake.addStep( doStepIf=( lambda step: hasUpgrade(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) - and hasFiles(step) + and hasPackagesGenerated(step) ), ) ) diff --git a/utils.py b/utils.py index 86fbaab8..0a9ff479 100644 --- a/utils.py +++ b/utils.py @@ -207,7 +207,7 @@ def createDebRepo() -> steps.ShellCommand: ), ], doStepIf=( - lambda step: hasFiles(step) + lambda step: hasPackagesGenerated(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) ), ) @@ -249,7 +249,7 @@ def uploadDebArtifacts() -> steps.ShellCommand: ), ], doStepIf=( - lambda step: hasFiles(step) + lambda step: hasPackagesGenerated(step) and savePackageIfBranchMatch(step, SAVED_PACKAGE_BRANCHES) ), descriptionDone=util.Interpolate( @@ -444,7 +444,7 @@ def dockerfile(props: IProperties) -> str: # checks if the list of files is empty -def hasFiles(step: BuildStep) -> bool: +def hasPackagesGenerated(step: BuildStep) -> bool: return len(step.getProperty("packages")) >= 1