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:
Make the following changes to /etc/pbuilderrc
:
The first, to point to your local mirror, and the second to credit you in the packages.
Then, as root:
Now, we can build a package, lets build the hello package:
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.:
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:
Assuming no errors, the built package will be sitting in /var/cache/pbuilder/result/
.
Now, for the repository:
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 package=version
or -d etch-backports
).
Let's start by importing our source package:
(There is currently a known bug in reprepro's command-line handling. -S
and -P
are swapped.)
Now, let's import our binary package:
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 /etc/apt/sources.list
Enjoy. My backports repository can be found here.
Comments
Pingback
Thanks for this!
There is so much information out there on how to package for Debian and Ubuntu, but not much at all about how to package for yourself. I guess they don’t realize that people want to make packages they don’t feel applicable for public use. Thanks so much for this article.
Post new comment