Make the first two positional arguments of digestgen() into keyword arguments
authorZac Medico <zmedico@gentoo.org>
Tue, 23 Feb 2010 03:28:27 +0000 (03:28 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 23 Feb 2010 03:28:27 +0000 (03:28 -0000)
since the first one isn't really needed (when this code is in stable we can
start showing a deprecation warning when the redundant argument is used).

svn path=/main/trunk/; revision=15438

bin/repoman
pym/_emerge/Scheduler.py
pym/portage/__init__.py

index 17c928662d992f875549b28be84aa2b0e1b4a914..c1f1481d0f6672fa67fbb36dd3faf3304418474a 100755 (executable)
@@ -1011,7 +1011,7 @@ for x in scanlist:
                                portage._doebuild_manifest_exempt_depend -= 1
 
                repoman_settings["O"] = checkdir
-               if not portage.digestgen([], repoman_settings, myportdb=portdb):
+               if not portage.digestgen(mysettings=repoman_settings, myportdb=portdb):
                        print("Unable to generate manifest.")
                        dofail = 1
                if options.mode == "manifest":
@@ -2335,7 +2335,7 @@ else:
                mydone=[]
                if repolevel==3:   # In a package dir
                        repoman_settings["O"] = startdir
-                       portage.digestgen([], repoman_settings, myportdb=portdb)
+                       portage.digestgen(mysettings=repoman_settings, myportdb=portdb)
                elif repolevel==2: # In a category dir
                        for x in myfiles:
                                xs=x.split("/")
@@ -2349,7 +2349,7 @@ else:
                                repoman_settings["O"] = os.path.join(startdir, xs[0])
                                if not os.path.isdir(repoman_settings["O"]):
                                        continue
-                               portage.digestgen([], repoman_settings, myportdb=portdb)
+                               portage.digestgen(mysettings=repoman_settings, myportdb=portdb)
                elif repolevel==1: # repo-cvsroot
                        print(green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n")
                        for x in myfiles:
@@ -2364,7 +2364,7 @@ else:
                                repoman_settings["O"] = os.path.join(startdir, xs[0], xs[1])
                                if not os.path.isdir(repoman_settings["O"]):
                                        continue
-                               portage.digestgen([], repoman_settings, myportdb=portdb)
+                               portage.digestgen(mysettings=repoman_settings, myportdb=portdb)
                else:
                        print(red("I'm confused... I don't know where I am!"))
                        sys.exit(1)
index c760c395e907565f9b050feb121d571b06382306..e508e233fa2ceb21ff61b7039d7a814357319f00 100644 (file)
@@ -591,7 +591,7 @@ class Scheduler(PollScheduler):
                        if ebuild_path is None:
                                raise AssertionError("ebuild not found for '%s'" % x.cpv)
                        pkgsettings['O'] = os.path.dirname(ebuild_path)
-                       if not portage.digestgen([], pkgsettings, myportdb=portdb):
+                       if not portage.digestgen(mysettings=pkgsettings, myportdb=portdb):
                                writemsg_level(
                                        "!!! Unable to generate manifest for '%s'.\n" \
                                        % x.cpv, level=logging.ERROR, noiselevel=-1)
index 1b8427c34d9bd973bafba5eaefdde530f23a0b10..b28658f5700455f43369f487f74aa3110f2e39d1 100644 (file)
@@ -1376,10 +1376,23 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
                return retval >> 8
        return retval
 
-def digestgen(myarchives, mysettings, overwrite=None, manifestonly=None, myportdb=None):
+def digestgen(myarchives=None, mysettings=None,
+       overwrite=None, manifestonly=None, myportdb=None):
        """
        Generates a digest file if missing. Fetches files if necessary.
+       NOTE: myarchives and mysettings used to be positional arguments,
+               so their order must be preserved for backward compatibility.
+       @param mysettings: the ebuild config (mysettings["O"] must correspond
+               to the ebuild's parent directory)
+       @type mysettings: config
+       @param myportdb: a portdbapi instance
+       @type myportdb: portdbapi
+       @rtype: int
+       @returns: 1 on success and 0 on failure
        """
+       if mysettings is None:
+               raise TypeError("portage.digestgen(): missing" + \
+                       " required 'mysettings' parameter")
        if myportdb is None:
                warnings.warn("portage.digestgen() called without 'myportdb' parameter",
                        DeprecationWarning, stacklevel=2)
@@ -1500,8 +1513,7 @@ def digestgen(myarchives, mysettings, overwrite=None, manifestonly=None, myportd
                                                return 0
                writemsg_stdout(_(">>> Creating Manifest for %s\n") % mysettings["O"])
                try:
-                       mf.create(requiredDistfiles=myarchives,
-                               assumeDistHashesSometimes=True,
+                       mf.create(assumeDistHashesSometimes=True,
                                assumeDistHashesAlways=(
                                "assume-digests" in mysettings.features))
                except portage.exception.FileNotFound as e:
@@ -3360,15 +3372,15 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 
                try:
                        if mydo == "manifest":
-                               return not digestgen(aalist, mysettings, myportdb=mydbapi)
+                               return not digestgen(mysettings=mysettings, myportdb=mydbapi)
                        elif mydo == "digest":
-                               return not digestgen(aalist, mysettings, myportdb=mydbapi)
+                               return not digestgen(mysettings=mysettings, myportdb=mydbapi)
                        elif mydo != 'fetch' and not emerge_skip_digest and \
                                "digest" in mysettings.features:
                                # Don't do this when called by emerge or when called just
                                # for fetch (especially parallel-fetch) since it's not needed
                                # and it can interfere with parallel tasks.
-                               digestgen(aalist, mysettings, myportdb=mydbapi)
+                               digestgen(mysettings=mysettings, myportdb=mydbapi)
                except portage.exception.PermissionDenied as e:
                        writemsg(_("!!! Permission Denied: %s\n") % (e,), noiselevel=-1)
                        if mydo in ("digest", "manifest"):