reprepro manual
This manual documents reprepro, a tool to generate and administer
Debian package repositories.
Other useful resources:
Table of contents
Sections of this document:
What reprepro does
Reprepro is a tool to take care of a repository of Debian packages
(.dsc,.deb and .udeb).
It installs them to the proper places, generates indices of packages
(Packages and Sources and their compressed variants)
and of index files (Release and optionally Release.gpg),
so tools like apt know what is available and where to get it from.
It will keep track which file belongs to where and remove files no longer
needed (unless told to not do so).
It can also make (partial) partial mirrors of remote repositories,
including merging multiple sources and
automatically (if explicitly requested) removing packages no longer available
in the source.
And many other things (sometimes I fear it got a few features too much).
What reprepro needs
It needs some libraries (zlib, libgpgme, libdb (Version 3, 4.3 or 4.4)) and can be compiled with some more for additional features (libarchive,
libbz2).
Otherwise it only needs
apt's methods (only when downloading stuff),
gpg (only when signing or checking signatures),
and if compiled without libarchive it needs tar and ar installed.
If you tell reprepro to call scripts for you, you will of course need the interpreters for these scripts:
The included example to generate pdiff files needs python. The example to extract
changelogs needs dpkg-source.
What this manual aims to do
This manual aims to give some overview over the most important features,
so people can use them and so that I do not implement something a second
time because I forgot support is already there.
For a full reference of all possible commands and config options take a
look at the man page, as this manual might miss some of the more obscure
options.
generate a repository with local packages
- Choose a directory (or create it).
- Create a subdirectory called conf in there.
- In the conf/ subdirectory create a file called distributions,
with content like:
Codename: mystuff
Components: main bad
Architectures: sparc i386 source
or with content like:
Codename: andy
Suite: rusty
Components: main bad
Architectures: sparc i386 source
Origin: myorg
Version: 20.3
Description: my first little repository
(Multiple distributions are separated by empty lines, Origin, Version and Description
are just copied to the generated Release files, more things controlling reprepro can
appear which are described later).
- If your conf/distributions file contained a Suite: and you
are too lazy to generate the symbolic links yourself, call:
reprepro -b $YOURBASEDIR createsymlinks
- Include some package, like:
reprepro -b $YOURBASEDIR include mystuff mypackage.changes
or:
reprepro -b $YOURBASEDIR includedeb mystuff mypackage.deb
- Take a look at the generated pool and dists
directories. They contain everything needed to apt-get from.
Tell apt to include it by adding the following to your sources.list:
deb file:///$YOURBASEDIR mystuff main bad
or make it available via http or ftp and do the same http:// or ftp:// source.
mirroring packages from other repositories
This example shows how to generate a mirror of a single architecture with
all packages of etch plus security updates:
- Choose a directory (or create it).
- Create a subdirectory called conf in there (if not already existent).
- In the conf/ subdirectory create a file called distributions,
with content like (or add to that file after an empty line):
Origin: Debian
Label: Debian
Suite: stable
Version: 4.0
Codename: etch
Architectures: i386
Components: main
Description: Debian 4.0 etch + security updates
Update: - debian security
Log: logfile
Actually only Codename, Components, Architecture and Update is needed, the rest is just information for clients.
The Update line tells to delete everything no longer available (-),
then add the debian and security rules, which still have to be defined:
- In the conf/ subdirectory create a file called updates,
with content like (or add to that file after an empty line:):
or with content like:
Name: security
Method: http://security.debian.org/debian-security
Fallback: ftp://klecker.debian.org/debian-security
Suite: */updates
VerifyRelease: A70DAF536070D3A1|B5D0C804ADB11277
Architectures: i386
Components: main
UDebComponents:
Name: debian
Method: http://ftp2.de.debian.org/debian
Config: Acquire::Http::Proxy=http://proxy.myorg.de:8080
VerifyRelease: A70DAF536070D3A1|B5D0C804ADB11277
(If there are no Architecture, Components or UDebComponents, it will try all the distribution to update has. Fallback means a URL to try when the first cannot offer some file (Has to be the same method)).
- Tell reprepro to update:
reprepro -b $YOURBASEDIR update etch
- Take a look at the generated pool and dists
directories. They contain everything needed to apt-get from.
Tell apt to include it by adding the following to your sources.list:
deb file:///$YOURBASEDIR etch main
or make it available via http or ftp.
An apt-getable repository of Debian packages consists of two parts:
the index files describing what is available and where it is and the actual
Debian binary (.deb),
installer binary (.udeb),
and source (.dsc together with
.tar.gz or
.orig.tar.gz and
.diff.gz) packages.
While you do not know how these look like to use reprepro, it's always a good
idea to know what you are creating.
Index files
All index files are in subdirectories of a directory called
dists. Apt is very decided what names those should
have, including the name of dists.
Including all optional and extensional files, the hierarchy looks like this:
- dists
-
- CODENAME
-
Each distribution has it's own subdirectory here, named by it's codename.
- Release
-
This file describes what distribution this is and the checksums of
all index files included.
- Release.gpg
-
This is the optional detached gpg signature of the Release file.
Take a look at the section about signing for how to
active this.
- Contents-ARCHITECTURE.gz
-
This optional file lists all files and which packages they belong to.
It's downloaded and used by tools like
apt-file
to allow users to determine which package to install to get a specific file.
To activate generating of these files by reprepro, you need a Contents
header in your distribution declaration.
- COMPONENT1
-
Each component has it's own subdirectory here. They can be named whatever users
can be bothered to write into their sources.list, but
things like main, non-free and contrib are common.
But funny names like bad or universe are just as possible.
- source
-
If this distribution supports sources, this directory lists which source
packages are available in this component.
- Release
-
This file contains a copy of those information about the distribution
applicable to this directory.
- Sources
- Sources.gz
- Sources.bz2
-
These files contain the actual description of the source Packages. By default
only the .gz file created, to create all three add the
following to the declarations of the distributions:
DscIndices Sources Release . .gz .bz2
That header can also be used to name those files differently, but then apt
will no longer find them...
- Sources.diff
-
This optional directory contains diffs, so that only parts of the index
file must be downloaded if it changed. While reprepro cannot generate these
so-called pdiffs itself, it ships both with a program called rredtool
and with an example python script to generate those.
- binary-ARCHITECTURE
-
Each architecture has its own directory in each component.
- Release
-
This file contains a copy of those information about the distribution
applicable to this directory.
- Packages
- Packages.gz
- Packages.bz2
-
These files contain the actual description of the binary Packages. By default
only the uncompressed and .gz files are created.
To create all three, add the following to the declarations of the distributions:
DebIndices Packages Release . .gz .bz2
That header can also be used to name those files differently, but then apt
will no longer find them...
- Packages.diff
-
This optional directory contains diffs, so that only parts of the index
file must be downloaded if it changed. While reprepro cannot generate these
so-called pdiffs itself, it ships both with a program called rredtool
and with an example python script to generate those.
- debian-installer
-
This directory contains information about the .udeb
modules for the Debian-Installer.
Those are actually just a very stripped down form of normal .deb
packages and this the hierarchy looks very similar:
- binary-ARCHITECTURE
-
- Packages
- Packages.gz
- COMPONENT2
-
There is one dir for every component. All look just the same.
- SUITE -> CODENAME
-
To allow accessing distribution by function instead of by name, there are often
symbolic links from suite to codenames. That way users can write
deb http://some.domain.tld/debian SUITE COMPONENT1 COMPONENT2
instead of
deb http://some.domain.tld/debian CODENAME COMPONENT1 COMPONENT2
in their /etc/apt/sources.list and totally get
surprised by getting something new after a release.
Package pool
While the index files have a required filename, the actual files
are given just as relative path to the base directory you specify
in your sources list. That means apt can get them no matter what
scheme is used to place them. The classical way Debian used till
woody was to just put them in subdirectories of the
binary-ARCHITECTURE directories, with the exception
of the architecture-independent packages, which were put into a
artificial binary-all directory. This was replaced
for the official repository with package pools, which reprepro also uses.
(Actually reprepro stores everything in pool a bit longer than the official
repositories, that's why it recalculates all filenames without exception).
In a package pool, all package files of all distributions in that repository
are stored in a common directory hierarchy starting with pool/,
only separated by the component they belong to and the source package name.
As everything this has disadvantages and advantages:
- disadvantages
- different files in different distributions must have different filenames
- it's impossible to determine which distribution a file belongs to by path and filename (think mirroring)
- packages can no longer be grouped together in common subdirectories by having similar functions
- advantages
- the extremely confusing situation of having differently build packages with the same version if different distributions gets impossible by design.
- the source (well, if it exists) is in the same directory as the binaries generated from it
- same files in different distributions need disk-space and bandwidth only once
- each package can be found only knowing component and sourcename
Now let's look at the actual structure of a pool (there is currently no difference
between the pool structure of official Debian repositories and those generated by
reprepro):
- pool
-
The directory all this resides in is normally called pool.
That's nowhere hard coded in apt but that only looks at the relative
directory names in the index files. But there is also no reason to name
it differently.
- COMPONENT1
-
Each component has it's own subdirectory here.
They can be named whatever users
can be bothered to write into their sources.list, but
things like main, non-free and contrib are common.
But funny names like bad or universe are just as possible.
- a
-
As there are really many different source packages,
the directory would be too full when all put here.
So they are separated in different directories.
Source packages starting with lib are put into a
directory named after the first four letters of the source name.
Everything else is put in a directory having the first letter as name.
- asource
-
Then the source package name follows.
So this directory pool/COMPONENT1/a/asource/ would contain
all files of different versions of the hypothetical package asource.
- asource
-
- a-source_version.dsc
- a-source_version.tar.gz
-
The actual source package consists of its description file (.dsc)
and the files references by that.
- binary_version_ARCH1deb
- binary_version_ARCH2.deb
- binary2_version_all.deb
-
- di-module_version_ARCH1.udeb
-
Binary packages are stored here to.
So to know where a binary package is stored you need to know what its source package
name is.
- liba
-
As described before packages starting with lib are not stored
in l but get a bit more context.
- COMPONENT2
-
There is one dir for every component. All look just the same.
As said before, you don't need to know this hierarchy in normal operation.
reprepro will put everything to where it belong, keep account what is there
and needed by what distribution or snapshot, and delete files no longer needed.
(Unless told otherwise or when you are using the low-level commands).
Configuring a reprepro repository is done by writing some config files
into a directory.
This directory is currently the conf subdirectory of the
base directory of the repository,
unless you specify --confdir or set the
environment variable REPREPRO_CONFIG_DIR.
- options
-
If this file exists, reprepro will consider each line an additional
command line option.
Arguments must be in the same line after an equal sign.
Options specified on the command line take precedence.
- distributions
-
This is the main configuration file and the only that is needed in all
cases.
It lists the distributions this repository contains and their properties.
See First steps for a short example or the manpage
for a list of all possible fields.
- updates
-
Rules about where to download packages from other repositories.
See the section Mirroring / Updating
for more examples or the man page for a full reference.
- pulls
-
Rules about how to move packages in bulk between distributions
where to download packages from other repositories.
See the section Propagation of packages
for an example or the man page for full reference.
- incoming
-
Rules for incoming queues as processed by processincoming.
See Processing an incoming queue for more information.
Deciding when to generate
As reprepro stores all state in its database,
you can decide when you want them to be written to the dists/
directory.
You can always tell reprepro to generate those files with the export command:
reprepro -b $YOURBASEDIR export $CODENAMES
This can be especially useful, if you just edited conf/distributions
and want to test what it generates.
While that command regenerates all files, in normal operation reprepro will only
regenerate files where something just changed or that are missing.
With --export option you can control when this fill happen:
- never
- Don't touch any index files.
This can be useful for doing multiple operations in a row and not wanting to regenerate
the indices all the time.
Note that unless you do an explicit export or change the same parts later without that
option, the generated index files may be permanently out of date.
- silent-never
- Like never, but be more silent about it.
- changed
- This is the default behaviour since 3.0.1.
Only export distributions where something changed
(and no error occurred that makes an inconsistent state likely).
And in those distributions only (re-)generate files which content should have been changed
by the current action or which are missing.
- lookedat
- New name for normal since 3.0.1.
- normal
- This was the default behaviour until 3.0.0 (changed in 3.0.1).
In this mode all distributions are processed that were looked at without error
(where error means only errors happening while the package was open so have a chance
to cause strange contents).
This ensures that even after a operation that had nothing to do the looked at
distribution has all the files exported needed to access it. (But still only files
missing or that content would change with this action are regenerated).
- force
- Also try to write the current state if some error occurred.
In all other modes reprepro will not write the index files if there was a problem.
While this keeps the repository usable for users, it means that you will need an
explicit export to write possible other changes done before that in the same run.
(reprepro will tell you that at the end of the run with error, but you should not
miss it).
Distribution specific fields
There are a lot of conf/distributions headers to control
what index files to generate for some distribution, how to name
them, how to postprocess them and so on. The most important are:
Fields for the Release files
The following headers are copied verbatim to the Release file, if they exist:
,
,
,
,
(excluding a possible value "source"),
,
, and
,
.
Depending on the type of the index files, different files are generated.
No specifying anything is equivalent to:
DscIndices Sources Release .gz
DebIndices Packages Release . .gz
UDebIndices Packages . .gz
This means to generate Release, Sources.gz for sources,
Release, Packages and Packages.gz for binaries
and Packages and Packages.gz for installer modules.
The format of these headers is the name of index file to generate, followed
by the optional name for a per-directory release description
(when no name is specified, no file is generated).
Then a list of compressions:
A single dot (.) means generating an uncompressed index,
.gz means generating a gzipped output,
while .bz2 requests and bzip2ed file.
(.bz2 is not available when disabled at compile time).
After the compressions a script can be given that is called to generate/update
additional forms, see "Additional index files".
If there is a SignWith header, reprepro will try
to generate a Release.gpg file using libgpgme.
If the value of the header is yes it will use the first key
it finds, otherwise it will give the option to libgpgme to determine the
key. (Which means fingerprints and keyids work fine, and whatever libgpgme
supports, which might include most that gpg supports to select a key).
The best way to deal with keys needing passphrases is to use
gpg-agent.
The only way to specify which keyring to use is to set the
GNUPGHOME environment variable, which will effect all
distributions.
Reprepro can generate files called
dists/CODENAME/Contents-ARCHITECTURE.gz
listing all files in all binary packages available for the selected
architecture in that distribution and which package they belong to.
This file can either be used by humans directly or via downloaded
and searched with tools like
apt-file.
To activate generating of these files by reprepro, you need a Contents header in that distribution's declaration in conf/distributions,
like:
Contents:
Versions before 3.0.0 need a ratio number there, like:
Contents: 1
The number is the inverse ratio of not yet looked at and cached files to process in
every run. The larger the more packages are missing. 1 means to list everything.
The arguments of the Contents field and other fields control
which Architectures to generate Contents files for and which
Components to include in those. For example
Contents: udebs nodebs . .gz .bz2
ContentsArchitectures: ia64
ContentsComponents:
ContentsUComponents: main
means to not skip any packages, generate Contents for .udeb
files, not generating Contents for .debs. Also it is only
generated for the ia64 architecture and only packages in component
main are included.
Index files reprepro cannot generate itself, can be generated by telling
it to call a script.
using rredtool to generate pdiff files
Starting with version 4.1.0, the rredtool coming with reprepro
can be used as hook to create and update Packages.diff/Index files.
Unlike dak (which created the official Debian repositories) or the pdiff.py
script (see below) derived from dak, an user will only need to download
one of those patches, as new changes are merged into the old files.
To use it, make sure you have
diff and
gzip
installed.
Then add something like the following to the headers of the distributions
that should use this in conf/distributions:
DscIndices: Sources Release . .gz /usr/bin/rredtool
DebIndices: Packages Release . .gz /usr/bin/rredtool
the pdiff example hook script (generates pdiff files)
This example generates Packages.diff and/or
Sources.diff directories containing a set of
ed-style patches, so that people do not redownload the whole index
for just some small changes.
To use it, copy pdiff.example from the examples directory
into your conf directory.
(or any other directory, then you will need to give an absolute path later).
Unpack, if needed. Rename it to pdiff.py and make it executable.
Make sure you have
python3-apt,
diff and
gzip
installed.
Then add something like the following to the headers of the distributions
that should use this in conf/distributions:
DscIndices: Sources Release . .gz pdiff.py
DebIndices: Packages Release . .gz pdiff.py
More information can be found in the file itself. You should read it.
the bzip2 example hook script
This is an very simple example.
Simple and mostly useless,
as reprepro has built in .bz2 generation support,
unless you compiled it your own with --without-libbz2 or
with no libbz2-dev installed.
To use it, copy bzip.example from the examples directory
into your conf directory.
(or any other directory, then you will need to give an absolute path later).
Unpack, if needed. Rename it to bzip2.sh and make it executable.
Then add something like the following to the headers of the distributions
that should use this in conf/distributions:
DscIndices: Sources Release . .gz bzip2.sh
DebIndices: Packages Release . .gz bzip2.sh
UDebIndices: Packages . .gz bzip2.sh
The script will compress the index file using the
bzip2 program and tell
reprepro which files to include in the Release file of the distribution.
internals
TO BE CONTINUED
...
TO BE CONTINUED
There are two ways to get packages not yet in any repository into yours.
- includedsc, includedeb, include
-
These are for including packages at the command line.
Many options are available to control what actually happens.
You can easily force components, section and priority and/or choose to
include only some files or only in specific architectures.
(Can be quite useful for architecture all packages depending on some
packages you will some time before building for some of your architectures).
Files can be moved instead of copied and most sanity checks overwritten.
They are also optimized towards being fast and simply try things instead of
checking a long time if they would succeed.
- processincoming
-
This command checks for changes files in an incoming directory.
Being optimized for automatic processing (i.e. trying to checking
everything before actually doing anything), it can be slower
(as every file is copied at least once to sure the owner is correct,
with multiple partitions another copy can follow).
Component, section and priority can only be changed via the distribution's
override files. Every inclusion needs a .changes file.
This method is also relatively new (only available since 2.0.0), thus
optimisation for automatic procession will happen even more.
There are three commands to directly include packages into your repository:
includedeb, includedsc
and includechanges.
Each needs to codename of the distribution you want to put your package into
as first argument and a file of the appropriate type
(.deb, .dsc or
.changes, respectively) as second argument.
If no component is specified via --component
(or short -C), it will be guessed looking at its
section and the components of that distribution.
If there are no --section
(or short -S) option, and it is not specified
by the (binary or source, depending on the type) override file of the
distribution, the value from the .changes-file
is used (if the command is includechanges)
or it is extracted out of the file (if it is a
.deb-file, future versions might also try to
extract it from a .dsc's diff or tarball).
Same with the priority and the --priority
(or short -P) option.
With the --architecture (or short -A)
option, the scope of the command is limited to that architecture.
includdeb will add a Architecture all
packages only to that architecture (and complain about Debian packages for
other architectures).
include will do the same and ignore packages for
other architectures (source packages will only be included if the value
for --architecture is source).
To limit the scope to a specify type of package, use the
--packagetype or short -T
option. Possible values are deb, udeb and dsc.
When using the --delete option, files will
be moved or deleted after copying them.
Repeating the --delete option will also delete
unused files.
TO BE CONTINUED.
Using the processincoming command reprepro
can automatically process incoming queues.
While this is still improveable (reprepro still misses ways to send
mails and especially an easy way to send rejection mails to the
uploader directly), it makes it easy to have an directory where you
place your packages and reprepro will automatically include them.
To get this working you need three things:
The file conf/incoming
describes the different incoming queues.
As usual the different chunks are separated by empty lines.
Each chunk can have the following fields:
- Name
- This
is the name of the incoming queue, that processincoming
wants as argument.
- IncomingDir
- The actual directory to look for
.changes files.
- TempDir
- To ensure integrity of the processed files and their
permissions,
every file is first copied from the incoming directory to this directory.
Only the user reprepro runs as needs write permissions here.
It speeds things up if this directory is in the same partition as the pool.
- Allow
-
This field lists the distributions this incoming queue might inject packages
into.
Each item can be a pair of a name of a distribution to accept and a distribution
to put it into.
Each upload has each item in its Distribution: field
compared first to last to each of this items and is put in the first distribution
accepting it. For example
Allow: stable>etch stable>etch-proposed-updates mystuff unstable>sid
will put a .changes file with
Distribution: stable into etch.
If that is not possible (e.g. because etch has a
UploadersList option not allowing this) it will
be put into etch-proposed-updates.
And a .changes file with
Distribution: unstable will be put into sid, while
with Distribution: mystuff will end up in mystuff.
If there is a Default field, the Allow
field is optional.
- Default
-
Every upload not caught by an item of the Allow
field is put into the distribution specified by this.
If there is a Allow field, the Default
field is optional.
- Multiple
-
This field only makes a difference if a .changes file
has multiple distributions listed in its Distribution:
field.
Without this field each of those distributions is tried according to the
above rules until the package is added to one (or none accepts it).
With this field it is tried for each distribution, so a package can be upload
to multiple distributions at the same time.
- Permit
-
A list of options to allow things otherwise causing errors.
(see the manpage for possible values).
This field os optional.
- Cleanup
-
Determines when and what files to delete from the incoming queue.
By default only successfully processed .changes files
and the files references by those are deleted.
For a list of possible options take a look into the man page.
This field os optional.
conf/distribution for processincoming
There are no special requirements on the conf/distribution
file by processincoming. So even a simple
Codename: mystuff
Architectures: i386 source
Components: main non-free contrib bad
will work.
The Uploaders field can list a file limiting
uploads to this distribution to specific keys and
AlsoAcceptFor is used to resolve unknown names
in conf/incoming's Allow
and Default fields.
Getting processincoming called.
While you can just call reprepro processincoming manually,
having an incoming queue needing manual intervention takes all the fun out of
having an incoming queue, so usually so automatic way is chosen:
- Dupload and dput have ways to call an hook after an package was uploaded.
This can be an ssh to the host calling reprepro.
The disavantage is having to configure this in every
.dupload.conf on every host you want to upload and give
everyone access to ssh and permissions on the archive who should upload.
The advantage is you can configure reprepro to have interactive scripts or
ask for passphrases.
- Install a cron-job calling reprepro every 5 minutes. Cron is usually
available everywhere and getting the output sent by mail to you or a mailing
list is easy.
The annoying part is having to wait almost 5 minutes for the processing.
- Use something like inoticoming.
Linux has a syscall called inotify, allowing a program to be run whenever
something happens to a file.
One program making use of this is inoticoming. It watches a directory using
this facility and whenever a .changes file is completed
it can call reprepro for you.
(As this happens directly, make sure you always upload the .changes
file last, dupload and dput always ensure this).
This can be combined with Debian's cron-extension to have a program started at
boot time with the @reboot directive.
For example with a crontab like:
MAI