title | section | header | footer | author | date | adjusting | hyphenate | |
---|---|---|---|---|---|---|---|---|
git-deb-pkg |
1 |
User manual |
git-deb-pkg |
|
2016-02-09 06:37:24 -0800 |
b |
true |
git-deb-pkg - lazy way to build Debian package using git
git deb-pkg [ options ] [ commands ]
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.
- Keep ./debian in a specific git branch.
-t DIR|--templates-dir DIR : Directory where the debhelper files reside (default: /usr/share/git-deb-pkg/templates).
-h|--help : Shows help screen.
-u BRANCH|--upstream-branch BRANCH : Upstream branch (default: upstream).
-d BRANCH|--debian-branch BRANCH : Debian branch (default: debian).
-U|--no-upstream-update : Do not update upstream branch.
-C|--no-changelog-update : Do not update debian changelog.
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 set-defaults
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
To build the package from any branch, just type:
git deb-pkg build
To build the source package from any branch, just type:
git deb-pkg source
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
git checkout master
git fetch -a
git merge upstream
git checkout master
git svn fetch
git merge upstream
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)
git(1), debhelper(7).
2016/02/09 : Update template directory
2016/01/11 : create debian patch when modifing autoconf.ac
2012/01/10 : Add set-defaults option.
2011/12/09 : Fix DpkgVersion 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.
No time to include bugs, command actions might seldom lead astray user's assumption.
Copyright © 2010-2016 Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>.
Relesed under WTFPL (http://sam.zoy.org/wtfpl/COPYING).