summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: