How to cleanup sources to rebuild package with dpkg-buildpackage?
Solution 1
the debian/rules
file is actually a Makefile
, and it MUST (according to the Debian policy) have a clean target to cleanup the build.
if this target is not run automatically, you can call it explictely with something like:
dpkg-buildpackage -rfakeroot -Tclean
Solution 2
Another possibility is to use debuild
instead of calling dpkg-buildpackage
directly.
Simplest method is to build the binary packages along with unsigned source and unsigned changelog, cd to the debian/
directory of the source and:
$ debuild -uc -us
You can call the clean
target on debuild
to clean up.
$ debuild -T clean
Solution 3
The debian/rules
file is usually set up to clean out old build artefacts, but yours seems to have a bug, or simply lack this functionality. (Submit a bug report?)
Without more knowledge about your package, this is speculative, but try removing the build
directory.
In the worst case, start over by unpacking the sources anew.
Solution 4
Thanks everyone for help.
In my case problem was spitted into two parts:
- uncleaned files (and original package has no proper cleaning rules)
- Incorrectly packed neutron_2013.2.3.orig.tar.gz, with neutron.egg-info (it even added to .gitignore on repo on github)
So in my case solution was rather complex:
- Repack neutron_2013.2.3.orig.tar.gz without neutron.egg-info
- Change md5sum/sha1sum/sha256sum and filesizes in neutron_2013.2.3-0ubuntu1~cloud0.dsc
- Unpack source again with dpkg-source -x neutron_2013.2.3-0ubuntu1~cloud0.dsc
- (patch/bump version)
- dpkg-buildpackage -sa
- To pack again, remove in neutron-2013.2.3:
- rm -r build neutron.egg-info
- find . -name "*.py" | xargs rm
- dpkg-buildpackage -sa
George Shuklin
Updated on June 04, 2022Comments
-
George Shuklin almost 2 years
I'm playing with dpkg, but I got rather strange problem: Package can not be build second time after 1st package was successfully build.
dpkg-buildpackage -sa .... dpkg-source: warning: newly created empty file 'build/lib.linux-x86_64-2.7/neutron/api/__init__.py' will not be represented in diff (repeats 100500 times for different files).
How can I to rebuild deb second time?
It looks like I miss some cleanup command.