#compdef rpmbuild local -a cmds b_cmds t_cmds options b_options cmds=(--rebuild --recompile) b_cmds=(-ba -bb -bp -bc -bi -bl -bs) t_cmds=(-ta -tb -tp -tc -ti -tl -ts) options=(--quiet -v -vv --verbose --rcfile --pipe --dbpath -r --root --buildroot --clean --nobuild --nodeps --nodigest --nosignature --macros --rmsource --rmspec --short-circuit --sign --target -D --define -E --eval --with --without --debug --bcond --install-build-tree) b_options=(--clean --nobuild --nodeps --nodigest --nosignature --rmsource --rmspec --short-circuit --sign --target --debug --with --without) _arguments \ "($cmds $b_cmds $t_cmds)"{-ba,-ta}'[Build binary and source packages]' \ "($cmds $b_cmds $t_cmds)"{-bb,-tb}'[Build a binary package]' \ "($cmds $b_cmds $t_cmds)"{-bp,-tp}'[Execute the "%prep" stage]' \ "($cmds $b_cmds $t_cmds)"{-bc,-tc}'[Do the "%build" stage]' \ "($cmds $b_cmds $t_cmds)"{-bi,-ti}'[Do the "%install" stage]' \ "($cmds $b_cmds $t_cmds)"{-bl,-tl}'[Do a "list check"]' \ "($cmds $b_cmds $t_cmds)"{-bs,-ts}'[Build just the source package]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"{-\?,--help}'[Show help message]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"--querytags'[Display known query tags]' \ "($cmds $b_cmds $t_cmds * $b_options)"--showrc'[Display final rpmrc and macro configuration]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"--usage'[Display brief usage message]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"--version'[Print the version of rpm being used]' \ "(-v --verbose -vv)"--quiet'[Print as little as possible]' \ "(-v --verbose --quiet)"{-v,--verbose}'[Print verbose information]' \ "(-v --verbose --quiet)"-vv'[Print lots of ugly debugging information]' \ --rcfile'[RC files]:RC files:_files -S\:' \ --macros'[Macros files]:Macros files:_files -S\:' \ --pipe'[Command to pipe the output of rpm to]:command' \ --dbpath'[Set database directory]:Database directory:_files -/' \ "(-r --root)"{-r,--root}'[Root file system tree]:Chroot directory:_files -/' \ --buildroot'[Override the BuildRoot]:BuildRoot directory:_files -/' \ --clean'[Remove the build tree after the packages are made]' \ --nobuild'[Do not execute any build stages (for spec testing purposes]' \ --nodeps'[Do not verify build dependencies]' \ --nodigest"[Don't verify package digest(s)]" \ --nosignature"[Don't verify package signature(s)]" \ --rmsource'[Remove the sources after the build]' \ --rmspec'[Remove the spec file after the build]' \ --short-circuit'[Skip straight to specified stage (-bc, -bi or -bb in PLD Linux]' \ --sign'[Embed a GPG signature]' \ --target='[Set target platform]:arch-vendor-os:' \ {'*-D','*--define='}'[Define MACRO with value EXPR]:MACRO EXPR' \ {'*-E','*--eval='}'[Print macro expansion of EXPR]:EXPR' \ '*--with[Enable configure option for build]:option' \ '*--without[Disable configure option for build]:option' \ "($cmds $b_cmds $t_cmds * $b_options)"--bcond'[Find all --with/--without values]' \ --debug'[Build packages with debug information]' \ "($cmds $b_cmds $t_cmds * $b_options)"--install-build-tree'[Make all needed dirs for building binary rpms]' \ "(--clean $b_cmds $t_cmds --rebuild)"--recompile'[Recompile source package]' \ "(--clean $b_cmds $t_cmds --recompile)"--rebuild'[Rebuild source package]' \ "*:file:_files -g '(#i)*.(spec|srpm|tgz|tar|tar.gz|tar.bz2)(-.)'" && ret=0