diff options
author | Priit Laes <plaes@plaes.org> | 2010-06-10 16:06:27 +0300 |
---|---|---|
committer | Priit Laes <plaes@plaes.org> | 2010-06-10 16:06:27 +0300 |
commit | 68fe305701c030e1026994b5d28486468498e74d (patch) | |
tree | 43c275a93bf73c6b88c24b90c66fc43a549e535b /utils | |
parent | Added progress report for second week (diff) | |
download | gsoc2010-grumpy-68fe305701c030e1026994b5d28486468498e74d.tar.gz gsoc2010-grumpy-68fe305701c030e1026994b5d28486468498e74d.tar.bz2 gsoc2010-grumpy-68fe305701c030e1026994b5d28486468498e74d.zip |
Utilize portage cache
Diffstat (limited to 'utils')
-rwxr-xr-x[-rw-r--r--] | utils/db_init.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/utils/db_init.py b/utils/db_init.py index c71a5ef..d763926 100644..100755 --- a/utils/db_init.py +++ b/utils/db_init.py @@ -2,6 +2,7 @@ import sys from pkgcore.config import load_config +from pkgcore.cache import metadata from pkgcore.ebuild import repository from pymongo import Connection @@ -12,9 +13,10 @@ def main(path): # pkgcore part to fetch all the ebuild information conf = load_config() - # NB! No cache is used, so this is ssslllooowwww.. eclass_cache = conf.eclass_cache['eclass stack'] - overlay_repo = repository.UnconfiguredTree(path, eclass_cache=eclass_cache) + cache = metadata.database(readonly=True, location=path) + overlay_repo = repository.UnconfiguredTree(path, cache=cache, \ + eclass_cache=eclass_cache) for pkg in overlay_repo: _id = "%s/%s" % (pkg.package, pkg.category) @@ -42,8 +44,8 @@ def main(path): slot = pkg.slot, eapi = pkg.eapi, keywords = list(pkg.keywords) if pkg.keywords else [], + iuse = list(pkg.iuse) if pkg.iuse else [], # TODO, need to figure out a proper queryable structure for these -# iuse ?? # license = pkg.license, # depends = pkg.depends, # rdepends = pkg.rdepends @@ -52,7 +54,7 @@ def main(path): print "Adding: ", db.ebuilds.save(ebuild) if __name__ == '__main__': - if len(sys.argv) != 1: + if len(sys.argv) != 2: print "Please provide path to portage directory as argument" sys.exit() main(sys.argv[1]) |