This might be a stupid question but I'm build a custom Debian package with the following command:

dpkg-deb --build sources/ my_package.deb

The sources directory is about 7MB and the resulting package is about 35MB.

How is this possible? Am I missing something?

I'm using Git with this source code but I delete the sources/.git directory before I build the package.



  • You should really check what is taking up that much space in your .deb. Statically linking libraries can make the compiled files bigger, but I doubt that it would grow that much… – Attila O. Feb 21 '13 at 17:49
  • Use dpkg-deb -c blah.deb to list the files inside along with the sizes. – mgorven Feb 21 '13 at 17:53
  • 1
    This isn't a forum, please don't change the title to include "solved". Just accept the answer which helped you, or if none did, post your own answer and accept it. – mgorven Feb 21 '13 at 18:08
  • If an answer was correct, you should select the checkmark next to it. That indicates the problem has been solved. If you solved it, but no answers provided were helpful, then you should write your own and select that. – Jeff Ferland Feb 21 '13 at 18:10

Most applications compile to be larger than their source code. This is especially true if the code you're building from generates resources such as images during the build process. View the actual contents of what it has for files inside it and judge by that. Use dpkg -c $FILE. (dpkg quick reference)

The sources/.git shouldn't be a factor whether you remove it or not.

  • Thanks for the suggestion of dpkg -c $FILE, I've found out that there was a .git/ "hidden" in my directory tree. My package is now of 1.7 MB ! (It's only scripts and assets so no code is really compiled) – Chewie Feb 21 '13 at 18:00
  • If a .git path is entering your package, you should rewrite the packaging scripts to ignore any unexpected ".*" files. – Jeff Ferland Feb 21 '13 at 18:03

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.