diff --git a/NEWS b/NEWS index fdad752..7674a55 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,10 @@ Changes in version 2.1 **STILL UNDER DEVELOPMENT; NOT RELEASED YET.** +* Issue 3: Added a new `PBULK_LOG` setting to point at a location that + holds all build logs, and made the `build` command print out details + about such logs on success and failure. + * Issue 4: Fixed the installable bootstrap kit generated during a build to not leak pkg_comp-internal paths. diff --git a/admin/make-macos-pkg.sh b/admin/make-macos-pkg.sh index 79af7b5..4cb2b4c 100755 --- a/admin/make-macos-pkg.sh +++ b/admin/make-macos-pkg.sh @@ -162,6 +162,7 @@ EOF edit_config "${f}" PKGSRCDIR /var/pkg_comp/pkgsrc edit_config "${f}" DISTDIR /var/pkg_comp/distfiles edit_config "${f}" PACKAGES /var/pkg_comp/packages + edit_config "${f}" PBULK_LOG /var/pkg_comp/log/pbulk edit_config "${f}" PBULK_PACKAGES /var/pkg_comp/pbulk-packages edit_config "${f}" LOCALBASE /opt/pkg edit_config "${f}" PKG_DBDIR /opt/pkg/libdata/pkgdb diff --git a/default.conf.in b/default.conf.in index 55348c4..8a48004 100644 --- a/default.conf.in +++ b/default.conf.in @@ -19,6 +19,7 @@ SANDBOX_CONFFILE="__PKG_COMP_ETCDIR__/sandbox.conf" PKGSRCDIR="/usr/pkgsrc" DISTDIR="${PKGSRCDIR}/distfiles" PACKAGES="${PKGSRCDIR}/packages" +PBULK_LOG="${PACKAGES}/log" PBULK_PACKAGES="${PACKAGES}/pbulk" # Target file layout. These are the directories that the built binary diff --git a/pkg_comp.8.in b/pkg_comp.8.in index 3d9470d..8ba2ed7 100644 --- a/pkg_comp.8.in +++ b/pkg_comp.8.in @@ -25,7 +25,7 @@ .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.Dd February 17, 2017 +.Dd August 30, 2018 .Dt PKG_COMP 8 .Os .Sh NAME @@ -253,6 +253,20 @@ This is necessary to keep fully-populated databases. However, because pbulk reuses existing binary packages and only rebuilds updated packages, any packages not given on the command line should "build" quickly. +.Pp +In case of build problems, detailed logs for each package that failed to build +will be located in the directory pointed at by +.Va PBULK_LOG . +Of special interest is the +.Pa SUMMARY +subdirectory, which contains summary reports of the whole operation in various +different formats. +Examples are: +.Pa report.html +and +.Pa report.txt , +both of which summarize how many packages were built and include details of all +that failed. .Ss The config command The config command dumps the loaded configuration to the standard output. The format of the output is not a script, so it cannot be fed back into diff --git a/pkg_comp.conf.5 b/pkg_comp.conf.5 index 17e7f81..2440520 100644 --- a/pkg_comp.conf.5 +++ b/pkg_comp.conf.5 @@ -25,7 +25,7 @@ .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.Dd February 14, 2017 +.Dd August 30, 2018 .Dt PKG_COMP.CONF 5 .Os .Sh NAME @@ -156,6 +156,14 @@ packages and bootstrap kit for the target environment. .Pp Default: .Pa /usr/pkgsrc/packages . +.It Va PBULK_LOG +Absolute path to the directory in the host that will hold the logs of the +pbulk build. +The contents of this directory are wiped at the beginning of each +build. +.Pp +Default: +.Pa /usr/pkgsrc/packages/log . .It Va PBULK_PACKAGES Absolute path to the directory in the host that will hold the built binary packages and bootstrap kit for the pbulk installation in the sandbox. diff --git a/pkg_comp.sh b/pkg_comp.sh index a1494dc..f192b8a 100644 --- a/pkg_comp.sh +++ b/pkg_comp.sh @@ -44,8 +44,8 @@ SHTK_MODULESPATH="${PKG_COMP_SHTK_MODULESDIR}" shtk_import pkgsrc # Please remember to update pkg_comp.conf(5) if you change this list. PKG_COMP_CONFIG_VARS="AUTO_PACKAGES CVS_ROOT CVS_TAG DISTDIR EXTRA_MKCONF FETCH_VCS GIT_BRANCH GIT_URL LOCALBASE NJOBS PACKAGES - PBULK_PACKAGES PKG_DBDIR PKGSRCDIR SANDBOX_CONFFILE - SYSCONFDIR UPDATE_SOURCES VARBASE" + PBULK_LOG PBULK_PACKAGES PKG_DBDIR PKGSRCDIR + SANDBOX_CONFFILE SYSCONFDIR UPDATE_SOURCES VARBASE" # Paths to installed files. @@ -72,6 +72,7 @@ pkg_comp_set_defaults() { shtk_config_set LOCALBASE "/usr/pkg" shtk_config_set NJOBS "$(shtk_hw_ncpus)" shtk_config_set PACKAGES "/usr/pkgsrc/packages" + shtk_config_set PBULK_LOG "/usr/pkgsrc/packages/log" shtk_config_set PBULK_PACKAGES "/usr/pkgsrc/packages/pbulk" shtk_config_set PKG_DBDIR "/usr/pkg/libdata/pkgdb" shtk_config_set PKGSRCDIR "/usr/pkgsrc" @@ -119,6 +120,7 @@ run_sandboxctl() { cat <>"${list}" done + local bulklog="$(shtk_config_get PBULK_LOG)" + # Removing bulklog/success seems to be necessary to restart a build, as # otherwise bulkbuild does not build modified packages. Is this correct? - rm -f "${root}/pkg_comp/work/bulklog/success" + rm -f "${root}/pkg_comp/bulklog/success" + shtk_cli_info "Starting pbulk build in the sandbox" run_sandboxctl run /pkg_comp/pbulk/bin/bulkbuild || \ - shtk_cli_error "bulkbuild failed; see ${root}/pkg_comp/work/bulklog/" \ - "for possible details" + shtk_cli_error "bulkbuild failed; see ${bulklog}/ for possible details" generate_pkg_summary "${root}" + + if [ -s "${bulklog}/SUMMARY/error" ]; then + local errors="$(cat ${bulklog}/SUMMARY/error)" + shtk_cli_error "Failed to build ${errors}; see ${bulklog}/ for" \ + "detailed logs" + else + shtk_cli_info "All packages built successfully; summary reports are" \ + "in ${bulklog}/SUMMARY/" + fi } diff --git a/pkg_comp_inttest.sh b/pkg_comp_inttest.sh index 63d52e6..569c382 100644 --- a/pkg_comp_inttest.sh +++ b/pkg_comp_inttest.sh @@ -95,6 +95,7 @@ integration_body() { cat >pkg_comp.conf <>pkg_comp.conf echo "GIT_URL='file://$(atf_config_get pkgsrcdir)'" >>pkg_comp.conf fi + + # Configure Git in case our tests want to modify the pkgsrc files. In those + # cases, pkg_comp will need to stash the modifications during "fetch" and + # we need these details. + git config --global user.email "travis@example.com" + git config --global user.name "Travis" } @@ -599,6 +606,40 @@ auto_workflow_reusing_sandbox_intbody() { } +integration_test_case logs_workflow +logs_workflow_intbody() { + reuse_bootstrap + reuse_packages cwrappers digest + + setup_fetch_from_local_git + + atf_check -o ignore -e ignore pkg_comp -c pkg_comp.conf fetch + + check_files pkgsrc/pkgtools/verifypc/Makefile + cat >>pkgsrc/pkgtools/verifypc/Makefile <pkg_comp.conf <