git deb-pkg offers a simple and easy way to manage Debian package generation using git (and other source code management system).
Both upstream and Debian code are kept in separated branches.
Features:
-
Update upstream from any SCM which git is capable of.
-
Checkout any file from any branch.
-
Cherry pick any commit
-
Few files to edit
- -t DIR|--templates-dir DIR
-
Directory where the debhelper files reside (default: '/usr/share/git-deb-pkg/templates').
- -h|--help
-
Shows help screen.
- init-debian
-
Init debian directory.
- set-defaults
-
Sets default options to git configuration.
- commit-debian
-
Commit the debian directory.
- build
-
Build debian package.
- source
-
Build debian source package only.
- show-version
-
Show all versions for the package.
- update-upstream
-
Update upstream branch.
- prepare
-
Prepare building environment.
- prepare-orig
-
Prepare upstream orig archive.
git-deb-pkg stores variables in git repository options.
- deb-pkg.scm
-
Specify the source code management system to use. Default: git.
- deb-pkg.upstream
-
Specify the branch to use as upstream code. Default: upstream.
- deb-pkg.debian
-
Specify the branch to use for debian package definition. Default: debian.
- deb-pkg.revision-scheme
-
Regexp to extract version number from 'git describe'. The git patchlevel '-PL-gTREEISH' is cut off before the regexp is applied. Default: 's/^v-\(.\+\)$/\1/;s/[-]/./g'. See UNDERSTANDING REVISION SCHEME.
- deb-pkg.cherrypick
-
Special commits to cherry pick. This option can occur many times. Order matters. Default: none.
- deb-pkg.checkout
-
Extra branch, directories or files to checkout before building the package. This option can occur many times. Order matters. The syntax of each item is: 'branch[:directory or file]'. Default: none.
First of all the upstream repository should be cloned the repository from a remote source. Depending on the remote used SCM the commands may differ.
mkdir git-project cd git-project git remote add upstream git://remote.host/path/to/repository git fetch --all git checkout -b upstream upstream/master git checkout master
mkdir git-project cd git-project git svn -i upstream clone clone http://remote.host/path/to/repository .
git cvsimport -d:pserver:[email protected]/path/to/repository \ -r master -o master -a -C . -v module
This is where the magic starts. git deb-pkg helps a lot for that part:
git deb-pkg init-debian
Package could be built using debuild command:
debuild --no-tgz-check -I.git -i'\.git/'
To cancel and return to previous branch (assuming it was 'master') just run:
debuild clean \ && git reset --hard \ && git checkout master \ && git branch -D debian-dev
Then a few files in the './debian' directory have to be updated, and commited:
debuild clean git deb-pkg commit-debian
This step is not mandatory unless you wish to publish your work:
git remote add origin [email protected]:/path/to/repository.git git push -u origin master
For example if the git tag is v-1.2 and 5 commits before the upstream branch, 'git describe' would produce something like:
v-1.2-5-gddf4ca0
Where:
-
v-1.2 is the current tag (understand upstram version)
-
5 is the number of commits after the current tag. This is the patch level ('PL')
-
ddf5ca0 is the current commit ID prefixed with 'g'. This is the git 'TREEISH'.
The regexp defined in 'deb-pkg.revision-scheme' variable is applied to the current tag ('v-1.2') and extracts the upstream version ('1.2').
The Debian package version would thus be: '1:1.2+git.5-1' which means:
-
version 1.2 of the upstream
-
git patch level 5
-
debian package revision 1
See the Debian policy manual, controle files and their fields, Version (http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version)
- 2012/01/10
-
Add set-defaults option.
- 2011/12/09
-
Fix Dpkg::Version invocation.
- 2011/09/19
-
Add source command.
- 2011/03/23
-
Use git configuration file for options.
- 2011/03/22
-
Change name from debian-builder to git-deb-pkg to git git tool suite.
- 2010/09/23
-
Initial release.
Copyright © 2010-2012 Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>.
Relesed under WTFPL (http://sam.zoy.org/wtfpl/COPYING).