Package: pbuilder Version: 0.221.1 Severity: wishlist Tags: patch Currently pbuilder does not export build results (*.deb, *.tar.*, *.dsc, ...) or additional build results if the package build fails.
The use case I have for this feature, is exporting files that inform on why the build failed (test logs, ...). Attached are patches that mean that additional buildresults are exported.
>From 2ec3e64746761eb03431d82d5c576449751618bd Mon Sep 17 00:00:00 2001 From: Christopher Baines <[email protected]> Date: Sun, 29 Nov 2015 14:15:56 +0000 Subject: [PATCH 1/2] Create export_additional_buildresults function --- pbuilder-buildpackage | 5 +---- pbuilder-buildpackage-funcs | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage index a4572bb..5ab7a1b 100755 --- a/pbuilder-buildpackage +++ b/pbuilder-buildpackage @@ -192,10 +192,7 @@ if [ -d "${BUILDRESULT}" ]; then cp -p "${FILE}" "${BUILDRESULT}" || true fi done - for FILE in "${ADDITIONAL_BUILDRESULTS[@]}"; do - log.i "Trying to save additional result ${FILE}" - cp -a "${BUILDPLACE}$BUILDDIR/"*"/${FILE}" "${BUILDRESULT}" || true - done + export_additional_buildresults executehooks "I" else log.e "BUILDRESULT=[$BUILDRESULT] is not a directory." diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs index f93d7ee..9ffbc24 100644 --- a/pbuilder-buildpackage-funcs +++ b/pbuilder-buildpackage-funcs @@ -168,3 +168,10 @@ EOF cat "$tmpcl" >> "$cl" rm "$tmpcl" } + +function export_additional_buildresults() { + for FILE in "${ADDITIONAL_BUILDRESULTS[@]}"; do + log.i "Trying to save additional result ${FILE}" + cp -a "${BUILDPLACE}$BUILDDIR/"*"/${FILE}" "${BUILDRESULT}" || true + done +} -- 2.6.2
>From 3c594c5831fe42b44bd590906a3bfc3612cac455 Mon Sep 17 00:00:00 2001 From: Christopher Baines <[email protected]> Date: Sun, 29 Nov 2015 14:15:19 +0000 Subject: [PATCH 2/2] Also export additional buildresults if the package build fails Additional buildresults may include files that are still generated if the package build fails. Users of pbuilder may still wish for these files to be exported. Even if any of the additional buildresults are not generated, pbuilder will not stop on the failure. As a practical use case, if the tests fail in the package build, there may be files that inform the user about the failure, which can be exported as additional buildresults such that the user can read them. --- pbuilder-buildpackage | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage index 5ab7a1b..994a939 100755 --- a/pbuilder-buildpackage +++ b/pbuilder-buildpackage @@ -175,6 +175,11 @@ if ! wait "${BUILD_PID}"; then trap umountproc_cleanbuildplace_trap exit sighup sigpipe eval "${KILL_WAIT_PID}" log.e "Failed autobuilding of package" + if [ -d "${BUILDRESULT}" ]; then + export_additional_buildresults + else + log.e "BUILDRESULT=[$BUILDRESULT] is not a directory." + fi executehooks "C" exit 1; else -- 2.6.2

