diff options
author | Holger Freyther <zecke@selfish.org> | 2006-05-05 17:51:37 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-05-05 17:51:37 +0000 |
commit | 8d0f5bcd8327fc1e2736c25b8d34e662ee818085 (patch) | |
tree | d0850217805a47cba14237f1127fd0ff9351e481 /contrib | |
parent | 2d64f2bfe77eb1ff11ecbc5f21bb39c341252542 (diff) |
contrib/qa/ipkg-diff/ipkg-diff:
use getattr to get the function by name
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/qa/ipkg-diff/ipkg-diff | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/contrib/qa/ipkg-diff/ipkg-diff b/contrib/qa/ipkg-diff/ipkg-diff index 276b8b2e1e..babfa17554 100644 --- a/contrib/qa/ipkg-diff/ipkg-diff +++ b/contrib/qa/ipkg-diff/ipkg-diff @@ -44,31 +44,35 @@ def diff_dirs( old_ipks, new_ipks ): return only_old, both, only_new def diff_packages( old, new ): - def compare( name, version, method, txt ): + def compare( name, version, attribute, txt ): """ Compare package with name and version with method and print error message """ try: - if not method( old[package_name][version], new[package_name][version] ): + left = getattr( old[package_name][version], 'get_' + attribute ) + right = getattr( new[package_name][version], 'get_' + attribute ) + if not left() == right(): print txt - except: + except Exception, e: + raise e print "Error with %s %s and '%s'" % (package_name,version, txt) for package_name in old.keys(): for version in old[package_name].keys(): print "Comparing %s %s" % (package_name, version) - compare( package_name, version, lambda x,y: x.get_maintainer() == y.get_maintainer(), "Maintainer is different" ) - compare( package_name, version, lambda x,y: x.get_architecture() == y.get_architecture(), "Architecture is different" ) - compare( package_name, version, lambda x,y: x.get_description() == y.get_description(), "Description is different" ) - compare( package_name, version, lambda x,y: x.get_depends() == y.get_depends(), "Depends are different" ) - compare( package_name, version, lambda x,y: x.get_provides() == y.get_provides(), "Provides are different" ) - compare( package_name, version, lambda x,y: x.get_conflicts() == y.get_conflicts(), "Provides are different" ) - compare( package_name, version, lambda x,y: x.get_suggests() == y.get_suggests(), "Suggests are different" ) - compare( package_name, version, lambda x,y: x.get_source() == y.get_source(), "Source is different" ) - compare( package_name, version, lambda x,y: x.get_section() == y.get_section(), "Section is different" ) - compare( package_name, version, lambda x,y: x.get_file_list() == y.get_file_list(), "Filelist is different" ) - compare( package_name, version, lambda x,y: x.md5 == y.md5, "MD5 is different" ) + compare( package_name, version, 'maintainer', "Maintainer is different" ) + compare( package_name, version, 'architecture', "Architecture is different" ) + compare( package_name, version, 'description', "Description is different" ) + compare( package_name, version, 'depends', "Depends are different" ) + compare( package_name, version, 'provides', "Provides are different" ) + compare( package_name, version, 'conflicts', "Provides are different" ) + compare( package_name, version, 'suggests', "Suggests are different" ) + compare( package_name, version, 'source', "Source is different" ) + compare( package_name, version, 'section', "Section is different" ) + compare( package_name, version, 'file_list', "Filelist is different" ) + compare( package_name, version, 'file_all_list', "Filelist is different" ) + compare( package_name, version, 'md5', "MD5 is different" ) def print_result_start( old, both, new ): """ |