Skip to content

whanulok/git-deb-pkg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-deb-pkg(1)

NAME

git-deb-pkg - lazy way to build Debian package using git.

SYNOPSIS

git deb-pkg [ options ] [ commands ]

DESCRIPTION

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

OPTIONS

general options

-t DIR|--templates-dir DIR

Directory where the debhelper files reside (default: '/usr/share/git-deb-pkg/templates').

-h|--help

Shows help screen.

git options

-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.

COMMANDS

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.

CONFIGURATION OPTIONS

git-deb-pkg stores variables in git repository options.

Variables

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.

HOW TO USE

Clone remote directory

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.

git

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

svn

mkdir git-project
cd git-project
git svn -i upstream clone clone http://remote.host/path/to/repository .

cvs

git cvsimport -d:pserver:[email protected]/path/to/repository \
    -r master -o master -a -C . -v module

Create the './debian' directory

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

build the package

To build the package from any branch, just type:

git deb-pkg build

build the source package

To build the source package from any branch, just type:

git deb-pkg source

publish package

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

keep package up to date

git

git checkout master
git fetch -a
git merge upstream

svn

git checkout master
git svn fetch
git merge upstream

UNDERSTANDING REVISION SCHEME

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)

SEE ALSO

  • git manpages.

  • debhelper manpages.

HISTORY

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.

BUGS

No time to include bugs, command actions might seldom lead astray user’s assumption.

AUTHORS

git-deb-pkg is written by Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>.

Copyright © 2010-2012 Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>.

Relesed under WTFPL (http://sam.zoy.org/wtfpl/COPYING).

About

lazy way to build Debian package using git

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 77.3%
  • Roff 22.0%
  • Other 0.7%