gbs export

Use the gbs export subcommand to export a Git tree to a tarball and spec file.

For command usage details, enter:

$ gbs export --help


  • Export source code to a 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:
    $ diff packaging/sed.spec packaging/sed-4.1.5-1/sed.spec
    > # Patches auto-generated by git-buildpackage:
    > Patch0: 0001-hello.patch
    > 25a28,29
    > # 0001-hello.patch
    > %patch0 -p1

    From the log, you can see that a patch has been generated, and a tarball is created from the pristine-tar branch. The --no-patch-export option can be used to disable this feature and generate a tarball from the current branch directly.

  • Use the -o option to generate packaging files to a specified path:

    $ gbs export -o ~/
  • Use the --source-rpm option to generate a source RPM package:

    $ gbs export -o ~/ --source-rpm
  • Use the --spec option, if there are multiple spec files:

    $ gbs export --spec=dlog.spec

    The --spec option only accepts a file name and must not contain any path info. GBS prefixes the packaging directory automatically.

  • Use the --fallback-to-native option to force the export process to perform packaging for non-native packages in the native packaging mode, ignoring the upstream branch and creating a tarball from HEAD (by default) or specified commit without generating any patch. Adding the --fallback-to-native option when issuing the gbs export command is equivalent to adding the fallback_to_native = true property to the [general] section of the GBS configuration file.


    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, the gbs export command always performs packaging in the native packaging mode.

    $ gbs export --fallback-to-native