summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2023-03-23 23:38:29 +0100
committerLevente Polyak <anthraxx@archlinux.org>2023-11-26 01:28:20 +0100
commitcc369e86d2e060d8b65c7dbbb0c933d18f8aa6b0 (patch)
treea0ac6d2621eed26122bbead3c38da84e9484d95e /contrib
parentc9de6a18b9fffa8904e191cb184c2b4d083d8dc3 (diff)
downloaddevtools-cc369e86d2e060d8b65c7dbbb0c933d18f8aa6b0.tar.xz
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 <anthraxx@archlinux.org>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/bash/devtools.in9
-rw-r--r--contrib/completion/zsh/_devtools.in4
2 files changed, 13 insertions, 0 deletions
diff --git a/contrib/completion/bash/devtools.in b/contrib/completion/bash/devtools.in
index e0fca51..b347b31 100644
--- a/contrib/completion/bash/devtools.in
+++ b/contrib/completion/bash/devtools.in
@@ -7,6 +7,8 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh
# shellcheck source=src/lib/valid-repos.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh
+# shellcheck source=src/lib/valid-inspect.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-inspect.sh
_binary_arch=${DEVTOOLS_VALID_ARCHES[*]:0:-1}
_colors=(never always auto)
@@ -24,6 +26,7 @@ _makechrootpkg_args=(
-n
-T
-U
+ -x
)
_makechrootpkg_args_d_opts() { _filedir -d; }
_makechrootpkg_args_D_opts() { _filedir -d; }
@@ -31,6 +34,7 @@ _makechrootpkg_args_r_opts() { _filedir -d; }
_makechrootpkg_args_I_opts() { _filedir '*.pkg.tar.*'; }
_makechrootpkg_args_l_opts() { _filedir -d; }
_makechrootpkg_args_U_opts() { :; }
+_makechrootpkg_args_x_opts() { _devtools_completions_inspect; }
_makechrootpkg() { __devtools_complete _makechrootpkg; }
complete -F _makechrootpkg makechrootpkg
@@ -169,6 +173,7 @@ _pkgctl_build_args=(
-o --offload
-c --clean
-w --worker
+ --inspect
--pkgver
--pkgrel
@@ -186,6 +191,7 @@ _pkgctl_build_args__arch_opts() { _devtools_completions_arch; }
_pkgctl_build_args__repo_opts() { _devtools_completions_repo; }
_pkgctl_build_args__worker_opts() { :; }
_pkgctl_build_args_w_opts() { _pkgctl_build_args__worker_opts; }
+_pkgctl_build_args__inspect_opts() { _devtools_completions_inspect; }
_pkgctl_build_args__pkgver_opts() { :; }
_pkgctl_build_args__pkgrel_opts() { :; }
_pkgctl_build_args__message_opts() { :; }
@@ -371,6 +377,9 @@ _devtools_completions_all_packages() {
_devtools_completions_protocol() {
mapfile -t COMPREPLY < <(compgen -W "https" -- "$cur")
}
+_devtools_completions_inspect() {
+ mapfile -t COMPREPLY < <(compgen -W "${DEVTOOLS_VALID_INSPECT_MODES[*]}" -- "$cur")
+}
__devtools_complete() {
local service=$1
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in
index d3d6df0..feeb2c2 100644
--- a/contrib/completion/zsh/_devtools.in
+++ b/contrib/completion/zsh/_devtools.in
@@ -7,6 +7,8 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh
# shellcheck source=src/lib/valid-repos.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh
+# shellcheck source=src/lib/valid-inspect.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-inspect.sh
_binary_arch=${DEVTOOLS_VALID_ARCHES[*]:0:-1}
_colors=(never always auto)
@@ -42,6 +44,7 @@ _pkgctl_build_args=(
'(-o --offload)'{-o,--offload}'[Build on a remote server and transfer artifacts afterwards]'
'(-c --clean)'{-c,--clean}'[Recreate the chroot before building]'
'(-I --install)'{-I,--install}'[Install a package into the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"'
+ "--inspect[Spawn an interactive shell to inspect the chroot (never, always, failure)]:inspect:($DEVTOOLS_VALID_INSPECT_MODES[*])"
'(-w --worker)'{-w,--worker}'[Name of the worker slot, useful for concurrent builds (disables auto-detection)]:slot:'
'--nocheck[Do not run the check() function in the PKGBUILD]'
'--pkgver=[Set pkgver, reset pkgrel and update checksums]:pkgver:'
@@ -190,6 +193,7 @@ _makechrootpkg_args=(
'-n[Run namcap on the package]'
'-T[Build in a temporary directory]'
'-U[Run makepkg as a specified user]:makepkg_user'
+ "-x[Spawn an interactive shell to inspect the chroot (never, always, failure)]:inspect:($DEVTOOLS_VALID_INSPECT_MODES[*])"
)
_mkarchroot_args=(