-
Notifications
You must be signed in to change notification settings - Fork 545
Debian and Ubuntu packaging using git dpm
Debian packaging for sosreport is done using the git-dpm tool that facilitate the management of quilt patches. In short, each quilt patch is represented by a git commit in the patched-{} branch.
First assumption is that you are working on a Debian derivative.
Install git, devscripts, git-dpm and pristine-tar
$ apt-get install -y git git-dpm pristine-tar devscripts
The example is setup for the packaging of the 3-1 version
The packaging branches are prefixed by either debian/ or ubuntu/. For obvious reasons, none of the packaging information is kept in the master branch.
This example uses some random github environment where the official sosreport repository is defined as remote.
$ git clone `[`https://github.com/sosreport/sos.git`](https://github.com/sosreport/sos.git)` sosreport
$ cd sosreport
$ git remote add upstream `[`https://github.com/sosreport/sos.git`](https://github.com/sosreport/sos.git)
$ git pull upstream
$ git checkout -b upstream upstream/master
$ git checkout -b sos31 3.1
$ git checkout -b ubuntu/utopic
$ git log --oneline
9ce854d Update debian changelog
5364fd2 Add /etc/network/interfaces to networking plugin
bff8a67 Force foreman to be quiet
$ mkdir ../tmp
$
Add the pristine tar under git control
$ pristine-tar commit ../sosreport_3.1.orig.tar.gz
This section is there for reference only. The prefixed debian/ and ubuntu/ branches are already under git-dpm control so there is no need to do this over again.
$ cd ..
$ rm -f *dsc *.gz
$ pull-lp-source -d sosreport utopic
$ cd sosreport
$ git-dpm init ../sosreport_3.1.orig.tar.gz ubuntu/utopic
$ git-dpm update-patches
$ git-dpm import-dsc --branch ubuntu/utopic ../*dsc
Branch upstream-ubuntu/utopic supprimée (previously 9ce854d).
Applying '0001-Use-input-method-from-python-six.patch' ...
Applying '0002-do_not_collect_isos_in_cobbler_plugin.patch' ...
Applying '0003-collect-cloud-init-log.patch' ...
Applying '0004-fix-command-not-found.patch' ...
Applying '0005-get-interfaces.d.patch' ...
Applying '0006-Add-rabbitmq-log-collection.patch' ...
Applying '0007-Collect-upstart-logs.patch' ...
Applying '0008-Collect-squid-deb-proxy-info.patch' ...
Applying '0009-fix-ceilometer-stack.patch' ...
../sosreport_3.1-1ubuntu3.dsc successfully imported
To regenerate the patches, run git-dpm update-patches
$ git-dpm update-patches
From now on, each Quilt patch is one git commit :
$ git log --oneline
d76df59 update debian/patches directory
d9fe6a2 Import sosreport 3.1-1ubuntu3
defaa3a Import sosreport_3.1-1ubuntu3.dsc
15a7e70 fix ceilometer stack
b18a8c1 Collect squid-deb-proxy info
bb5ffbe Collect upstart logs
630047c Add rabbitmq log collection
e79d780 get-interfaces.d
e5e04a0 fix-command-not-found
c207db8 collect-cloud-init-log
56677ef do_not_collect_isos_in_cobbler_plugin
98d376c Use input method from python six
0dae684 Initialize git-dpm
9ce854d Update debian changelog
$ git checkout ubuntu/utopic
$ git checkout -b ubuntu/precise
$ ls debian/patches
**`0001-Use-input-method-from-python-six.patch`**` 0003-collect-cloud-init-log.patch 0005-get-interfaces.d.patch
0002-do_not_collect_isos_in_cobbler_plugin.patch 0004-fix-command-not-found.patch series
$ git-dpm checkout-patched
$ git rebase -i HEAD~5
and remove the commit that correspond to the patch that you want removed
$ git-dpm update-patches
$ ls debian/patches
0001-do_not_collect_isos_in_cobbler_plugin.patch 0003-fix-command-not-found.patch series
0002-collect-cloud-init-log.patch 0004-get-interfaces.d.patch
$ ls debian/patches
0001-do_not_collect_isos_in_cobbler_plugin.patch 0003-fix-command-not-found.patch series
0002-collect-cloud-init-log.patch 0004-get-interfaces.d.patch
$ git-dpm checkout-patched
$ patch -p1 < ~/src/sosreport/precise/fix_pysix_issue.patch
$ git commit -sa
fix pysix issue for precise
Some of the pysix functionalities expected are not available
in precise. Fix accordingly so it builds correctly
$ git-dpm update-patches
git-dpm: Calling merge-patched-into-debian first...
Branche patched-ubuntu/precise supprimée (précédemment 18302ec).
Patches updated...
You are now in branch 'ubuntu/precise'
$ ls debian/patches/
0001-do_not_collect_isos_in_cobbler_plugin.patch 0003-fix-command-not-found.patch 0005-fix-pysix-issue-for-precise.patch
0002-collect-cloud-init-log.patch 0004-get-interfaces.d.patch series
$ mkdir ~/workshop/builds/sosreport/sos-3.1-precise
$ tar --exclude-vcs --exclude=*.git-dpm -cf - . | $(cd ~/workshop/builds/sosreport/sosreport-3.1-precise;tar xf -)
$ pristine-tar checkout sosreport_3.1.orig.tar.gz
pristine-tar: successfully generated sosreport_3.1.orig.tar.gz
$ mv sosreport_3.1.orig.tar.gz ~/workshop/builds/sosreport
$ cd ~/workshop/builds/sosreport/sos-3.1-precise
$ debuild -S -us -uc
$ sbuild -A -d precise *dsc