Site Overlay

Compiling duplicity for OpenWRT

A couple of months ago, I already presented a method to compile duplicity for OpenWRT. With the release of oWRT’s Chaos Calmer, a few of the major obstacles have disappeared, while a couple of new but minor problems have come up. Here is how duplicity is compiled for the Chaos Calmer release.

No more patching

One of the main problems with duplicity under the Barrier Breaker buildroot was that it lacked the python-setuptools package which duplicity’s setup.py imports. The workaround was to patch the setup.py file in a way that all references to setuptools were replaced by the older distutils package.

The good news is: The Chaos Calmer release now ships with python-setuptools – no need for patches any longer. We can therefore delete the patc subdirectory from the ~/myowrt/custpacks/duplicity directory.

Update Makefile

Bump up PKG_VERSION, PKG_SOURCE_URL and PKG_MD5SUM to the most recent release (as of writing, this is version 0.7.07).

Update the DEPENDS variable as follows:

This means that we drop the python-expat and lockfile modules from our previous Barrier Breaker Makefile.

As fas as python-expat is concerned, it has been dropped from the Chaos Calmer package support, so we cannot list it as depends. This isn’t any problem though because the shared library which duplicity needs is already provided by python-xml (worth a thought whether we put this package into the DEPENS variable).

lockfile is a bit more tricky as it is a Python import which is invoked when running duplicity – but it is not needed for compilation. This is why we can “cheat” ourselves around this dependency by later running easy_install lockfile on the router (pip install lockfile does not seem to work) before installing our duplicity package. The problem with easy_install is that it only registers the modules in the local Python installation – and not in opkg‘s directory of installed packages. Therefore if duplicity checks for its installation depends it will not find the lockfile module even if it was installed. It is for that reason that we remove the lockfile entry from the depends list. The cleanest way would be to come up with a separate Python lockfile module which is installed by (and therefore later visible to) opkg.

Adapt files/setup.cfg.in

In the duplicity source directory, make sure that files/setup.cfg,in looks like that:

Get librsync

Now for the tricky part: duplicity will only compile if librsync headers are provided, but librsync package maintenance was also abandoned with the Chaos Calmer release. The cheapest way to cheat around this depend is to copy the librsync feed from the oldpackages/libs directory of the Barrier Breaker buildroot to the custom packages. This will provide librsync in version 0.9.7 – enough until we find a way to compile the recent 2.0 release of librsync.

Compile and install

We are now ready to compile the package. Launch  on your workstation and M-select the duplicity package. This should also select all dependencies at compile time. Check if librsync in the Libraries section has also been M-selected. Save the new menuconfig and start the compilation process:

Transfer the ipk-packages to your router and make a manual install with opkg.