summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-20 02:17:02 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-20 02:17:02 +0000
commit710bb557cc124fc88aca249b9e938b432a958c01 (patch)
treeaec26d7565af61df38aa22aa3d8d5359da40ac77 /pym
parent187a82ab54471433e0b85841a45d50dc79358541 (diff)
downloadportage-710bb557cc124fc88aca249b9e938b432a958c01.tar.gz
portage-710bb557cc124fc88aca249b9e938b432a958c01.tar.bz2
portage-710bb557cc124fc88aca249b9e938b432a958c01.zip
For bug #158608, don't attempt to use distlocks when it's detected that the filesystem is readonly (unless "skiprocheck" is in FEATURES for some strange reason).
svn path=/main/trunk/; revision=5330
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py30
1 files changed, 13 insertions, 17 deletions
diff --git a/pym/portage.py b/pym/portage.py
index d0f2bbe5f..c41832557 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2169,11 +2169,21 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
can_fetch=True
+ if listonly:
+ can_fetch = False
+
for var_name in ("FETCHCOMMAND", "RESUMECOMMAND"):
if not mysettings.get(var_name, None):
can_fetch = False
- if not listonly:
+ if can_fetch and \
+ not fetch_to_ro and \
+ not os.access(mysettings["DISTDIR"], os.W_OK):
+ writemsg("!!! No write access to '%s'\n" % mysettings["DISTDIR"],
+ noiselevel=-1)
+ can_fetch = False
+
+ if can_fetch:
dirmode = 02070
filemode = 060
modemask = 02
@@ -2200,12 +2210,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
writemsg("!!! Directory Not Found: DISTDIR='%s'\n" % mysettings["DISTDIR"], noiselevel=-1)
writemsg("!!! Fetching will fail!\n", noiselevel=-1)
- if not os.access(mysettings["DISTDIR"]+"/",os.W_OK):
- if not fetch_to_ro:
- print "!!! No write access to %s" % mysettings["DISTDIR"]+"/"
- can_fetch=False
- else:
- if use_locks and locks_in_subdir:
+ if can_fetch and use_locks and locks_in_subdir:
distlocks_subdir = os.path.join(mysettings["DISTDIR"], locks_in_subdir)
if not os.access(distlocks_subdir, os.W_OK):
writemsg("!!! No write access to write to %s. Aborting.\n" % distlocks_subdir,
@@ -2328,16 +2333,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
else:
continue
- # check if we can actually write to the directory/existing file.
- if fetched!=2 and os.path.exists(mysettings["DISTDIR"]+"/"+myfile) != \
- os.access(mysettings["DISTDIR"]+"/"+myfile, os.W_OK) and not fetch_to_ro:
- writemsg( red("***") + \
- " Lack write access to %s, failing fetch\n" % \
- os.path.join(mysettings["DISTDIR"], myfile),
- noiselevel=-1)
- fetched=0
- break
- elif fetched!=2:
+ if fetched != 2:
#we either need to resume or start the download
#you can't use "continue" when you're inside a "try" block
if fetched==1: