Merged from trunk 8510:8513
authorFabian Groffen <grobian@gentoo.org>
Fri, 16 Nov 2007 07:57:24 +0000 (07:57 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 16 Nov 2007 07:57:24 +0000 (07:57 -0000)
   | 8511    | Bug #199311 - Make dblink.getcontents() show the path of the |
   | zmedico | CONTENTS file when any kind of parse error occurs.           |

   | 8512    | Don't export ${IMAGE} to the ebuild environment anymore      |
   | zmedico | since everything uses ${D} now (including the entire tree).  |

   | 8513    | Set IMAGE for minimal backward compatibility with overlays   |
   | zmedico | or user's bashrc, but don't export it.                       |

svn path=/main/branches/prefix/; revision=8515

bin/ebuild.sh
pym/portage/__init__.py
pym/portage/dbapi/vartree.py

index 3a2102bb54c34aa0f834d67c07355abc0b8d3b84..a673505e5f30dd186cbe6bd88dbd760ec8f33264 100755 (executable)
@@ -1451,6 +1451,9 @@ for x in D T P PN PV PVR PR CATEGORY A EBUILD EMERGE_FROM FILESDIR PORTAGE_TMPDI
        [[ ${!x-UNSET_VAR} != UNSET_VAR ]] && declare -r ${x}
 done
 unset x
+# Set IMAGE for minimal backward compatibility with
+# overlays or user's bashrc, but don't export it.
+IMAGE=${D}
 
 # Turn of extended glob matching so that g++ doesn't get incorrectly matched.
 shopt -u extglob
index d78148923aa196a63ef9d891307a51c6e5ac9896..8fd32c0e62d2ec142828ea4a9f5382569ab7149c 100644 (file)
@@ -4225,7 +4225,6 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                        filemode=060, filemask=0)
                        return retval
                elif mydo == "preinst":
-                       mysettings["IMAGE"] = mysettings["D"]
                        phase_retval = spawn(" ".join((EBUILD_SH_BINARY, mydo)),
                                mysettings, debug=debug, free=1, logfile=logfile)
                        if phase_retval == os.EX_OK:
@@ -4240,7 +4239,6 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                if phase_retval != os.EX_OK:
                                        writemsg("!!! post preinst failed; exiting.\n",
                                                noiselevel=-1)
-                       del mysettings["IMAGE"]
                        return phase_retval
                elif mydo == "postinst":
                        mysettings.load_infodir(mysettings["O"])
index 5d60250372363e6501aa8527a80dfb64460c273a..548fda91d6c748460551e515b9d05194057ca558 100644 (file)
@@ -962,13 +962,11 @@ class dblink(object):
                if myroot == os.path.sep:
                        myroot = None
                pos = 0
-               for line in mylines:
-                       pos += 1
+               errors = []
+               for pos, line in enumerate(mylines):
                        if null_byte in line:
                                # Null bytes are a common indication of corruption.
-                               writemsg("!!! Null byte found in contents " + \
-                                       "file, line %d: '%s'\n" % (pos, contents_file),
-                                       noiselevel=-1)
+                               errors.append((pos + 1, "Null byte found in CONTENTS entry"))
                                continue
                        line = line.rstrip("\n")
                        # Split on " " so that even file paths that
@@ -985,8 +983,7 @@ class dblink(object):
                                        try:
                                                splitter = mydat.index("->", 2, len(mydat) - 2)
                                        except ValueError:
-                                               writemsg("!!! Unrecognized CONTENTS entry on " + \
-                                                       "line %d: '%s'\n" % (pos, line), noiselevel=-1)
+                                               errors.append((pos + 1, "Unrecognized CONTENTS entry"))
                                                continue
                                        spaces_in_path = splitter - 2
                                        spaces_in_target = spaces_total - spaces_in_path
@@ -1026,11 +1023,13 @@ class dblink(object):
                                        #format: type
                                        pkgfiles[mydat[1]] = [mydat[0]]
                                else:
-                                       writemsg("!!! Unrecognized CONTENTS entry on " + \
-                                               "line %d: '%s'\n" % (pos, line), noiselevel=-1)
+                                       errors.append((pos + 1, "Unrecognized CONTENTS entry"))
                        except (KeyError, IndexError):
-                               writemsg("!!! Unrecognized CONTENTS entry on " + \
-                                       "line %d: '%s'\n" % (pos, line), noiselevel=-1)
+                               errors.append((pos + 1, "Unrecognized CONTENTS entry"))
+               if errors:
+                       writemsg("!!! Parse error in '%s'\n" % contents_file, noiselevel=-1)
+                       for pos, e in errors:
+                               writemsg("!!!   line %d: %s\n" % (pos, e), noiselevel=-1)
                self.contentscache = pkgfiles
                return pkgfiles