summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 03:54:24 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 03:54:24 +0000
commit626eabbe2947989986b374b25c5331a10edb6ad4 (patch)
tree82b52129ac97d1792fc3611784e4ecb597522755 /pym
parent8c1a78f0796eb624d6ad30b7c9af28cf92e70c3e (diff)
downloadportage-626eabbe2947989986b374b25c5331a10edb6ad4.tar.gz
portage-626eabbe2947989986b374b25c5331a10edb6ad4.tar.bz2
portage-626eabbe2947989986b374b25c5331a10edb6ad4.zip
Inside portage.fetch(), check for the case where FETCOMMAND creates a
directory where a file is expected. This can happen if FETCHCOMMAND erroneously contains wget's -P option where it should instead have -O, as reported in bug #258433, comment #16. (trunk r12601) svn path=/main/branches/2.1.6/; revision=12882
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 3c2807a53..f40116d29 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -3806,6 +3806,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
pass
if mystat is not None:
+ if stat.S_ISDIR(mystat.st_mode):
+ portage.util.writemsg_level(
+ ("!!! Unable to fetch file since " + \
+ "a directory is in the way: \n" + \
+ "!!! %s\n") % myfile_path,
+ level=logging.ERROR, noiselevel=-1)
+ return 0
+
if mystat.st_size == 0:
if distdir_writable:
try:
@@ -4055,9 +4063,11 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
#resume mode:
writemsg(">>> Resuming download...\n")
locfetch=resumecommand
+ command_var = resumecommand_var
else:
#normal mode:
locfetch=fetchcommand
+ command_var = fetchcommand_var
writemsg_stdout(">>> Downloading '%s'\n" % \
re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc))
variables = {
@@ -4105,6 +4115,25 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
del e
fetched = 0
else:
+
+ if stat.S_ISDIR(mystat.st_mode):
+ # This can happen if FETCHCOMMAND erroneously
+ # contains wget's -P option where it should
+ # instead have -O.
+ portage.util.writemsg_level(
+ ("!!! The command specified in the " + \
+ "%s variable appears to have\n!!! " + \
+ "created a directory instead of a " + \
+ "normal file.\n") % command_var,
+ level=logging.ERROR, noiselevel=-1)
+ portage.util.writemsg_level(
+ "!!! Refer to the make.conf(5) " + \
+ "man page for information about how " + \
+ "to\n!!! correctly specify " + \
+ "FETCHCOMMAND and RESUMECOMMAND.\n",
+ level=logging.ERROR, noiselevel=-1)
+ return 0
+
# no exception? file exists. let digestcheck() report
# an appropriately for size or checksum errors