Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Completion for sbuild



Hello Daniel,

On 8/23/19 6:40 AM, Daniel Shahaf wrote:
> Baptiste BEAUPLAT wrote on Thu, Aug 22, 2019 at 21:53:14 +0200:
>> Don't hesitate to give me feedback, I'd be glade to improve it.
> 
> I've done a partial review and found some minor issues.  I also have
> some suggested additions; those are nice to haves, not blockers, of
> course.

First of all, let me apologize for the overdue response. I got somewhat
overwhelm by the technicality of certain aspect of zsh's completion system.

Thanks a lot for taking the time to review this patch, that greatly
appreciated. I'll try to fix as much as I can do.

>> _deb_distributions() {
> 
> There's already Completion/Debian/Type/_deb_codenames.  Please use it
> (and improve it if needed).

Fixed. I've added unstable to that list.

>> _get_identity() {
>>     [ -n "${DEBFULLNAME}" -a -n "${DEBEMAIL}" ] && \
>>         compadd "$@" "${DEBFULLNAME} <${DEBEMAIL}>"
> 
> Please add an end-of-options guard:
> .
>     compadd "$@" -- …
> .
> Please also fix the other instances of this issue in the patch.

Fixed.

> Please use «_wanted» to allow filtering by tags.
> 
> I know it's annoying, but it's allowed to do:
> .
>     unset DEBFULLNAME
>     DEBEMAIL="J Random <jrandom@xxxxxxxxxx>"
> .
> Could you support this?

Fixed. Although, I did not use _wanted due to a lack of understanding of
how it worked.

> Please use «[[» instead of «[»: the former is a reserved word, the
> latter a builtin.  (No effect in this case, but more for a consistent
> coding style.)

Fixed.

>> }
>>
>> _get_gpg_key() {
>>     compadd "$@" $(gpg -K --with-colons 2> /dev/null | grep '^uid:u:' |
>>                    grep -o -e '<[^>]*>' | tr -d '<>')
> 
> Example output:
> 
> [[[
> % GNUPGHOME=$PWD gpg -K --with-colons
> sec:u:3072:1:A1EA95DE874DB2D5:1566533599:1629605599::u:::scESC:::+::::
> fpr:::::::::D1ADEF874C12D90BFB1062E0A1EA95DE874DB2D5:
> grp:::::::::835F9949A6E28D3B70696867F064CBFF5DEBF50B:
> uid:u::::1566533599::A06E327EA7388C18E4740E350ED4E60F2E04FC41::foobar:
> ssb:u:3072:1:7CF9BDFD879FC134:1566533599:1629605599:::::e:::+:::
> fpr:::::::::876684635455EB5CC21751587CF9BDFD879FC134:
> grp:::::::::CD7D8D5F91E21EE5ADA28CADF7A17233F028C1FC:
> ]]]
> 
> A couple of issues here:
> 
> - Please use _call_program, to make the path to gpg configurable by
>   zstyle.
> 
> - It would be nice to use builtins and parameter expansions instead of
>   greps, for performance on Cygwin.  (Yes, I know this completion is
>   for sbuild, but someone might do «ssh foo sbuild <TAB>».)  For
>   example:
> 
>   local -a lines=( ${(f)"$(_call_program …)"} )
>   lines=( ${(M)lines:#(#s)uid:u:*}
> 
>   and then split each element by colons to get the right field.  (You
>   need to do that anyway for two reasons: (1) because the uid line
>   needn't contain angle brackets; (2) for forwards compatibility with
>   future versions of gpg.)
>   
>   By the way, consider using _describe.  If you use the "Name <Email>
>   (Comment)" as the completion, you can add the keyid as the
>   description, and vice-versa.

Fixed. I didn't used _describe as the email address is pretty self
describing IMHO.

> 
>> }
>>
>> _sbuild() {
>>         '--add-depends=[add dependencies to source package]:depends' \
> 
> The part after the colon should say something like "source package
> name" or "source package names, comma separated".  It's actually
> displayed during completion if you have the «format» style set (e.g.,
> «zstyle ':completion:*:(messages|descriptions)' format '> Completing %d»).

I switched to 'packages' as that's what the expected value is.

> I ran out of time here so haven't reviewed the rest of this function,
> sorry.
> 
>>         '*:dsc file:_files -g "*.dsc"'
>> }
>>
>> _sbuild "$@"

Thanks again!

Beside your comments, I also:

- renamed the internal functions to use _sbuild as a prefix in order to
avoid name collision.
- re-indended the file to 2 space to match with existing completions files.

I'll try my best to be more reactive to the next comments.

Best,

-- 
Baptiste BEAUPLAT - lyknode


From 990037ad0bce3e8fbf9e3a59aff845caec0602e8 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <bbeauplat@xxxxxxxxxxx>
Date: Fri, 23 Aug 2019 09:06:03 +0200
Subject: [PATCH 1/7] _sbuild: safe use of compadd

---
 Completion/Debian/Command/_sbuild | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index 86a4e60b6..401c6e244 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -12,17 +12,17 @@ _deb_distributions() {
                  cut -d ',' -f 3))
     fi
 
-    compadd "$@" "${suite[@]}" unstable experimental
+    compadd "$@" -- "${suite[@]}" unstable experimental
 }
 
 _get_identity() {
     [ -n "${DEBFULLNAME}" -a -n "${DEBEMAIL}" ] && \
-        compadd "$@" "${DEBFULLNAME} <${DEBEMAIL}>"
+        compadd "$@" -- "${DEBFULLNAME} <${DEBEMAIL}>"
 }
 
 _get_gpg_key() {
-    compadd "$@" $(gpg -K --with-colons 2> /dev/null | grep '^uid:u:' |
-                   grep -o -e '<[^>]*>' | tr -d '<>')
+    compadd "$@" -- $(gpg -K --with-colons 2> /dev/null | grep '^uid:u:' |
+                      grep -o -e '<[^>]*>' | tr -d '<>')
 }
 
 _sbuild() {
-- 
2.24.0

From 142f4c4d73f76f45c4c95933a6f6fcacceaa6db7 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <bbeauplat@xxxxxxxxxxx>
Date: Fri, 23 Aug 2019 09:12:55 +0200
Subject: [PATCH 2/7] _sbuild: support DEBEMAIL on its own

---
 Completion/Debian/Command/_sbuild | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index 401c6e244..0296c7a94 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -16,8 +16,17 @@ _deb_distributions() {
 }
 
 _get_identity() {
-    [ -n "${DEBFULLNAME}" -a -n "${DEBEMAIL}" ] && \
-        compadd "$@" -- "${DEBFULLNAME} <${DEBEMAIL}>"
+    local identity
+
+    if [[ -n "${DEBEMAIL}" ]]; then
+        if [[ -n "${DEBFULLNAME}" ]]; then
+            identity = "${DEBFULLNAME} <${DEBEMAIL}>"
+        else
+            identity = "${DEBEMAIL}"
+        fi
+
+        compadd "$@" -- "${identity}"
+    fi
 }
 
 _get_gpg_key() {
-- 
2.24.0

From f268d3be445fa0ffe68b2b1edb58946dad3d4493 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <lyknode@xxxxxxxx>
Date: Fri, 23 Aug 2019 19:36:26 +0200
Subject: [PATCH 3/7] Use parameter subtitution to get email from gpg uid

---
 Completion/Debian/Command/_sbuild | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index 0296c7a94..5796ed827 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -30,8 +30,16 @@ _get_identity() {
 }
 
 _get_gpg_key() {
-    compadd "$@" -- $(gpg -K --with-colons 2> /dev/null | grep '^uid:u:' |
-                      grep -o -e '<[^>]*>' | tr -d '<>')
+    local -a lines uids
+    local line
+
+    lines=(${(M)${(f)"$(_call_program gpg gpg -K --with-colons 2> /dev/null)"}:#uid:u*})
+
+    for line in "${lines[@]}"; do
+        uids+=("${${(s.:.)line}[5][(ws:<:)2,(ws:>:)1]}")
+    done
+
+    compadd "$@" -- "${uids[@]}"
 }
 
 _sbuild() {
-- 
2.24.0

From 910e531c71c2a57504f0c1dc0113d8ae13cee7c5 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <lyknode@xxxxxxxx>
Date: Tue, 10 Dec 2019 10:39:39 +0100
Subject: [PATCH 4/7] Use _deb_codenames to fetch distribution list in _sbuild

---
 Completion/Debian/Command/_sbuild | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index 5796ed827..469fe5336 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -1,18 +1,8 @@
 #compdef sbuild
 
 _deb_distributions() {
-    local suite stable
-    suite=""
-
-    # Get stable, oldstable and oldoldstable
-    if [ -f /usr/share/distro-info/debian.csv ]; then
-        stable="$(grep -E '^[^,]*(,[^,]*){4}$' /usr/share/distro-info/debian.csv |
-                  tail -n 1 | cut -d ',' -f 3)"
-        suite=($(grep -B 2 -F ",${stable}," /usr/share/distro-info/debian.csv |
-                 cut -d ',' -f 3))
-    fi
-
-    compadd "$@" -- "${suite[@]}" unstable experimental
+    _deb_codenames
+    compadd "$@" -- unstable
 }
 
 _get_identity() {
-- 
2.24.0

From 1d552d2b860545337b0bd8e5cfe254acbd756a82 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <lyknode@xxxxxxxx>
Date: Tue, 10 Dec 2019 10:45:25 +0100
Subject: [PATCH 5/7] Reindent _sbuild with 2 spaces

---
 Completion/Debian/Command/_sbuild | 243 +++++++++++++++---------------
 1 file changed, 121 insertions(+), 122 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index 469fe5336..23a88e907 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -1,141 +1,140 @@
 #compdef sbuild
 
 _deb_distributions() {
-    _deb_codenames
-    compadd "$@" -- unstable
+  _deb_codenames
+  compadd "$@" -- unstable
 }
 
 _get_identity() {
-    local identity
+  local identity
 
-    if [[ -n "${DEBEMAIL}" ]]; then
-        if [[ -n "${DEBFULLNAME}" ]]; then
-            identity = "${DEBFULLNAME} <${DEBEMAIL}>"
-        else
-            identity = "${DEBEMAIL}"
-        fi
-
-        compadd "$@" -- "${identity}"
+  if [[ -n "${DEBEMAIL}" ]]; then
+    if [[ -n "${DEBFULLNAME}" ]]; then
+      identity = "${DEBFULLNAME} <${DEBEMAIL}>"
+    else
+      identity = "${DEBEMAIL}"
     fi
+    compadd "$@" -- "${identity}"
+  fi
 }
 
 _get_gpg_key() {
-    local -a lines uids
-    local line
+  local -a lines uids
+  local line
 
-    lines=(${(M)${(f)"$(_call_program gpg gpg -K --with-colons 2> /dev/null)"}:#uid:u*})
+  lines=(${(M)${(f)"$(_call_program gpg gpg -K --with-colons 2> /dev/null)"}:#uid:u*})
 
-    for line in "${lines[@]}"; do
-        uids+=("${${(s.:.)line}[5][(ws:<:)2,(ws:>:)1]}")
-    done
+  for line in "${lines[@]}"; do
+    uids+=("${${(s.:.)line}[5][(ws:<:)2,(ws:>:)1]}")
+  done
 
-    compadd "$@" -- "${uids[@]}"
+  compadd "$@" -- "${uids[@]}"
 }
 
 _sbuild() {
-    _arguments \
-        '(-h --help)'{-h,--help}'[show help message]' \
-        '(-V --version)'{-V,--version}'[show version information]' \
-        '(-D --debug)'{-D,--debug}'[enable debug output]' \
-        '--add-depends=[add dependencies to source package]:depends' \
-        '--add-conflicts=[add conflicts to source package]:conflicts' \
-        '--add-depends-arch=[add arch dependencies to source package]:depends' \
-        '--add-conflicts-arch=[add arch conflicts to source package]:conflicts' \
-        '--add-depends-indep=[add indep dependencies to source package]:depends' \
-        '--add-conflicts-indep=[add indep conflicts to source package]:conflicts' \
-        '--arch=[architecture]:architecture:_deb_architectures' \
-        '--host=[host architecture]:architecture:_deb_architectures' \
-        '--build=[build architecture]:architecture:_deb_architectures' \
-        '(-A --arch-all --no-arch-all)'{-A,--arch-all}'[build Architecture: all packages]' \
-        '(-A --arch-all --no-arch-all)--no-arch-all[do not build Architecture: all packages]' \
-        '(--arch-any --no-arch-any)--arch-any[build Architecture: any packages]' \
-        '(--arch-any --no-arch-any)--no-arch-any[do not build Architecture: any packages]' \
-        '(-b --batch)'{-b,--batch}'[operate in batchmode]' \
-        '(-c --chroot)'{-c=,--chroot=}'[chroot to use]:chroot' \
-        '(--chroot-mode)--chroot-mode=[chroot mode]:mode:(schroot sudo autopkgtest unshare)' \
-        '(-d --dist)'{-d=,--dist=}'[distribution]:distribution:_deb_distributions' \
-        '--archive=[use specified archive]' \
-        '(--apt-clean --no-apt-clean)--apt-clean[force apt-get clean]' \
-        '(--apt-clean --no-apt-clean)--no-apt-clean[do not apt-get clean]' \
-        '(--apt-upgrade --no-apt-upgrade)--apt-upgrade[force apt-get upgrade]' \
-        '(--apt-upgrade --no-apt-upgrade)--no-apt-upgrade[do not apt-get upgrade]' \
-        '(--apt-distupgrade --no-apt-distupgrade)--apt-distupgrade[force apt-get distupgrade]' \
-        '(--apt-distupgrade --no-apt-distupgrade)--no-apt-distupgrade[do not apt-get distupgrade]' \
-        '(-m --maintainer)'{-m=,--maintainer=}'[Maintainer field for .changes]:maintainer:_get_identity' \
-        '(-e --uploader)'{-e=,--uploader=}'[Uploader field for .changes]:uploader:_get_identity' \
-        '(-k --keyid)'{-k=,--keyid=}'[GPG Key to sign packages]:gpg key:_get_gpg_key' \
-        '(-j --jobs)'{-j=,--jobs=}'[jobs to run simultaneously]:number of jobs' \
-        '--debbuildopt=[option to dpkg-buildpackage]:option' \
-        '--debbuildopts=[options to dpkg-buildpackage]:options' \
-        '--dpkg-source-opt=[option to dpkg-source]:option' \
-        '--dpkg-source-opts=[options to dpkg-source]:options' \
-        '--mail-log-to=[send log to mail]:recipient:_email_addresses -c' \
-        '--mailfrom=[mail from]:sender:_email_addresses -c' \
-        '(-n --nolog)'{-n,--nolog}'[no build log file]' \
-        '--profiles=[profiles for dpkg-buildpackage]:profile list (comma separated)' \
-        '(-p --purge)'{-p=,--purge=}'[purge mode]:purge mode:(never successful always)' \
-        '--purge-build=[build purge mode]:purge mode:(never successful always)' \
-        '--purge-deps=[deps purge mode]:purge mode:(never successful always)' \
-        '--purge-session=[session purge mode]:purge mode:(never successful always)' \
-        '(-s --source --no-source)'{-s,--source}'[build source package]' \
-        '(-s --source --no-source)--no-source[do not build source package]' \
-        '--force-orig-source[force orig.tar.gz in .changes]' \
-        '--use-snapshot[use latest gcc snapshot]' \
-        '(-v --verbose)'{-v,--verbose}'[be verbose]' \
-        '(-q --quiet)'{-q,--quiet}'[be quiet]' \
-        '--make-binNMU=[create binNMU with changelog entry]:changelog entry' \
-        '--binNMU=[binNMU version]:version' \
-        '--append-to-version=[append string to version]:string' \
-        '--binNMU-timestamp=[binNMU timestamp]:timestamp' \
-        '--binNMU-changelog=[use this file as binNMU changelog]:file:_files' \
-        '--build-dir=[build directory]:directory:_files -/' \
-        '(--clean-source --no-clean-source)--clean-source[clean inside an unpacked source tree]' \
-        '(--clean-source --no-clean-source)--no-clean-source[do not clean inside an unpacked source tree]' \
-        '(--run-lintian --no-run-lintian)--run-lintian[run lintian]' \
-        '(--run-lintian --no-run-lintian)--no-run-lintian[do not run lintian]' \
-        '(--no-run-lintian --lintian-opt)--lintian-opt=[option for lintian]:option' \
-        '(--no-run-lintian --lintian-opts)--lintian-opts=[options for lintian]:options' \
-        '(--run-piuparts --no-run-piuparts)--run-piuparts[run piuparts]' \
-        '(--run-piuparts --no-run-piuparts)--no-run-piuparts[do not run piuparts]' \
-        '(--no-run-piuparts --piuparts-opt)--piuparts-opt=[option for piuparts]:option' \
-        '(--no-run-piuparts --piuparts-opts)--piuparts-opts=[options for piuparts]:options' \
-        '(--no-run-piuparts --piuparts-root-arg)--piuparts-root-arg=[root-argion for piuparts]:argument' \
-        '(--no-run-piuparts --piuparts-root-args)--piuparts-root-args=[root-argions for piuparts]:arguments' \
-        '(--run-autopkgtest --no-run-autopkgtest)--run-autopkgtest[run autopkgtest]' \
-        '(--run-autopkgtest --no-run-autopkgtest)--no-run-autopkgtest[do not run autopkgtest]' \
-        '(--no-run-autopkgtest --autopkgtest-opt)--autopkgtest-opt=[option for autopkgtest]:option' \
-        '(--no-run-autopkgtest --autopkgtest-opts)--autopkgtest-opts=[options for autopkgtest]:options' \
-        '(--no-run-autopkgtest --autopkgtest-root-arg)--autopkgtest-root-arg=[root-argion for autopkgtest]:argument' \
-        '(--no-run-autopkgtest --autopkgtest-root-args)--autopkgtest-root-args=[root-argions for autopkgtest]:arguments' \
-        '--pre-build-commands=[run commands before starting anything]:commands' \
-        '--chroot-setup-commands=[run commands after chroot initialization]:commands' \
-        '--chroot-update-failed-commands=[run commands after chroot update fails]:commands' \
-        '--build-deps-failed-commands=[run commands after installing build deps fails]:commands' \
-        '--starting-build-commands=[run commands after dependencies are installed]:commands' \
-        '--finished-build-commands=[run commands after package is built]:commands' \
-        '--build-failed-commands=[run commands after dpkg-buildpackage fails]:commands' \
-        '--chroot-cleanup-commands=[run commands after chroot cleanup]:commands' \
-        '--post-build-commands=[run commands after package is build sucessfuly]:commands' \
-        '--post-build-failed-commands[run commands after package failed to build]:commands' \
-        '--anything-failed-commands=[run commands for all --xxx-failed-commands option]:commands' \
-        '--log-external-command-output[external commands output are logged]' \
-        '--log-external-command-error[external commands error output are logged]' \
-        '--build-dep-resolver=[resolver for build dependency]:resolver:(apt aptitude aspcud xapt null)' \
-        '--aspcud-criteria=[Optimization for aspcud]:criteria' \
-        '(--resolve-alternatives --no-resolve-alternatives)--resolve-alternatives[allow alternatives in Build-Depends*]' \
-        '(--resolve-alternatives --no-resolve-alternatives)--no-resolve-alternatives[disallow alternatives in Build-Depends*]' \
-        '--extra-package=[make a package or directory available to the resolver]:package:_files -g "*deb' \
-        '--extra-repository=[add a repository to the resolver]:url' \
-        '--extra-repository-key=[add key to the resolver]:key:_files -g "*.asc"' \
-        '--build-path=[place to build the package inside chroot]:path:_files -/' \
-        '--autopkgtest-virt-server=[autopkgtest virtualization server]:type:(schroot lxc chroot qemu ssh)' \
-        '--autopkgtest-virt-server-opt=[option for autopkgtest virtialization server]:option' \
-        '--autopkgtest-virt-server-opts=[options for autopkgtest virtialization server]:options' \
-        '--sbuild-mode=[switch to buildd mode]:mode:(user buildd)' \
-        '--stats-dir=[write stats to directory]:path:_files -/' \
-        '--purge-extra-packages[remove all but strictly required dependencies (experimental)]' \
-        '--bd-uninstallable-explainer=[choose the method to explain why dependencies failed]:method:(dose3 apt)' \
-        '*:dsc file:_files -g "*.dsc"'
-}
+  _arguments \
+    '(-h --help)'{-h,--help}'[show help message]' \
+    '(-V --version)'{-V,--version}'[show version information]' \
+    '(-D --debug)'{-D,--debug}'[enable debug output]' \
+    '--add-depends=[add dependencies to source package]:depends' \
+    '--add-conflicts=[add conflicts to source package]:conflicts' \
+    '--add-depends-arch=[add arch dependencies to source package]:depends' \
+    '--add-conflicts-arch=[add arch conflicts to source package]:conflicts' \
+    '--add-depends-indep=[add indep dependencies to source package]:depends' \
+    '--add-conflicts-indep=[add indep conflicts to source package]:conflicts' \
+    '--arch=[architecture]:architecture:_deb_architectures' \
+    '--host=[host architecture]:architecture:_deb_architectures' \
+    '--build=[build architecture]:architecture:_deb_architectures' \
+    '(-A --arch-all --no-arch-all)'{-A,--arch-all}'[build Architecture: all packages]' \
+    '(-A --arch-all --no-arch-all)--no-arch-all[do not build Architecture: all packages]' \
+    '(--arch-any --no-arch-any)--arch-any[build Architecture: any packages]' \
+    '(--arch-any --no-arch-any)--no-arch-any[do not build Architecture: any packages]' \
+    '(-b --batch)'{-b,--batch}'[operate in batchmode]' \
+    '(-c --chroot)'{-c=,--chroot=}'[chroot to use]:chroot' \
+    '(--chroot-mode)--chroot-mode=[chroot mode]:mode:(schroot sudo autopkgtest unshare)' \
+    '(-d --dist)'{-d=,--dist=}'[distribution]:distribution:_deb_distributions' \
+    '--archive=[use specified archive]' \
+    '(--apt-clean --no-apt-clean)--apt-clean[force apt-get clean]' \
+    '(--apt-clean --no-apt-clean)--no-apt-clean[do not apt-get clean]' \
+    '(--apt-upgrade --no-apt-upgrade)--apt-upgrade[force apt-get upgrade]' \
+    '(--apt-upgrade --no-apt-upgrade)--no-apt-upgrade[do not apt-get upgrade]' \
+    '(--apt-distupgrade --no-apt-distupgrade)--apt-distupgrade[force apt-get distupgrade]' \
+    '(--apt-distupgrade --no-apt-distupgrade)--no-apt-distupgrade[do not apt-get distupgrade]' \
+    '(-m --maintainer)'{-m=,--maintainer=}'[Maintainer field for .changes]:maintainer:_get_identity' \
+    '(-e --uploader)'{-e=,--uploader=}'[Uploader field for .changes]:uploader:_get_identity' \
+    '(-k --keyid)'{-k=,--keyid=}'[GPG Key to sign packages]:gpg key:_get_gpg_key' \
+    '(-j --jobs)'{-j=,--jobs=}'[jobs to run simultaneously]:number of jobs' \
+    '--debbuildopt=[option to dpkg-buildpackage]:option' \
+    '--debbuildopts=[options to dpkg-buildpackage]:options' \
+    '--dpkg-source-opt=[option to dpkg-source]:option' \
+    '--dpkg-source-opts=[options to dpkg-source]:options' \
+    '--mail-log-to=[send log to mail]:recipient:_email_addresses -c' \
+    '--mailfrom=[mail from]:sender:_email_addresses -c' \
+    '(-n --nolog)'{-n,--nolog}'[no build log file]' \
+    '--profiles=[profiles for dpkg-buildpackage]:profile list (comma separated)' \
+    '(-p --purge)'{-p=,--purge=}'[purge mode]:purge mode:(never successful always)' \
+    '--purge-build=[build purge mode]:purge mode:(never successful always)' \
+    '--purge-deps=[deps purge mode]:purge mode:(never successful always)' \
+    '--purge-session=[session purge mode]:purge mode:(never successful always)' \
+    '(-s --source --no-source)'{-s,--source}'[build source package]' \
+    '(-s --source --no-source)--no-source[do not build source package]' \
+    '--force-orig-source[force orig.tar.gz in .changes]' \
+    '--use-snapshot[use latest gcc snapshot]' \
+    '(-v --verbose)'{-v,--verbose}'[be verbose]' \
+    '(-q --quiet)'{-q,--quiet}'[be quiet]' \
+    '--make-binNMU=[create binNMU with changelog entry]:changelog entry' \
+    '--binNMU=[binNMU version]:version' \
+    '--append-to-version=[append string to version]:string' \
+    '--binNMU-timestamp=[binNMU timestamp]:timestamp' \
+    '--binNMU-changelog=[use this file as binNMU changelog]:file:_files' \
+    '--build-dir=[build directory]:directory:_files -/' \
+    '(--clean-source --no-clean-source)--clean-source[clean inside an unpacked source tree]' \
+    '(--clean-source --no-clean-source)--no-clean-source[do not clean inside an unpacked source tree]' \
+    '(--run-lintian --no-run-lintian)--run-lintian[run lintian]' \
+    '(--run-lintian --no-run-lintian)--no-run-lintian[do not run lintian]' \
+    '(--no-run-lintian --lintian-opt)--lintian-opt=[option for lintian]:option' \
+    '(--no-run-lintian --lintian-opts)--lintian-opts=[options for lintian]:options' \
+    '(--run-piuparts --no-run-piuparts)--run-piuparts[run piuparts]' \
+    '(--run-piuparts --no-run-piuparts)--no-run-piuparts[do not run piuparts]' \
+    '(--no-run-piuparts --piuparts-opt)--piuparts-opt=[option for piuparts]:option' \
+    '(--no-run-piuparts --piuparts-opts)--piuparts-opts=[options for piuparts]:options' \
+    '(--no-run-piuparts --piuparts-root-arg)--piuparts-root-arg=[root-argion for piuparts]:argument' \
+    '(--no-run-piuparts --piuparts-root-args)--piuparts-root-args=[root-argions for piuparts]:arguments' \
+    '(--run-autopkgtest --no-run-autopkgtest)--run-autopkgtest[run autopkgtest]' \
+    '(--run-autopkgtest --no-run-autopkgtest)--no-run-autopkgtest[do not run autopkgtest]' \
+    '(--no-run-autopkgtest --autopkgtest-opt)--autopkgtest-opt=[option for autopkgtest]:option' \
+    '(--no-run-autopkgtest --autopkgtest-opts)--autopkgtest-opts=[options for autopkgtest]:options' \
+    '(--no-run-autopkgtest --autopkgtest-root-arg)--autopkgtest-root-arg=[root-argion for autopkgtest]:argument' \
+    '(--no-run-autopkgtest --autopkgtest-root-args)--autopkgtest-root-args=[root-argions for autopkgtest]:arguments' \
+    '--pre-build-commands=[run commands before starting anything]:commands' \
+    '--chroot-setup-commands=[run commands after chroot initialization]:commands' \
+    '--chroot-update-failed-commands=[run commands after chroot update fails]:commands' \
+    '--build-deps-failed-commands=[run commands after installing build deps fails]:commands' \
+    '--starting-build-commands=[run commands after dependencies are installed]:commands' \
+    '--finished-build-commands=[run commands after package is built]:commands' \
+    '--build-failed-commands=[run commands after dpkg-buildpackage fails]:commands' \
+    '--chroot-cleanup-commands=[run commands after chroot cleanup]:commands' \
+    '--post-build-commands=[run commands after package is build sucessfuly]:commands' \
+    '--post-build-failed-commands[run commands after package failed to build]:commands' \
+    '--anything-failed-commands=[run commands for all --xxx-failed-commands option]:commands' \
+    '--log-external-command-output[external commands output are logged]' \
+    '--log-external-command-error[external commands error output are logged]' \
+    '--build-dep-resolver=[resolver for build dependency]:resolver:(apt aptitude aspcud xapt null)' \
+    '--aspcud-criteria=[Optimization for aspcud]:criteria' \
+    '(--resolve-alternatives --no-resolve-alternatives)--resolve-alternatives[allow alternatives in Build-Depends*]' \
+    '(--resolve-alternatives --no-resolve-alternatives)--no-resolve-alternatives[disallow alternatives in Build-Depends*]' \
+    '--extra-package=[make a package or directory available to the resolver]:package:_files -g "*deb' \
+    '--extra-repository=[add a repository to the resolver]:url' \
+    '--extra-repository-key=[add key to the resolver]:key:_files -g "*.asc"' \
+    '--build-path=[place to build the package inside chroot]:path:_files -/' \
+    '--autopkgtest-virt-server=[autopkgtest virtualization server]:type:(schroot lxc chroot qemu ssh)' \
+    '--autopkgtest-virt-server-opt=[option for autopkgtest virtialization server]:option' \
+    '--autopkgtest-virt-server-opts=[options for autopkgtest virtialization server]:options' \
+    '--sbuild-mode=[switch to buildd mode]:mode:(user buildd)' \
+    '--stats-dir=[write stats to directory]:path:_files -/' \
+    '--purge-extra-packages[remove all but strictly required dependencies (experimental)]' \
+    '--bd-uninstallable-explainer=[choose the method to explain why dependencies failed]:method:(dose3 apt)' \
+    '*:dsc file:_files -g "*.dsc"'
+  }
 
 _sbuild "$@"
-- 
2.24.0

From 134bb906da20344e15b5d7935751e8e9f2d82f57 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <lyknode@xxxxxxxx>
Date: Tue, 10 Dec 2019 10:50:03 +0100
Subject: [PATCH 6/7] Rename _sbuild internal functions to avoid overlap

---
 Completion/Debian/Command/_sbuild | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index 23a88e907..cc1df0f4c 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -1,11 +1,11 @@
 #compdef sbuild
 
-_deb_distributions() {
+_sbuild_distributions() {
   _deb_codenames
   compadd "$@" -- unstable
 }
 
-_get_identity() {
+_deb_identity() {
   local identity
 
   if [[ -n "${DEBEMAIL}" ]]; then
@@ -18,7 +18,7 @@ _get_identity() {
   fi
 }
 
-_get_gpg_key() {
+_sbuild_signing_key() {
   local -a lines uids
   local line
 
@@ -52,7 +52,7 @@ _sbuild() {
     '(-b --batch)'{-b,--batch}'[operate in batchmode]' \
     '(-c --chroot)'{-c=,--chroot=}'[chroot to use]:chroot' \
     '(--chroot-mode)--chroot-mode=[chroot mode]:mode:(schroot sudo autopkgtest unshare)' \
-    '(-d --dist)'{-d=,--dist=}'[distribution]:distribution:_deb_distributions' \
+    '(-d --dist)'{-d=,--dist=}'[distribution]:distribution:_sbuild_distributions' \
     '--archive=[use specified archive]' \
     '(--apt-clean --no-apt-clean)--apt-clean[force apt-get clean]' \
     '(--apt-clean --no-apt-clean)--no-apt-clean[do not apt-get clean]' \
@@ -60,9 +60,9 @@ _sbuild() {
     '(--apt-upgrade --no-apt-upgrade)--no-apt-upgrade[do not apt-get upgrade]' \
     '(--apt-distupgrade --no-apt-distupgrade)--apt-distupgrade[force apt-get distupgrade]' \
     '(--apt-distupgrade --no-apt-distupgrade)--no-apt-distupgrade[do not apt-get distupgrade]' \
-    '(-m --maintainer)'{-m=,--maintainer=}'[Maintainer field for .changes]:maintainer:_get_identity' \
-    '(-e --uploader)'{-e=,--uploader=}'[Uploader field for .changes]:uploader:_get_identity' \
-    '(-k --keyid)'{-k=,--keyid=}'[GPG Key to sign packages]:gpg key:_get_gpg_key' \
+    '(-m --maintainer)'{-m=,--maintainer=}'[Maintainer field for .changes]:maintainer:_deb_identity' \
+    '(-e --uploader)'{-e=,--uploader=}'[Uploader field for .changes]:uploader:_deb_identity' \
+    '(-k --keyid)'{-k=,--keyid=}'[GPG Key to sign packages]:gpg key:_sbuild_signing_key' \
     '(-j --jobs)'{-j=,--jobs=}'[jobs to run simultaneously]:number of jobs' \
     '--debbuildopt=[option to dpkg-buildpackage]:option' \
     '--debbuildopts=[options to dpkg-buildpackage]:options' \
-- 
2.24.0

From e4702dcf213de6cd2306d7ef7e30f2d55eb5bc29 Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <lyknode@xxxxxxxx>
Date: Tue, 10 Dec 2019 11:02:56 +0100
Subject: [PATCH 7/7] Make message completion more accurate for _sbuild

---
 Completion/Debian/Command/_sbuild | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Completion/Debian/Command/_sbuild b/Completion/Debian/Command/_sbuild
index cc1df0f4c..05f97ef14 100644
--- a/Completion/Debian/Command/_sbuild
+++ b/Completion/Debian/Command/_sbuild
@@ -36,12 +36,12 @@ _sbuild() {
     '(-h --help)'{-h,--help}'[show help message]' \
     '(-V --version)'{-V,--version}'[show version information]' \
     '(-D --debug)'{-D,--debug}'[enable debug output]' \
-    '--add-depends=[add dependencies to source package]:depends' \
-    '--add-conflicts=[add conflicts to source package]:conflicts' \
-    '--add-depends-arch=[add arch dependencies to source package]:depends' \
-    '--add-conflicts-arch=[add arch conflicts to source package]:conflicts' \
-    '--add-depends-indep=[add indep dependencies to source package]:depends' \
-    '--add-conflicts-indep=[add indep conflicts to source package]:conflicts' \
+    '--add-depends=[add dependencies to source package]:packages' \
+    '--add-conflicts=[add conflicts to source package]:packages' \
+    '--add-depends-arch=[add arch dependencies to source package]:packages' \
+    '--add-conflicts-arch=[add arch conflicts to source package]:packages' \
+    '--add-depends-indep=[add indep dependencies to source package]:packages' \
+    '--add-conflicts-indep=[add indep conflicts to source package]:packages' \
     '--arch=[architecture]:architecture:_deb_architectures' \
     '--host=[host architecture]:architecture:_deb_architectures' \
     '--build=[build architecture]:architecture:_deb_architectures' \
-- 
2.24.0

Attachment: signature.asc
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author