Merged from trunk -r11913:11935
authorFabian Groffen <grobian@gentoo.org>
Sat, 15 Nov 2008 16:29:35 +0000 (16:29 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 15 Nov 2008 16:29:35 +0000 (16:29 -0000)
   | 11916   | Fix new* and do* ebuild helpers to generate consistent error |
   | zmedico | messages for missing files and generate an appropriate QA    |
   |         | Notice when such an error is detected in the build log.      |
   |         | Thanks to Diego 'Flameeyes' Pettenò <flameeyes@g.o> for the |
   |         | suggestion.                                                  |

   | 11918   | Bug #216190 - Make dblink.treewalk() bail out rather than    |
   | zmedico | install a package with file paths containing newlines.       |

   | 11920   | Bug #243022 - Inside dblink.mergeme(), when merging a        |
   | zmedico | directory and a symlink is in the way, verify that if points |
   |         | to a directory before accepting it, otherwise move it out of |
   |         | the way.                                                     |

   | 11922   | Bug #236683 - Fix PermissionDenied handling to report the    |
   | zmedico | exception type.                                              |

   | 11924   | Make digestgen() handle PermissionDenied internally by       |
   | zmedico | returning failure, so callers like repoman don't need        |
   |         | exception handling.                                          |

   | 11926   | Bug #236714 - Handle PortagePackageException raised from     |
   | zmedico | Manifest.create().                                           |

   | 11928   | Bug #173284 - Do not traverse hidden directories such as     |
   | zmedico | .svn or .git when search for protected files.                |

   | 11929   | Bug #173284 - Do not traverse hidden directories such as     |
   | zmedico | .svn or .git when search for protected files.                |

   | 11931   | Remove stray print statement from previous commit.           |
   | zmedico |                                                              |

   | 11933   | Bug #173284 - Update config update counting code in          |
   | zmedico | chk_updated_cfg_files() so hidden directories are ignored.   |

   | 11935   | Bug #236207 - Replace some hardcoded colors with color       |
   | zmedico | codes, and use portage.output.EOutput() where appropriate.   |

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

24 files changed:
bin/dispatch-conf
bin/dobin
bin/dodoc
bin/doexe
bin/doinfo
bin/doins
bin/doman
bin/domo
bin/ebuild
bin/etc-update
bin/newbin
bin/newconfd
bin/newdoc
bin/newenvd
bin/newexe
bin/newinitd
bin/newins
bin/newlib.a
bin/newlib.so
bin/newman
bin/newsbin
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/dbapi/vartree.py

index 557a5073481a6ed7975908db886b743f1024216f..cf42a1ce592fa8f3eeaa51a02a985e44c3323ec2 100755 (executable)
@@ -31,7 +31,7 @@ import portage
 from portage import dispatch_conf, const
 from portage.process import find_binary
 
-FIND_EXTANT_CONFIGS  = "find '%s' %s -iname '._cfg????_%s' ! -iname '.*~' ! -iname '.*.bak'"
+FIND_EXTANT_CONFIGS  = "find '%s' %s -name '._cfg????_%s' ! -name '.*~' ! -iname '.*.bak' -print"
 DIFF_CONTENTS        = "diff -Nu '%s' '%s'"
 DIFF_CVS_INTERP      = "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep -v '# .Header:.*'"
 DIFF_WSCOMMENTS      = "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep -v '^[-+]#' | grep -v '^[-+][:space:]*$'"
@@ -96,7 +96,7 @@ class dispatch:
             except OSError:
                 continue
             basename = "*"
-            find_opts = ""
+            find_opts = "-name '.*' -type d -prune -o"
             if not stat.S_ISDIR(mymode):
                 path, basename = os.path.split(path)
                 find_opts = "-maxdepth 1"
index 57a07a809abb074329b916826426a6f954138c79..274d4f40922eff1ddb17c0be808f6dce55c6a9b7 100755 (executable)
--- a/bin/dobin
+++ b/bin/dobin
@@ -20,7 +20,7 @@ for x in "$@" ; do
        if [[ -e ${x} ]] ; then
                install -m 0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin"
        else
-               vecho "!!! ${0##*/}: ${x} does not exist" 1>&2
+               echo "!!! ${0##*/}: $x does not exist" 1>&2
                false
        fi
        ((ret+=$?))
index 343ee91f314f8d3070fb5c8fe98834b52dea6a75..bdfbe7aef6176776705f064365b292d7b1e3fd4d 100755 (executable)
--- a/bin/dodoc
+++ b/bin/dodoc
@@ -20,7 +20,7 @@ for x in "$@" ; do
                install -m0644 "${x}" "${dir}"
                ecompress --queue "${dir}/${x##*/}"
        elif [ ! -e "${x}" ] ; then
-               echo "dodoc: ${x} does not exist" 1>&2
+               echo "!!! ${0##*/}: $x does not exist" 1>&2
                ((++ret))
        fi
 done
index cfb6a72e29fd4e2b8c173eb7ea7caa1f79873829..bd278e52e9ee32a7304b73034969d3a33f2ed938 100755 (executable)
--- a/bin/doexe
+++ b/bin/doexe
@@ -24,5 +24,6 @@ for x in "$@" ; do
        else
                mysrc="${x}"
        fi
-       install ${EXEOPTIONS} "${mysrc}" "${ED}${_E_EXEDESTTREE_}"
+       install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_" || \
+               echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
 done
index c263a093a6b4cbdab8fef63da3a856da3d109395..a00885c0cd9df5acb38558640353dc6c30a03939 100755 (executable)
@@ -12,4 +12,11 @@ if [[ ! -d ${ED}usr/share/info ]] ; then
        install -d "${ED}usr/share/info" || exit 1
 fi
 
-exec install -m0644 "$@" "${ED}usr/share/info"
+install -m0644 "$@" "${ED}usr/share/info"
+rval=$?
+if [ $rval -ne 0 ] ; then
+       for x in "$@" ; do
+               [ -e "$x" ] || echo "!!! ${0##*/}: $x does not exist" 1>&2
+       done
+fi
+exit $rval
index e823da7820878b3842698faaa2a27a3d39f1a96b..a1141ccfed26644e7dc46e2fa561a95651616180 100755 (executable)
--- a/bin/doins
+++ b/bin/doins
@@ -51,6 +51,7 @@ _doins() {
        install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
        rval=$?
        [[ -n ${cleanup} ]] && rm -f "${cleanup}"
+       [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
        return $rval
 }
 
index 0ee656befb145114e66ca945286c6ec6a0dfa249..88e87be87f3c9961127c2fcaf6ff223749fd3ef2 100755 (executable)
--- a/bin/doman
+++ b/bin/doman
@@ -49,7 +49,7 @@ for x in "$@" ; do
                        install -m0644 "${x}" "${ED}/usr/share/man/${mandir}/${name}"
                        ((ret+=$?))
                elif [[ ! -e ${x} ]] ; then
-                       vecho "doman: ${x} does not exist" 1>&2
+                       echo "!!! ${0##*/}: $x does not exist" 1>&2
                        ((++ret))
                fi
        else
index 9f41c360de68902fd12ae17743430ecf424f1694..2f1295e9c597bdb6a20fb86a0d0c1659fbc15a08 100755 (executable)
--- a/bin/domo
+++ b/bin/domo
@@ -21,6 +21,6 @@ for x in "$@" ; do
                fi
                install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo"
        else
-               echo "${0}: ${x} does not exist"
+               echo "!!! ${0##*/}: $x does not exist" 1>&2
        fi
 done
index 03fbe08a2a04775c2421966e9e5390e3f2f8ae68..80c4d744e7e433d1f0344914d994aaab2ea67976 100755 (executable)
@@ -205,7 +205,8 @@ def stale_env_warning():
                        for x in msg:
                                portage.writemsg(">>> %s\n" % x)
 
-from portage.exception import UnsupportedAPIException
+from portage.exception import PermissionDenied, \
+       PortagePackageException, UnsupportedAPIException
 checked_for_stale_env = False
 
 for arg in pargs:
@@ -233,6 +234,12 @@ for arg in pargs:
                for x in msg:
                        portage.writemsg("!!! %s\n" % x, noiselevel=-1)
                a = 1
+       except PortagePackageException, e:
+               portage.writemsg("!!! %s\n" % (e,), noiselevel=-1)
+               a = 1
+       except PermissionDenied, e:
+               portage.writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1)
+               a = 1
        if a == None:
                print "Could not run the required binary?"
                a = 127
index ad0419be6dbfe97ad9b1be2b674b743852e20a13..a9b056831597b9e9b48e9c56fd88b12d80091d62 100755 (executable)
@@ -50,17 +50,19 @@ scan() {
 
        for path in ${CONFIG_PROTECT} ; do
                path="${EROOT}${path}"
-               find_opts="-iname ._cfg????_*"
+               # Do not traverse hidden directories such as .svn or .git.
+               find_opts="-name .* -type d -prune -o -name ._cfg????_*"
                if [ ! -d "${path}" ]; then
                        [ ! -f "${path}" ] && continue
                        my_basename="${path##*/}"
                        path="${path%/*}"
-                       find_opts="-maxdepth 1 -iname ._cfg????_${my_basename}"
+                       find_opts="-maxdepth 1 -name ._cfg????_${my_basename}"
                fi
 
                ofile=""
                # The below set -f turns off file name globbing in the ${find_opts} expansion.
-               for file in $(set -f; find ${path}/ ${find_opts} ! -iname '.*~' ! -iname '.*.bak' |
+               for file in $(set -f ; find ${path}/ ${find_opts} \
+                      ! -name '.*~' ! -iname '.*.bak' -print |
                           sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\2\%\3:" |
                           sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'); do
 
index b45dd849719a38620564fb82f954ac098eb7ed49..925229329c2a0e078bc91b042df7288420817a86 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec dobin "${T}/${2}"
index 9ce6d406961102ca53db9170361431d04b9e8321..877ddfdc18d03e92dcc5a4820fe9da7d7ab9edd8 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec doconfd "${T}/${2}"
index 8b41093f48ff8506016cf337eaef379fde60cf2c..82e8c5ca83dce82f26016beb099aad2b48feb200 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec dodoc "${T}/${2}"
index ece766bf3f347d06049bac103fd0337be0bf76c0..5628cc7d22392db61614d9a3e6b550d28f1326f3 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec doenvd "${T}/${2}"
index 6bd52418c09798d505134c3ec9eb909a0fd4331c..007bcdaa836c96c7218a8196983eade88006b07e 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec doexe "${T}/${2}"
index 5ab06d3afdd440dde1bc355bf64a099cef68b8c4..9f5ed7296e10e9a4a2ba59df8a1bd657f0f2b122 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec doinitd "${T}/${2}"
index a0e58bed8a568be93f089cb28dc64a813dd4cf44..f3ce74cbc7d81b97e4b5f1742921e66718f88658 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" || exit $?
 cp -f "${1}" "${T}/${2}" || exit $?
 doins "${T}/${2}"
index f26abfbcb99c4626f39dc75478f052c73cdaad34..b84dc1295b9cd722ef744315c5c3275385bc6910 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec dolib.a "${T}/${2}"
index 558bc2fc0d9aaf731a8e68579bfa9146c7b89156..649f188952d66fd58e4261d01dca568fa14fa74a 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec dolib.so "${T}/${2}"
index 5273fc64c266c2da6d9082d04816912d3ac691d7..32e4486b4891fd0c755f89baa161894e4263ad49 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec doman "${T}/${2}"
index 74acaf1705c70576e67095097b9e6fa53b33a5d1..8240edf8a50ab4d127c291b1cc1cff1c9fa5209a 100755 (executable)
@@ -8,6 +8,11 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
        exit 1
 fi
 
+if [ ! -e "$1" ] ; then
+       echo "!!! ${0##*/}: $1 does not exist" 1>&2
+       exit 1
+fi
+
 rm -rf "${T}/${2}" && \
 cp -f "${1}" "${T}/${2}" && \
 exec dosbin "${T}/${2}"
index d2c9470f52a8254838464d64ee7a03803e8aadf4..4a1e55b78246ed172c3368c0c56e1454914babaf 100644 (file)
@@ -5377,7 +5377,10 @@ class depgraph(object):
                                print "- "+pkg.cpv+" ("+", ".join(mreasons)+")"
 
                elif masked_packages:
-                       print "\n!!! "+red("All ebuilds that could satisfy ")+green(xinfo)+red(" have been masked.")
+                       print "\n!!! " + \
+                               colorize("BAD", "All ebuilds that could satisfy ") + \
+                               colorize("INFORM", xinfo) + \
+                               colorize("BAD", " have been masked.")
                        print "!!! One of the following masked packages is required to complete your request:"
                        have_eapi_mask = show_masked_packages(masked_packages)
                        if have_eapi_mask:
@@ -11022,6 +11025,7 @@ def unmerge(root_config, myopts, unmerge_action,
 def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
 
        if os.path.exists(EPREFIX+"/usr/bin/install-info"):
+               out = portage.output.EOutput()
                regen_infodirs=[]
                for z in infodirs:
                        if z=='':
@@ -11034,13 +11038,16 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                                regen_infodirs.append(inforoot)
 
                if not regen_infodirs:
-                       portage.writemsg_stdout("\n "+green("*")+" GNU info directory index is up-to-date.\n")
+                       portage.writemsg_stdout("\n")
+                       out.einfo("GNU info directory index is up-to-date.")
                else:
-                       portage.writemsg_stdout("\n "+green("*")+" Regenerating GNU info directory index...\n")
+                       portage.writemsg_stdout("\n")
+                       out.einfo("Regenerating GNU info directory index...")
 
                        dir_extensions = ("", ".gz", ".bz2")
                        icount=0
                        badcount=0
+                       errmsg = ""
                        for inforoot in regen_infodirs:
                                if inforoot=='':
                                        continue
@@ -11048,7 +11055,7 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                if not os.path.isdir(inforoot) or \
                                        not os.access(inforoot, os.W_OK):
                                        continue
-                               errmsg = ""
+
                                file_list = os.listdir(inforoot)
                                file_list.sort()
                                dir_file = os.path.join(inforoot, "dir")
@@ -11118,11 +11125,12 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                prev_mtimes[inforoot] = long(os.stat(inforoot).st_mtime)
 
                        if badcount:
-                               print " "+yellow("*")+" Processed",icount,"info files;",badcount,"errors."
-                               print errmsg
+                               out.eerror("Processed %d info files; %d errors." % \
+                                       (icount, badcount))
+                               writemsg_level(errmsg, level=logging.ERROR, noiselevel=-1)
                        else:
                                if icount > 0:
-                                       print " "+green("*")+" Processed",icount,"info files."
+                                       out.einfo("Processed %d info files." % (icount,))
 
 
 def display_news_notification(root_config, myopts):
@@ -11333,11 +11341,11 @@ def chk_updated_cfg_files(target_root, config_protect):
                                except OSError:
                                        pass
                        if stat.S_ISDIR(mymode):
-                               mycommand = "find '%s' -iname '._cfg????_*'" % x
+                               mycommand = "find '%s' -name '.*' -type d -prune -o -name '._cfg????_*'" % x
                        else:
-                               mycommand = "find '%s' -maxdepth 1 -iname '._cfg????_%s'" % \
+                               mycommand = "find '%s' -maxdepth 1 -name '._cfg????_%s'" % \
                                        os.path.split(x.rstrip(os.path.sep))
-                       mycommand += " ! -iname '.*~' ! -iname '.*.bak' -print0"
+                       mycommand += " ! -name '.*~' ! -iname '.*.bak' -print0"
                        a = commands.getstatusoutput(mycommand)
                        if a[0] != 0:
                                sys.stderr.write(" %s error scanning '%s': " % (bad("*"), x))
@@ -11420,6 +11428,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
        xterm_titles = "notitles" not in settings.features
        emergelog(xterm_titles, " === sync")
        myportdir = settings.get("PORTDIR", None)
+       out = portage.output.EOutput()
        if not myportdir:
                sys.stderr.write("!!! PORTDIR is undefined.  Is /etc/make.globals missing?\n")
                sys.exit(1)
@@ -11749,26 +11758,27 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                                ">>> Exceeded PORTAGE_RSYNC_RETRIES: %s\n" % maxretries)
                        sys.exit(1)
                elif (exitcode>0):
-                       print
+                       msg = []
                        if exitcode==1:
-                               print darkred("!!!")+green(" Rsync has reported that there is a syntax error. Please ensure")
-                               print darkred("!!!")+green(" that your SYNC statement is proper.")
-                               print darkred("!!!")+green(" SYNC="+settings["SYNC"])
+                               msg.append("Rsync has reported that there is a syntax error. Please ensure")
+                               msg.append("that your SYNC statement is proper.")
+                               msg.append("SYNC=" + settings["SYNC"])
                        elif exitcode==11:
-                               print darkred("!!!")+green(" Rsync has reported that there is a File IO error. Normally")
-                               print darkred("!!!")+green(" this means your disk is full, but can be caused by corruption")
-                               print darkred("!!!")+green(" on the filesystem that contains PORTDIR. Please investigate")
-                               print darkred("!!!")+green(" and try again after the problem has been fixed.")
-                               print darkred("!!!")+green(" PORTDIR="+settings["PORTDIR"])
+                               msg.append("Rsync has reported that there is a File IO error. Normally")
+                               msg.append("this means your disk is full, but can be caused by corruption")
+                               msg.append("on the filesystem that contains PORTDIR. Please investigate")
+                               msg.append("and try again after the problem has been fixed.")
+                               msg.append("PORTDIR=" + settings["PORTDIR"])
                        elif exitcode==20:
-                               print darkred("!!!")+green(" Rsync was killed before it finished.")
+                               msg.append("Rsync was killed before it finished.")
                        else:
-                               print darkred("!!!")+green(" Rsync has not successfully finished. It is recommended that you keep")
-                               print darkred("!!!")+green(" trying or that you use the 'emerge-webrsync' option if you are unable")
-                               print darkred("!!!")+green(" to use rsync due to firewall or other restrictions. This should be a")
-                               print darkred("!!!")+green(" temporary problem unless complications exist with your network")
-                               print darkred("!!!")+green(" (and possibly your system's filesystem) configuration.")
-                       print
+                               msg.append("Rsync has not successfully finished. It is recommended that you keep")
+                               msg.append("trying or that you use the 'emerge-webrsync' option if you are unable")
+                               msg.append("to use rsync due to firewall or other restrictions. This should be a")
+                               msg.append("temporary problem unless complications exist with your network")
+                               msg.append("(and possibly your system's filesystem) configuration.")
+                       for line in msg:
+                               out.eerror(line)
                        sys.exit(exitcode)
        elif syncuri[:6]=="cvs://":
                if not os.path.exists(EPREFIX+"/usr/bin/cvs"):
index b09acaf70711c4250f629975c22a8c26eaaf6f84..7e75f18f891bb4062eaedd897b31ce52fa67fa25 100644 (file)
@@ -4280,7 +4280,14 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
                        writemsg(("!!! File %s doesn't exist, can't update " + \
                                "Manifest\n") % e, noiselevel=-1)
                        return 0
-               mf.write(sign=False)
+               except portage.exception.PortagePackageException, e:
+                       writemsg(("!!! %s\n") % (e,), noiselevel=-1)
+                       return 0
+               try:
+                       mf.write(sign=False)
+               except portage.exception.PermissionDenied, e:
+                       writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1)
+                       return 0
                if "assume-digests" not in mysettings.features:
                        distlist = mf.fhashdict.get("DIST", {}).keys()
                        distlist.sort()
@@ -4522,6 +4529,9 @@ def _check_build_log(mysettings, out=None):
        bash_command_not_found = []
        bash_command_not_found_re = re.compile(
                r'(.*): line (\d*): (.*): command not found$')
+       helper_missing_file = []
+       helper_missing_file_re = re.compile(
+               r'^!!! (do|new).*: .* does not exist$')
 
        configure_opts_warn = []
        configure_opts_warn_re = re.compile(
@@ -4538,6 +4548,9 @@ def _check_build_log(mysettings, out=None):
                        if bash_command_not_found_re.match(line) is not None:
                                bash_command_not_found.append(line.rstrip("\n"))
 
+                       if helper_missing_file_re.match(line) is not None:
+                               helper_missing_file.append(line.rstrip("\n"))
+
                        if configure_opts_warn_re.match(line) is not None:
                                configure_opts_warn.append(line.rstrip("\n"))
        finally:
@@ -4574,6 +4587,12 @@ def _check_build_log(mysettings, out=None):
                msg.extend("\t" + line for line in bash_command_not_found)
                _eqawarn(msg)
 
+       if helper_missing_file:
+               msg = ["QA Notice: file does not exist:"]
+               msg.append("")
+               msg.extend("\t" + line[4:] for line in helper_missing_file)
+               _eqawarn(msg)
+
        if configure_opts_warn:
                msg = ["QA Notice: Unrecognized configure options:"]
                msg.append("")
@@ -5732,7 +5751,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        elif "digest" in mysettings.features:
                                digestgen(aalist, mysettings, overwrite=0, myportdb=mydbapi)
                except portage.exception.PermissionDenied, e:
-                       writemsg("!!! %s\n" % str(e), noiselevel=-1)
+                       writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1)
                        if mydo in ("digest", "manifest"):
                                return 1
 
index 3ed3c55b6f369fdcbb72fe7ca43fed5b3a305689..1d060b3b7457403801e089d585f7fcc35bd6e192 100644 (file)
@@ -3609,19 +3609,40 @@ class dblink(object):
 
                myfilelist = []
                mylinklist = []
+               paths_with_newlines = []
+               srcroot_len = len(srcroot)
                def onerror(e):
                        raise
                for parent, dirs, files in os.walk(srcroot, onerror=onerror):
                        for f in files:
                                file_path = os.path.join(parent, f)
+                               relative_path = file_path[srcroot_len:]
+
+                               if "\n" in relative_path:
+                                       paths_with_newlines.append(relative_path)
+
                                file_mode = os.lstat(file_path).st_mode
                                if stat.S_ISREG(file_mode):
-                                       myfilelist.append(file_path[len(srcroot):])
+                                       myfilelist.append(relative_path)
                                elif stat.S_ISLNK(file_mode):
                                        # Note: os.walk puts symlinks to directories in the "dirs"
                                        # list and it does not traverse them since that could lead
                                        # to an infinite recursion loop.
-                                       mylinklist.append(file_path[len(srcroot):])
+                                       mylinklist.append(relative_path)
+
+               if paths_with_newlines:
+                       msg = []
+                       msg.append("This package installs one or more files containing")
+                       msg.append("a newline (\\n) character:")
+                       msg.append("")
+                       paths_with_newlines.sort()
+                       for f in paths_with_newlines:
+                               msg.append("\t/%s" % (f.replace("\n", "\\n")))
+                       msg.append("")
+                       msg.append("package %s NOT merged" % self.mycpv)
+                       msg.append("")
+                       eerror(msg)
+                       return 1
 
                # If there are no files to merge, and an installed package in the same
                # slot has files, it probably means that something went wrong.
@@ -4181,7 +4202,8 @@ class dblink(object):
                                                writemsg("!!! And finish by running this: env-update\n\n")
                                                return 1
 
-                                       if stat.S_ISLNK(mydmode) or stat.S_ISDIR(mydmode):
+                                       if stat.S_ISDIR(mydmode) or \
+                                               (stat.S_ISLNK(mydmode) and os.path.isdir(mydest)):
                                                # a symlink to an existing directory will work for us; keep it:
                                                showMessage("--- %s/\n" % mydest)
                                                if bsd_chflags: