From 93619e7832c025c01989e96d286197b6a5cd1ac7 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 27 Jul 2008 14:43:00 +0000 Subject: [PATCH] Merged from trunk 11215:11223 | 11216 | Fixes from Arfrever: * Highlight the "Files built without | | zmedico | respecting LDFLAGS" QA Notice with red. * Remove | | | scanelf-ignored-LDFLAGS.log when empty. | | 11217 | Fix breakage from r11213 in INHERITED values returned from | | zmedico | portdbapi.aux_get(). | | 11218 | Add support to elog_base() to split messages on newlines | | zmedico | automatically. Thanks to Arfrever for the suggestion. | | 11219 | Make all the elog functions split lines when displaying | | zmedico | output, just like elog_base() does when saving it. | | 11220 | Make elog_base() just use \n as the delimiter in the file | | zmedico | since it's safe now that lines are always split. | | 11221 | Use ${NORMAL} to properly restore color when necessary. | | zmedico | | | 11222 | Update path to make.conf.example. Thanks to Arfrever. | | zmedico | | | 11223 | Fix EbuildFetcher to pass all config variables to the | | zmedico | fetcher so things like http_proxy are included. | svn path=/main/branches/prefix/; revision=11224 --- bin/ebuild.sh | 2 +- bin/isolated-functions.sh | 50 ++++++++++++++++++++++++++++++----- bin/misc-functions.sh | 4 ++- man/make.conf.5 | 2 +- pym/_emerge/__init__.py | 8 +----- pym/portage/__init__.py | 7 +++++ pym/portage/dbapi/porttree.py | 12 +++------ pym/portage/elog/messages.py | 2 +- 8 files changed, 61 insertions(+), 26 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index f0b9312eb..137582316 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1184,7 +1184,7 @@ inherit() { # false alarms due to INHERITED in /var/db/pkg being outdated # in comparison the the eclasses from the portage tree. if ! hasq $ECLASS $INHERITED; then - eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF" + eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF $EBUILD_PHASE" fi fi diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 1a7fa96dc..5b3027b43 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -165,7 +165,7 @@ vecho() { # Internal logging function, don't use this in ebuilds elog_base() { - local messagetype + local line messagetype [ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1 case "${1}" in INFO|WARN|ERROR|LOG|QA) @@ -177,14 +177,26 @@ elog_base() { return 1 ;; esac - echo -ne "${messagetype} $*\n\0" >> "${T}/logging/${EBUILD_PHASE:-other}" + save_IFS + IFS=$'\n' + for line in $* ; do + echo -ne "${messagetype} ${line}\n" >> \ + "${T}/logging/${EBUILD_PHASE:-other}" + done + restore_IFS return 0 } eqawarn() { elog_base QA "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - vecho -e " ${WARN}*${NORMAL} $*" >&2 + save_IFS + IFS=$'\n' + local line + for line in $* ; do + vecho -e " ${WARN}*${NORMAL} ${line}" >&2 + done + restore_IFS LAST_E_CMD="eqawarn" return 0 } @@ -192,7 +204,13 @@ eqawarn() { elog() { elog_base LOG "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo -e " ${GOOD}*${NORMAL} $*" + save_IFS + IFS=$'\n' + local line + for line in $* ; do + echo -e " ${GOOD}*${NORMAL} ${line}" + done + restore_IFS LAST_E_CMD="elog" return 0 } @@ -220,7 +238,13 @@ esyslog() { einfo() { elog_base INFO "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo -e " ${GOOD}*${NORMAL} $*" + save_IFS + IFS=$'\n' + local line + for line in $* ; do + echo -e " ${GOOD}*${NORMAL} ${line}" + done + restore_IFS LAST_E_CMD="einfo" return 0 } @@ -236,7 +260,13 @@ einfon() { ewarn() { elog_base WARN "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*" >&2 + save_IFS + IFS=$'\n' + local line + for line in $* ; do + echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}${line}" >&2 + done + restore_IFS LAST_E_CMD="ewarn" return 0 } @@ -244,7 +274,13 @@ ewarn() { eerror() { elog_base ERROR "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*" >&2 + save_IFS + IFS=$'\n' + local line + for line in $* ; do + echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}${line}" >&2 + done + restore_IFS LAST_E_CMD="eerror" return 0 } diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 12cca1401..9ec255b8e 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -183,12 +183,14 @@ install_qa_check() { f=$(<"${T}"/scanelf-ignored-LDFLAGS.log) if [[ -n ${f} ]] ; then vecho -ne '\a\n' - eqawarn "QA Notice: Files built without respecting LDFLAGS have been detected" + eqawarn "${BAD}QA Notice: Files built without respecting LDFLAGS have been detected${NORMAL}" eqawarn " Please include this file in your report:" eqawarn " ${T}/scanelf-ignored-LDFLAGS.log" eqawarn "${f}" vecho -ne '\a\n' sleep 1 + else + rm -f "${T}"/scanelf-ignored-LDFLAGS.log fi fi fi diff --git a/man/make.conf.5 b/man/make.conf.5 index b1e0693f5..f6b4b85d5 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -446,7 +446,7 @@ This variable contains flags for the \fBPORTAGE_COMPRESS\fR command. .B PORTAGE_ELOG_MAILFROM .TP .B PORTAGE_ELOG_MAILSUBJECT -Please see /etc/make.conf.example for elog documentation. +Please see /usr/share/portage/config/make.conf.example for elog documentation. .TP \fBPORTAGE_FETCH_CHECKSUM_TRY_MIRRORS\fR = \fI5\fR Number of mirrors to try when a downloaded file has an incorrect checksum. diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index e4d0b009a..dfc0ffd00 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2244,8 +2244,6 @@ class EbuildFetcher(SpawnProcess): __slots__ = ("fetchonly", "pkg",) - _env_vars = ("FETCHCOMMAND", "GENTOO_MIRRORS", "RESUMECOMMAND") - def _start(self): root_config = self.pkg.root_config @@ -2253,12 +2251,8 @@ class EbuildFetcher(SpawnProcess): ebuild_path = portdb.findname(self.pkg.cpv) settings = root_config.settings - fetch_env = settings.environ() + fetch_env = dict(settings.iteritems()) fetch_env["PORTAGE_NICENESS"] = "0" - for k in self._env_vars: - v = settings.get(k) - if v is not None: - fetch_env[k] = v if self.fetchonly: fetch_env["PORTAGE_PARALLEL_FETCHONLY"] = "1" diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 4e97519ec..461a60301 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -2818,6 +2818,13 @@ class config(object): def iterkeys(self): return iter(self) + def iteritems(self): + for k in self: + yield (k, self[k]) + + def items(self): + return list(self.iteritems()) + def __setitem__(self,mykey,myvalue): "set a value; will be thrown away at reset() time" if not isinstance(myvalue, str): diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 7f4008432..2948ba6a4 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -432,15 +432,11 @@ class portdbapi(dbapi): mydata["repository"] = self._repository_map.get( os.path.sep.join(myebuild.split(os.path.sep)[:-3]), "") + mydata["INHERITED"] = ' '.join(mydata.get("_eclasses_", [])) + mydata["_mtime_"] = st.st_mtime + #finally, we look at our internal cache entry and return the requested data. - returnme = [] - for x in mylist: - if x == "INHERITED": - returnme.append(' '.join(mydata.get("_eclasses_", []))) - elif x == "_mtime_": - returnme.append(st.st_mtime) - else: - returnme.append(mydata.get(x,"")) + returnme = [mydata.get(x, "") for x in mylist] if cache_me: if self._aux_cache_slot_dict is None: diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py index 5455e17f4..d9e26ce87 100644 --- a/pym/portage/elog/messages.py +++ b/pym/portage/elog/messages.py @@ -35,7 +35,7 @@ def collect_ebuild_messages(path): logentries[msgfunction] = [] lastmsgtype = None msgcontent = [] - for l in open(filename, "r").read().split("\0"): + for l in open(filename, "r"): if not l: continue try: -- 2.26.2