aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-18 12:51:12 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-18 12:51:12 -0700
commitaa1a33a58262c2982e43238ef6f7710115eba9a3 (patch)
tree51fc353614c9b88d31284d775fd39e2b7eced599 /bin
parentportageq: fix all_best_visible to fail early (diff)
downloadportage-aa1a33a58262c2982e43238ef6f7710115eba9a3.tar.gz
portage-aa1a33a58262c2982e43238ef6f7710115eba9a3.tar.bz2
portage-aa1a33a58262c2982e43238ef6f7710115eba9a3.zip
emaint binhost: check SIZE and MTIME
Diffstat (limited to 'bin')
-rwxr-xr-xbin/emaint22
1 files changed, 21 insertions, 1 deletions
diff --git a/bin/emaint b/bin/emaint
index 1b1df71c1..7294d79d7 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -5,6 +5,7 @@ from __future__ import print_function
import re
import signal
+import stat
import sys
import textwrap
import time
@@ -19,6 +20,9 @@ except ImportError:
from portage import os
+if sys.hexversion >= 0x3000000:
+ long = int
+
class WorldHandler(object):
short_desc = "Fix problems in the world file"
@@ -185,7 +189,23 @@ class BinhostHandler(object):
del missing[:]
for i, cpv in enumerate(cpv_all):
d = metadata.get(cpv)
- if not d or "MD5" not in d:
+ if not d or \
+ "MD5" not in d or \
+ "SIZE" not in d or \
+ "MTIME" not in d:
+ missing.append(cpv)
+ continue
+
+ pkg_path = bintree.getname(cpv)
+ s = os.lstat(pkg_path)
+ try:
+ if long(d["MTIME"]) != s[stat.ST_MTIME]:
+ missing.append(cpv)
+ continue
+ if long(d["SIZE"]) != long(s.st_size):
+ missing.append(cpv)
+ continue
+ except ValueError:
missing.append(cpv)
maxval = len(missing)