My first (real) debian repo
Up to now, whenever I've needed a backport or debian recompile, I've done it locally. But finally last night, instead of studying for this morning's exam, I decided to do it properly.
The tool for producing a debian archive tree is reprepro. There are a few howtos out there for it, but none of them quite covered everything I needed. So this is mine. But we'll get to that later, first we need to have some packages to put up.
For building packages, I decided to do it properly and use pbuilder. Just install it:
# aptitude install pbuilder cdebootstrap devscripts
Make the following changes to
MIRRORSITE=http://ftp.uk.debian.org/debian DEBEMAIL="Your Name <email@example.com>"
The first, to point to your local mirror, and the second to credit you in the packages.
Then, as root:
# pbuilder create --distribution etch --debootstrapopts --variant=buildd
Now, we can build a package, lets build the hello package:
$ mkdir /tmp/packaging; cd /tmp/packaging $ gpg --recv-key 3EF23CD6 $ dget -x http://ftp.uk.debian.org/debian/pool/main/h/hello/hello_2.2-2.dsc dpkg-source: extracting hello in hello-2.2 dpkg-source: unpacking hello_2.2.orig.tar.gz dpkg-source: applying ./hello_2.2-2.diff.gz $ cd hello-2.2/ $ debchange -n
dget and debchange are neat little utilities from
devscripts. You can configure them to know your name, e-mail address, etc. If you work with debian packages a lot, you'll get to know them well. Future versions of debchange support
--bpo for backports, but we use
-n which means new package. You should edit the version number in the top line to be a backport version, i.e.:
hello (2.2-2~bpo-sr.1) etch-backports; urgency=low * Rebuild for etch-backports. -- Your Name <firstname.lastname@example.org> Wed, 2 Apr 2008 22:24:30 +0100
Now, let's build it. We are only doing a backport, but if you were making any changes, you'd do them before the next stage, and list them in the changelog you just edited:
$ cd .. $ dpkg-source -sa -b hello-2.2-2~bpo/ $ sudo pbuilder build hello_2.2-2~bpo-sr.1.dsc
Assuming no errors, the built package will be sitting in
Now, for the repository:
$ mkdir ~/public_html/backports $ cd ~/public_html/backports $ mkdir conf $ cat > conf/distributions << EOF Origin: Your Name Label: Your Name's Backports Suite: stable-backports Codename: etch-backports Version: 4.0 Architectures: i386 all source Components: main Description: Your Name's repository of etch backports. SignWith: ABCDABCD NotAutomatic: yes EOF
This file defines your repository. The codename will be the distribution you list in your
sources.list. The version should match it. The architectures are the architectures you are going to carry - "all" refers to non-architecture-specific packages, and source to source packages. I added amd64 to mine. SignWith is the ID of the GPG key you are going to use with this repo. I created a new DSA key for the job. NotAutomatic is a good setting for a backports repo, it means that packages won't be installed from here unless explicitly requested (via
Let's start by importing our source package:
$ cd /tmp/packaging $ debsign -kABCDABCD hello_2.2-2~bpo-sr.1.dsc $ cd ~/public_html/backports $ reprepro -P optional -S devel --ask-passphrase -Vb . includedsc etch-backports /tmp/packaging/hello_2.2-2~bpo-sr.1.dsc
(There is currently a known bug in reprepro's command-line handling.
-P are swapped.)
Now, let's import our binary package:
$ reprepro --ask-passphrase -Vb . includedeb etch-backports /var/cache/pbuilder/result/hello_2.2-2~bpo-sr.1_i386.deb
Reprepro can be automated with it's
processincoming command, but that's beyond the scope of this howto.
Test your new repository, add it to your
deb http://example.com/~you/backports etch-backports main # aptitude update # aptitude install hello=2.2-2~bpo-sr.1
Enjoy. My backports repository can be found here.