72 lines
2.2 KiB
Plaintext
72 lines
2.2 KiB
Plaintext
|
#compdef xbps-src
|
||
|
|
||
|
setopt localoptions extended_glob
|
||
|
|
||
|
local ret=0 archs top
|
||
|
|
||
|
archs=(armv6hf-musl armv6hf armv7hf-musl armv7hf i686-musl i686 mips mipsel x86_64-musl)
|
||
|
|
||
|
# path to masterdir and srcpkgs.
|
||
|
top=$~_comp_command1:h
|
||
|
|
||
|
_xbps_src_all_packages() {
|
||
|
compadd "$@" -- $top/srcpkgs/*(:t)
|
||
|
}
|
||
|
|
||
|
_xbps_src_destdir_packages() {
|
||
|
local -a dirs
|
||
|
dirs=( $top/masterdir/destdir/*~[^-]#-linux-[^-]#(N/) )
|
||
|
compadd "$@" -- ${${dirs:t}%-*}
|
||
|
}
|
||
|
|
||
|
_xbps_src_build_packages() {
|
||
|
local -a dirs
|
||
|
dirs=( $top/masterdir/builddir/*~[^-]#-linux-[^-]#(N/) )
|
||
|
compadd "$@" -- ${${dirs:t}%-*}
|
||
|
}
|
||
|
|
||
|
_arguments -s : \
|
||
|
'-a[Cross compile packages]:architecture:($archs)' \
|
||
|
'-C[Do not remove build directory/autodeps/destdir]' \
|
||
|
'-f[Force building and registering binary packages]' \
|
||
|
'-G[Enable XBPS_USE_GIT_REVS]' \
|
||
|
'-g[Enable building -dbg packages]' \
|
||
|
'-H[Absolute path to hostdir]:hostdir:_files -/' \
|
||
|
'-h[Help]' \
|
||
|
'-I[Ignore required dependencies]' \
|
||
|
'-j[Number of parallel build jobs]:number: ' \
|
||
|
'-L[Disable ASCII colors]' \
|
||
|
'-m[Absolute path to masterdir]:masterdir:_files -/' \
|
||
|
'-N[Disable use of remote repositories]' \
|
||
|
'-o[Set package build options]:options: ' \
|
||
|
'-r[Use alternative local repository]:repo:_files -/' \
|
||
|
'1:target:->target' \
|
||
|
'*::args:->args' && ret=0
|
||
|
|
||
|
case $state in
|
||
|
target)
|
||
|
_values "target" binary-bootstrap bootstrap bootstrap-update \
|
||
|
build chroot clean configure extract fetch install \
|
||
|
list pkg remove remove-autodeps show show-build-deps \
|
||
|
show-deps show-files show-options show-shlib-provides \
|
||
|
show-shlib-requires show-var show-repo-updates \
|
||
|
show-sys-updates update-bulk update-sys zap
|
||
|
ret=0;;
|
||
|
args)
|
||
|
case $words[1] in
|
||
|
build|configure|extract|fetch|install|pkg|show|show-build-deps)
|
||
|
_arguments ':package:_xbps_src_all_packages' && ret=0;;
|
||
|
binary-bootstrap)
|
||
|
_arguments '::architecture:($archs)' && ret=0;;
|
||
|
bootstrap|bootstrap-update|chroot|list|remove-autodepsshow-repo-updates|show-sys-updates|update-bulk|update-sys)
|
||
|
# no further arguments
|
||
|
ret=0;;
|
||
|
clean)
|
||
|
_arguments '::package:_xbps_src_build_packages' && ret=0;;
|
||
|
remove|show-deps|show-files|show-options|show-shlib-provides|show-shlib-requires)
|
||
|
_arguments ':package:_xbps_src_destdir_packages' && ret=0;;
|
||
|
esac;;
|
||
|
esac
|
||
|
|
||
|
return $ret
|