Ubuntu – Include Binary Files in DEB package

bazaarbinarydebdpkgpackaging

I need to build a DEB package from mainly Node.js Javascript files, but it should include some binary files as well. They are listed inside debian/source/include-binaries. Otherwise I get the error message

dpkg-source: error: unrepresentable changes to source

The command in question is:

bzr builddeb -- -us -uc

After adding the file include-binaries, when running bzr builddeb — -us -uc again, now I get a different error: It says

dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/mailadmin_0.0-1.diff.n6m5_6

I have no idea how to get rid of this.

In the next line of output it tells me

dpkg-source: info: you can integrate the local changes with dpkg-source --commit

But if I run this command in the build area of my package, it gives me the unrepresentable changes to source error message again, even though debian/source/include-binaries is present in the build area as well.

I am missing the way out of this…

I tried deleting all files that are produced by the build process, still no success.

Further details:

The target directory is /opt/mailadmin. Since this directory is unusual, I listed it in the file debian/mailadmin.install (which contains one line:)

opt/mailadmin opt/

The bzr builddeb process uses this file as expected.

There is no upstream tarball, because the project is new.

Best Answer

Your error doesn't have anything to do with binary file. Though it does sound extremely similar. (Might be worth filing a bug on dpkg about better error messages in these cases.) If it was about a binary file it would look like:

dpkg-source: error: cannot represent change to package_name-X.Y/debian/some_binary_file.png: binary file contents changed

And even then, it would only happen if you were using an old style version 1.0 source package.

This has to do with the upstream tarball. If you're really using bzr builddeb -- -us -uc you must have convinced bzr builddeb you have an upstream tarball or it would have errored looking for one. The contents of whatever tarball you created don't match the contents of the bzr branch, so you get the error about "unexpected upstream changes."

The simplest way to deal with this case is to pass the --split flag:

bzr builddeb --split -- -us -uc

From bzr help builddeb:

  --split               Automatically create an .orig.tar.gz from a full
                        source branch.

This simply puts everything outside of /debian into a tarball and uses that.