From cc369e86d2e060d8b65c7dbbb0c933d18f8aa6b0 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 23 Mar 2023 23:38:29 +0100 Subject: feat(makechrootpkg): add option to interactively inspect the chroot Implement the -x option for makechrootpkg which allows to get an interactive shell in the chroot after building the package. Useful to ease the debugging of a package build. Depending on the argument, the interactive shell is either always spawned or only when an error occurred during build. This option is also forwarded from `pkgctl build` via the `--inspect` flag. Component: pkgctl build Component: makechrootpkg Signed-off-by: Levente Polyak --- src/lib/build/build.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib/build/build.sh') diff --git a/src/lib/build/build.sh b/src/lib/build/build.sh index 8d58b63..2b9d4cf 100644 --- a/src/lib/build/build.sh +++ b/src/lib/build/build.sh @@ -20,6 +20,8 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/pacman.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh # shellcheck source=src/lib/valid-tags.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh +# shellcheck source=src/lib/valid-inspect.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-inspect.sh source /usr/share/makepkg/util/config.sh source /usr/share/makepkg/util/message.sh @@ -48,6 +50,7 @@ pkgctl_build_usage() { -o, --offload Build on a remote server and transfer artifacts afterwards -c, --clean Recreate the chroot before building -I, --install FILE Install a package into the working copy of the chroot + --inspect WHEN Spawn an interactive shell to inspect the chroot (never, always, failure) -w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names) --nocheck Do not run the check() function in the PKGBUILD @@ -218,6 +221,14 @@ pkgctl_build() { warning 'not running checks is disallowed for official packages, except for bootstrapping. Please rebuild after bootstrapping is completed!' shift ;; + --inspect) + (( $# <= 1 )) && die "missing argument for %s" "$1" + if ! in_array "${2}" "${DEVTOOLS_VALID_INSPECT_MODES[@]}"; then + die "Invalid inspect mode: %s" "${2}" + fi + MAKECHROOT_OPTIONS+=("-x" "${2}") + shift 2 + ;; -r|--release) # shellcheck source=src/lib/release.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh -- cgit v1.2.3-54-g00ecf