Permalink
Browse files

fixing filesize handling

  • Loading branch information...
1 parent de7dfe5 commit a86e799a64acb638a768b59f2d24c3feee8379d6 @02strich committed Feb 12, 2012
Showing with 5 additions and 2 deletions.
  1. +3 −0 pyrpm/rpm.py
  2. +1 −1 pyrpm/yum.py
  3. +1 −1 setup.py
View
@@ -421,10 +421,13 @@ def _match_composite(self):
def _compute_checksum(self):
self.rpmfile.seek(0)
m = hashlib.sha256()
+ size = 0
data = self.rpmfile.read()
while data:
+ size += len(data)
m.update(data)
data = self.rpmfile.read()
+ self.filesize = size
self.checksum = m.hexdigest()
View
@@ -23,7 +23,7 @@ def _xml_base_items(self, ele):
ele.append(element('{http://linux.duke.edu/metadata/common}packager', text=self.header.packager))
ele.append(element('{http://linux.duke.edu/metadata/common}url', text=self.header.url))
ele.append(element('{http://linux.duke.edu/metadata/common}time', {'file': str(self.header.build_time), 'build': str(self.header.build_time)}))
- ele.append(element('{http://linux.duke.edu/metadata/common}size', {'package': str(self.header.size), 'installed': str(sum([file.size for file in self.filelist])), 'archive': str(self.header.archive_size)}))
+ ele.append(element('{http://linux.duke.edu/metadata/common}size', {'package': str(self.filesize), 'installed': str(sum([file.size for file in self.filelist])), 'archive': str(self.header.archive_size)}))
ele.append(element('{http://linux.duke.edu/metadata/common}location', {'href':self.canonical_filename}))
View
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name='pyrpm-02strich',
- version='0.5',
+ version='0.5.1',
description="A pure python rpm reader and YUM metadata generator",
author="Stefan Richter",
author_email="stefan@02strich.de",

0 comments on commit a86e799

Please sign in to comment.