From a6fc3b46fc9d282e78c873f947416479257af364 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 12 Dec 2008 00:04:21 +0000 Subject: Fix --getbinpkgonly behavior so that binaries from the remote server are preferred over local packages if they are not identical. Thanks to Lance Albertson for reporting. svn path=/main/trunk/; revision=12207 --- pym/_emerge/__init__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'pym/_emerge') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 81f0f3667..d416bb6b3 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -3409,7 +3409,18 @@ class BinpkgFetcher(SpawnProcess): settings = bintree.settings use_locks = "distlocks" in settings.features pkg_path = self.pkg_path - resume = os.path.exists(pkg_path) + + portage.util.ensure_dirs(os.path.dirname(pkg_path)) + if use_locks: + self.lock() + exists = os.path.exists(pkg_path) + resume = exists and os.path.basename(pkg_path) in bintree.invalids + if not resume: + # Remove existing file or broken symlink. + try: + os.unlink(pkg_path) + except OSError: + pass # urljoin doesn't work correctly with # unrecognized protocols like sftp @@ -3441,10 +3452,6 @@ class BinpkgFetcher(SpawnProcess): fetch_args = [portage.util.varexpand(x, mydict=fcmd_vars) \ for x in shlex.split(fcmd)] - portage.util.ensure_dirs(os.path.dirname(pkg_path)) - if use_locks: - self.lock() - if self.fd_pipes is None: self.fd_pipes = {} fd_pipes = self.fd_pipes -- cgit v1.2.3-1-g7c22