Of course I forgot the patch the first time. -- Antonio Terceiro <terce...@debian.org>
From b1fa3601c8c5a905dcce9ad2806b33afd6a3ed89 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro <terce...@debian.org> Date: Sat, 16 May 2015 17:45:47 -0300 Subject: [PATCH] Add hook to build with sbuild
--- gitpkg.1 | 34 ++++++++++++++++++++++++++++++++++ gitpkg.bash_completion | 2 +- hooks/sbuild-exit-hook | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 hooks/sbuild-exit-hook diff --git a/gitpkg.1 b/gitpkg.1 index 83426c6..d7c2135 100644 --- a/gitpkg.1 +++ b/gitpkg.1 @@ -529,6 +529,40 @@ option, which likewise must be passed multiple times to set multiple options. .TP 4 +.B sbuild-exit-hook +A simple exit hook which builds the exported package using +.BR sbuild(1). +To enable it: + +.nh +.nf + $ git config gitpkg.exit-hook /usr/share/gitpkg/hooks/sbuild-exit-hook +.fi +.hy + +Additional \fBgit-config\fP(1) configuration options: + +.RS + +.TP 8 +.B gitpkg-sbuild-exit-hook.ask-first +If 'true' prompt for confirmation before calling \fBsbuild\fP. +Default is to just go ahead and do it. + +.TP 8 +.B gitpkg-sbuild-exit-hook.options +May include any other options to pass verbatim to \fBsbuild\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 \-\-sbuild= arg +.hy +option, which likewise must be passed multiple times to set multiple options. + +.RE + + +.TP 4 .B dpkg-buildpackage-exit-hook A simple exit hook to build binary packages locally with .BR dpkg-buildpackage (1). diff --git a/gitpkg.bash_completion b/gitpkg.bash_completion index e2c28f9..ef9637a 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 --cowpoke --sbuild --dpkg-bp' if [[ "${cur}" == -* ]]; then COMPREPLY=( $( compgen -W "${options}" -- "${cur}" ) ) diff --git a/hooks/sbuild-exit-hook b/hooks/sbuild-exit-hook new file mode 100644 index 0000000..ef38d4f --- /dev/null +++ b/hooks/sbuild-exit-hook @@ -0,0 +1,42 @@ +# gitpkg hook script to build the exported package with sbuild +# +# To enable this hook, use: +# git config gitpkg.exit-hook /usr/share/gitpkg/hooks/sbuild-exit-hook + +# We're out of the repo tree, but want to check git-config +. /usr/share/gitpkg/hooks/repo-config-helper + +# See sbuild(1) for what's valid to set in this one +extract_values_for_option sbuild "${GITPKG_IOPTS[@]}" + +# Use the distribution in the changelog by default +SBUILD_OPTS=( "-d" $(dpkg-parsechangelog -l${REPO_DIR}/debian/changelog -SDistribution) ) + +# Command line options override the git config +if [ ${#EXTRACTED_OPTS[@]} -gt 0 ]; then + SBUILD_OPTS+=( "${EXTRACTED_OPTS[@]}" ) +else + while read opt; do SBUILD_OPTS+=("$opt") + done < <(repo_config --get-all gitpkg-sbuild-exit-hook.options) + + # Having a veto can be handy sometimes + if [ "$(repo_config --get --bool gitpkg-sbuild-exit-hook.ask-first)" = "true" ] + then + printf "Build $DEB_DSC with sbuild (Y/n)? " + read -e yesno + case "$yesno" in + N* | n*) + echo "Ok, you're the boss. If you change your mind, just run:" + echo "sbuild ${SBUILD_OPTS[@]} $DEB_DSC" + echo + exit 0 + ;; + *) ;; + esac + fi +fi + +echo "sbuild ${SBUILD_OPTS[@]} $DEB_DSC" +sbuild "${SBUILD_OPTS[@]}" "$DEB_DSC" + +# vi:sts=4:sw=4:noet:foldmethod=marker -- 2.1.4
signature.asc
Description: Digital signature