summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/emaint38
-rw-r--r--pym/portage/dbapi/bintree.py2
2 files changed, 37 insertions, 3 deletions
diff --git a/bin/emaint b/bin/emaint
index ea9cca085..0152a08e1 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -94,7 +94,6 @@ class BinhostHandler(object):
f.close()
def check(self, onProgress=None):
- errors = []
missing = []
cpv_all = self._bintree.dbapi.cpv_all()
cpv_all.sort()
@@ -109,7 +108,11 @@ class BinhostHandler(object):
missing.append(cpv)
if onProgress:
onProgress(maxval, i+1)
- return ["'%s' is not in Packages" % cpv for cpv in missing]
+ errors = ["'%s' is not in Packages" % cpv for cpv in missing]
+ stale = set(pkgindex.packages).difference(cpv_all)
+ for cpv in stale:
+ errors.append("'%s' is not in the repository" % cpv)
+ return errors
def fix(self, onProgress=None):
bintree = self._bintree
@@ -127,6 +130,37 @@ class BinhostHandler(object):
bintree.inject(cpv)
if onProgress:
onProgress(maxval, i+1)
+ stale = set(pkgindex.packages).difference(cpv_all)
+ if stale:
+ from portage import locks
+ pkgindex_lock = locks.lockfile(
+ self._pkgindex_file, wantnewlockfile=1)
+ try:
+ from portage import getbinpkg
+ del pkgindex
+ self._pkgindex = getbinpkg.PackageIndex()
+ f = open(self._pkgindex_file, 'r')
+ try:
+ self._pkgindex.read(f)
+ finally:
+ f.close()
+ from portage.dbapi.bintree import binarytree
+ self._bintree = binarytree(bintree.root, bintree.pkgdir,
+ settings=bintree.settings)
+ del bintree
+ portage.db[self._bintree.root]["bintree"] = self._bintree
+ self._bintree._populate()
+ for cpv in set(self._pkgindex.packages).difference(
+ self._bintree.dbapi.cpv_all()):
+ del self._pkgindex.packages[cpv]
+ from portage.util import atomic_ofstream
+ f = atomic_ofstream(self._pkgindex_file)
+ try:
+ self._pkgindex.write(f)
+ finally:
+ f.close()
+ finally:
+ locks.unlockfile(pkgindex_lock)
return None
class VdbKeyHandler(object):
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index c81de292e..8ef1ff23b 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -361,7 +361,7 @@ class binarytree(object):
if pkgindex_lock:
unlockfile(pkgindex_lock)
- def _populate(self, getbinpkgs, getbinpkgsonly):
+ def _populate(self, getbinpkgs=0, getbinpkgsonly=0):
if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
return 0