"dpkg-source: unrepresentable changes to source" when trying to debuild a modified package

Solution 1:

Thanks to joeytwiddle's answer as it gave me a great place to start in my solution to this issue.

In my Python project that I attempted to create a debian package for, I am using:

  • pybuild to prepare the debian package before running debuild
  • git for version control
  • PyCharm IDE for the Python development

git creates a .git directory, pybuild creates a .pybuild directory and PyCharm creates a .idea directory all in the root of my project.

Because joeytwiddle mentioned that debuild didn't like a certain file (in his case a swp file) then I felt it probably had a fit about the hidden directories. I found out that for git, you can do: debuild -i and it ignores version control directories for as for the pybuild and idea directories, I have not found another option yet. So for my solution, I copied over my project to a blank directory, deleted .git, .idea, and .pybuild directories and success!

Solution 2:

This has tripped me up more than once before. Sometimes I thought the reason for debuild errors after changing the source was that after the source has been changed, the package maintainers signature (signoff) is no longer valid for that source.

But actually in this case the answer was simple:

dpkg-source: error: cannot represent change to gkrellweather-2.0.8/.gkrellweather.c.swp: binary file contents changed

The problem is that Vim had created a swafile, and debuild didn't like that!

The solution was simple: remove the swapfile, and then building can work:

$ rm ./.gkrellweather.c.swp
$ debuild