Make fetchlist_dict an optional parameter in the Manifest constructor since it's...
authorZac Medico <zmedico@gentoo.org>
Wed, 26 Apr 2006 22:10:16 +0000 (22:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 26 Apr 2006 22:10:16 +0000 (22:10 -0000)
svn path=/main/trunk/; revision=3245

bin/emerge
bin/repoman
pym/portage.py
pym/portage_manifest.py

index d172af69cffe567b039588a707404b81bf9cbf61..fc3677ee53eaddc0573e242ba764d21c0886c560 100755 (executable)
@@ -789,10 +789,11 @@ class search:
                                        myebuild = portage.portdb.findname(mycpv)
                                        pkgdir = os.path.dirname(myebuild)
                                        import portage_manifest
-                                       mf = portage_manifest.Manifest(pkgdir,
-                                               portage.FetchlistDict(pkgdir, portage.settings, portage.portdb),
-                                               portage.settings["DISTDIR"])
-                                       mysum[0] = mf.getDistfilesSize(mf.fetchlist_dict[mycpv])
+                                       mf = portage_manifest.Manifest(
+                                               pkgdir, portage.settings["DISTDIR"])
+                                       fetchlist = portage.portdb.getfetchlist(mycpv,
+                                               mysettings=portage.settings, all=True)
+                                       mysum[0] = mf.getDistfilesSize(fetchlist)
                                        mystr = str(mysum[0]/1024)
                                        mycount=len(mystr)
                                        while (mycount > 3):
index 9cbe8b68ab3b67a54633ab8d0a15d575619334a4..03bc5ee1f9941c1e9125c32f5f4e7c4cec3ddc9c 100755 (executable)
@@ -799,9 +799,7 @@ for x in scanlist:
                repoman_settings["O"] = checkdir
                portage.digestgen([], repoman_settings, manifestonly=1, myportdb=portage.portdb)
 
-       mf = Manifest(checkdir,
-               portage.FetchlistDict(checkdir, repoman_settings, portage.portdb),
-               repoman_settings["DISTDIR"])
+       mf = Manifest(checkdir, repoman_settings["DISTDIR"])
        mydigests=mf.getTypeDigests("DIST")
        myfiles_all = []
 
index c5b5fdccbf0f8eb00079cef08387d8d2a6a8ddf5..334a8f58cc232c3036b3742ab0d0a1c55e98c4be 100644 (file)
@@ -2150,7 +2150,8 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
                writemsg("Warning: myportdb not specified to digestgen\n")
                global portdb
                myportdb = portdb
-       mf = Manifest(mysettings["O"], FetchlistDict(mysettings["O"], mysettings, myportdb), mysettings["DISTDIR"])
+       mf = Manifest(mysettings["O"], mysettings["DISTDIR"],
+               fetchlist_dict=FetchlistDict(mysettings["O"], mysettings, myportdb))
        writemsg(">>> Creating Manifest for %s\n" % mysettings["O"])
        try:
                mf.create(assumeDistfileHashes=True, requiredDistfiles=myarchives)
@@ -2178,10 +2179,8 @@ def digestParseFile(myfilename, mysettings=None):
        if mysettings is None:
                global settings
                mysettings = config(clone=settings)
-       global portdb
-       mf = Manifest(pkgdir, FetchlistDict(pkgdir, mysettings, portdb), mysettings["DISTDIR"])
 
-       return mf.getDigests()
+       return Manifest(pkgdir, mysettings["DISTDIR"]).getDigests()
 
 # XXXX strict was added here to fix a missing name error.
 # XXXX It's used below, but we're not paying attention to how we get it?
@@ -2237,8 +2236,7 @@ def digestcheck(myfiles, mysettings, strict=0, justmanifest=0):
                writemsg("!!! Manifest file not found: '%s'\n" % manifest_path)
                if strict:
                        return 0
-       global portdb
-       mf = Manifest(pkgdir, FetchlistDict(pkgdir, mysettings, portdb), mysettings["DISTDIR"])
+       mf = Manifest(pkgdir, mysettings["DISTDIR"])
        try:
                writemsg_stdout(">>> checking ebuild checksums\n")
                mf.checkTypeHashes("EBUILD")
@@ -4905,7 +4903,7 @@ class portdbapi(dbapi):
                # returns a filename:size dictionnary of remaining downloads
                myebuild = self.findname(mypkg)
                pkgdir = os.path.dirname(myebuild)
-               mf = Manifest(pkgdir, FetchlistDict(pkgdir, self.mysettings, self), self.mysettings["DISTDIR"])
+               mf = Manifest(pkgdir, self.mysettings["DISTDIR"])
                checksums = mf.getDigests()
                if not checksums:
                        if debug: print "[empty/missing/bad digest]: "+mypkg
@@ -4948,7 +4946,7 @@ class portdbapi(dbapi):
                myuri, myfiles = self.getfetchlist(mypkg, useflags=useflags, mysettings=mysettings, all=all)
                myebuild = self.findname(mypkg)
                pkgdir = os.path.dirname(myebuild)
-               mf = Manifest(pkgdir, FetchlistDict(pkgdir, self.mysettings, self), self.mysettings["DISTDIR"])
+               mf = Manifest(pkgdir, self.mysettings["DISTDIR"])
                mysums = mf.getDigests()
 
                failures = {}
index 1ca793c80fe501a1dd24a070543baa0508903286..1a6780a51902647fa5ac9e47f8e6207dd7a2f7b5 100644 (file)
@@ -98,10 +98,13 @@ class Manifest2Entry(ManifestEntry):
 
 class Manifest(object):
        parsers = (parseManifest2, parseManifest1)
-       def __init__(self, pkgdir, fetchlist_dict, distdir, manifest1_compat=True, from_scratch=False):
+       def __init__(self, pkgdir, distdir, fetchlist_dict=None,
+               manifest1_compat=True, from_scratch=False):
                """ create new Manifest instance for package in pkgdir
                    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) """
+                   Do not parse Manifest file if from_scratch == True (only for internal use)
+                       The fetchlist_dict parameter is required only for generation of
+                       a Manifest (not needed for parsing and checking sums)."""
                self.pkgdir = pkgdir.rstrip(os.sep) + os.sep
                self.fhashdict = {}
                self.hashes = portage_const.MANIFEST2_HASH_FUNCTIONS[:]
@@ -405,7 +408,8 @@ class Manifest(object):
                        distfilehashes = self.fhashdict["DIST"]
                else:
                        distfilehashes = {}
-               self.__init__(self.pkgdir, self.fetchlist_dict, self.distdir, from_scratch=True)
+               self.__init__(self.pkgdir, self.distdir,
+                       fetchlist_dict=self.fetchlist_dict, from_scratch=True)
                for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(self.pkgdir):
                        break
                for f in pkgdir_files: