_gbs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. #compdef gbs
  2. #
  3. # Copyright (c) 2013 Intel, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License as published by the Free
  7. # Software Foundation; version 2 of the License
  8. #
  9. # This program is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. # for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License along
  15. # with this program; if not, write to the Free Software Foundation, Inc., 59
  16. # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. local ret=1 state
  18. local -a common_ops
  19. common_ops=(
  20. {-h,--help}"[show this help message and exit]"
  21. {-V,--version}"[show program's version number and exit]"
  22. {-c,--conf}"[specify config file for gbs]:filename:_files"
  23. {-d,--debug}"[debug output]"
  24. {-v,--verbose}"[verbose output]"
  25. )
  26. _directories () {
  27. _wanted directories expl directory _path_files -/ "$@" -
  28. }
  29. typeset -A opt_args
  30. _arguments \
  31. ':subcommand:->subcommand' \
  32. $common_ops \
  33. '*::options:->options' && ret=0
  34. case $state in
  35. subcommand)
  36. local -a subcommands
  37. subcommands=(
  38. "changelog:update the changelog file with the git commit messages"
  39. "remotebuild:remote build package"
  40. "export:export files and prepare for build"
  41. "chroot:chroot to build root"
  42. "import:import spec file/source rpm/tar ball to git repository"
  43. "clone:clone a git repository"
  44. "submit:submit tag to gerrit and trigger building in OBS"
  45. "pull:update a package git repository"
  46. "build:local build package"
  47. )
  48. _describe -t subcommands 'gbs subcommand' subcommands && ret=0
  49. ;;
  50. options)
  51. local -a args
  52. args=(
  53. $common_ops
  54. )
  55. local -a import_ops
  56. import_ops=(
  57. "--author-name[author name of git commit]:parameter"
  58. "--author-email[author email of git commit]:parameter"
  59. "--upstream-branch[specify upstream branch for new package version]:parameter"
  60. "--upstream-tag[upstream tag format, '\$\{upstreamversion\}' is expanded to the version in the spec file. E.g. 'v\$\{upstreamversion\}']:parameter"
  61. "--packaging-dir[directory containing packaging files]:directory:_directories"
  62. "--no-pristine-tar[don't use pristine-tar to import source. pristine-tar only support import *tar.{gz,bz2,xz} sources, this option can be specified to import other format sources]"
  63. "--filter[files to filter out d]:parameter"
  64. "--allow-same-version[allow to import already imported version]"
  65. "--native[this is a dist native package, no separate upstream]"
  66. "--no-patch-import[don't import patches automatically]"
  67. "--merge[merge new upstream branch to master]"
  68. "--upstream-vcs-tag[upstream VCS tag add to the merge commit]:parameter"
  69. )
  70. local -a export_ops
  71. export_ops=(
  72. {-o,--outdir}"[output directory]:directory:_directories"
  73. "--spec[specify a spec file to use. It should be a file name that GBS will find it in packaging dir]:filename:_files"
  74. {-c,--commit}"[specify a commit ID to export]:parameter"
  75. "--include-all[uncommitted changes and untracked files would be included while generating tar ball]"
  76. "--source-rpm[generate source rpm]"
  77. "--no-patch-export[don't create patches between upstream and export-treeish, and create tar ball from the export-treeish instead of upstream branch]"
  78. "--upstream-branch[upstream branch]:parameter"
  79. "--upstream-tag[upstream tag format, '\$\{upstreamversion\}' is expanded to the version in the spec file. E.g. 'v\$\{upstreamversion\}']:parameter"
  80. "--squash-patches-until[when generating patches, squash patches up to given commit-ish into one monolithic diff file. Format is the commit-ish optionally followed by a colon and diff filename base]:parameter"
  81. "--packaging-dir[directory containing packaging files]:directory:_directories"
  82. )
  83. local -a build_ops
  84. build_ops=(
  85. {-A,--arch}"[build target arch. Supported arch types are: x86_64 i586 armv6l armv7hl armv7l]: :_arch_filters"
  86. {-D,--dist}"[specify project (build) configuration file]:parameter"
  87. {-P,--profile}"[profile to be used for building, it is defined in .gbs.conf, can be given without the \"profile.\" prefix]:parameter"
  88. {-R,--repository}"[specify package repositories, only rpm-md format is supported]:parameter"
  89. "--skip-conf-repos[skip repositories mentioned in config file, and only use repos from command line -R option]"
  90. "--overwrite[overwrite existing binaries and build them anyway]"
  91. "--define[define macro X with value Y with format \"X Y\"]:parameter"
  92. "--debug[debug output]"
  93. {-B,--buildroot}"[specify build root to setup chroot environment. By default, ~/GBS-ROOT/ will be used, and if no -B option, but TIZEN_BUILD_ROOT env exists, then \$\{TIZEN_BUILD_ROOT\} will used as build root]:parameter"
  94. {-C,--clean}"[delete old build root before initialization]"
  95. "--clean-once[clean the build environment only once when you start building multiple packages, after that use existing environment for all packages.]"
  96. "--clean-repos[clean up local repos created by gbs build before building packages]"
  97. "--extra-packs[specify extra packages to install to build root, Multiple packages can be separated by comma(,)]:parameter"
  98. "--keep-packs[keep unused packages in build root. without this option, unused packages will be removed from build root]"
  99. "--incremental[build a package from the local git tree incremental. If the build fails, changes can be done directly to the source and build can continue from where it stopped]"
  100. "--no-configure[this option disables running configure scripts and auto generation of auto-tools to make incremental build possible. This requires the configure scripts in the spec to be referenced using the \%configure, \%reconfigure and \%autogen macros]"
  101. "--noinit[working in offline mode. Start building directly]"
  102. "--ccache[use ccache to speed up rebuilds]"
  103. "--threads[number of threads to build multiple packages in parallel]:parameter"
  104. {-c,--commit}"[specify a commit ID to build]:parameter"
  105. "--include-all[uncommitted changes and untracked files would be included while generating tar ball]"
  106. "--packaging-dir[directory containing packaging files]:directory:_directories"
  107. "--spec[specify a spec file to use. It should be a file name that GBS will find it in packaging dir]:filename:_files"
  108. "--upstream-branch[upstream branch]:parameter"
  109. "--upstream-tag[upstream tag format, '\$\{upstreamversion\}' is expanded to the version in the spec file. E.g. 'v\$\{upstreamversion\}]:parameter"
  110. "--squash-patches-until[when generating patches, squash patches up to given commit-ish into one monolithic diff file. Format is the commit-ish optionally followed by a colon and diff filename base.]:parameter"
  111. "--no-patch-export[don't create patches between upstream and export-treeish, and create tar ball from the export-treeish instead of upstream branch]"
  112. "--binary-list[specify a package list to be built. Multiple packages can be separated by comma(,). Note: package names are from spec files, not the package dir name]:parameter"
  113. "--binary-from-file[specify a binary package list file. Packages listed in this file will be selected to be built. The format of binary-list file is one package for one line, and only binary RPM name is accepted]:filename:_files"
  114. "--exclude[specify a package list to be excluded for building. Multiple packages can be separated by comma(,)]"
  115. "--exclude-from-file[specify an exclude package list text file, the format is one package in one line, and only binary RPM package name is accepted. Packages listed in this file will be skipped to be built.]:parameter"
  116. "--deps[build specified packages and all packages they depend on]"
  117. "--rdeps[build specified packages and all packages depend on]"
  118. )
  119. local -a remotebuild_ops
  120. remotebuild_ops=(
  121. {-T,--target-obsprj}"[OBS project where package will be checked in. Default is home:<userid>:gbs:<base_prj>, you can set default target_prj in .gbs.conf]:parameter"
  122. {-B,--base-obsprj}"[OBS project being used to branch from, you can set default base_prj in .gbs.conf]:parameter"
  123. {-P,--profile}"[profile to be used for building, can be given without the "profile." prefix]:parameter"
  124. "--spec[specify a spec file to use. It should be a file name that GBS will find it in packaging dir]:filename:_files"
  125. {-c,--commit}"[specify a commit ID to build]:parameter"
  126. "--no-patch-export[don't create patches between upstream and export-treeish, and create tar ball from the export-treeish instead of upstream branch]"
  127. "--buildlog[get buildlog from build sever]"
  128. "--status[get build status from build server]"
  129. {-R,--repository}"[OBS repository for --buildlog]:parameter"
  130. {-A,--arch}"[OBS build architecture for --buildlog]:parameter"
  131. "--include-all[uncommitted changes and untracked files will be included while generating tar ball]"
  132. "--upstream-branch[upstream branch]:parameter"
  133. "--upstream-tag[upstream tag format, '\$\{upstreamversion\}' is expanded to the version in the spec file. E.g. 'v\$\{upstreamversion\}']:parameter"
  134. "--squash-patches-until[when generating patches, squash patches up to given commit-ish into one monolithic diff file. Format is the commit-ish optionally followed by a colon and diff filename base.]:parameter"
  135. "--packaging-dir[directory containing packaging files]:directory:_directories]"
  136. )
  137. case $words[1] in
  138. changelog)
  139. args+=(
  140. "--spec=[specify a spec file to use. It should be a file name that GBS will find it in packaging dir]:filename:_files"
  141. {-s,--since=}"[commit to start from]"
  142. {-m,--message}"[use given message as the changelog entry]:parameter"
  143. "--packaging-dirdirectory[containing packaging files]:directory:_directories"
  144. )
  145. ;;
  146. remotebuild)
  147. args+=(
  148. $remotebuild_ops
  149. )
  150. ;;
  151. export)
  152. args+=(
  153. $export_ops
  154. )
  155. ;;
  156. chroot)
  157. args+=(
  158. {-r,--root}"[chroot as root instead of abuild by default]:directory:_directories"
  159. )
  160. ;;
  161. import)
  162. args+=(
  163. $import_ops
  164. )
  165. ;;
  166. clone)
  167. args+=(
  168. "--upstream-branch[upstream branch]:parameter"
  169. "--all[track all remote branches]"
  170. "--depth[git history depth, for creating shallow clones]:parameter"
  171. )
  172. ;;
  173. submit)
  174. args+=(
  175. "--tag[create tag using specified tag name. This option can be used for group submission, and submissions with same tag can be seen as one group]:parameter"
  176. {-m,--msg}"[specify tag message info]:parameter"
  177. {-c,--commit}"[specify a commit ID to submit]:parameter"
  178. {-s,--sign}"[make a GPG-signed tag]:parameter"
  179. {-u,--user-key}"[using the given key to make a GPG-signed tag]:parameter"
  180. {-t,--target}"[specify target version to submit, eg: trunk.]:parameter"
  181. {-r,--remote}"[specify gerrit project server, for example: ssh://user@review.tizen.org:29418/public/base/gcc]:parameter"
  182. )
  183. ;;
  184. pull)
  185. args+=(
  186. "--upstream-branch[upstream branch]:parameter"
  187. "--depth[git history depth, for creating shallow clones]:parameter"
  188. "--force[force branch update even if unable to fast-forward, WARNING: local changes may be lost]"
  189. "--all[update all branches]"
  190. )
  191. ;;
  192. build)
  193. args+=(
  194. $build_ops
  195. )
  196. ;;
  197. esac
  198. _arguments $args && ret=0
  199. ;;
  200. esac
  201. (( $+functions[_arch_filters] )) ||
  202. _arch_filters() {
  203. local filters; filters=(x86_64 i586 armv6l armv7hl armv7l)
  204. _values $@ 'filter' "${filters[@]}"
  205. }
  206. return ret
  207. # vim: ft=zsh sw=2 ts=2 et