Package: gitpkg Version: 0.28 Severity: wishlist Tags: patch Hi, As discussed in #debian-devel, here is a patch to add a cowbuilder exit hook.
Regards, James -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages gitpkg depends on: ii dpkg-dev 1.18.4 ii git 1:2.8.0~rc3-1 gitpkg recommends no packages. Versions of packages gitpkg suggests: ii devscripts 2.16.2 -- no debconf information
>From af85cd437c3daea09c038cb35b2015854c720b64 Mon Sep 17 00:00:00 2001 From: James Clarke <jrt...@jrtc27.com> Date: Wed, 13 Apr 2016 22:50:35 +0100 Subject: [PATCH] Add new exit hook to build with cowbuilder --- gitpkg.1 | 34 ++++++++++++++++++++++++++++++++++ gitpkg.bash_completion | 2 +- hooks/cowbuilder-exit-hook | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/gitpkg.1 b/gitpkg.1 index 83426c6..574860e 100644 --- a/gitpkg.1 +++ b/gitpkg.1 @@ -495,6 +495,40 @@ There are some canned hook scripts for various tasks available in which currently include: .TP 4 +.B cowbuilder-exit-hook +A simple exit hook which builds the exported package with +.BR cowbuilder (8). +To enable it: + +.nh +.nf + $ git config gitpkg.exit-hook /usr/share/gitpkg/hooks/cowbuilder-exit-hook +.fi +.hy + +Additional \fBgit-config\fP(1) configuration options: + +.RS + +.TP 8 +.B gitpkg-cowbuilder-exit-hook.ask-first +If 'true' prompt for confirmation before calling \fBcowbuilder\fP. +Default is to just go ahead and do it. + +.TP 8 +.B gitpkg-cowbuilder-exit-hook.options +May include any other options to pass verbatim to \fBcowbuilder\fP. +To pass multiple options, set this multiple times, once for each option. +This may be overridden on the command line with the +.nh +.BI \-\-cowbuilder= arg +.hy +option, which likewise must be passed multiple times to set multiple options. + +.RE + + +.TP 4 .B cowpoke-exit-hook A simple exit hook which sends the exported package off for building using .BR cowpoke (1). diff --git a/gitpkg.bash_completion b/gitpkg.bash_completion index e2c28f9..d7fb059 100644 --- a/gitpkg.bash_completion +++ b/gitpkg.bash_completion @@ -30,7 +30,7 @@ _gitpkg() { COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" - options='--help --version --deb-dir --admin-config-hook --exit-hook --keep-unpacked-source --dpkg-source --cowpoke --dpkg-bp' + options='--help --version --deb-dir --admin-config-hook --exit-hook --keep-unpacked-source --dpkg-source --cowbuilder --cowpoke --dpkg-bp' if [[ "${cur}" == -* ]]; then COMPREPLY=( $( compgen -W "${options}" -- "${cur}" ) ) diff --git a/hooks/cowbuilder-exit-hook b/hooks/cowbuilder-exit-hook new file mode 100644 index 0000000..6ba1a3d --- /dev/null +++ b/hooks/cowbuilder-exit-hook @@ -0,0 +1,39 @@ +# gitpkg hook script to build the exported package with cowbuilder +# +# To enable this hook, use: +# git config gitpkg.exit-hook /usr/share/gitpkg/hooks/cowbuilder-exit-hook + +# We're out of the repo tree, but want to check git-config +. /usr/share/gitpkg/hooks/repo-config-helper + +# See cowbuilder(8) for what's valid to set in this one +extract_values_for_option cowbuilder "${GITPKG_IOPTS[@]}" + +# Command line options override the git config +if [ ${#EXTRACTED_OPTS[@]} -gt 0 ]; then + COWBUILDER_OPTS=( "${EXTRACTED_OPTS[@]}" ) +else + while read opt; do COWBUILDER_OPTS+=("$opt") + done < <(repo_config --get-all gitpkg-cowbuilder-exit-hook.options) + + # Having a veto can be handy sometimes + if [ "$(repo_config --get --bool gitpkg-cowbuilder-exit-hook.ask-first)" = "true" ] + then + printf "Build $DEB_DSC with cowbuilder (Y/n)? " + read -e yesno + case "$yesno" in + N* | n*) + echo "Ok, you're the boss. If you change your mind, just run:" + echo "sudo HOME=\$HOME cowbuilder --build $DEB_DSC --buildresult $DEB_DIR/$DEB_SOURCE ${COWBUILDER_OPTS[@]}" + echo + exit 0 + ;; + *) ;; + esac + fi +fi + +echo "cowbuilder --build $DEB_DSC --buildresult . ${COWBUILDER_OPTS[@]}" +sudo HOME="$HOME" cowbuilder --build "$DEB_DSC" --buildresult . "${COWBUILDER_OPTS[@]}" + +# vi:sts=4:sw=4:noet:foldmethod=marker -- 2.8.0.rc3