diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-18 12:51:12 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-18 12:51:12 -0700 |
commit | aa1a33a58262c2982e43238ef6f7710115eba9a3 (patch) | |
tree | 51fc353614c9b88d31284d775fd39e2b7eced599 | |
parent | fed6021192dd59eda1f6b9f3fb227597a83870de (diff) | |
download | portage-aa1a33a58262c2982e43238ef6f7710115eba9a3.tar.gz portage-aa1a33a58262c2982e43238ef6f7710115eba9a3.tar.bz2 portage-aa1a33a58262c2982e43238ef6f7710115eba9a3.zip |
emaint binhost: check SIZE and MTIME
-rwxr-xr-x | bin/emaint | 22 |
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) |