Merged from trunk -r15370:15380
authorFabian Groffen <grobian@gentoo.org>
Fri, 19 Feb 2010 10:18:20 +0000 (10:18 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 19 Feb 2010 10:18:20 +0000 (10:18 -0000)
   | 15371   | Remove unused merge_cmd variable.                            |
   | zmedico |                                                              |

   | 15372   | Only enable --rebuilt-binaries automatically if --update and |
   | zmedico | --deep are also enabled.                                     |

   | 15373   | Allow --rebuilt-binaries to trigger downgrades.              |
   | zmedico |                                                              |

   | 15374   | Deprecate the unused getbinpkgsonly parameter to             |
   | zmedico | binarytree.populate().                                       |

   | 15375   | Remove the deprecated 'clone' parameter to the binarytree    |
   | zmedico | constructor.                                                 |

   | 15376   | Remove deprecated binarytree.get_use() method.               |
   | zmedico |                                                              |

   | 15377   | Remove deprecated portdbapi.getfetchlist() method.           |
   | zmedico |                                                              |

   | 15378   | Remove the deprecated 'clone' parameter from the portagetree |
   | zmedico | constructor.                                                 |

   | 15379   | Use a property to trigger deprecation warnings if            |
   | zmedico | binarytree.remotepkgs is accessed.                           |

   | 15380   | Make dep_getkey() recommend cpv_getkey() if given a cpv.     |
   | zmedico |                                                              |

svn path=/main/branches/prefix/; revision=15387

bin/dispatch-conf
man/emerge.1
pym/_emerge/create_depgraph_params.py
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/porttree.py
pym/portage/dep.py

index a1c183d72c1818147bf73cb32d347844c42c2511..5a72b9db747ad60a47f7a9048850e8758192048f 100755 (executable)
@@ -119,7 +119,6 @@ class dispatch:
                         "use-rcs=yes in config; fatal', file=sys.stderr)
                     return False
 
-        merge_cmd = self.options.get("merge", "").split()
 
         # config file freezing support
         frozen_files = set(self.options.get("frozen-files", "").split())
index f88513c8a1420e4a3f094c7902e8acc1ce9edc65..bbbddd1f4d8f26f434dd5934fb6155248b5677b3 100644 (file)
@@ -481,8 +481,9 @@ display it on stdout.
 Replace installed packages with binary packages that have
 been rebuilt. Rebuilds are detected by comparison of
 BUILD_TIME package metadata. This option is enabled
-automatically when using binary packages (see
-\fB\-\-usepkg\fR and \fB\-\-getbinpkg\fR).
+automatically when using binary packages
+(\fB\-\-usepkg\fR or \fB\-\-getbinpkg\fR) together with
+\fB\-\-update\fR and \fB\-\-deep\fR.
 .TP
 .BR "\-\-reinstall changed\-use"
 Tells emerge to include installed packages where USE flags have
index 188dc6f967d6bc22102181d9d9cbdede467c343f..37bda4922c8f197ab4a097d64ac6d7e83ccf7185 100644 (file)
@@ -15,6 +15,7 @@ def create_depgraph_params(myopts, myaction):
        # empty:     pretend nothing is merged
        # complete:  completely account for all known dependencies
        # remove:    build graph for use in removing packages
+       # rebuilt_binaries: replace installed packages with rebuilt binaries
        myparams = {"recurse" : True}
 
        if myaction == "remove":
@@ -37,6 +38,15 @@ def create_depgraph_params(myopts, myaction):
                myparams["deep"] = myopts["--deep"]
        if "--complete-graph" in myopts:
                myparams["complete"] = True
+
+       rebuilt_binaries = myopts.get('--rebuilt-binaries')
+       if rebuilt_binaries is True or \
+               rebuilt_binaries != 'n' and \
+               '--usepkg' in myopts and \
+               myopts.get('--deep') is True and \
+               '--update' in myopts:
+               myparams['rebuilt_binaries'] = True
+
        if myopts.get("--selective") == "n":
                # --selective=n can be used to remove selective
                # behavior that may have been implied by some
index 00dd31f8492620ed12e1773d2cf653a97311b7c5..9ff9b47aeb82293c33473cf1c89a5955bdb20720 100644 (file)
@@ -2396,9 +2396,7 @@ class depgraph(object):
                atom_set = InternalPackageSet(initial_atoms=(atom,))
                existing_node = None
                myeb = None
-               usepkg = "--usepkg" in self._frozen_config.myopts
-               rebuilt_binaries = usepkg and \
-                       self._frozen_config.myopts.get('--rebuilt-binaries') != 'n'
+               rebuilt_binaries = 'rebuilt_binaries' in self._dynamic_config.myparams
                usepkgonly = "--usepkgonly" in self._frozen_config.myopts
                empty = "empty" in self._dynamic_config.myparams
                selective = "selective" in self._dynamic_config.myparams
@@ -2632,8 +2630,7 @@ class depgraph(object):
                                        elif pkg.built:
                                                built_pkg = pkg
                                if built_pkg is not None and inst_pkg is not None:
-                                       if built_pkg >= inst_pkg and \
-                                               built_pkg.metadata['BUILD_TIME'] != \
+                                       if built_pkg.metadata['BUILD_TIME'] != \
                                                inst_pkg.metadata['BUILD_TIME']:
                                                return built_pkg, built_pkg
 
index afdaa1cabebadd894f180f92b4a993a461144df7..7c6b334fce9468e30d356f462063587b3626ae31 100644 (file)
@@ -510,8 +510,9 @@ def help(myopts, havecolor=1):
                desc = "Replace installed packages with binary packages that have " + \
                        "been rebuilt. Rebuilds are detected by comparison of " + \
                        "BUILD_TIME package metadata. This option is enabled " + \
-                       "automatically when using binary packages (see " + \
-                       "--usepkg and --getbinpkg)."
+                       "automatically when using binary packages " + \
+                       "(--usepkg or --getbinpkg) together with " + \
+                       "--update and --deep."
                for line in wrap(desc, desc_width):
                        print(desc_indent + line)
                print()
index 9a30548671ebcda33444392591c1ca380743bddf..91823d910a8e54560f054a847fd4a1043f3bdcb3 100644 (file)
@@ -742,8 +742,7 @@ def parse_opts(tmpcmdline, silent=False):
                myoptions.keep_going = None
 
        if myoptions.rebuilt_binaries in ("True",):
-               # The depgraph will enable this by default unless 'n' is specified.
-               myoptions.rebuilt_binaries = None
+               myoptions.rebuilt_binaries = True
 
        if myoptions.root_deps == "True":
                myoptions.root_deps = True
index 283981a47e62e4a861291e5f62ee50372384975a..e389c6959d7eae5bc52e3da39a4e38530d933303 100644 (file)
@@ -33,6 +33,7 @@ import errno
 import re
 import stat
 import sys
+import warnings
 from itertools import chain
 
 if sys.hexversion >= 0x3000000:
@@ -151,20 +152,8 @@ class bindbapi(fakedbapi):
 
 class binarytree(object):
        "this tree scans for a list of all packages available in PKGDIR"
-       def __init__(self, root, pkgdir, virtual=None, settings=None, clone=None):
-               if clone:
-                       writemsg("binartree.__init__(): deprecated " + \
-                               "use of clone parameter\n", noiselevel=-1)
-                       # XXX This isn't cloning. It's an instance of the same thing.
-                       self.root = clone.root
-                       self.pkgdir = clone.pkgdir
-                       self.dbapi = clone.dbapi
-                       self.populated = clone.populated
-                       self.tree = clone.tree
-                       self.remotepkgs = clone.remotepkgs
-                       self.invalids = clone.invalids
-                       self.settings = clone.settings
-               else:
+       def __init__(self, root, pkgdir, virtual=None, settings=None):
+               if True:
                        self.root = root
                        #self.pkgdir=settings["PKGDIR"]
                        self.pkgdir = normalize_path(pkgdir)
@@ -176,7 +165,7 @@ class binarytree(object):
                        self._remote_has_index = False
                        self._remote_base_uri = None
                        self._remotepkgs = None # remote metadata indexed by cpv
-                       self.remotepkgs = {}  # indexed by tbz2 name (deprecated)
+                       self.__remotepkgs = {}  # indexed by tbz2 name (deprecated)
                        self.invalids = []
                        self.settings = settings
                        self._pkg_paths = {}
@@ -237,6 +226,24 @@ class binarytree(object):
                                chain(*self._pkgindex_translated_keys)
                        ))
 
+       def _get_remotepkgs(self):
+               warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs",
+                       DeprecationWarning)
+               return self.__remotepkgs
+
+       def _set_remotepkgs(self, remotepkgs):
+               warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs",
+                       DeprecationWarning)
+               self.__remotepkgs = remotepkgs
+
+       def _del_remotepkgs(self):
+               warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs",
+                       DeprecationWarning)
+               del self.__remotepkgs
+
+       remotepkgs = property(_get_remotepkgs, _set_remotepkgs, _del_remotepkgs,
+               "Deprecated self.remotepkgs, only for backward compatibility")
+
        def move_ent(self, mylist):
                if not self.populated:
                        self.populate()
@@ -446,8 +453,15 @@ class binarytree(object):
                _movefile(src_path, dest_path, mysettings=self.settings)
                self._pkg_paths[cpv] = mypath
 
-       def populate(self, getbinpkgs=0, getbinpkgsonly=0):
+       def populate(self, getbinpkgs=0, getbinpkgsonly=None):
                "populates the binarytree"
+
+               if getbinpkgsonly is not None:
+                       warnings.warn(
+                               "portage.dbapi.bintree.binarytree.populate(): " + \
+                               "getbinpkgsonly parameter is deprecated",
+                               DeprecationWarning)
+
                if self._populating:
                        return
                from portage.locks import lockfile, unlockfile
@@ -457,13 +471,13 @@ class binarytree(object):
                                pkgindex_lock = lockfile(self._pkgindex_file,
                                        wantnewlockfile=1)
                        self._populating = True
-                       self._populate(getbinpkgs, getbinpkgsonly)
+                       self._populate(getbinpkgs)
                finally:
                        if pkgindex_lock:
                                unlockfile(pkgindex_lock)
                        self._populating = False
 
-       def _populate(self, getbinpkgs=0, getbinpkgsonly=0):
+       def _populate(self, getbinpkgs=0):
                if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
                        return 0
 
@@ -760,7 +774,7 @@ class binarytree(object):
                                        self._remotepkgs[d["CPV"]] = d
                                self._remote_has_index = True
                                self._remote_base_uri = pkgindex.header.get("URI", base_url)
-                               self.remotepkgs = {}
+                               self.__remotepkgs = {}
                                for cpv in self._remotepkgs:
                                        self.dbapi.cpv_inject(cpv)
                                self.populated = 1
@@ -805,18 +819,18 @@ class binarytree(object):
                        writemsg_stdout(
                                colorize("GOOD", _("Fetching bininfo from ")) + \
                                re.sub(r'//(.+):.+@(.+)/', r'//\1:*password*@\2/', base_url) + "\n")
-                       self.remotepkgs = portage.getbinpkg.dir_get_metadata(
+                       self.__remotepkgs = portage.getbinpkg.dir_get_metadata(
                                self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size)
                        #writemsg(green("  -- DONE!\n\n"))
 
-                       for mypkg in list(self.remotepkgs):
-                               if "CATEGORY" not in self.remotepkgs[mypkg]:
+                       for mypkg in list(self.__remotepkgs):
+                               if "CATEGORY" not in self.__remotepkgs[mypkg]:
                                        #old-style or corrupt package
                                        writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg,
                                                noiselevel=-1)
-                                       del self.remotepkgs[mypkg]
+                                       del self.__remotepkgs[mypkg]
                                        continue
-                               mycat = self.remotepkgs[mypkg]["CATEGORY"].strip()
+                               mycat = self.__remotepkgs[mypkg]["CATEGORY"].strip()
                                fullpkg = mycat+"/"+mypkg[:-5]
 
                                if fullpkg in metadata:
@@ -839,7 +853,7 @@ class binarytree(object):
                                        # invalid tbz2's can hurt things.
                                        #print "cpv_inject("+str(fullpkg)+")"
                                        self.dbapi.cpv_inject(fullpkg)
-                                       remote_metadata = self.remotepkgs[mypkg]
+                                       remote_metadata = self.__remotepkgs[mypkg]
                                        for k, v in remote_metadata.items():
                                                remote_metadata[k] = v.strip()
 
@@ -860,7 +874,7 @@ class binarytree(object):
                                except:
                                        writemsg(_("!!! Failed to inject remote binary package: %s\n") % fullpkg,
                                                noiselevel=-1)
-                                       del self.remotepkgs[mypkg]
+                                       del self.__remotepkgs[mypkg]
                                        continue
                self.populated=1
 
@@ -1118,11 +1132,6 @@ class binarytree(object):
                # package is downloaded, state is updated by self.inject().
                return True
 
-       def get_use(self, pkgname):
-               writemsg("deprecated use of binarytree.get_use()," + \
-                       " use dbapi.aux_get() instead", noiselevel=-1)
-               return self.dbapi.aux_get(pkgname, ["USE"])[0].split()
-
        def gettbz2(self, pkgname):
                """Fetches the package from a remote site, if necessary.  Attempts to
                resume if the file appears to be partially downloaded."""
index 6012cd41411de6225ef578acbff2b98db5b54f9a..a4cf16fc056755729863bf579994099a14aec784 100644 (file)
@@ -793,30 +793,6 @@ class portdbapi(dbapi):
 
                return uri_map
 
-       def getfetchlist(self, mypkg, useflags=None, mysettings=None,
-               all=0, mytree=None):
-
-               writemsg("!!! pordbapi.getfetchlist() is deprecated, " + \
-                       "use getFetchMap() instead.\n", noiselevel=-1)
-
-               if all:
-                       useflags = None
-               elif useflags is None:
-                       if mysettings is None:
-                               mysettings = self.doebuild_settings
-                       mysettings.setcpv(mypkg, mydb=self)
-                       useflags = mysettings["PORTAGE_USE"].split()
-               uri_map = self.getFetchMap(mypkg, useflags=useflags, mytree=mytree)
-
-               all_uris = []
-               all_files = []
-               for filename, uris in uri_map.items():
-                       for uri in uris:
-                               all_uris.append(uri)
-                               all_files.append(filename)
-
-               return [all_uris, all_files]
-
        def getfetchsizes(self, mypkg, useflags=None, debug=0):
                # returns a filename:size dictionnary of remaining downloads
                myebuild = self.findname(mypkg)
@@ -1200,7 +1176,7 @@ def close_portdbapi_caches():
                i.close_caches()
 
 class portagetree(object):
-       def __init__(self, root="/", virtual=None, clone=None, settings=None):
+       def __init__(self, root="/", virtual=None, settings=None):
                """
                Constructor for a PortageTree
                
@@ -1208,19 +1184,11 @@ class portagetree(object):
                @type root: String/Path
                @param virtual: UNUSED
                @type virtual: No Idea
-               @param clone: Set this if you want a copy of Clone
-               @type clone: Existing portagetree Instance
                @param settings: Portage Configuration object (portage.settings)
                @type settings: Instance of portage.config
                """
 
-               if clone:
-                       writemsg("portagetree.__init__(): deprecated " + \
-                               "use of clone parameter\n", noiselevel=-1)
-                       self.root = clone.root
-                       self.portroot = clone.portroot
-                       self.pkglines = clone.pkglines
-               else:
+               if True:
                        self.root = root
                        if settings is None:
                                from portage import settings
index fe3f04f5972feb01aedcad5f33bec9f20cffe59f..47da7cedb68093e79563cc0d356fa3d5ea84e8aa 100644 (file)
@@ -937,9 +937,14 @@ def dep_getkey(mydep):
                return Atom(mydep).cp
        except InvalidAtom:
                try:
-                       return Atom('=' + mydep).cp
+                       atom = Atom('=' + mydep)
                except InvalidAtom:
                        pass
+               else:
+                       warnings.warn(_("invalid input to %s: '%s', use %s instead") % \
+                               ('portage.dep.dep_getkey()', mydep, 'portage.cpv_getkey()'),
+                               DeprecationWarning)
+                       return atom.cp
 
        # Fall back to legacy code for backward compatibility.
        warnings.warn(_("%s is deprecated, use %s instead") % \