Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] _bsd_pkg update
- X-seq: zsh-workers 42114
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [patch] _bsd_pkg update
- Date: Mon, 11 Dec 2017 23:47:10 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=bC/ArkybwziF6Q7N0HhB05gq4n/d+4JPt+BZVNz8mL8=; b=LBFFjYuYPfrDdnqNrS3K56nqDeST8nMYyVvrQicNHTklwKJzIfD6Y2NsiYlwXiISGQ VuleiWnDHcci4dVi+vyl8SbgguoAlD/ppu6JvgXrPlKtUK/fcqHpahH7HkoR7e8Z0adp uXIAMm9bRxB95nQpzhh8kU9xC62YinI+jxMKFxcZyywXCtApRxeUo8H7JwSu0N5HXZwl 7IwA0RonIN1HgouR1p1nQUfBnkVp8DdLGEk8IoPTBJRACavxsWRhfmtVIn+7jnlFtpu9 fqjHjjEEpzGQjq/1lfL5GbAUxCEo+WlFEZCb/VN3XwSzvAo0Hc/cKUIzkEKDaQiaUmai CW2A==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
FreeBSD has moved away from pkg_* tooling, so the FreeBSD bits have been
removed. There is still an XXX for OpenBSD's pkg_info -K which should
only be offered with -L. Also fix some tabs while here.
I did check that the PORTSDIR and PACKAGE_REPOSITORY settings in
/etc/mk.conf override the environment variable not the other way around.
Added _{f,n,o}bsd_architectures types. Still not clear on what is
required for types, so that's mostly cargo culted. _fbsd isn't used in
this patch, but it seemed odd to have _obsd and _nbsd without completing
the three.
- Matthew Martin
diff --git a/Completion/BSD/Command/_bsd_pkg b/Completion/BSD/Command/_bsd_pkg
index 9f4b0f11a..d8928afaf 100644
--- a/Completion/BSD/Command/_bsd_pkg
+++ b/Completion/BSD/Command/_bsd_pkg
@@ -7,14 +7,20 @@ _bsd_pkg_pkgfiles() {
case $OSTYPE in
netbsd*)
portsdir=/usr/pkgsrc
+ pkgsdir=${PACKAGES:-$portsdir/packages}/All
+ ;;
+ openbsd*)
+ portsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PORTSDIR*}#*=[[:blank:]]#}
+ portsdir=${${portsdir:-$PORTSDIR}:-/usr/ports}
+ pkgsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PACKAGE_REPOSITORY*}#*=[[:blank:]]#}
+ pkgsdir=${${pkgsdir:-$PACKAGE_REPOSITORY}:-$portsdir/packages/}/$(make -V MACHINE_ARCH)/All
;;
*)
portsdir=${PORTSDIR:-/usr/ports}
+ pkgsdir=${PACKAGES:-$portsdir/packages}/All
;;
esac
- pkgsdir=${PACKAGES:-$portsdir/packages}/All
-
paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
_files "$@" -g '*.t[bg]z(-.)' && ret=0
(( $#path )) && _files "$@" -W paths -g '*.t[bg]z(-.)' && ret=0
@@ -47,171 +53,197 @@ _bsd_pkg() {
case "$service" in
pkg_add)
flags=(
- '-f[force installation]'
- '-I[don'\''t execute installation scripts]'
- '-M[run in master mode]'
- '-n[don'\''t really install packages]'
- '-p[specify prefix]:prefix directory:_files -/'
- '-R[don'\''t record]'
- '-S[run in slave mode]'
- '-t[specify mktemp template]:mktemp template:_files -/'
+ "-n[don't really install packages]"
'-v[be verbose]'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '-r[fetch from remote site]'
- )
- ;;
netbsd*)
- flags=(
- $flags[@]
- '-u[update]'
- '-V[show version and exit]'
+ flags+=(
+ '-A[do not record packages as installed manually]'
+ '-C[specify configuration file]:config file:_files'
+ '-D[force updating even if dependencies are not satisfied]'
+ '-f[force installation]'
+ "-I[don't execute installation scripts]"
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-m[specify machine architecture]:architecture:_netbsd_architectures'
+ '-P[specify destdir prefix]:destdir directory:_files -/'
+ '-p[specify prefix]:prefix directory:_files -/'
+ "-R[don't record]"
+ '-U[replace an already installed version]'
+ '-u[update]'
+ '-V[show version and exit]'
+ '*:package to install:_bsd_pkg_pkgfiles'
)
;;
+ openbsd*)
+ flags+=(
+ '-A[arch to assume for any package tests]:architecture:_obsd_architectures'
+ '-a[do not record packages as installed manually]'
+ '-aa[force already installed packages to be tagged as installed automatically]'
+ '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-c[while replacing packages, delete extra configuration file in the old package]'
+ '-D[specify failsafe to waive]:failsafe:((
+ allversions\:"do not trim older p* variants of packages for updates"
+ arch\:"architecture recorded in package may not match"
+ checksum\:"verify checksums before deleting or tying old files"
+ dontmerge\:"do not merge updates together if dependencies are too strict"
+ donttie\:"do not try to find new files in old packages by comparing the stored sha256"
+ downgrade\:"do not filter out package versions older than what is currently installed"
+ installed\:"in update mode, reinstall an existing package with the same update signature"
+ libdepends\:"library specifications may not be fulfilled"
+ nonroot\:"install even if not running as root"
+ paranoid\:"do not run any @exec/@unexec"
+ repair\:"attempt to repair installed packages with missing registration data"
+ scripts\:"external scripts may fail"
+ SIGNER\:"list of trusted signers, separated by commas"
+ snap\:"force %c and %m to expand to snapshots"
+ unsigned\:"allow the installation of unsigned packages without warnings/errors"
+ updatedepends\:"force update even if forward dependencies no longer match"
+ ))'
+ '-I[force non-interactive mode]'
+ '-i[force interactive mode]'
+ '-L[specify a localbase]:localbase:_files -/'
+ '-l[specify pkg_info output file to install]:pkg_info file:_files'
+ '-m[always display progress meter]'
+ '-P[check distribution permissions]:permission type:(cdrom ftp)'
+ "-qq[don't check checksums]"
+ '-r[replace existing packages]'
+ "-s[don't install; just report disk size changes]"
+ '-U[update dependencies before installing]'
+ '-u[update the specified package or all if none given]'
+ '-V[turn on statistics output]'
+ '-x[disable progress meter]'
+ '-z[fuzzy package matching]'
+ )
esac
- _arguments -s \
- $flags[@] \
- '*:package to install:_bsd_pkg_pkgfiles'
+ _arguments -s $flags[@]
;;
pkg_create)
case "$OSTYPE" in
- freebsd*)
- flags=(
- '-f[specify plist file]:plist file:_files'
- '(-b)-c[specify comment file]:comment file:_files'
- '(-b)-d[specify descr file]:descr file:_files'
- '-Y[assume YES for any questions asked]'
- '-N[assume NO for any questions asked]'
- '(-b)-O[packing list only mode]'
- '-v[be verbose]'
- '-h[force tar to follow symlinks]'
- '(-b)-i[specify pre-install script]:pre-install script:_files'
- '(-b)-I[specify post-install script]:post-install script:_files'
- '(-b)-P[specify initial dependencies]:dependencies:_bsd_pkg_pkgs'
- '(-b)-p[specify prefix]:prefix directory:_files -/'
- '(-b)-k[specify deinstall script]:deinstall script:_files'
- '(-b)-K[specify post-deinstall script]:post-deinstall script:_files'
- '(-b)-r[specify req script]:req script:_files'
- '(-b)-s[specify source directory]:source directory:_files -/'
- '(-b)-t[specify mktemp template]:mktemp template:_files'
- '(-b)-X[specify exclude file]:exclude file for tar:_files'
- '(-b)-D[specify message file]:message file:_files'
- '(-b)-m[specify mtree file]:mtree file:_files'
- '(-b)-o[specify origin]:origin:_files -W ${PORTSDIR\:-/usr/ports} -/'
- '-j[use bzip2]'
- '-z[use gzip]'
- '(-c -d -O -i -I -P -p -k -K -r -s -t -X -D -m -o)-b[specify pkgname]:pkgname:_bsd_pkg_pkgs'
- '*:package file name:_files'
- )
- ;;
netbsd*)
# NetBSD users, improve me!
flags=(
- '*:package name:_bsd_pkg_pkgs'
+ '*:package name:_bsd_pkg_pkgs'
)
;;
esac
- _arguments -s \
- $flags[@]
- ;;
+ _arguments -s $flags[@]
+ ;;
pkg_delete)
flags=(
- '-D[don'\''t execute deinstallation scripts]'
- '-d[remove empty directories]'
- '-f[force deinstallation]'
- '-n[don'\''t really deinstall packages]'
- '-p[specify prefix]:prefix directory:_files -/'
+ "-n[don't really deinstall packages]"
'-v[be verbose]'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '(:)-a[delete all installed packages]'
- '-G[do not expand glob patterns]'
- '-i[be interactive]'
- '-r[delete recursively]'
- '-x[use regular expression]'
- )
- ;;
netbsd*)
- flags=(
- $flags[@]
- '(:)-a[delete all installed packages]'
- '-F[specify each package by an installed file]'
- '-i[be interactive]'
- '-O[only delete the package'\''s entries]'
+ flags+=(
+ '(:)-a[delete all installed packages]'
+ "-D[don't execute deinstallation scripts]"
+ '-F[specify each package by an installed file]'
+ '-f[force deinstallation]'
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ "-O[only delete the package's entries]"
+ '-P[specify destdir prefix]:destdir directory:_files -/'
+ '-p[specify prefix]:prefix directory:_files -/'
'-R[delete upward recursively]'
'-r[delete recursively]'
- '-V[show version and exit]'
+ '-V[show version and exit]'
+ '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ )
+ ;;
+ openbsd*)
+ flags+=(
+ '-a[delete unused dependencies]'
+ '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-D[specify failsafe to waive]:failsafe:((
+ baddepend\:"force deletion of packages even if they reference nonexistent dependencies"
+ checksum\:"verify checksums before deleting or tying old files"
+ dependencies\:"delete the set of packages that depend upon the requested packages"
+ nonroot\:"install even if not running as root"
+ scripts\:"external scripts may fail"
+ ))'
+ '-I[force non-interactive mode]'
+ '-i[force interactive mode]'
+ '-m[always display progress meter]'
+ "-qq[don't check checksums]"
+ "-s[don't install; just report disk size changes]"
+ '-V[turn on statistics output]'
+ '-X[delete everything, except the specified packages]'
+ '-x[disable progress meter]'
+ '*:package name:_bsd_pkg_pkgs_and_files'
)
;;
esac
- _arguments -s \
- $flags[@] \
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ _arguments -s $flags[@]
;;
pkg_info)
flags=(
'(:)-a[show all installed packages]'
'-c[show comment fields]'
- '-D[show install-message files]'
'-d[show long descriptions]'
'-e[test if package is installed]:package name:_bsd_pkg_pkgs'
'-f[show packing list instructions]'
'-I[show index lines]'
- '-i[show install scripts]'
- '-k[show deinstall scripts]'
'-L[show full pathnames of files]'
'-l[specify prefix string]:prefix string:'
- '-m[show mtree files]'
- '-p[show installation prefixes]'
'-q[be quiet]'
'-R[show list of installed requiring packages]'
- '-r[show requirements scripts]'
+ '-s[show total size occupied by each package]'
'-v[be verbose]'
+ '(-a -A)*:package name:_bsd_pkg_pkgs_and_files'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '-G[do not expand glob patterns]'
- '-g[show files that'\''s modified]'
- '-o[show origin]'
- '-s[show total size occupied by each package]'
- '-t[specify mktemp template]:mktemp template:_files -/'
- '*-W[show which package the file belongs to]:file:_files'
- '-x[use regular expression]'
+ netbsd*)
+ flags+=(
+ '-B[show build information]'
+ '-b[show RCS Id strings]'
+ '-D[show install-message files]'
+ '-F[specify each package by an installed file]'
+ '-i[show install scripts]'
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-k[show deinstall scripts]'
+ '-m[show mtree files]'
+ '-N[show which packages each package was built with]'
+ '-n[show which packages each package needs]'
+ '-p[show installation prefixes]'
+ '-Q[show the definition of the speficied variable from the build information]:variable:'
+ '-r[show list of installed requiring packages recursively]'
+ '-S[show total size occupied by each package and its dependents]'
+ '-u[show information for all user-installed packages]'
+ '-V[show version and exit]'
+ '-X[print summary information]'
)
;;
- netbsd*)
- flags=(
- $flags[@]
- '-B[show build information]'
- '-b[show RCS Id strings]'
- '-F[specify each package by an installed file]'
- '-S[show total size occupied by each package and its dependents]'
- '-s[show total size occupied by each package]'
- '-V[show version and exit]'
+ openbsd*)
+ flags+=(
+ '(:)-A[show all installed packages, including internal packages]'
+ '-C[show certificate information]'
+ '-E[show the package that contains the speficied file]:file:_files'
+ # XXX only with -L
+ '-K[prefix filenames with category keywords]'
+ '-M[show the install-message file]'
+ '-m[only show manual installations]'
+ '-P[show the pkgpath]'
+ '-Q[show packages matching the specified query]:query:'
+ '-r[check the list of packages for a specified pkgspec]:pkgspec:'
+ '-S[show the update signature]'
+ '-t[show packages not required by any other]'
+ '-U[show the deinstall-message file]'
+ '-z[fuzzy package matching]'
)
;;
esac
- _arguments -s \
- $flags[@] \
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ _arguments -s $flags[@]
;;
esac
}
diff --git a/Completion/BSD/Type/_fbsd_architectures b/Completion/BSD/Type/_fbsd_architectures
new file mode 100644
index 000000000..24bdf4620
--- /dev/null
+++ b/Completion/BSD/Type/_fbsd_architectures
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" amd64 arm arm64 i386 mips ppc sparc xbox
diff --git a/Completion/BSD/Type/_nbsd_architectures b/Completion/BSD/Type/_nbsd_architectures
new file mode 100644
index 000000000..441b874da
--- /dev/null
+++ b/Completion/BSD/Type/_nbsd_architectures
@@ -0,0 +1,11 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" amd64 evbarm evbmips evbppc hpcarm i386 sparc64 xen \
+ acorn32 algor alpha amiga amigappc arc atari bebox cats cesfic cobalt dreamcast \
+ emips epoc32 evbsh3 ews4800mips hp300 hppa hpcmips hpcsh ia64 ibmnws iyonix \
+ landisk luna68k mac68k macppc mipsco mmeye mvme68k mvmeppc netwinder news68k \
+ newsmips next68k ofppc pmax prep rs6000 sandpoint sbmips sgimips shark sparc \
+ sun2 sun3 vax x68k zaurus
diff --git a/Completion/BSD/Type/_obsd_architectures b/Completion/BSD/Type/_obsd_architectures
new file mode 100644
index 000000000..ca3e0e12f
--- /dev/null
+++ b/Completion/BSD/Type/_obsd_architectures
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk longson luna88k macppc octeon sgi sparc64
Messages sorted by:
Reverse Date,
Date,
Thread,
Author