8

I'm developing debian packages and I have troubles with correctly defining 'Installed-Size' under DEBIAN/control.
I have created a script that continuously checks svn repository for new revisions, and if found some changes then calculates code's size (excluding DEBIAN folder) with du -s command and then this value is placed to 'Installed-size'.

DEBIAN/control file looks like follows:

Package: myfirstdebpackage
Version: 1.0
Architecture: all
Maintainer: me
Installed-Size: 16664
Depends: python (>=2.7), python-appindicator, python-numpy, python-suds
Section: extras
Priority: optional
Homepage: www.example.com
Description: My first deb package

Application's folder structure:

myfirstdebpackage/DEBIAN
myfirstdebpackage/usr/bin/myfirstdebpackage/<files>

First installation goes well (via apt repository) but after creating a newer version and trying to update package I got 'size-mismatch' or 'Hash Sum mismatch' error.

What's wrong?

Levi
  • 81
  • 1
  • 2

3 Answers3

2

I'm assuming that you are generating the binary package with the same version but with different content each time. Do not do that. This will confuse apt and many other tools, which expect and assume that each pkgname-version-arch tuple denotes a unique and different package.

Regarding the Installed-Size, dpkg-gencontrol would generate it automatically for you, but I'm assuming you are creating the DEBIAN/control file by hand. I'd recommend against that, because it means more manual work which is more prone to error.

Guillem Jover
  • 2,090
  • 2
  • 11
  • 16
  • 2
    Why the downvote? The proper way to set the Installed-Size is by using dpkg-gencontrol. It could be generated by hand, but that's rather unorthodox. to do so, you'd need to use the same algorithm, which is no longer the one documented in debian-policy, but the one referenced in https://bugs.debian.org/793499. Of course that has nothing to do with the error mentioned later on in the question, which is related to the meta indices being out of sync with the source and binary package, but that's not what the question was about. – Guillem Jover Apr 02 '21 at 14:04
  • Can you provide an example of how to use `dpkg-gencontrol`? I can't seem to get it to work without spitting errors at me – codejedi365 Mar 18 '23 at 23:49
  • In a source tree, its usage requires well formed `debian/control` and `debian/changelog` files, and if run as-is, also the `debian/tmp/DEBIAN/` directory. If the packages ships programs dynamically linked then you will want to run `dpkg-shlibdeps` beforehand. Then running `dpkg-gencontrol -p` should generate it (`-p` only necessary when `debian/control` contains multiple packages). But this is all necessarily really brief as it amounts to "How to package without a helper like debhelper", which I'd advise against, unless one really knows what they are doing. – Guillem Jover Mar 21 '23 at 02:48
0
Package: xx-xx-xx-app
Version: 1.0
Architecture: all
Essential: no
Priority: optional
Installed-Size: `du -ks usr|cut -f 1`
Maintainer: XXX Team
Description: XXX Service
  • this doesn't work with the `dpkg-deb --build` command. There is some pre-step, I'm clearly missing if this works for you. please add directions to your post – codejedi365 Mar 18 '23 at 20:01
-1

I don't expect that you should change that value manually. Instead, run debuild (part of devscripts package) in the root directory of the package. A binary package will be created in that root's parent directory and will, of course, have the field automatically filled in for you.

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • I have removed the 'Installed-Size' field from control file and the package has been created successfully. However the problem still exists. Maybe something wrong with my apt repository? Anytime I create a new deb package I copy it to the repository ('binary' folder) and then execute 'dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz' command... – Levi Aug 21 '13 at 09:27
  • 1
    Do not run `dpkg-scanpackages` manually. Rather use a helper tool like reprepro: http://serverfault.com/a/224635. – tshepang Aug 21 '13 at 13:54