summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/__init__.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-12 21:45:18 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-12 21:45:18 +0000
commitb5930985225c70ef5a5fcde5cd988732ad306f32 (patch)
treec4ffa6609e2a9723362564f006928d4c4bfc9f21 /pym/_emerge/__init__.py
parent199d813d90bea172e8f5bf6f1a84c5a8987135d1 (diff)
downloadportage-b5930985225c70ef5a5fcde5cd988732ad306f32.tar.gz
portage-b5930985225c70ef5a5fcde5cd988732ad306f32.tar.bz2
portage-b5930985225c70ef5a5fcde5cd988732ad306f32.zip
Fix --getbinpkgonly behavior so that binaries from the remote server are
preferred over local packages if they are not identical. Thanks to Lance Albertson <ramereth@g.o> for reporting. (trunk r12207) svn path=/main/branches/2.1.6/; revision=12238
Diffstat (limited to 'pym/_emerge/__init__.py')
-rw-r--r--pym/_emerge/__init__.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index b7cafa8a6..d8fb14621 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -3390,7 +3390,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
@@ -3422,10 +3433,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