dunetna

[debian] [free software] [free knowledge] [sharing]


Recipe under construction

Creating a new package with git

Description: Basic steps to create a new package with git. This page does not pretend to b a packging tutorial.

Language(s): English

Download the upstream package. Repack it if it is needed. Suppose you have a file with format package_name-version.tar.gz. Let's create our git repo:

PKGNAME=package_name
VERSION=version  
mkdir $PKGNAME; cd $PKGNAME
git init

Check that user.name and user-email have the right values:

git config user.name '<Your name>'
git config user.email '<Your email>'

Import upstream sources to your repository:

gbp import-orig -u $VERSION --pristine-tar ../$PKGNAME-$VERSION.tar.gz  

If you miss to add –pristine-tar option, you can generate it later wit the following command:

pristine-tar commit ../$PKGNAME_-$VERSION.orig.tar.gz

In the parent folder you have a link named PKGNAME_VERSION.orig.tar.gz to your original .tar.gz upstream file. Let's create the debian directory:

# license can be gpl, gpl2, gpl3, lgpl, lgpl2, lgpl3, artistic, apache, bsd or mit. 
# See man dh_make, option -c
LICENSE=license 
dh_make -c LICENSE -f ../PKGNAME_VERSION.orig.tar.gz -p PKGNAME_VERSION
git add debian/
git commit -m "Create debian directory via dh_make"

Remove all unneeded files in debian directory (it depends on your package):

git rm debian/README.Debian debian/README.source ...
git commit -m "Remove all unneeded dh_make templates"

Stuff that always must be done:

  • Close the ITP bug
  • Add building dependencies (almost always)
  • Add runtime dependencies (not so frequently)

If you're impatient, you can try to build it now… In fact, after each change you do, you can try to build the package. See how to build the package below. More change you will do:

  • Update Section, Priority, Homepage and Description fields.
  • Update debhelper compatibility
  • Update copyright
  • Update menu file, adding an icon if it is necessary
  • Update watch file
  • Install files that are not installed automatically: icons, man pages,…
  • Adapt debian/rules to your needs
  • Unapply patches after building

If you have to change the source code, you should use quilt. First, add .pc directory (and optionally .gitignore) to .gitignore:

echo -e ".gitignore\n.pc" > .gitignore

Now you can change the code with:

quilt new new-patch-name.patch
quilt edit files-to-change
quilt refresh

To build the package you can use git-buildpackage:

git buildpackage

or better (but slower):

git buildpackage --git-pbuilder

To check that every thing is ok:

lintian -i -I --show-overrides --pedantic ../$PKGNAME_$VERSION-1_i386.changes

Sign the package:

debsign $PKGNAME*.changes

Upload the package

dput $PKG_NAME*changes

Remember to tag your last commit:

git-buildpackage --git-tag-only

And push if you haven't done it before:

git push alioth
git push alioth --tags

Set up a remote repository in collab-maint in allioth (or inthe corresponding team):

ssh git.debian.org
umask 002
cd /git/collab-maint/
./setup-repository $PKGNAME '$PKGNAME Debian packaging'
exit

git config gitweb.owner '<Your name>'

git remote add alioth ssh://git.debian.org/git/collab-maint/$PKGNAME.git
git push alioth master 
git push alioth upstream
git push alioth pristine-tar

More info: https://wiki.debian.org/Alioth/Git