summaryrefslogtreecommitdiffstats
path: root/pym/_emerge
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-12 00:04:21 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-12 00:04:21 +0000
commita6fc3b46fc9d282e78c873f947416479257af364 (patch)
treef3e1e89ac2b69b58228635e65869aed5f6a6c616 /pym/_emerge
parentae1c3a658eaf8e71c731c054cbba57d6c26dea85 (diff)
downloadportage-a6fc3b46fc9d282e78c873f947416479257af364.tar.gz
portage-a6fc3b46fc9d282e78c873f947416479257af364.tar.bz2
portage-a6fc3b46fc9d282e78c873f947416479257af364.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. svn path=/main/trunk/; revision=12207
Diffstat (limited to 'pym/_emerge')
-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 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