Differences between revisions 41 and 42
Revision 41 as of 2013-01-03 16:07:56
Size: 8885
Editor: ?MathieuParent
Comment:
Revision 42 as of 2013-01-03 16:12:16
Size: 8906
Editor: ?MathieuParent
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
{{{#!wiki debian
Line 11: Line 12:
}}}

General note

  • /!\ The below sections (Guidelines for packaging Horde3 with Git) are outdated. Since Horde 4, we follow a traditionnal GitPackagingWorkflow with the following branches:

  • upstream-sid
  • (if needed) upstream+repack-sid
  • debian-sid

Some tools are provided to ease packaging. See: http://anonscm.debian.org/gitweb/?p=pkg-horde/horde4/tools.git;a=blob;f=README


(Outdated) Guidelines for packaging Horde3 with Git

See http://lists.alioth.debian.org/pipermail/pkg-horde-hackers/2009-March/003058.html.

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 patches), debian-sid, debian-etch, debian-lenny.
  • Use pristine-tar for upstream and Debian sources

Howto

Prerequisites

Some packages should be installed

sudo apt-get install git-core pristine-tar git-buildpackage git-load-dirs

New repository 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 DEBPKGNAME.git
/path$ cd 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 add origin ssh://LOGIN@git.debian.org/git/pkg-horde/DEBPKGNAME.git
# commands to track all branches
/path/DEBPKGNAME.git$ git config branch.upstream.remote origin
/path/DEBPKGNAME.git$ git config branch.upstream.merge refs/heads/upstream
/path/DEBPKGNAME.git$ git config branch.upstream+patches.remote origin
/path/DEBPKGNAME.git$ git config branch.upstream+patches.merge refs/heads/upstream+patches
/path/DEBPKGNAME.git$ git config branch.upstream+repack.remote origin (if needed!)
/path/DEBPKGNAME.git$ git config branch.upstream+repack.merge refs/heads/upstream+repack (if needed!)
/path/DEBPKGNAME.git$ git config branch.pristine-tar.remote origin
/path/DEBPKGNAME.git$ git config branch.pristine-tar.merge refs/heads/pristine-tar
# push all
/path/DEBPKGNAME.git$ git push --all 

Repack upstream (if needed!)

/path/DEBPKGNAME.git$ git checkout upstream+repack
# Create a shell script, and commit it in debian/
/path/DEBPKGNAME.git$ sh /tmp/cleanup-upstream.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

# create branch
/path/DEBPKGNAME.git$ git checkout -b debian-sid upstream+repack
# track branch
/path/DEBPKGNAME.git$ git config branch.debian-sid.remote origin
/path/DEBPKGNAME.git$ git config branch.debian-sid.merge refs/heads/debian-sid
# Hack and commit
/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/DEBPKGNAME.git$ git checkout debian-sid
/path/DEBPKGNAME.git$ dch -v NEWVERSION
hack hack...
/path/DEBPKGNAME.git$ git commit -a -m "New changelog"
hack hack...

Build Debian package

/path/DEBPKGNAME.git$ pristine-tar checkout DEBPKGNAME*.orig.tar.gz
/path/DEBPKGNAME.git$ mv DEBPKGNAME*.orig.tar.gz ..
/path/DEBPKGNAME.git$ git checkout debian-sid
/path/DEBPKGNAME.git$ git-buildpackage -us -uc --git-pristine-tar --git-upstream-branch=upstream+repack --git-debian-branch=debian-sid

Accessing an existing repository

cd /path
# If you have only read-only access, use git:// or http://
/path$ git clone --no-checkout ssh://LOGIN@git.debian.org/git/pkg-horde/DEBPKGNAME.git DEBPKGNAME.git
cd DEBPKGNAME.git
# Checkout branches which you want
git checkout -b upstream origin/upstream
git checkout -b upstream+repack origin/upstream+repack #(if exists!)
git checkout -b upstream+patches origin/upstream+patches
git checkout -b pristine-tar origin/pristine-tar
git checkout -b debian-sid origin/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 branch --track debian-sid origin/debian-sid
/path/DEBPKGNAME.git$ git checkout 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
/path/DEBPKGNAME.git$ git commit -m "merge from upstream"

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

4. Check Debian changes in upstream source and put them in upstream+patches branch (if needed)

Check changes in diff.gz file (for example, zgrep +++ *diff.gz). If there are, add git patch stuff in debian/rules.

See http://git.debian.org/?p=pkg-horde/horde3.git;a=commitdiff;h=bb953be969e2944f8aa91c825a35b3ffe6a82e71;hp=d41f4d934c07c7226de1ed5d7dab5fe851f2c3cd#patch2

5. VERY 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 (replace "git-update-ref" to "git update-ref" on line 24).

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


CategoryGit