SF.net SVN: gar:[23039] csw/mgar/gar/v2/lib/python/checkpkg_lib.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue Feb 18 10:40:28 CET 2014
Revision: 23039
http://sourceforge.net/p/gar/code/23039
Author: wahwah
Date: 2014-02-18 09:40:25 +0000 (Tue, 18 Feb 2014)
Log Message:
-----------
checkpkg: Prepare namedtuples with symbol info
This should be unified under LazyElfinfo.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/checkpkg_lib.py
Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py 2014-02-18 09:40:16 UTC (rev 23038)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py 2014-02-18 09:40:25 UTC (rev 23039)
@@ -163,6 +163,16 @@
return self.triad_cache[key]
+def ElfinfoBlobToStruct(elfdump_data):
+ # json doesn't preserve namedtuple so we do some post-processing
+ # to transform symbol info from List to NamedTuple
+ symbols = elfdump_data['symbol table']
+ for idx, symbol_as_list in enumerate(symbols):
+ symbols[idx] = representations.ElfSymInfo(*symbol_as_list)
+
+ return elfdump_data
+
+
class LazyElfinfo(object):
"""Used at runtime for lazy fetches of elfdump info data."""
@@ -171,15 +181,9 @@
def __getitem__(self, md5_sum):
elfdump_data = self.rest_client.GetBlob('elfdump', md5_sum)
- # json doesn't preserve namedtuple so we do some post-processing
- # to transform symbol info from List to NamedTuple
- symbols = elfdump_data['symbol table']
- for idx, symbol_as_list in enumerate(symbols):
- symbols[idx] = representations.ElfSymInfo(*symbol_as_list)
+ return ElfinfoBlobToStruct(elfdump_data)
- return elfdump_data
-
class CheckpkgManagerBase(SqlobjectHelperMixin):
"""Common functions between the older and newer calling functions."""
@@ -496,7 +500,8 @@
self.AddError(checkpkg_tag)
def GetElfdumpInfo(self, md5_sum):
- return self.rest_client.GetBlob('elfinfo', md5_sum)
+ elfdump_data = self.rest_client.GetBlob('elfdump', md5_sum)
+ return ElfinfoBlobToStruct(elfdump_data)
class IndividualCheckInterface(CheckInterfaceBase):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list