Skip to content

Commit bb73f42

Browse files
committed
T8599: Don't ignore other build.py failures
Exit with error for other failures: * Creating/installing dependency package should be error: e.g. debugging why strongswan cannot find systemd could be easier if build.py failed when it couldn't install systemd and not when `configure` couldn't find it. * Creating tarball * pre_hook run
1 parent 0042227 commit bb73f42

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/package-build/build.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ def build_package(package: list, patch_dir: Path) -> None:
120120
print(f'I: execute pre_build_hook for the package "{repo_name}"')
121121
run(pre_build_hook, cwd=repo_dir, check=True, shell=True)
122122
except CalledProcessError as e:
123-
print(e)
124-
print(f"I: pre_build_hook failed for the {repo_name}")
123+
print(f"E: pre_build_hook failed for the {repo_name}")
125124
raise
126125

127126
# Apply patches if the 'apply_patches' key is set to True (default) in the package configuration
@@ -171,18 +170,20 @@ def build_package(package: list, patch_dir: Path) -> None:
171170
# Clean up or dpkg-source will see this as changes to binary files
172171
cleanup_build_deps(repo_dir)
173172
except CalledProcessError as e:
174-
print(f"Failed to build package {repo_name}: {e}")
173+
print(f"E: Failed to create/install dependency package for {repo_name}: {e}")
174+
raise
175175

176176
# Build the package, check if we have build_cmd in the package.toml
177177
try:
178178
build_cmd = package.get('build_cmd', r'dpkg-buildpackage -uc -us -tc -F --source-option=--tar-ignore=.git --source-option=--tar-ignore=.github --source-option=--extend-diff-ignore="^\.github(?:/.*)?$"')
179179
run(build_cmd, cwd=repo_dir, check=True, shell=True)
180180
except CalledProcessError as e:
181-
print(f"E: Package build failed for package '{repo_name}': {e}")
182-
sys.exit(1)
181+
print(f"E: Build command failed for '{repo_name}': {build_cmd}")
182+
raise
183183

184184
except CalledProcessError as e:
185185
print(f"Failed to build package {repo_name}: {e}")
186+
sys.exit(1)
186187
finally:
187188
# Clean up repository directory
188189
# shutil.rmtree(repo_dir, ignore_errors=True)

0 commit comments

Comments
 (0)