]> code.ossystems Code Review - openembedded-core.git/commitdiff
package: don't count every hardlink for PKGSIZE
authorRoss Burton <ross.burton@intel.com>
Fri, 16 Dec 2016 18:06:20 +0000 (18:06 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 17 Dec 2016 09:56:45 +0000 (09:56 +0000)
When calculating PKGSIZE we sum the size of files after doing lstat() so we
don't count directory metadata overhead, but were not correctly handling
hardlinks.  This results in packages such as e2fsprogs-mke2fs having PKGSIZE of
1.5M when it's actually a single 300K binary with five hardlinks.

[ YOCTO #10423 ]

Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/package.bbclass

index 1f7918823655e4920d2a50c0669a76fe292f2c5e..e177e775e5aa65412154cafa5d175fe84965d2fd 100644 (file)
@@ -1342,11 +1342,14 @@ python emit_pkgdata() {
         pkgdestpkg = os.path.join(pkgdest, pkg)
         files = {}
         total_size = 0
+        seen = set()
         for f in pkgfiles[pkg]:
             relpth = os.path.relpath(f, pkgdestpkg)
             fstat = os.lstat(f)
-            total_size += fstat.st_size
             files[os.sep + relpth] = fstat.st_size
+            if fstat.st_ino not in seen:
+                seen.add(fstat.st_ino)
+                total_size += fstat.st_size
         d.setVar('FILES_INFO', json.dumps(files))
 
         subdata_file = pkgdatadir + "/runtime/%s" % pkg