summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-07 06:17:36 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-07 06:17:36 +0000
commita536c3aa2a3926db585ba36c09ce16b4516eeaf0 (patch)
treea39c4d8c0bf2e3bbaf0a5660b0dfd4c9994d898a
parent9d173800bbb813990f6bad872a83b7b4ec1040c5 (diff)
downloadportage-a536c3aa2a3926db585ba36c09ce16b4516eeaf0.tar.gz
portage-a536c3aa2a3926db585ba36c09ce16b4516eeaf0.tar.bz2
portage-a536c3aa2a3926db585ba36c09ce16b4516eeaf0.zip
For bug #157385, enable portage.digestgen() to fetch any distfiles for which there are no existing digests.
svn path=/main/trunk/; revision=5197
-rw-r--r--pym/portage.py36
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,