From: Zac Medico Date: Thu, 7 Dec 2006 06:17:36 +0000 (-0000) Subject: For bug #157385, enable portage.digestgen() to fetch any distfiles for which there... X-Git-Tag: v2.1.2~383 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a536c3aa2a3926db585ba36c09ce16b4516eeaf0;p=portage.git For bug #157385, enable portage.digestgen() to fetch any distfiles for which there are no existing digests. svn path=/main/trunk/; revision=5197 --- 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,