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
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,
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: