Howto for Horde packages with GNU Arch

Here is a mini-howto deal with Horde packages with GNU Arch.
Thanks to Lionel Elie Mamane for his help (see Links section).

Keywords:

HORDE_APPLI is the name of horde module : forwards, imp, ...
VERSION_NUMBER is major number of horde version : e.g. 4 for imp 
DEB_PKG_NAME is debian's name of horde module : sork-forwards-h3, imp4, ...
HORDE_NUMBER is Horde's version number : e.g. 4.1.1 for imp
DEB_NUMBER is Debian's version number : e.g. 4.1.1-1 for imp
YOUR NAME is your name, probably first name and surname
MAIL@DOMAIN.TLD is your mail
ALIOTH-LOGIN is your Alioth login
YOUR-EDITOR is your preferred editor : vim, emacs, ...

First use of GNU Arch

Set your tla id (to put it on ~/.arch-params/=id file)

$ tla my-id "YOUR NAME <MAIL@DOMAIN.TLD>"

If you are afraid of spam and such, you can use something still guaranteed unique like "YOUR NAME <MAIL@invalid.DOMAIN.TLD>"

Register pkg-horde archive (to put it on ~/.arch-params/=locations directory)

$ tla register-archive sftp://ALIOTH-LOGIN@arch.debian.org/arch/pkg-horde/2006/
(Enter your password)

Set pkg-horde archive as your default archive (to put it on ~/.arch-params/=default-archive)

$ tla my-default-archive pkg-horde-hackers@lists.alioth.debian.org--2006

First commit of upstream sources

Create empty HORDE_APPLI--upstream--VERSION_NUMBER:

$ tla archive-setup -A pkg-horde-hackers@lists.alioth.debian.org--2006 \
HORDE_APPLI--upstream--VERSION_NUMBER

Download your Horde webapp and:

$ (tar xvf | (cvs co && rm CVS)) /path/HORDE_APPLI
$ cd /path/HORDE_APPLI

Set an empty tree for HORDE_APPLI--upstream--VERSION_NUMBER

$ tla init-tree HORDE_APPLI--upstream--VERSION_NUMBER

GNU Arch tries to help you not commit compiled or other non-source files (like .o for C sources) to the archive; it thus has a set of naming rules to recognise them. By default filenames starting with "." are forbidden to go to the archive, but horde apps use .htaccess files. So change the naming rules to accept these as sources:

$ echo "source ^\.htaccess$"  >> \{arch\}/\=tagging-method
$ YOUR-EDITOR `tla make-log`

Enter text to comment your operation, for example "Import from HORDE_APPLI HORDE_NUMBER"

$ tla inventory --names --both --source | xargs tla add-id
$ tla import

Note this "tla inventory" / "tla add-id" method is for educational example. You could use easy tla_load_dirs method if you prefer:

$ mkdir /path/HORDE_APPLI.tla.dir 
$ cd /path/HORDE_APPLI.tla.dir
$ tla init-tree HORDE_APPLI--upstream--VERSION_NUMBER
$ echo "source ^\.htaccess$"  >> \{arch\}/\=tagging-method
$ tla_load_dirs -s"Import from HORDE_APPLI HORDE_NUMBER" ../HORDE_APPLI

Be carefull, with version before 1.0.29 of tla_load_dirs, you must import manually after tla_load_dirs (due to a bug):

$ tla_load_dirs -n -s"Import from HORDE_APPLI HORDE_NUMBER" ../HORDE_APPLI
$ tla import

First commit of Debian package sources

Create HORDE_APPLI--sid--VERSION_NUMBER:

$ tla archive-setup -A pkg-horde-hackers@lists.alioth.debian.org--2006 \
HORDE_APPLI--sid--VERSION_NUMBER
$ tla tag HORDE_APPLI--upstream--VERSION_NUMBER--base-0 \
HORDE_APPLI--sid--VERSION_NUMBER

Debianize and test your package in /path/YOUR-DEB-PKG-SRC/ and:

$ cd /path/
$ tla get HORDE_APPLI--sid--VERSION_NUMBER
$ cd HORDE_APPLI--sid--VERSION_NUMBER

When you finish debianization of a file DEB_FILE:

$ tla add-id debian
$ tla add-id debian/DEB_FILE

And when you are ready:

$ YOUR-EDITOR `tla make-log`
$ tla commit

Note that tla_load_dirs is deprecated for this operation to avoid bad files like *.ex files from dh_make.

Build package for upload/test

$ cd /tmp/random_dir/

Get Debian sources:

$ tla get HORDE_APPLI--sid--VERSION_NUMBER DEB_PKG_NAME-HORDE_NUMBER

Clean sources (you could insert this in debian/rules):

$ for i in `find ./DEB_PKG_NAME-HORDE_NUMBER/ -name ".arch-ids" `; do rm -rf $i; done
$ for i in `find ./DEB_PKG_NAME-HORDE_NUMBER/ -name "{arch}" `; do rm -rf $i; done

Get upstream sources (we use original source to build) and rename tarball:

$ wget ftp://ftp.horde.org/pub/HORDE_APPLI/HORDE_APPLI_HORDE_NUMBER.tar.gz
$ mv HORDE_APPLI_HORDE_NUMBER.tar.gz DEB_PKG_NAME_HORDE_NUMBER.orig.tar.gz

Note: if there is a wrapper "debian/cleanup.sh" (it is the case of the horde3 package for example), use it for renaming/cleaning the tarball.

$ cd DEB_PKG_NAME-HORDE_NUMBER

build and verify:

$ debuild -S -i
$ lintian -v ../*changes
$ debuild
$ lintian -v ../*deb

pbuilder it:

$ cd ..
$ sudo pbuilder update
$ sudo pbuilder build *.dsc
$ lintian -v /var/cache/pbuilder/result/DEB_PKG_NAME*{deb,changes}

You can also use tla-buildpackage to build. See this post and tbp docs.

Here is a way to build/verify with tbp. First, init tree:

$ mkdir /path/tbp-debian
$ cd /path/tbp-debian
$ tla init-tree

And create file for debianized sources:

$ mkdir -p configs/debian/DEB_PKG_NAME
$ echo -n "./+packages/DEB_PKG_NAME/DEB_PKG_NAME-HORDE_NUMBER " \
> configs/debian/DEB_PKG_NAME/DEB_NUMBER
$ echo -n "pkg-horde-hackers@lists.alioth.debian.org--2006/" \
>> configs/debian/DEB_PKG_NAME/DEB_NUMBER
$ echo "HORDE_APPLI--sid--VERSION_NUMBER" \
>> configs/debian/DEB_PKG_NAME/DEB_NUMBER

Fetch and build (verify ~/.tla-buildpackage contains '/path/tbp-debian'):

$ tla buildcfg debian/DEB_PKG_NAME/DEB_NUMBER
$ cd +packages/DEB_PKG_NAME
$ wget ftp://ftp.horde.org/pub/HORDE_APPLI/HORDE_APPLI_HORDE_NUMBER.tar.gz
$ mv HORDE_APPLI_HORDE_NUMBER.tar.gz DEB_PKG_NAME_HORDE_NUMBER.orig.tar.gz
$ cd DEB_PKG_NAME-HORDE_NUMBER
$ tla-buildpackage -rfakeroot -us -uc
$ lintian -v ../*{changes,deb}

Modify Debian package sources

$ cd /tmp/random_dir/
$ tla get HORDE_APPLI--sid--VERSION_NUMBER
$ cd HORDE_APPLI--sid--VERSION_NUMBER--patch-NUMBER

Modify your package and:

YOUR-EDITOR `tla make-log`

Write changelog and:

$ tla (add-id|delete-idi|move-id|commit)

Please don't use tla_load_dirs for every semantically atomic operation you do (like fix one bug, implement one feature, ...)

New upstream release

Get sources:

$ cd /tmp/random_dir/
$ tla get HORDE_APPLI--upstream--VERSION_NUMBER \
HORDE_APPLI--upstream--VERSION_NUMBER
$ tla get HORDE_APPLI--sid--VERSION_NUMBER HORDE_APPLI--sid--VERSION_NUMBER

Download your new Horde webapp:

$ (tar xvf | (cvs co && rm CVS)) HORDE_APPLI

Import it in upstream branche:

$ cd HORDE_APPLI--upstream--VERSION_NUMBER
$ tla_load_dirs -s'Import HORDE_APPLI VERSION_NUMBER' ../HORDE_APPLI

And merge it in sid branche:

$ cd ../HORDE_APPLI--sid--VERSION_NUMBER
$ tla star-merge HORDE_APPLI--upstream--VERSION_NUMBER
$ tla commit -s'Merge with upstream'

Of course, don't forget your Debian work (Debian changelog, patches, etc.) and commit all:

$ dch -v DEB_NUMBER
$ YOUR-EDITOR `tla make-log`
$ tla commit 

Add Debian patches

Our "patch system" is GNU Arch itself (with branches for upstream and for sid) and built-in mechanism in dpkg.

Get Debian sources:

$ tla get HORDE_APPLI--sid--VERSION_NUMBER DEB_PKG_NAME-HORDE_NUMBER
$ cd HORDE_APPLI--sid--VERSION_NUMBER DEB_PKG_NAME-HORDE_NUMBER

Hack/import patches and commit:

$ tla commit

After a build, patches are in .diff.gz file.

When we import new upstream upstream sources, after the magic "tla star-merge", commiting can fail (generates *.rej files) and patches must be adapted/removed.

Links