From 0113950c012bb59bda47aa0530a7da3dcc0c1c7d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 10 Apr 2006 01:42:02 +0000 Subject: [PATCH] Pass DISTDIR into the Manifest constructor instead of getting it from mysettings because mysettings will be eliminated soon. svn path=/main/trunk/; revision=3110 --- bin/repoman | 3 ++- pym/portage.py | 51 +++++++++++++++++++++-------------------- pym/portage_manifest.py | 9 +++----- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/bin/repoman b/bin/repoman index 4a46196a5..ac5166027 100755 --- a/bin/repoman +++ b/bin/repoman @@ -795,7 +795,8 @@ for x in scanlist: fails["CVS/Entries.IO_error"].append(checkdir+"/files/CVS/Entries") continue - mf=Manifest(checkdir, db=portage.db["/"]["porttree"].dbapi, mysettings=repoman_settings) + mf = Manifest(checkdir, db=portage.db["/"]["porttree"].dbapi, + mysettings=repoman_settings, repoman_settings["DISTDIR"]) mydigests=mf.getTypeDigests("DIST") myfiles_all = [] diff --git a/pym/portage.py b/pym/portage.py index 66cbb6678..727b99ae5 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2072,7 +2072,8 @@ def digestgen(myarchives,mysettings,db=None,overwrite=1,manifestonly=0): if db is None: db = portagetree().dbapi - mf = Manifest(mysettings["O"], db, mysettings) + global settings + mf = Manifest(mysettings["O"], db, mysettings, mysettings["DISTDIR"]) mf.create(assumeDistfileHashes=True) for f in myarchives: # the whole type evaluation is only for the case that myarchives isn't a @@ -2110,7 +2111,7 @@ def digestParseFile(myfilename,mysettings=None,db=None): if mysettings is None: mysettings = config(clone=settings) - mf = Manifest(pkgdir, db, mysettings) + mf = Manifest(pkgdir, db, mysettings, mysettings["DISTDIR"]) return mf.getDigests() @@ -2164,7 +2165,7 @@ def digestcheck(myfiles, mysettings, strict=0, justmanifest=0, db=None): pkgdir = mysettings["O"] if db is None: db = portagetree().dbapi - mf = Manifest(pkgdir, db, mysettings) + mf = Manifest(pkgdir, db, mysettings, mysettings["DISTDIR"]) try: if strict: print ">>> checking ebuild checksums", @@ -2712,6 +2713,28 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea if need_distfiles and not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly): return 1 + if mydo=="fetch" and listonly: + return 0 + + if "digest" in features: + #generate digest if it doesn't exist. + if mydo=="digest": + return (not digestgen(aalist,mysettings,overwrite=1)) + else: + digestgen(aalist,mysettings,overwrite=0) + elif mydo=="digest": + #since we are calling "digest" directly, recreate the digest even if it already exists + return (not digestgen(aalist,mysettings,overwrite=1)) + if mydo=="manifest": + return (not digestgen(aalist,mysettings,overwrite=1,manifestonly=1)) + + # See above comment about fetching only when needed + if not digestcheck(checkme, mysettings, ("strict" in features), (mydo not in ["digest","fetch","unpack"] and settings["PORTAGE_CALLER"] == "ebuild" and "noauto" in features)): + return 1 + + if mydo=="fetch": + return 0 + # inefficient. improve this logic via making actionmap easily searchable to see if we're in the chain of what # will be executed, either that or forced N doebuild calls instead of a single set of phase calls. if (mydo not in ("setup", "clean", "postinst", "preinst", "prerm", "fetch", "digest", "manifest") and @@ -2737,28 +2760,6 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea print "!!! Failed symlinking in '%s' to ebuild distdir" % file raise - if mydo=="fetch" and listonly: - return 0 - - if "digest" in features: - #generate digest if it doesn't exist. - if mydo=="digest": - return (not digestgen(aalist,mysettings,overwrite=1)) - else: - digestgen(aalist,mysettings,overwrite=0) - elif mydo=="digest": - #since we are calling "digest" directly, recreate the digest even if it already exists - return (not digestgen(aalist,mysettings,overwrite=1)) - if mydo=="manifest": - return (not digestgen(aalist,mysettings,overwrite=1,manifestonly=1)) - - # See above comment about fetching only when needed - if not digestcheck(checkme, mysettings, ("strict" in features), (mydo not in ["digest","fetch","unpack"] and settings["PORTAGE_CALLER"] == "ebuild" and "noauto" in features)): - return 1 - - if mydo=="fetch": - return 0 - #initial dep checks complete; time to process main commands nosandbox=(("userpriv" in features) and ("usersandbox" not in features) and \ diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index b50d389ed..fff9983aa 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -26,7 +26,7 @@ def manifest2MiscfileFilter(filename): return not (filename in ["CVS", ".svn", "files", "Manifest"] or filename.endswith(".ebuild")) class Manifest(object): - def __init__(self, pkgdir, db, mysettings, manifest1_compat=True, from_scratch=False): + def __init__(self, pkgdir, db, mysettings, distdir, manifest1_compat=True, from_scratch=False): """ create new Manifest instance for package in pkgdir, using db and mysettings for metadata lookups, and add compability entries for old portage versions if manifest1_compat == True. Do not parse Manifest file if from_scratch == True (only for internal use) """ @@ -44,10 +44,7 @@ class Manifest(object): self.compat = manifest1_compat self.db = db self.mysettings = mysettings - if mysettings.has_key("PORTAGE_ACTUAL_DISTDIR"): - self.distdir = mysettings["PORTAGE_ACTUAL_DISTDIR"] - else: - self.distdir = mysettings["DISTDIR"] + self.distdir = distdir def guessType(self, filename): """ Perform a best effort guess of which type the given filename is, avoid using this if possible """ @@ -289,7 +286,7 @@ class Manifest(object): distfilehashes = self.fhashdict["DIST"] else: distfilehashes = {} - self.__init__(self.pkgdir, self.db, self.mysettings, from_scratch=True) + self.__init__(self.pkgdir, self.db, self.mysettings, self.distdir, from_scratch=True) for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(self.pkgdir): break for f in pkgdir_files: -- 2.26.2