George Shuklin
George Shuklin

Reputation: 7877

How to cleanup sources to rebuild package with dpkg-buildpackage?

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.

Upvotes: 8

Views: 20599

Answers (4)

Alex
Alex

Reputation: 1641

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

Upvotes: 5

George Shuklin
George Shuklin

Reputation: 7877

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:

  1. Repack neutron_2013.2.3.orig.tar.gz without neutron.egg-info
  2. Change md5sum/sha1sum/sha256sum and filesizes in neutron_2013.2.3-0ubuntu1~cloud0.dsc
  3. Unpack source again with dpkg-source -x neutron_2013.2.3-0ubuntu1~cloud0.dsc
  4. (patch/bump version)
  5. dpkg-buildpackage -sa
  6. To pack again, remove in neutron-2013.2.3:
    1. rm -r build neutron.egg-info
    2. find . -name "*.py" | xargs rm
  7. dpkg-buildpackage -sa

Upvotes: 1

umläute
umläute

Reputation: 31274

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

Upvotes: 16

tripleee
tripleee

Reputation: 189327

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.

Upvotes: 2

Related Questions