Differences between revisions 13 and 14
Revision 13 as of 2009-04-26 17:27:03
Size: 5921
Comment: Improve a lot :)
Revision 14 as of 2009-04-26 17:28:00
Size: 5919
Comment:
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
Note: please use a --bare repository. We will have a clean Gitweb URL like http://git.debian.org/?p=pkg-horde/DEBPKGNAME.git Note: please use a bare repository. We will have a clean Gitweb URL like http://git.debian.org/?p=pkg-horde/DEBPKGNAME.git

Policy

  • One Git repository for each package : /git/pkg-horde/DEBPKGNAME.git on alioth (please use bare repository)
  • Branches: upstream, upstream+repack (if needed), upstream+patches, debian-sid, debian-etch, debian-lenny.
  • Use pristine-tar for upstream and Debian sources

Howto

New repo for new package

Init git repository on alioth:

/git/pkg-horde$ mkdir DEBPKGNAME.git
/git/pkg-horde$ cd DEBPKGNAME.git
/git/pkg-horde/DEBPKGNAME.git$ git --bare init

Note: please use a bare repository. We will have a clean Gitweb URL like http://git.debian.org/?p=pkg-horde/DEBPKGNAME.git and not http://git.debian.org/?p=pkg-horde/DEBPKGNAME.git/.git with a non-bare repository

Configure the repository:

/git/pkg-horde/DEBPKGNAME.git$ echo "Debian Horde Packages repository: DEBPKGNAME package" > description
/git/pkg-horde/DEBPKGNAME.git$ git config --add hooks.mailinglist "pkg-horde-hackers@lists.alioth.debian.org"
/git/pkg-horde/DEBPKGNAME.git$ echo "exec /usr/local/bin/git-commit-notice" >> hooks/post-receive
/git/pkg-horde/DEBPKGNAME.git$ chmod +x hooks/post-receive

Init your own repository:

# fetch upstream sources
/path$ wget upstream.tar.gz 
/path$ tar -xvf upstream.tar.gz
/path$ mv upstream 
/path$ cd rep DEBPKGNAME.git
# init Git repository
/path/DEBPKGNAME.git$ git init
/path/DEBPKGNAME.git$ git add .
/path/DEBPKGNAME.git$ git commit -m "Import PKGNAME VERSION" 
# create branches
/path/DEBPKGNAME.git$ git branch -m master upstream
/path/DEBPKGNAME.git$ git branch upstream+patches upstream
/path/DEBPKGNAME.git$ git branch upstream+repack upstream (if needed!)
# pristine-tar upstream sources
/path/DEBPKGNAME.git$ pristine-tar commit ../upstream.tar.gz

Push all to alioth repository:

/path/DEBPKGNAME.git$ git remote origin ssh://LOGIN@git.debian.org/git/pkg-horde/DEBPKGNAME.git
# TODO: command to track all branches
/path/DEBPKGNAME.git$ git push --all 

Repack upstream (if needed!)

# repack upstream
/path/DEBPKGNAME.git$ git checkout upstream+repack
/path/DEBPKGNAME.git$ sh cleanup-git.sh
/path/DEBPKGNAME.git$ git commit -a -m repack
/path/DEBPKGNAME.git$ tar --exclude .git -czf ../upstream+debian0.orig.tar.gz .
/path/DEBPKGNAME.git$ pristine-tar commit ../upstream+debian0.orig.tar.gz upstream+repack

If you don't need repack, don't forget to commit .orig.tar.gz:

/path/DEBPKGNAME.git$ mv ../upstream.tar.gz ../DEBPKGNAME_VERSION.orig.tar.gz
/path/DEBPKGNAME.git$ pristine-tar commit ../DEBPKGNAME_VERSION.orig.tar.gz

First Debianization

/path/DEBPKGNAME.git$ git checkout -b debian-sid upstream+repack
/path/DEBPKGNAME.git$ mkdir debian && hack hack....
/path/DEBPKGNAME.git$ git add debian && git commit -m "First Debian packaging"

New upstream release

# Fetch new source
/path$ wget newupstream.tar.gz
/path$ tar -xvf newupstream.tar.gz
/path$ cd DEBPKGNAME.git
/path/DEBPKGNAME.git$ git checkout upstream
/path/DEBPKGNAME.git$ git_load_dirs -s 'Import new upstream sources' ../newupstream/
/path/DEBPKGNAME.git$ pristine-tar commit ../newupstream.tar.gz
# Merge new sources to upstream+patches branch
/path/DEBPKGNAME.git$ git checkout upstream+patches
/path/DEBPKGNAME.git$ git merge upstream
# Merge new sources to upstream+repack branch (if needed!)
/path/DEBPKGNAME.git$ git checkout upstream+repack
/path/DEBPKGNAME.git$ git merge upstream
hack... hack... if need of new repack
# Store .orig.tar.gz tarball
/path/DEBPKGNAME.git$ tar --exclude .git -czf ../newupstream+debian0.orig.tar.gz .
/path/DEBPKGNAME.git$ pristine-tar commit ../upstream+debian0.orig.tar.gz upstream+repack

New Debian package with new upstream

/path/DEBPKGNAME.git$ git checkout debian-sid
/path/DEBPKGNAME.git$ git merge upstream+repack
/path/DEBPKGNAME.git$ dch -v NEWVERSION
hack hack...
/path/DEBPKGNAME.git$ git commit -a -m "New changelog"
hack hack...

New Debian package

/path/rep$ git checkout debian-sid
/path/rep$ dch -v NEWVERSION
hack hack...
/path/rep$ git commit -a -m "New changelog"
hack hack...

Build Debian package

/path/rep$ git checkout debian-sid
/path/rep$ git-buildpackage -us -uc --git-pristine-tar --git-upstream-branch=upstream+repack --git-debian-branch=debian-sid

Notes about migration from GNU Arch to Git

Migration is done with git-archimport.

# Migration of all GNU Arch repo 
git-archimport -v pkg-horde-hackers@lists.alioth.debian.org--2006

It's done in /git/pkg-horde/archimport.git on alioth.

Steps are :

1. Create a new repository (--bare repo on alioth with upstream branches)

  • [SEE ABOVE]

2. Push GNU Arch branch to your new repository

~$ cd /git/pkg-horde/archimport.git
/git/pkg-horde/archimport.git$ git remote add DEBPKGNAME /git/pkg-horde/DEBPKGNAME.git/
/git/pkg-horde/archimport.git$ git push DEBPKGNAME pkg-horde-hackers@lists.alioth.debian.org--2006,PKGNAME--sid--VERSION:refs/heads/debian-sid

3. Merge upstream (or upstream-repack) to debian-sid branch

/path/DEBPKGNAME.git$ git pull
/path/DEBPKGNAME.git$ git checkout -b debian-sid origin/debian-sid
/path/DEBPKGNAME.git$ cp -pr debian/ /tmp/
/path/DEBPKGNAME.git$ /usr/lib/git-core/git-merge-resolve upstream+repack (or git-merge-stupid!)
/path/DEBPKGNAME.git$ cp -pr /tmp/debian/ .
/path/DEBPKGNAME.git$ git reset HEAD debian

Note: I'm aware it's a dirty way. Comments welcome!

4. VERY IMPORTANT: give ancestor to debian-sid branch for future merges

Download git-merge-unrelated-branch script from http://wingolog.org/archives/2008/10/14/merging-in-unrelated-git-branches

/path/DEBPKGNAME.git$ git checkout debian-sid
/path/DEBPKGNAME.git$ sh /tmp/git-merge-unrelated-branch . upstream+repack