Development flow

Table of Contents
Development models
Starting from scratch with a non-native package
Converting an existing git repository of a non-native package

Development models

The gbp buildpackage-rpm toolset basically supports three different models of package maintenance.


Native package

This means that you are the upstream, there is no separate upstream with which you have to sync. Basically, only packaging-branch is used - it contains both the source code and packaging files. No patches should be present as all changes can be directly committed to upstream (which is you). When building, gbp buildpackage-rpm will create the source tarball and copy it and the packaging to the build directory.


Upstream package, alternative 1: packaging and sources in the same branch

This represents somewhat Debian-style package maintenance. All changes (packaging and source code) are done to the same branch, i.e., the packaging-branch, based on the upstream-branch. When package is built, gbp buildpackage-rpm can automatically generate patches from upstream version to packaging branch head (one patch per commit). and modify the spec file accordingly.


Upstream package, alternative 2: packaging and sources in separate branches

In this model packaging files (spec and patches) are held in packaging-branch and upstream sources in upstream-branch. Your code development is done on the patch-queue-branch, based on the upstream-branch, which only contains source code but no packaging files. When building the package, gbp pq-rpm tool is used to export patches from the patch queue branch to the packaging branch and edit the spec file accordingly. Finally, gbp buildpackage-rpm will create the upstream source tarball and export it and the packaging files to the build directory, and, build the RPM package.


Starting from scratch with a non-native package

In this case, you most probably want to package software not yet found in your distro. First, create an empty repository:

    $ mkdir mypackage
    $ cd mypackage
    $ git init
        
Then, import the upstream sources, create the packaging/development branch and add the rpm packaging files. You have two choices:

  1. packaging files and development sources in the same branch

        $ git-import-orig-rpm ../mypackage.tar.gz
        # Optionally (recommended): add gbp.conf
        $ vim .gbp.conf && git add .gbp.conf && git commit -m"Add gbp.conf"
        # Add packaging files to source tree under subdir 'packaging'
        $ mkdir packaging && cd packaging
        $ vim mypackage.spec
        $ git add .
        $ git commit -m"Add packaging files"
                

  2. development sources and packaging files in separate branches

        $ git-import-orig-rpm --no-merge ../mypackage.tar.gz
        # Optionally (recommended): add gbp.conf
        $ vim .gbp.conf && git add .gbp.conf && git commit -m"Add gbp.conf"
        # Add packaging files (to root of master branch)
        $ vim mypackage.spec
        $ git add  .
        $ git commit -m"Add packaging files"
                


Converting an existing git repository of a non-native package

In this case, you already have a git repository containing the upstream source, but it was created neither with gbp clone nor gbp import-srpm. You need to have a separate branch for upstream sources. If you already have that, you can simply rename that branch to the default upstream-branch:

    $ git branch -m my-old-upstream-branch upstream
        
OR just add the name of your upstream branch to gbp.conf. Then, you just create a packaging/development branch(es) with git and add packaging files to the packaging branch. If you want to maintain sources and packaging in the same branch (Non-native package, model 1) do something like:
    $ git checkout -b master upstream
    # Optionally (recommended): add gbp.conf
    $ vim .gbp.conf && git add .gbp.conf && git commit -m"Add gbp.conf"
    # Add packaging files to source tree, add and commit the packaging files
    # ...
        
If you want to maintain development sources and packaging in separate branches (Non-native package, model 2):
    $ git checkout --orphan master
    $ rm .git/index
    $ git commit --allow-empty -m"Create packaging branch"
    # Optionally (recommended): add gbp.conf
    $ vim .gbp.conf && git add .gbp.conf && git commit -m"Add gbp.conf"
    # Next, add and commit the packaging files (.spec etc)
    $ vim mypackage.spec && git add mypackage.spec && git commit -m"Add packaging files"
    # Now, you can create the development branch (and import possible patches)
    $ gbp pq-rpm import