Special usage casesHandling non-DFSG clean upstream sourcesIf you have to handle non DFSG clean upstream sources you can use a
different branch which you have to create once:
&gitcmd; branch dfsg_clean upstream
This creates the dfsg_clean branch from the tip of a
branch called upstream. Then, when importing a new
upstream version, you import the new version on the
(by default named
upstream) as usual and just don't merge to the
debian-branch (by default named
master):
&git-import-orig; --no-merge /path/to/nondfsg-clean-package_10.4.orig.tar.gz
&gitcmd; 10.4
After the import you can switch to the dfsg_clean
branch and get the newly imported changes from the upstream branch:
&gitcmd; dfsg_clean
&gitcmd; . upstream
Now make this checkout dfsg clean (preverably by a cleanup script), commit
your changes and merge to your :
cleanup-script.sh
&gitcmd; commit -a -m "Make source dfsg clean"
&gitcmd; tag 10.4.dfsg
&gitcmd; checkout master
&gitcmd; pull .dfsg_cleanImporting NMUs
First create a branch that holds the NMUs from the tip of your
(default is master) once:
&gitcmd; nmumaster
To import an NMU change into the git repository and use &git-import-dsc;:
&gitcmd; checkout master
&git-import-dsc; =nmu/path/to/package_1.0-1nmu0.dsc
This will import the NMU onto the branched named nmu
instead of the default . This method can also
be used to import "old" releases into the &git; repository when migrating
to &git; from another VCS.
Using &pbuilder;
Since &pbuilder; uses different command line arguments than
&debuild; and &dpkg-buildpackage; we can't simply pass the options on the
command line but have to wrap them in the
option instead:
git-buildpackage
Note that we also used a different clean command since since &pdebuildcmd;
means something different than &debuildcmd;
.
The above is a bit long, so using a tiny script that gets invoked by
&git-buildpackage; is more convienient:
cat <<EOF >/usr/local/bin/gbp-pbuilder
#!/bin/sh
# pass commandline arguments to dpkg-buildpackage
pdebuild "-i\.git -I.git $*"
EOF
chmod a+x /usr/local/bin/gbp-pbuilder
This makes the above look like:
git-buildpackage
We can shorten this further by using ~/.gbp.conf:
cat <<EOF > ~/.gbp.conf
[DEFAULT]
# tell git-buildpackage howto clean the source tree
cleaner = fakeroot debian/rules clean
# this is how we invoke pbuilder, arguments passed to git-buildpackage will be
# passed to dpkg-buildpackge in the chroot
builder = /usr/local/bin/gbp-pbuilder
Invoking &git-buildpackage; will now invoke &pdebuildcmd; by
default and all additional command line arguments are passed to
dpkg-buildpackage. If you want to use debuild again (without modifying
~/.gbp.conf) you can use:
git-buildpackage --git-builder=debuild
Futhrermore, if you don't want this for all your invocations of
&git-buildpackage; you can use .git/gbp.conf in
one of your &git; repositories instead of
~/.gbp.conf.
Working on random packages
Whenever you need to work on an arbitrary Debian package you can check it
right into &git; with one command:
apt-get source --download-only package
git-import-dsc package*.dsc
cd package
git-branch debian
This puts the orig.tar.gz onto the and
the Debian patch onto a branch called debian. Now you
can easily modify the package, revert changes you made, create other
branches for testing, see what changes you made, etc.. When finished just
do
git-commit -a
git-diff debian --
to get a nice patch that can be submitted to the Debian BTS.