From: Fabian Groffen Date: Tue, 9 Jan 2007 19:34:05 +0000 (-0000) Subject: Merged from trunk 5486:5499 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=50663331a100722866f5bf99886daf1087f7a819;p=portage.git Merged from trunk 5486:5499 Note: 5486 (Make PORTAGE_BASE_PATH dynamic based on __file__) not merged into prefix, as in prefix PORTAGE_BASE_PATH is controlled by the prefix itself, semi-dynamic. Always run src_test when calling 'ebuild foo test' (genone) Disable qa_source usage until it actually works (genone) Zac pointed out that the retcodes would be wrong if stuff failed...Yeah... (WarnerBro) Add new eqawarn function and QA loglevel to be used for QA messages (genone) Mention new QA loglevel in make.conf.example (genone) Okies this works locally for me now (and Zac) (WarnerBro) This file apparently uses spaces to line everything up pretty (I have weird tabs set, so spacies are good :P) (WarnerBro) Update NEWS with eqawarn and 'ebuild foo test' changes (genone) Split PORTAGE_ELOG_CLASSES outside the loop for better efficiency. Make digestgen() force fetch unless all required digest types are available. Thanks to jokey for reporting on irc. For bug #161103, don't skip collision-protect checks in cases where the beginning of the file path matches a symlink but is not acually inside a symlinked directory (check the path against symlink + os.path.sep). svn path=/main/branches/prefix/; revision=5501 --- diff --git a/NEWS b/NEWS index f556895bd..2cee62dc2 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ portage-2.1.2 * New elog modules mail_summary and save_summary that act like the mail/save modules except that they merge messages from multiple packages in a single file/mail. +* New QA loglevel and matching eqawarn function +* `ebuild foo test` now always runs src_test if available portage-2.1.1 ------------ diff --git a/bin/ebuild b/bin/ebuild index f120f0c14..d8266243c 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -126,6 +126,10 @@ def discard_digests(myebuild, mysettings, mydbapi): for arg in pargs: try: tmpsettings = portage.config(clone=portage.settings) + if arg == "test" and not "test" in tmpsettings.features: + print "Forcing test." + tmpsettings["EBUILD_FORCE_TEST"] = "1" + tmpsettings.backupenv["EBUILD_FORCE_TEST"] = "1" if arg == "digest" and force: discard_digests(ebuild, tmpsettings, portage.portdb) a = portage.doebuild(ebuild, arg, portage.root, tmpsettings, diff --git a/bin/ebuild.sh b/bin/ebuild.sh index bc925f9a4..75a8ff1a2 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -25,7 +25,7 @@ declare -rx EBUILD_PHASE qa_source() { local shopts=$(shopt) OLDIFS="$IFS" - source "$@" + source "$@" || return 1 [[ $shopts != $(shopt) ]] && vecho "QA Notice: Global shell options were changed and not restored while sourcing $1" [[ "$IFS" != "$OLDIFS" ]] && @@ -35,7 +35,7 @@ qa_source() { qa_call() { local shopts=$(shopt) OLDIFS="$IFS" - "$@" + "$@" || return 1 [[ $shopts != $(shopt) ]] && vecho "QA Notice: Global shell options were changed while calling $1" [[ "$IFS" != "$OLDIFS" ]] && @@ -1165,6 +1165,7 @@ dyn_compile() { } dyn_test() { + [ "${EBUILD_FORCE_TEST}" == "1" ] && rm -f "${PORTAGE_BUILDDIR}/.tested" [ "$(type -t pre_src_test)" == "function" ] && qa_call pre_src_test if [ "${PORTAGE_BUILDDIR}/.tested" -nt "${WORKDIR}" ]; then vecho ">>> It appears that ${PN} has already been tested; skipping." @@ -1175,7 +1176,7 @@ dyn_test() { if [ -d "${S}" ]; then cd "${S}" fi - if ! hasq test $FEATURES; then + if ! hasq test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}" elif hasq test $RESTRICT; then ewarn "Skipping make test/check due to ebuild restriction." diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index e487a9aff..b28167f78 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -15,7 +15,7 @@ elog_base() { local messagetype [ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1 case "${1}" in - INFO|WARN|ERROR|LOG) + INFO|WARN|ERROR|LOG|QA) messagetype="${1}" shift ;; @@ -28,6 +28,12 @@ elog_base() { return 0 } +eqawarn() { + elog_base QA "$*" + echo -e " ${WARN}*${NORMAL} $*" + return 0 +} + elog() { elog_base LOG "$*" echo -e " ${GOOD}*${NORMAL} $*" diff --git a/cnf/make.conf b/cnf/make.conf index b1f87c0f7..b3a85e7a6 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -321,7 +321,7 @@ # logging related variables: # PORTAGE_ELOG_CLASSES: selects messages to be logged, possible values are: -# info, warn, error, log +# info, warn, error, log, qa # Warning: commenting this will disable elog PORTAGE_ELOG_CLASSES="warn error log" diff --git a/pym/elog_modules/mod_syslog.py b/pym/elog_modules/mod_syslog.py index be8e4f33d..a95ecb452 100644 --- a/pym/elog_modules/mod_syslog.py +++ b/pym/elog_modules/mod_syslog.py @@ -7,7 +7,11 @@ def process(mysettings, cpv, logentries, fulltext): if not phase in logentries: continue for msgtype,msgcontent in logentries[phase]: - pri = {"INFO": syslog.LOG_INFO, "WARN": syslog.LOG_WARNING, "ERROR": syslog.LOG_ERR, "LOG": syslog.LOG_NOTICE} + pri = {"INFO": syslog.LOG_INFO, + "WARN": syslog.LOG_WARNING, + "ERROR": syslog.LOG_ERR, + "LOG": syslog.LOG_NOTICE, + "QA": syslog.LOG_WARNING} msgtext = "".join(msgcontent) syslog.syslog(pri[msgtype], "%s: %s: %s" % (cpv, phase, msgtext)) syslog.closelog() diff --git a/pym/portage.py b/pym/portage.py index 3cff4dc9f..8747efad7 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -469,10 +469,11 @@ def elog_process(cpv, mysettings): # exploit listdir() file order so we process log entries in chronological order mylogfiles.reverse() mylogentries = {} + my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split()) for f in mylogfiles: msgfunction, msgtype = f.split(".") - if not msgtype.upper() in mysettings["PORTAGE_ELOG_CLASSES"].split() \ - and not msgtype.lower() in mysettings["PORTAGE_ELOG_CLASSES"].split(): + if msgtype.upper() not in my_elog_classes \ + and msgtype.lower() not in my_elog_classes: continue if msgfunction not in portage_const.EBUILD_PHASES: writemsg("!!! can't process invalid log file: %s\n" % f, @@ -2615,8 +2616,18 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None distfiles_map.setdefault(myfile, []).append(cpv) mf = Manifest(mysettings["O"], mysettings["DISTDIR"], fetchlist_dict=fetchlist_dict) - missing_hashes = set(distfiles_map).difference( - mf.fhashdict.get("DIST", {})) + required_hash_types = set(portage_const.MANIFEST1_HASH_FUNCTIONS) + required_hash_types.update(portage_const.MANIFEST2_HASH_FUNCTIONS) + required_hash_types.add("size") + dist_hashes = mf.fhashdict.get("DIST", {}) + missing_hashes = set() + for myfile in distfiles_map: + myhashes = dist_hashes.get(myfile) + if not myhashes: + missing_hashes.add(myfile) + continue + if required_hash_types.difference(myhashes): + missing_hashes.add(myfile) if missing_hashes: missing_files = [] for myfile in missing_hashes: @@ -7013,6 +7024,9 @@ class dblink: os.chdir(srcroot) mysymlinks = filter(os.path.islink, listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False)) myfilelist.extend(mysymlinks) + mysymlinked_directories = [s + os.path.sep for s in mysymlinks] + del mysymlinks + stopmerge=False starttime=time.time() @@ -7039,10 +7053,10 @@ class dblink: nocheck = False # listdir isn't intelligent enough to exclude symlinked dirs, # so we have to do it ourself - for s in mysymlinks: - # the length comparison makes sure that the symlink itself is checked - if f[:len(s)] == s and len(f) > len(s): + for s in mysymlinked_directories: + if f.startswith(s): nocheck = True + break if nocheck: continue i=i+1 diff --git a/pym/portage_const.py b/pym/portage_const.py index 09ede4a14..51a19f9a2 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -53,7 +53,7 @@ EBUILD_PHASES = ["setup", "unpack", "compile", "test", "install", EAPI = "prefix" -HASHING_BLOCKSIZE = 32768 +HASHING_BLOCKSIZE = 32768 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"] MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]