---
name: "gbp-buildpackage-rpm"
section: "1"
platform: "linux"
package: "git-buildpackage-rpm"
version: "0.9.38"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gbp-buildpackage-rpm"
---

# gbp-buildpackage-rpm(1)

Build RPM packages from a Git repository

## NAME

gbp-buildpackage-rpm - Build RPM packages from a Git repository

## SYNOPSIS

FC**gbp buildpackage-rpm**F\[0\]  \[FC**--git-\[no-\]ignore-new**F\[0\]\] \[FC**--git-tag**F\[0\]\] \[FC**--git-verbose**F\[0\]\] \[FC**--git-color=**F\[0\]\[auto\|on\|off\]\] \[FC**--git-color-scheme=**F\[0\] *COLOR\_SCHEME*\] \[FC**--git-notify=**F\[0\]\[auto\|on\|off\]\] \[FC**--git-tmp-dir**F\[0\]= *DIRECTORY*\] \[FC**--git-vendor**F\[0\]= *VENDOR*\] \[FC**--git-native**F\[0\]\[auto\|on\|off\]\] \[FC**--git-upstream-branch=**F\[0\] *TREEISH*\] \[FC**--git-packaging-branch=**F\[0\] *BRANCH\_NAME*\] \[FC**--git-ignore-branch**F\[0\]\] \[FC**--git-\[no-\]submodules**F\[0\]\] \[FC**--git-builder=**F\[0\] *BUILD\_CMD*\] \[FC**--git-cleaner=**F\[0\] *CLEAN\_CMD*\] \[FC**--git-\[no-\]sign-tags**F\[0\]\] \[FC**--git-keyid=**F\[0\] *GPG-KEYID*\] \[FC**--git-posttag=**F\[0\] *COMMAND*\] \[FC**--git-postbuild=**F\[0\] *COMMAND*\] \[FC**--git-postexport=**F\[0\] *COMMAND*\] \[FC**--git-prebuild=**F\[0\] *COMMAND*\] \[FC**--git-preexport=**F\[0\] *COMMAND*\] \[FC**--git-\[no-\]build**F\[0\]\] \[FC**--git-\[no-\]hooks**F\[0\]\] \[FC**--git-packaging-tag=**F\[0\] *TAG-FORMAT*\] \[FC**--git-upstream-tag=**F\[0\] *TAG-FORMAT*\] \[FC**--git-force-create**F\[0\]\] \[FC**--git-no-create-orig**F\[0\]\] \[FC**--git-upstream-tree=**F\[0\] *\[TAG\|BRANCH\|TREEISH\]*\] \[FC**--git-tarball-dir=**F\[0\] *DIRECTORY*\] \[FC**--git-compression-level=**F\[0\] *LEVEL*\] \[FC**--git-export-dir=**F\[0\] *DIRECTORY*\] \[FC**--git-export=**F\[0\] *TREEISH*\] \[FC**--git-packaging-dir=**F\[0\] *DIRECTORY*\] \[FC**--git-spec-file=**F\[0\] *FILEPATH*\] \[FC**--git-export-sourcedir**F\[0\]= *DIRECTORY*\] \[FC**--git-export-specdir**F\[0\]= *DIRECTORY*\] \[FC**--git-\[no-\]pristine-tar**F\[0\]\] \[FC**--git-\[no-\]pristine-tar-commit**F\[0\]\] \[FC**--git-tag-only**F\[0\]\] \[FC**--git-retag**F\[0\]\] \[FC**--git-mock**F\[0\]\] \[FC**--git-dist**F\[0\]= *DISTRIBUTION*\] \[FC**--git-arch**F\[0\]= *ARCHITECTURE*\] \[FC**--git-mock-options**F\[0\]= *OPTIONS*\] \[FC**--git-mock-root**F\[0\]= *ROOT*\] \[FC**--git-spec-vcs-tag**F\[0\]= *TAG\_FORMAT*\]

## DESCRIPTION

**gbp buildpackage-rpm** is used to build RPM packages from a Git repository. It is an RPM counterpart for the **gbp buildpackage** tool that is designed for building Debian packages.

**gbp buildpackage-rpm** will, in order:

- •

  Verify that it is being executed from the proper location.

- •

  Verify that the repository doesn't contain any uncommitted source changes.

- •

  Verify that it is being executed from the correct branch.

- •

  Export packaging files to a separate build area.

- •

  Create an orig source tarball if it doesn't exist.

- •

  Call [rpmbuild(1)](/rpmbuild/1.md) (or the application specified via FC**--git-builder**F\[0\]), passing along all command line arguments that don't start with --git-.

- •

  (Optionally) tag the tree after a successful build.

- •

  (Optionally) call a post build hook - e.g. to run **rpmlint**.

- •

  (Optionally) call a post tag hook - e.g. to push the results to a remote repository after creating the tag.

## OPTIONS

- FC**--git-\[no-\]ignore-new**F\[0\]

  Don't abort if there are uncommitted changes in the source tree or the current branch doesn't match the *PACKAGING-BRANCH*.

- FC**--git-tag**F\[0\]

  Add a git tag after a successful build.

- FC**--git-builder=**F\[0\]*BUILD\_CMD*

  Use *BUILD\_CMD* instead of **rpmbuild -ba**.

- FC**--git-cleaner=**F\[0\]*CLEAN\_CMD*

  Use *CLEAN\_CMD*.

- FC**--git-verbose**F\[0\]

  Verbose execution

- FC**--git-color=**F\[0\]\[auto\|on\|off\]

  Whether to use colored output.

- FC**--git-color-scheme=**F\[0\]*COLOR\_SCHEME*

  Colors to use in output (when color is enabled). The format for COLOR\_SCHEME is '\<debug\>:\<info\>:\<warning\>:\<error\>'. Numerical values and color names are accepted, empty fields imply the default color. For example --git-color-scheme='cyan:34::' would show debug messages in cyan, info messages in blue and other messages in default (i.e. warning and error messages in red).

- FC**--git-notify=**F\[0\]\[auto\|on\|off\]

  Whether to send a desktop notification after the build.

- FC**--git-tmp-dir**F\[0\]=*DIRECTORY*

  Base directory under which temporary directories are created.

- FC**--git-vendor**F\[0\]=*VENDOR*

  Distribution vendor name.

- FC**--git-native=**F\[0\]\[auto\|on\|off\]

  Define the 'nativity' of a package. The default value *auto* makes **gbp buildpackage-rpm** to guess. Guessing is based on the existence of upstream branch.

- FC**--git-upstream-branch**F\[0\]=*BRANCH\_NAME*

  Branch to build the orig tarball from if FC**--git-upstream-tree**F\[0\] is set to *BRANCH*. Default is *upstream*.

- FC**--git-packaging-branch**F\[0\]=*BRANCH\_NAME*

  If you're not on this branch when invoking **gbp buildpackage-rpm** it will fail. Default is *master*. This is done to make sure you don't accidentally release from a topic branch. Not being on this branch will be ignored when using FC**--git-ignore-new**F\[0\].

- FC**--git-ignore-branch**F\[0\]

  Don't check if the current branch matches *PACKAGING-BRANCH*.

- FC**--git-\[no-\]submodules**F\[0\]

  Include git submodules in the orig tarball.

- FC**--git-\[no-\]sign-tags**F\[0\]

  GPG sign all created tags.

- FC**--git-keyid=**F\[0\]*GPG-KEYID*

  Use this keyid for gpg signing tags.

- FC**--git-posttag=**F\[0\]*COMMAND*

  Execute *COMMAND* after tagging a new version.

  Exported environment variables are: **GBP\_TAG** (the name of the generated tag), **GBP\_BRANCH** (the branch the package was built from) and **GBP\_SHA1** (the sha1 of the commit the tag was created at).

- FC**--git-postbuild=**F\[0\]*COMMAND*

  Execute *COMMAND* after successful build.

  Exported environment variables are: **GBP\_CHANGES\_FILE** (the name of the generated changes file), **GBP\_BUILD\_DIR** (the build dir).

- FC**--git-preexport=**F\[0\]*COMMAND*

  Execute *COMMAND* before exporting the source tree.

  Exported environment variables are: **GBP\_GIT\_DIR** (the repository the package is being built from), **GBP\_TMP\_DIR** (the temporary directory where the sources have been initially exported).

- FC**--git-postexport=**F\[0\]*COMMAND*

  Execute *COMMAND* after exporting the source tree.

  Exported environment variables are: **GBP\_GIT\_DIR** (the repository the package is being built from), **GBP\_TMP\_DIR** (the temporary directory where the sources have been initially exported).

- FC**--git-prebuild=**F\[0\]*COMMAND*

  Execute *COMMAND* from the build directory before calling rpmbuild or the application specified via FC**--git-builder**F\[0\].

  Exported environment variables are: **GBP\_GIT\_DIR** (the repository the package is being built from), **GBP\_BUILD\_DIR** (the build dir).

- FC**--git-\[no-\]build**F\[0\]

  Enable builder. Note: FC**--git-no-build**F\[0\] causes the postbuild hook to be disabled, too.

- FC**--git-\[no-\]hooks**F\[0\]

  Enable running all (cleaner, preexport, postexport, prebuild, postbuild, and posttag) hooks. Note: the FC**--git-builder**F\[0\] command is not affected by this option.

- FC**--git-packaging-tag=**F\[0\]*TAG-FORMAT*

  Use this tag format when tagging released versions of the package.

- FC**--git-upstream-tag=**F\[0\]*TAG-FORMAT*

  Use this tag format when looking for tags of upstream versions, default is *upstream/%(version)s*.

- FC**--git-force-create**F\[0\]

  Force creation of an orig tarball (overwriting a pre-existing one if present).

- FC**--git-no-create-orig**F\[0\]

  Don't try to create any orig tarball.

- FC**--git-export-dir=**F\[0\]*DIRECTORY*

  Export the packaging files from the current branch head (or the treeish object given via FC**--git-export**F\[0\] to *DIRECTORY* before building.

- FC**--git-export-sourcedir**F\[0\]=*DIRECTORY* , FC**--git-export-specdir**F\[0\]=*DIRECTORY*

  Subdirectories under export directory where packaging files are exported. The default build options of rpmbuild builder are also adjusted accordingly.

- FC**--git-export=**F\[0\]*TREEISH*

  Instead of exporting the current branch head, export the treeish object *TREEISH*. The special name *INDEX* exports the current index, *WC*) exports all files in the current working directory.

- FC**--git-packaging-dir=**F\[0\]*DIRECTORY*

  Subdirectory that contains the RPM packaging files.

- FC**--git-spec-file=**F\[0\]*FILEPATH*

  Relative path to the spec file to use. Special value *auto* causes **gbp buildpackage-rpm** to search and guess. Other values cause the FC**--git-packaging-dir**F\[0\] option to be ignored: the directory of the spec file is used, instead.

- FC**--git-upstream-tree=**F\[0\]*\[TAG\|BRANCH\|TREEISH\]*

  How to find the upstream sources used to generate the tarball. *TAG* looks at a tag corresponding to the version in the changelog. *BRANCH* looks at the upstream branch given via the FC**--git-upstream-branch**F\[0\] option. Other values are interpreted as treeishs.

  This doesn't have any effect if FC**--git-pristine-tar**F\[0\] is being used.

- FC**--git-tarball-dir=**F\[0\]*DIRECTORY*

  Search for original tarballs in *DIRECTORY* instead of generating them.

- FC**--git-compression-level=**F\[0\]*LEVEL*

  Specifies the upstream tarball compression level if an upstream tarball needs to be built.

- FC**--git-tag-only**F\[0\]

  Don't build, only tag and run post-tag hooks.

- FC**--git-retag**F\[0\]

  Don't fail tag operations if a tag with the same version already exists, but, overwrite the existing tag, instead.

- FC**--git-pristine-tar**F\[0\]

  Use pristine-tar when generating the upstream tarball if it doesn't exist.

- FC**--git-pristine-tar-commit**F\[0\]

  Commit the pristine-tar delta to the pristine-tar branch if a new tarball was generated and the pristine-tar data isn't already there.

- FC**--git-mock**F\[0\]

  Use mock to build the rpms by invoking **gbp-builder-mock**.

- FC**--git-dist**F\[0\]

  Build for this distribution when using mock (e.g.: epel-6).

- FC**--git-arch**F\[0\]

  Build for this architecture when using mock, default is to build for the current host architecture.

- FC**--git-mock-root**F\[0\]

  The mock root to use. Defaults to *DIST*-*ARCH* from above.

- FC**--git-mock-options**F\[0\]

  Additional options to pass to mock. Default is to pass no additional options.

- FC**--git-spec-vcs-tag**F\[0\]=*TAG\_FORMAT*

  **gbp buildpackage-rpm** always automatically sets/updates the 'VCS:' tag in the spec file after exporting. This option defines the format string for the 'VCS:' tag. An empty value causes no 'VCS:' tag to be inserted and possible old 'VCS:' tag to be removed. Otherwise, the old 'VCS:' tag is updated or a new 'VCS:' tag is added if one does not exist. In the format string '%(tagname)s' expands to the long tag name (from git-describe) and '%(commit)s' expans to the sha1 of the exported commit.

## EXAMPLES

Only build a source RPM with **rpmbuild**

```
FC
      gbp buildpackage-rpm -bs
    F[0]
```

Build an RPM package with **rpmbuild** on a custom branch with the uncommitted changes included.

```
FC
      gbp buildpackage-rpm --git-ignore-branch --git-export=WC
    F[0]
```

## CONFIGURATION FILES

Several FC*gbp.conf*F\[0\] files are parsed  to set defaults for the above command-line arguments. See the [**gbp.conf**(5)](/gbp.conf/5.md) manpage for details.

All options in the config files are specified without the 'git-' prefix.

## SEE ALSO

[**gbp-import-srpm**(1)](/gbp-import-srpm/1.md), [**gbp-pq-rpm**(1)](/gbp-pq-rpm/1.md), [**gbp-rpm-ch**(1)](/gbp-rpm-ch/1.md), [**rpmbuild**(8)](/rpmbuild/8.md), [**mock**(1)](/mock/1.md), [**gbp.conf**(5)](/gbp.conf/5.md), [**debuild**(1)](/debuild/1.md), [**git**(1)](/git/1.md), [**pristine-tar**(1)](/pristine-tar/1.md),\
        The Git-Buildpackage Manual ⟨file:///usr/share/doc/git-buildpackage/manual-html/index.html⟩

## AUTHOR

Markus Lehtonen \<FCmarkus.lehtonen@linux.intel.comF\[0\]\>
