Merged from trunk 5486:5499
authorFabian Groffen <grobian@gentoo.org>
Tue, 9 Jan 2007 19:34:05 +0000 (19:34 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 9 Jan 2007 19:34:05 +0000 (19:34 -0000)
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

NEWS
bin/ebuild
bin/ebuild.sh
bin/isolated-functions.sh
cnf/make.conf
pym/elog_modules/mod_syslog.py
pym/portage.py
pym/portage_const.py

diff --git a/NEWS b/NEWS
index f556895bdc018c913d73f8f55c9e842b9586a72d..2cee62dc2331f402b6479e9eb01564ad5ecd101d 100644 (file)
--- 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
 ------------
index f120f0c145f7913495e72db45a9bae6af3663c67..d8266243ccf8477b603576790800c058c8347381 100755 (executable)
@@ -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,
index bc925f9a4c204944d590e54af1609c97fb6573e8..75a8ff1a2fe21b565f0426c1ead3f619f436a86f 100755 (executable)
@@ -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."
index e487a9aff26f09e2cc47ef1de944369cc1388874..b28167f788b5f53c883fe5ab6549e934c1c4b4cd 100644 (file)
@@ -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} $*"
index b1f87c0f7fc151003dca15444170660b575dc455..b3a85e7a60d1d6a31603844cf5d3e2c7c661c2cd 100644 (file)
 
 # 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"
 
index be8e4f33d28822419574f68cb72f88645c13dd56..a95ecb452e270ac2f94419e7cae0e7b22de13df2 100644 (file)
@@ -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()
index 3cff4dc9f831bbf593e64d703f991ade098fc2ee..8747efad78e19d7410b0754561f13c96f2a612e2 100644 (file)
@@ -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
index 09ede4a1471f166d9a62f9918e8c03fd58eaa7c2..51a19f9a2223b2a247596798a624d47ff4bfc3ad 100644 (file)
@@ -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"]