Upload own Ubuntu packages to reprepro repository

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

In the following article, it is explained how to upload your own Ubuntu packages to a reprepro repository. The packages are transferred in a folder on the repository server with dupload via scp and processed there via an inoticoming job from reprepro. In the examples shown, the client is running Ubuntu 12.10, and the server is running Ubuntu 12.04.2 with kernel 3.2.0-38-generic.

In the article Create Own apt repository using reprepro on Ubuntu, it is explained how to generate an own reprepro repository.

Installation

On the repository server

inoticoming[1] triggered actions, when files are added to a folder.

:~$ sudo apt-get install inoticoming

On the client

dupload[2] loads the Ubuntu packages from the repository server that is monitored by inoticoming.

:~$ sudo apt-get install dupload

Configuration

On the server

The configuration file incoming sets the rules and folders for uploads of new packages into the reprepro repository. The configuration file incoming is located in the /conf folder of the used reprepro repos.

:~$ vi packages/conf/incoming
Name: incoming
IncomingDir: /home/repository/incoming
Allow: precise
Cleanup: on_deny on_error
Tempdir: /home/repository/incoming_tmp
LogDir: /home/repository/incoming_log

The incoming rule is called by inoticoming via inoticoming:

:~$ inoticoming --logfile /home/repository/incoming_log/upload.log /home/repository/incoming/ \
> --stderr-to-log --stdout-to-log --suffix '.changes' \
> reprepro --waitforlock 100 processincoming incoming {} \;

Make sure that inoticoming runs under the same user account that manages the repository and uploads the packages. This ensures that the files and folders can be created and have the correct permissions.

:~$ ps -u repository
  PID TTY          TIME CMD
[...]
 3098 ?        00:00:00 inoticoming

On the client

First, an SSH key is transmitted to the server for authentication:

:~$ ssh-copy-id -i .ssh/key_rsa.pub repository@192.168.56.102

The dupload-configuration specifies how the packages are loaded into the rep:

:~$ vi .dupload.conf
package config;
$default_host = "tkpack";
$cfg{'tkpack'} = {
        fqdn => "192.168.56.102",
        method => "scp",
        login => "repository",
        incoming => "/home/repository/incoming/",
        # files pass on to dinstall which sends emails itself
        dinstall_runs => 1,
};

Upload packages to repository

You can then use dupload to upload a package to the repo from the client (in this case, without sending notification emails):

:~$ dupload -f --nomail -t tkpack tkmon_0.0.1-1_amd64.changes
dupload warning: mail options disabled, can't run `/usr/sbin/sendmail': No such file or directory
dupload note: no announcement will be sent.
Uploading (scp) to 192.168.56.102:/home/repository/incoming/
[ job tkmon_0.0.1-1_amd64 from tkmon_0.0.1-1_amd64.changes
 tkmon_0.0.1-1.dsc, size ok, md5sum ok, sha1sum ok, sha256sum ok
 tkmon_0.0.1-1.debian.tar.gz, size ok, md5sum ok, sha1sum ok, sha256sum ok
 tkmon_0.0.1.orig.tar.gz, size ok, md5sum ok, sha1sum ok, sha256sum ok
 tkmon_0.0.1-1_all.deb, size ok, md5sum ok, sha1sum ok, sha256sum ok
 tkmon_0.0.1-1_amd64.changes ok ]
Uploading (scp) to tkpack (192.168.56.102)
[ Uploading job tkmon_0.0.1-1_amd64
 tkmon_0.0.1-1.dsc 0.8 kB, ok (0 s, 0.81 kB/s)
 tkmon_0.0.1-1.debian.tar.gz 6.1 kB, ok (0 s, 6.07 kB/s)
 tkmon_0.0.1.orig.tar.gz 720.0 kB, ok (1 s, 720.00 kB/s)
 tkmon_0.0.1-1_all.deb 701.7 kB, ok (1 s, 701.66 kB/s)
 tkmon_0.0.1-1_amd64.changes 1.4 kB, ok (0 s, 1.43 kB/s) ]

On the server, inoticoming loads the packages with reprepro into the repository:

:~/incoming_log$ cat upload.log 
Will call action reprepro for: tkmon_0.0.1-1_amd64.changes
Exporting indices...
:~/incoming_log$ reprepro list precise 
precise|main|i386: tkmon 0.0.1-1
precise|main|amd64: tkmon 0.0.1-1
precise|main|source: tkmon 0.0.1-1

Troubleshooting

The following error occurs when using the upload method scpb, which is actually recommended in the dupload man page:

[...]
chmod: cannot access `tkmon_0.0.1-1.dsc': No such file or directory
chmod: cannot access `tkmon_0.0.1-1.debian.tar.gz': No such file or directory
chmod: cannot access `tkmon_0.0.1.orig.tar.gz': No such file or directory
chmod: cannot access `tkmon_0.0.1-1_all.deb': No such file or directory
chmod: cannot access `tkmon_0.0.1-1_amd64.changes': No such file or directory
dupload fatal error: ssh -x -l repository 192.168.56.102 'cd /home/repository/incoming/;chmod 0644 tkmon_0.0.1-1.dsc tkmon_0.0.1-1.debian.tar.gz tkmon_0.0.1.orig.tar.gz tkmon_0.0.1-1_all.deb tkmon_0.0.1-1_amd64.changes ;' failed
 at /usr/bin/dupload line 662

This error occurs because inoticoming is processing the uploaded packages too quickly. The packages have already been moved to the repository by reprepro, so dupload can no longer perform a chmod.

Workaround

The right permissions can be set with preupload-hook before the upload. This also allows you to upload using scpb.

[...]
$preupload{'file'} = 'chmod 644 %1',
$preupload{'deb'} = 'chmod 644 %1',
$cfg{'tkpack'} = {
        fqdn => "192.168.56.102",
        method => "scpb",
        login => "repository",
[...]

References

  1. inoticoming Ubuntu-package (packages.ubuntu.com)
  2. dupload Ubuntu-package (packages.ubuntu.com)

Author: Georg Schönberger

Translator: Alina Ranzinger

Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.


Related articles

Activate Hibernate in Ubuntu 12.04
Configure Locales in Ubuntu
Display and deactivate Firefox Browser Disk Cache