Forking from an Upstream¶
Depending on your upstream, there are three main ways of interacting with Debian package repositories:
- No upstream: Debian native package
- Upstream is Debian (or a Debian downstream like Ubuntu)
- Upstream is not Debian
Upstream type determines how our package versions are bumped. Version examples:
Upstream type | Upstream version | Upstream tag | Release tag |
---|---|---|---|
not Debian | 4.5.6 |
v4.5.6 |
debian/4.5.6-0opx1 |
Debian | 4.5.6-2 |
debian/4.5.6-2 |
debian/4.5.6-2opx1 |
Ubuntu | 4.5.6-2ubuntu3 |
debian/4.5.6-2ubuntu3 |
debian/4.5.6-2ubuntu3opx1 |
Debian native package¶
- Develop on master
- Release on
debian/X.Y.Z
tags
Upstream is Debian¶
Development is done on the opx/master
branch. Development is done through Debian patches with gbp pq.
Workflow for new upstream versions¶
- Merge upstream (Debian) tag into
opx/master
branch. - Resolve conflicts
- Create/adapt packaging
- Add changelog entry with
gbp dch
- Reset
opxX
toopx1
- Add changelog entry with
- Raise pull request
- Merge, tag, and release
Workflow for new OPX changes¶
- Follow normal OPX workflow, forking from
opx/master
- Import patches with
gbp pq import
- Make changes (to source only, no packaging)
- Export patches with
gbp pq export
- Create/adapt packaging
- Add changelog entry with
gbp dch
(keep same upstream version, only increment finalopxX
- Add changelog entry with
- Raise pull request
- Merge, tag, and release
Upstream is not Debian¶
Development is done on the opx/master
branch. No patches or patch queues are used.
Workflow for new upstream versions¶
- Merge upstream tag into
opx/master
branch. - Resolve conflicts
- Create/adapt packaging
- Add changelog entry with
gbp dch
- Reset
opxX
toopx1
- Add changelog entry with
- Raise pull request
- Merge
- Tag and release
Workflow for new OPX changes¶
- Follow normal OPX workflow, forking from
opx/master
- Make changes
- Create/adapt packaging
- Add changelog entry with
gbp dch
(keep same upstream version, only increment finalopxX
- Add changelog entry with
- Raise pull request
- Merge
- Tag and release
Upstream is a tarball¶
- Create repo with
gbp import-orig
- Create packaging with
dh_make
- Add, modify, and remove patches with
gbp pq import
andgbp pq export
- Import new upstream versions with
gbp import-orig --uscan
Demo of creating a Debian fork and an initial release¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | PKG=net-snmp UPSTREAM=5.7.3+dfsg-1.7 OPX_VER=${UPSTREAM}opx1 git clone -o upstream https://salsa.debian.org/debian/net-snmp.git # Create our development branch git -C $PKG checkout -b opx/master debian/$UPSTREAM # Create new changelog for initial OPX release # Add new changelog entry, changing 5.7.3+dfsg-2 to 5.7.3+dfsg-1.7opx1 dbp shell -c "cd $PKG; gbp dch --release" git -C $PKG add debian/changelog # Commit our changes git -C $PKG commit -sm 'Initial commit for OPX' # Build it! And tag it on successful build dbp --dist stretch --no-extra-sources build $PKG --gbp='--git-tag' # Push our changes and remove the repo git -C $PKG remote add origin https://github.com/theucke/net-snmp git -C $PKG push origin opx/master git -C $PKG push origin debian/$OPX_VER rm -rf $PKG |
Demo of modifying the Debian fork¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Clone from our fork git clone https://github.com/theucke/net-snmp git -C $PKG checkout opx/master # Create dev branch git -C $PKG checkout --track opx/master -b bugfix/python-indentation # Import patch queue dbp shell -c "cd $PKG; gbp pq import" # Fix tab character in python file for something to change sed -i $'s/\t/ /' $PKG/python/setup.py git -C $PKG add python/setup.py # Commit changes and export patch queue git -C $PKG commit -asm "python: Fix indentation" dbp shell -c "cd $PKG; gbp pq export" # Add new changelog entry, changing 5.7.3+dfsg-1.7opx1 to 5.7.3+dfsg-1.7opx2 # Version should be changed automatically for you dbp shell -c "cd $PKG; gbp dch --release" git -C $PKG commit --amend -a # Raise pull request git pull-request |
Demo of merging in new upstream release¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Clone from our fork git clone https://github.com/theucke/net-snmp git -C $PKG checkout opx/master # Import new upstream version and resolve conflicts # Move new changelog entry to Debian changelog (must be a better way, Git didn't detect rename) git -C $PKG merge debian/5.7.3+dfsg-1.8 # Add new changelog entry, changing 5.7.3+dfsg-1.7opx2 to 5.7.3+dfsg-1.8opx1 dbp shell -c "cd $PKG; gbp dch --release" git -C $PKG commit --amend -a # Build for verification (normally CI will do this) dbp --dist stretch --no-extra-sources build $PKG --gbp='--git-tag' # Push our new tag git -C $PKG push origin opx/master git -C $PKG push origin debian/5.7.3+dfsg-1.8opx1 |