debian mentors/ solvingcommonproblems/ Non-Free files

Non Free Files in the upstream tarball

When you have an upstream tarball that is mainly under a DFSG free license, but there are some files under a different license that is non-free you have a problem.

As the license is non-free you are usually not allowed to make distributions, and so even if they are not included in the resulting .debs. This would mean that you could not build a package out of the software, as Debian requires that each package has a source package and that that source package is distributable.

You don't have to panic though, as you can still package the software if you remove the non-free files. There are a few steps that you have to go through to do this, but they are not too complex.

Step 1: Repackaging upstream tarball.

The only way to ensure that the non-free files do not exist in the source package is to remove them from the upstream tarball. This means that you have to repackage it. We assume that we are repackaging gscruff, and that this package contains an RFC file (a common non-free file to be removed).

# First unpack the upstream tarball
tar xzf gscruff_1.0.orig.tar.gz
# Delete all non-free files
cd gscruff-1.0
rm rfc1234.txt
# Repack the tarball
cd ../
mv gscruff-1.0 gscruff-1.0.orig
tar czf gscruff_1.0.dfsg.orig.tar.gz gscruff-1.0.orig/

The reason that we add .dfsg to the tarball name is so that it is clear that it is not the upstream tarball.

If you have not created the package yet the follow the normal instructions but take note of the rest of the steps below.

If you already have the package then move all of your changes in to an unpacked version of this new tarball (otherwise the non-free files will just move to your .diff.gz). If you have not touched anything outside the debian/ directory then you can just copy this over. You will however have to change the version in debian/changelog to have the .dfsg string in it. If this is not the first version of the package to be uploaded mention the change in your changelog.

Step 2: Document what you have done.

For other people you should document what changes you have made and why. Create a debian/README.Debian-source file, and in there explain that you had to remove non free files, and which files they were.

This file doesn't need to be installed in to a .deb, but should be in the source package for as long as you repack the upstream tarball.

Step 3: Add get-orig-source rule.

See for a mention of this target.

This target should take the upstream tarball, and automate the repackaging that you yourself did in step 1.

This rule is not to be depended on by the normal build rules in debian/rules, i.e. it is not for use when building the package.

Also you should not rely on this when a new upstream version comes out, you should check the resulting tarball to check that all non-free files are removed.

See for an example of this target.

Some links on the subject