diff options
author | 2005-08-16 00:30:53 +0000 | |
---|---|---|
committer | 2005-08-16 00:30:53 +0000 | |
commit | 9648fe9b211151dbe104d59fa3397d8144e51d12 (patch) | |
tree | 86f54a6c3302bf3d1368d0881cb1216a01669a0d | |
parent | improper tracking of additions without recording a forced change (duplicate f... (diff) | |
download | portage-cvs-9648fe9b211151dbe104d59fa3397d8144e51d12.tar.gz portage-cvs-9648fe9b211151dbe104d59fa3397d8144e51d12.tar.bz2 portage-cvs-9648fe9b211151dbe104d59fa3397d8144e51d12.zip |
no package class defined yet, but fixed imports so that querying is usable now.
from there, just defining package classes and metadata pulls; the mutable aspect comes later
-rw-r--r-- | portage/binpkg/repository.py | 30 | ||||
-rw-r--r-- | portage/vdb/repository.py | 28 |
2 files changed, 18 insertions, 40 deletions
diff --git a/portage/binpkg/repository.py b/portage/binpkg/repository.py index 6e521e4..8c6d26b 100644 --- a/portage/binpkg/repository.py +++ b/portage/binpkg/repository.py @@ -1,19 +1,16 @@ # Copyright: 2005 Gentoo Foundation # Author(s): Brian Harring (ferringb@gentoo.org) # License: GPL2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/binpkg/repository.py,v 1.2 2005/07/13 05:51:35 ferringb Exp $ - - -#yoink when fixed -raise Exception("sorry bub, doesn't work atm do to changes in portage namespace. plsfix kthnx") +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/binpkg/repository.py,v 1.3 2005/08/16 00:30:53 ferringb Exp $ import os,stat -import prototype, errors +from portage.repository import prototype, errors #needed to grab the PN -import portage_versions +from portage.package.cpv import CPV as cpv -class tree(prototype.PrototypeTree): +class tree(prototype.tree): + package_class = str def __init__(self, base): super(tree,self).__init__() self.base = base @@ -42,11 +39,11 @@ class tree(prototype.PrototypeTree): def _get_packages(self, category): cpath = os.path.join(self.base,category.lstrip(os.path.sep)) #-5 == len(".tbz2") - l=[] + l=set try: for x in os.listdir(cpath): if x.endswith(".tbz2"): - l.append(portage_versions.pkgsplit(x[:-5])[0]) + l.add(cpv(x[:-5]).package) return tuple(l) except (OSError, IOError), e: @@ -55,20 +52,11 @@ class tree(prototype.PrototypeTree): def _get_versions(self, catpkg): pkg = catpkg.split("/")[-1] - l=[] + l=set() try: for x in os.listdir(os.path.join(self.base, os.path.dirname(catpkg.lstrip("/").rstrip("/")))): if x.startswith(pkg): - ver=portage_versions.pkgsplit(x[:-5]) - - #pkgsplit returns -r0, when it's not always there - if ver[2] == "r0": - if x.endswith(ver[2]+".tbz2"): - l.append("%s-%s" % (ver[1], ver[2])) - else: - l.append(ver[1]) - else: - l.append("%s-%s" % (ver[1], ver[2])) + l.add(cpv(x[:-5]).fullver) return tuple(l) except (OSError, IOError), e: raise KeyError("failed fetching packages for package %s: %s" % \ diff --git a/portage/vdb/repository.py b/portage/vdb/repository.py index 2b1803e..3b21d35 100644 --- a/portage/vdb/repository.py +++ b/portage/vdb/repository.py @@ -1,18 +1,17 @@ # Copyright: 2005 Gentoo Foundation # Author(s): Brian Harring (ferringb@gentoo.org) # License: GPL2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/vdb/repository.py,v 1.2 2005/07/13 05:51:35 ferringb Exp $ - -# hack, remove when it's fixed -raise Exception("sorry, this won't work with current portage namespace layout. plsfix, kthnx") +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/vdb/repository.py,v 1.3 2005/08/16 00:30:53 ferringb Exp $ import os,stat -import prototype, errors +from portage.repository import prototype, errors #needed to grab the PN -import portage_versions +from portage.package.cpv import CPV as cpv +from portage.util.lists import unique class tree(prototype.tree): + package_class = str def __init__(self, base): super(tree,self).__init__() self.base = base @@ -40,11 +39,11 @@ class tree(prototype.tree): def _get_packages(self, category): cpath = os.path.join(self.base,category.lstrip(os.path.sep)) - l=[] + l=set() try: for x in os.listdir(cpath): if stat.S_ISDIR(os.stat(os.path.join(cpath,x)).st_mode) and not x.endswith(".lockfile"): - l.append(portage_versions.pkgsplit(x)[0]) + l.add(cpv(x).package) return tuple(l) except (OSError, IOError), e: @@ -54,21 +53,12 @@ class tree(prototype.tree): def _get_versions(self, catpkg): pkg = catpkg.split("/")[-1] - l=[] + l=set() try: cpath=os.path.join(self.base, os.path.dirname(catpkg.lstrip("/").rstrip("/"))) for x in os.listdir(cpath): if x.startswith(pkg) and stat.S_ISDIR(os.stat(os.path.join(cpath,x)).st_mode) and not x.endswith(".lockfile"): - ver=portage_versions.pkgsplit(x) - - #pkgsplit returns -r0, when it's not always there - if ver[2] == "r0": - if x.endswith(ver[2]): - l.append("%s-%s" % (ver[1], ver[2])) - else: - l.append(ver[1]) - else: - l.append("%s-%s" % (ver[1], ver[2])) + l.add(cpv(x).fullver) return tuple(l) except (OSError, IOError), e: raise KeyError("failed fetching packages for package %s: %s" % \ |