#!/Gentoo/usr/bin/python import getopt, os, sys # Check number of parameters if len(sys.argv) <= 2: print "Usage: ebuilds-manifest-manipulator " print "" sys.exit(1) # Check actual parameters try: opts, pargs = getopt.getopt(sys.argv[1:], '', ['debug', 'force']) except getopt.GetoptError, e: print e sys.exit(1) # Import portage os.environ["PORTAGE_CALLER"]="ebuild" try: import portage except ImportError: from os import path as osp sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import portage.util, portage.const import portage.dep portage.dep._dep_check_strict = True eout = portage.output.EOutput() # Initialize variables pkgdir = pargs.pop(0) distdir = pargs.pop(0) tmpsettings = portage.config(clone=portage.settings) fetchlist_dict = portage.FetchlistDict(pkgdir, tmpsettings, portage.portdb) from portage.manifest import Manifest mf = Manifest(pkgdir, distdir, fetchlist_dict=fetchlist_dict) # # Check the digest of the ebuilds, borrowed from __init__.py in portage # Notice that we do not check for DIST as this would need the file to be # downloaded. # try: eout.ebegin("checking ebuild checksums ;-)") mf.checkTypeHashes("EBUILD") eout.eend(0) eout.ebegin("checking auxfile checksums ;-)") mf.checkTypeHashes("AUX") eout.eend(0) eout.ebegin("checking miscfile checksums ;-)") mf.checkTypeHashes("MISC", ignoreMissingFiles=True) eout.eend(0) except portage.exception.DigestException: eout.eend(13, "ebuilds got corrupted.") sys.exit(2) sys.exit(0)