]> git.ipfire.org Git - pakfire.git/commitdiff
Implement file size of source packages.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 2 Oct 2011 23:06:07 +0000 (01:06 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 2 Oct 2011 23:06:07 +0000 (01:06 +0200)
python/pakfire/packages/base.py
python/pakfire/packages/make.py
python/pakfire/packages/packager.py

index 8c5ae374e437827c4139c78fa8f93a7d8ae831c1..0bb4f21561cd18961ae6dc3fd82eb86b54efd65d 100644 (file)
@@ -208,7 +208,12 @@ class Package(object):
 
        @property
        def inst_size(self):
-               raise NotImplementedError, "%s" % self
+               """
+                       The used disk space when the package is installed.
+
+                       Returns None if inst_size is unknown.
+               """
+               return None
 
        @property
        def local(self):
index 2019f47f69165c3b25165ff36610d0fa17450cd6..ad48cb35e4bc149090e4517b4dfbe44eec278eaa 100644 (file)
@@ -343,10 +343,6 @@ class Makefile(MakefileBase):
 
                        shutil.copy2(_filename, filename)
 
-       @property
-       def inst_size(self):
-               return 0
-
 
 class MakefilePackage(MakefileBase):
        def __init__(self, pakfire, name, lexer):
index 4e913cbd29de2d1068771878044f1f65250a2b60..b50483b49c00dd9f4803e0c721420f43afab4d5c 100644 (file)
@@ -552,6 +552,9 @@ class SourcePackager(Packager):
                info.update(self.pakfire.distro.info)
                info.update(self.pkg.info)
 
+               # Size is the size of the (uncompressed) datafile.
+               info["inst_size"] = os.path.getsize(datafile)
+
                # Update package information for string formatting.
                requires = [PACKAGE_INFO_DEPENDENCY_LINE % r for r in self.pkg.requires]
                info.update({