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:]*$'"
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"
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+=$?))
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
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
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
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
}
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
fi
install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo"
else
- echo "${0}: ${x} does not exist"
+ echo "!!! ${0##*/}: $x does not exist" 1>&2
fi
done
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:
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
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
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}"
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}"
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}"
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}"
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}"
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}"
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}"
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}"
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}"
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}"
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}"
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:
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=='':
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
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")
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):
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))
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)
">>> 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"):
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()
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(
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:
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("")
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
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.
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: