Use 'gbs export' to export git tree to tarball and spec file. You can see how to use the export subcommand by using this command:
$ gbs export --help
- export source code to default packaging directory
$ gbs export info: Generating patches from git (upstream/4.1.5..HEAD) info: Didn't find any old 'Patch' tags, adding new patches after the last 'Source' tag. info: Didn't find any old '%patch' macros, adding new patches after the last '%setup' macro pristine-tar: successfully generated /var/tmp/.gbs_export_UJn0nS/sed-4.1.5.tar.gz info: package files have been exported to: /home/test/sed/packaging/sed-4.1.5-1 $ diff packaging/sed.spec packaging/sed-4.1.5-1/sed.spec 11a12,13 > # Patches auto-generated by git-buildpackage: > Patch0: 0001-hello.patch 25a28,29 > # 0001-hello.patch > %patch0 -p1
From the log we can see patches has been generated, and tarball is created from pristine-tar branch. --no-patch-export option can be used to disable this feature, and tarball will be generated from current branch directly.
- Use -o option to generate packaging files to specified path
$ gbs export -o ~/
- Using --source-rpm option to generate source RPM package:
$ gbs export -o ~/ --source-rpm
- Using --spec option, if there are multiple spec files
$ gbs export --spec=dlog.spec
--spec only accept file name should not contains any path info. gbs will prefix packaging dir automatically.
Use --fallback-to-native option to force gbs-export to perform packaging for non-native packages in native packaging mode, that is, ignore upstream branch and create tarball from HEAD (by default) or specified commit without generating any patch. Adding --fallback-to-native option when issuing gbs export is equvalent to adding "fallback_to_native = true" into [general] section in GBS configuration file.
Note: This option serves as a work-around solution for solving export failures of some non-native packages caused by a tricky engineering problem. For Tizen native packages, gbs-export always performs packaging in native packaging mode.
$ gbs export --fallback-to-native