#!/usr/bin/python -O # # Copyright 2006 Sven Wegener # Distributed under the terms of the GNU General Public License v2 # # $Id: verifymanifest 481 2007-01-10 20:08:26Z sven $ # import portage from portage_manifest import Manifest from portage_exception import DigestException, FileNotFound from sys import argv from os.path import join as join_path for pkgdir in argv[1:] or ['.']: m = Manifest(pkgdir, '/this/directory/does/not/exist') for t in [None, 'AUX', 'EBUILD', 'MISC']: if not m.fhashdict.has_key(t): continue for f in m.fhashdict[t]: try: m.checkFileHashes(t, f) except DigestException, e: print pkgdir, e except FileNotFound, e: if t == 'MISC': continue print pkgdir, e if t == 'AUX': y = portage.listdir(join_path(pkgdir, 'files'), recursive = True, filesonly = True, ignorecvs = True) for f in y: if f.startswith('digest-'): continue if f not in m.fhashdict[t]: print pkgdir, f + ' missing in Manifest' elif t == None: y = portage.listdir(pkgdir, recursive = True, filesonly = True, ignorecvs = True) for f in y: if not f.startswith(join_path('files', 'digest-')): continue if f not in m.fhashdict[t]: print pkgdir, f + ' missing in Manifest'