diff options
-rw-r--r-- | pym/portage.py | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py index 1e4936788..44206c34e 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2478,9 +2478,41 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None global _doebuild_manifest_exempt_depend try: _doebuild_manifest_exempt_depend += 1 + distfiles_map = {} + fetchlist_dict = FetchlistDict(mysettings["O"], mysettings, myportdb) + for cpv, fetchlist in fetchlist_dict.iteritems(): + for myfile in fetchlist: + distfiles_map.setdefault(myfile, []).append(cpv) mf = Manifest(mysettings["O"], mysettings["DISTDIR"], - fetchlist_dict=FetchlistDict(mysettings["O"], - mysettings, myportdb)) + fetchlist_dict=fetchlist_dict) + missing_hashes = set(distfiles_map).difference( + mf.fhashdict.get("DIST", {})) + if missing_hashes: + missing_files = [] + for myfile in missing_hashes: + try: + os.stat(os.path.join(mysettings["DISTDIR"], myfile)) + except OSError, e: + if e.errno != errno.ENOENT: + raise + del e + missing_files.append(myfile) + if missing_files: + mytree = os.path.realpath(os.path.dirname( + os.path.dirname(mysettings["O"]))) + myuris = [] + for myfile in missing_files: + for cpv in distfiles_map[myfile]: + alluris, aalist = myportdb.getfetchlist( + cpv, mytree=mytree, all=True, + mysettings=mysettings) + for i in xrange(len(aalist)): + if aalist[i] == myfile: + myuris.append(alluris[i]) + if not fetch(myuris, mysettings): + writemsg("!!! File %s doesn't exist, can't update " + \ + "Manifest\n" % myfile, noiselevel=-1) + return 0 writemsg_stdout(">>> Creating Manifest for %s\n" % mysettings["O"]) try: mf.create(requiredDistfiles=myarchives, |