r4595 - trunk/src/host/opkg-utils
tick at docs.openmoko.org
tick at docs.openmoko.org
Tue Aug 12 06:11:26 CEST 2008
Author: tick
Date: 2008-08-12 06:11:25 +0200 (Tue, 12 Aug 2008)
New Revision: 4595
Modified:
trunk/src/host/opkg-utils/opkg.py
Log:
[opkg-util] adding Size support when creating Packages
Modified: trunk/src/host/opkg-utils/opkg.py
===================================================================
--- trunk/src/host/opkg-utils/opkg.py 2008-08-09 07:36:58 UTC (rev 4594)
+++ trunk/src/host/opkg-utils/opkg.py 2008-08-12 04:11:25 UTC (rev 4595)
@@ -133,9 +133,9 @@
self.section = None
self.filename_header = None
self.file_list = []
- # md5 is lazy attribute, computed on demand
+ # md5 and size is lazy attribute, computed on demand
#self.md5 = None
- self.size = None
+ #self.size = None
self.installed_size = None
self.filename = None
self.isdeb = 0
@@ -179,6 +179,8 @@
if name == "md5":
self._computeFileMD5()
return self.md5
+ elif name == 'size':
+ return self._get_file_size()
else:
raise AttributeError, name
@@ -193,6 +195,14 @@
f.close()
self.md5 = sum.hexdigest()
+ def _get_file_size(self):
+ if not self.fn:
+ self.size = 0;
+ else:
+ stat = os.stat(self.fn)
+ self.size = stat[ST_SIZE]
+ return int(self.size)
+
def read_control(self, control):
import os
More information about the commitlog
mailing list