I downloaded the source to a package using:

$ apt-get source gkrellweather

I also made sure I had the compile dependencies:

$ sudo apt-get build-dep gkrellweather

And I tested that it could build fine:

$ cd gkrellweather-2.0.8
$ debuild

It built a .deb package in the folder above, which I could install using:

$ sudo dpkg -i ../gkrellweather*.deb

OK so everything is in place. Let's get started!

I opened up the source code in Vim and made some changes I wanted. Then I tried to rebuild:

$ debuild

But I got the following error:

dh_clean: Compatibility levels before 5 are deprecated (level 4 in use)
 dpkg-source -b gkrellweather-2.0.8
dpkg-source: warning: no source format specified in debian/source/format, see dpkg-source(1)
dpkg-source: info: using source format `1.0'
dpkg-source: info: building gkrellweather using existing gkrellweather_2.0.8.orig.tar.gz
dpkg-source: info: building gkrellweather in gkrellweather_2.0.8-2.diff.gz
dpkg-source: error: cannot represent change to gkrellweather-2.0.8/.gkrellweather.c.swp: binary file contents changed
dpkg-source: warning: the diff modifies the following upstream files: 
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -b gkrellweather-2.0.8 gave error exit status 1
debuild: fatal error at line 1357:
dpkg-buildpackage -rfakeroot -D -us -uc failed



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!

  • 3
    -i gets passed through debuild to dpkg-buildpackage and then to dpkg-source, whose man page says that a regexp can be provided. Without testing, I guess -i'(^|/)\.(git|idea|pybuild)($|/)' might work for you. – joeytwiddle Oct 8 '16 at 4:56

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.