Lines 6551-6556
Link Here
|
6551 |
'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com"] or [] if mycpv not found' |
6551 |
'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com"] or [] if mycpv not found' |
6552 |
raise NotImplementedError |
6552 |
raise NotImplementedError |
6553 |
|
6553 |
|
|
|
6554 |
def _add(self, pkg_dblink): |
6555 |
self._clear_cache(pkg_dblink) |
6556 |
|
6557 |
def _remove(self, pkg_dblink): |
6558 |
self._clear_cache(pkg_dblink) |
6559 |
|
6560 |
def _clear_cache(self, pkg_dblink): |
6561 |
# Due to 1 second mtime granularity in < python-1.5, mtime checks |
6562 |
# are not always sufficient to invalidate vardbapi caches. Therefore, |
6563 |
# the caches need to be actively invalidated here. |
6564 |
self.mtdircache.pop(pkg_dblink.cat, None) |
6565 |
self.matchcache.pop(pkg_dblink.cat, None) |
6566 |
self.cpcache.pop(pkg_dblink.mysplit[0], None) |
6567 |
from portage import dircache |
6568 |
dircache.pop(pkg_dblink.dbcatdir, None) |
6569 |
|
6554 |
def match(self, origdep, use_cache=1): |
6570 |
def match(self, origdep, use_cache=1): |
6555 |
"""Given a dependency, try to find packages that match |
6571 |
"""Given a dependency, try to find packages that match |
6556 |
Args: |
6572 |
Args: |
Lines 9033-9056
Link Here
|
9033 |
""" |
9049 |
""" |
9034 |
if not os.path.exists(self.dbdir): |
9050 |
if not os.path.exists(self.dbdir): |
9035 |
return |
9051 |
return |
9036 |
try: |
|
|
9037 |
for x in os.listdir(self.dbdir): |
9038 |
os.unlink(self.dbdir+"/"+x) |
9039 |
os.rmdir(self.dbdir) |
9040 |
except OSError, e: |
9041 |
print "!!! Unable to remove db entry for this package." |
9042 |
print "!!! It is possible that a directory is in this one. Portage will still" |
9043 |
print "!!! register this package as installed as long as this directory exists." |
9044 |
print "!!! You may delete this directory with 'rm -Rf "+self.dbdir+"'" |
9045 |
print "!!! "+str(e) |
9046 |
print |
9047 |
sys.exit(1) |
9048 |
|
9052 |
|
9049 |
# Due to mtime granularity, mtime checks do not always properly |
9053 |
# Check validity of self.dbdir before attempting to remove it. |
9050 |
# invalidate vardbapi caches. |
9054 |
if not self.dbdir.startswith(self.dbroot): |
9051 |
self.vartree.dbapi.mtdircache.pop(self.cat, None) |
9055 |
writemsg("portage.dblink.delete(): invalid dbdir: %s\n" % \ |
9052 |
self.vartree.dbapi.matchcache.pop(self.cat, None) |
9056 |
self.dbdir, noiselevel=-1) |
9053 |
self.vartree.dbapi.cpcache.pop(self.mysplit[0], None) |
9057 |
return |
|
|
9058 |
import shutil |
9059 |
shutil.rmtree(self.dbdir) |
9060 |
self.vartree.dbapi._remove(self) |
9054 |
|
9061 |
|
9055 |
def clearcontents(self): |
9062 |
def clearcontents(self): |
9056 |
""" |
9063 |
""" |
Lines 10206-10216
Link Here
|
10206 |
f.write(line) |
10213 |
f.write(line) |
10207 |
f.close() |
10214 |
f.close() |
10208 |
|
10215 |
|
10209 |
# Due to mtime granularity, mtime checks do not always properly |
10216 |
self.vartree.dbapi._add(self) |
10210 |
# invalidate vardbapi caches. |
|
|
10211 |
self.vartree.dbapi.mtdircache.pop(self.cat, None) |
10212 |
self.vartree.dbapi.matchcache.pop(self.cat, None) |
10213 |
self.vartree.dbapi.cpcache.pop(self.mysplit[0], None) |
10214 |
contents = self.getcontents() |
10217 |
contents = self.getcontents() |
10215 |
|
10218 |
|
10216 |
#do postinst script |
10219 |
#do postinst script |