Merged from trunk 6451:6459
authorFabian Groffen <grobian@gentoo.org>
Mon, 30 Apr 2007 14:33:33 +0000 (14:33 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 30 Apr 2007 14:33:33 +0000 (14:33 -0000)
   +------------------------------------------------------------------------+
   | 6452    | For bug #175058, properly quote the variables in             |
   | zmedico | FETCHCOMMAND and RESUMECOMMAND since the command is spawned  |
   |         | in a bash shell.                                             |
   |---------+--------------------------------------------------------------|
   | 6454    | For bug #176384, adjust config according to options of the   |
   | zmedico | command being resumed.                                       |
   |---------+--------------------------------------------------------------|
   | 6456    | For bug #175058, avoid potential quoting issues by spawning  |
   | zmedico | FETCHCOMMAND without a shell.                                |
   |---------+--------------------------------------------------------------|
   | 6458    | - add new echo module for people who don't want any real     |
   | genone  | logging - add copyright header in elog modules and enable    |
   |         | keyword substitution - enable save_summary and echo modules  |
   |         | in make.globals                                              |
   |---------+--------------------------------------------------------------|
   | 6459    | Fix -* handling in gvisible to match incremental semantics   |
   | genone  |                                                              |
   +------------------------------------------------------------------------+

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

15 files changed:
NEWS
RELEASE-NOTES
cnf/make.conf
cnf/make.globals
pym/emerge/__init__.py
pym/portage/__init__.py
pym/portage/dbapi/porttree.py
pym/portage/elog/__init__.py
pym/portage/elog/mod_custom.py
pym/portage/elog/mod_echo.py [new file with mode: 0644]
pym/portage/elog/mod_mail.py
pym/portage/elog/mod_mail_summary.py
pym/portage/elog/mod_save.py
pym/portage/elog/mod_save_summary.py
pym/portage/elog/mod_syslog.py

diff --git a/NEWS b/NEWS
index 065970d78a46121faaeb07a1baa80cf3cbd97b72..48f66e86731e9fbe5352d5eb178959102b27d681 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ portage-2.1.3
 * Namespace sanitizing: move all portage related code into portage.* namespace,
   rename portage_foo modules to portage.foo (but keep symlinks for compability)
 * Add license visibility filtering (GLEP 23)
+* Add new elog module "echo" to simply display messages when emerge exits
+* Enable "echo" and "save_summary" elog modules by default
+* Fix -* handling in package.keywords to work as intended (reset the accepted 
+  keywords list), also see RELEASE-NOTES.
 
 portage-2.1.2
 -------------
index 88335040339cec2e9cc8c6e0aba9e1327450c6a2..eba5316e933c3fd46b6f055a54623a75bf7d5298 100644 (file)
@@ -7,6 +7,16 @@ portage-2.1.3
 * The python namespace for portage has been sanitized, all portage related code
   is now contained within the portage namespace. External script should be updated
   accordingly, though links exist for backward compability.
+* The "save_summary" and "echo" elog modules are now enabled by default. Setting
+  PORTAGE_ELOG_SYSTEM in make.conf will override this, so if you don't want elog
+  set PORTAGE_ELOG_SYSTEM="" in make.conf
+* -* support in package.keywords was changed as it was inconsistent with 
+  ACCEPT_KEYWORDS behavior (also see http://dev.gentoo.org/~genone/docs/KEYWORDS.stupid).
+  Previously having -* in package.keywords matched packages with KEYWORDS="-*", 
+  now it resets the ACCEPT_KEYWORDS list for the given atom like it does when
+  used in ACCEPT_KEYWORDS.
+  For packages that don't specify any other KEYWORDS you can use the new ** token
+  as documented in portage(5) to disable KEYWORDS filtering completely.
 
 portage-2.1.2
 ==================================
index f633ba5c4d1a49bc97fd4c40e9813879f596d17f..eb365b6c11aa9fa43a3c8e0d5a99c159c0add523 100644 (file)
@@ -317,6 +317,7 @@ PORTAGE_ELOG_CLASSES="warn error log"
 
 # PORTAGE_ELOG_SYSTEM: selects the module(s) to process the log messages. Modules
 #                      included in portage are (empty means logging is disabled):
+#                          echo (display messages again when emerge exits)
 #                          save (saves one log per package in $PORT_LOGDIR/elog, 
 #                                /var/log/portage/elog if $PORT_LOGDIR is unset)
 #                          custom (passes all messages to $PORTAGE_ELOG_COMMAND)
index e88550de92de9d09a3663bf8a63cbb2fd8e12313..a759e35396743e557a38cd2088205aa7a9bcb004 100644 (file)
@@ -79,6 +79,7 @@ PORTAGE_WORKDIR_MODE="0700"
 
 # Some defaults for elog
 PORTAGE_ELOG_CLASSES="log warn error"
+PORTAGE_ELOG_SYSTEM="save_summary echo"
 
 PORTAGE_ELOG_MAILURI="@rootuser@"
 PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}"
index aba28ec842178028b408f1cce5b018dbf2cd2d8a..d01b4500b35fff54b4ccf285f02539f9ce272338 100644 (file)
@@ -4917,6 +4917,15 @@ def action_build(settings, trees, mtimedb,
                        if myopt not in myresumeopts:
                                myresumeopts[myopt] = myarg
                myopts=myresumeopts
+
+               # Adjust config according to options of the command being resumed.
+               for myroot in trees:
+                       mysettings =  trees[myroot]["vartree"].settings
+                       mysettings.unlock()
+                       adjust_config(myopts, mysettings)
+                       mysettings.lock()
+                       del myroot, mysettings
+
                myparams = create_depgraph_params(myopts, myaction)
                if "--quiet" not in myopts and "--nodeps" not in myopts:
                        print "Calculating dependencies  ",
index 172c289314aef9f98e971221878797c0c1a04cfa..7e27bbf9a4a68be5f04b95114b07104115d6a53e 100644 (file)
@@ -2610,9 +2610,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                else:
                                        resumecommand=mysettings["RESUMECOMMAND"]
 
-                               fetchcommand=fetchcommand.replace("${DISTDIR}",mysettings["DISTDIR"])
-                               resumecommand=resumecommand.replace("${DISTDIR}",mysettings["DISTDIR"])
-
                                if not can_fetch:
                                        if fetched != 2:
                                                if fetched == 0:
@@ -2642,8 +2639,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                                locfetch=fetchcommand
                                        writemsg_stdout(">>> Downloading '%s'\n" % \
                                                re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc))
-                                       myfetch=locfetch.replace("${URI}",loc)
-                                       myfetch=myfetch.replace("${FILE}",myfile)
+                                       myfetch = locfetch.split()
+                                       variables = {"${DISTDIR}":mysettings["DISTDIR"],
+                                               "${URI}":loc, "${FILE}":myfile}
+                                       for i in xrange(len(myfetch)):
+                                               token = myfetch[i].strip("\"'")
+                                               value = variables.get(token)
+                                               if value is not None:
+                                                       myfetch[i] = value
 
                                        spawn_keywords = {}
                                        if "userfetch" in mysettings.features and \
@@ -2661,7 +2664,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                                        con = con.replace(mysettings["PORTAGE_T"], mysettings["PORTAGE_FETCH_T"])
                                                        selinux.setexec(con)
 
-                                               myret = portage.process.spawn_bash(myfetch,
+                                               myret = portage.process.spawn(myfetch,
                                                        env=mysettings.environ(), **spawn_keywords)
 
                                                if mysettings.selinux_enabled():
@@ -4702,12 +4705,14 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
                if matches:
                        inc_pgroups = []
                        for x in pgroups:
-                               if x != "-*" and x.startswith("-"):
+                               if x == "-*":
+                                       inc_pgroups = []
+                               elif x[0] == "-":
                                        try:
                                                inc_pgroups.remove(x[1:])
                                        except ValueError:
                                                pass
-                               if x not in inc_pgroups:
+                               elif x not in inc_pgroups:
                                        inc_pgroups.append(x)
                        pgroups = inc_pgroups
                        del inc_pgroups
@@ -4724,10 +4729,10 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
                        if gp=="*":
                                kmask=None
                                break
-                       elif gp=="-"+myarch:
+                       elif gp=="-"+myarch and myarch in pgroups:
                                kmask="-"+myarch
                                break
-                       elif gp=="~"+myarch:
+                       elif gp=="~"+myarch and myarch in pgroups:
                                kmask="~"+myarch
                                break
 
index ad6ccc45a3888016179bd0a821442a60842569b3..16e962a85de14bf74eed14dabd853ce4f2059290 100644 (file)
@@ -668,24 +668,26 @@ class portdbapi(dbapi):
                                for atom in matches:
                                        pgroups.extend(pkgdict[cp][atom])
                                if matches:
+                                       # normalize pgroups with incrementals logic so it 
+                                       # matches ACCEPT_KEYWORDS behavior
                                        inc_pgroups = []
                                        for x in pgroups:
-                                               # The -* special case should be removed once the tree 
-                                               # is clean of KEYWORDS=-* crap
-                                               if x != "-*" and x.startswith("-"):
+                                               if x == "-*":
+                                                       inc_pgroups = []
+                                               elif x[0] == "-":
                                                        try:
                                                                inc_pgroups.remove(x[1:])
                                                        except ValueError:
                                                                pass
-                                               if x not in inc_pgroups:
+                                               elif x not in inc_pgroups:
                                                        inc_pgroups.append(x)
                                        pgroups = inc_pgroups
                                        del inc_pgroups
                        hasstable = False
                        hastesting = False
                        for gp in mygroups:
-                               if gp=="*":
-                                       writemsg("--- WARNING: Package '%s' uses '*' keyword.\n" % mycpv,
+                               if gp == "*" or (gp == "-*" and len(mygroups) == 1):
+                                       writemsg("--- WARNING: Package '%s' uses '%s' keyword.\n" % (mycpv, gp),
                                                noiselevel=-1)
                                        match=1
                                        break
index c6f6ec47c60420f703c5a5bb5e81ae8582e4b4bd..be7eb5b66a121b27d53aebdd10c881a6e8b5890d 100644 (file)
@@ -1,3 +1,8 @@
+# elog/__init__.py - elog core functions
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
 from portage.const import EBUILD_PHASES
 from portage.exception import PortageException
 from portage.process import atexit_register
index 5fae84078bdb9dab2a227a7c97fdb138de78e43f..3433bbbf1d9bba6c43e4fe5c430688c2ff16ce58 100644 (file)
@@ -1,3 +1,8 @@
+# elog/mod_custom.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
 import portage.elog_modules.mod_save, portage.process, portage.exception
 
 def process(mysettings, cpv, logentries, fulltext):
diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py
new file mode 100644 (file)
index 0000000..73928b4
--- /dev/null
@@ -0,0 +1,30 @@
+# elog/mod_echo.py - elog dispatch module
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+from portage.output import EOutput
+from portage.const import EBUILD_PHASES
+
+_items = {}
+def process(mysettings, cpv, logentries, fulltext):
+       _items[cpv] = logentries
+
+def finalize(mysettings):
+       printer = EOutput()
+       for cpv in _items.keys():
+               print
+               printer.einfo("Messages for package %s:" % cpv)
+               print
+               for phase in EBUILD_PHASES:
+                       if not phase in _items[cpv]:
+                               continue
+                       for msgtype, msgcontent in _items[cpv][phase]:
+                               fmap = {"INFO": printer.einfo,
+                                               "WARN": printer.ewarn,
+                                               "ERROR": printer.eerror,
+                                               "LOG": printer.einfo,
+                                               "QA": printer.ewarn}
+                               for line in msgcontent:
+                                       fmap[msgtype](line.strip("\n"))
+       return
index b84555e8c33b77bcf18bcf0e1aacf066dacef585..4695e8ec463248634a2018b17758440b125aa30c 100644 (file)
@@ -1,5 +1,5 @@
-# portage.py -- core Portage functionality
-# Copyright 1998-2004 Gentoo Foundation
+# elog/mod_mail.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
index 99c285642b8d3ac4bc2850aaea301f120ec04ef4..a1f4ed57ffbca43c1dff7d364b749148c55f4e02 100644 (file)
@@ -1,7 +1,7 @@
-# portage.py -- core Portage functionality
-# Copyright 1998-2004 Gentoo Foundation
+# elog/mod_mail_summary.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Id: mod_mail.py 3484 2006-06-10 22:38:44Z genone $
+# $Id$
 
 import portage.mail, socket, os, time
 from email.MIMEText import MIMEText as TextMessage
index 2993b45db353e5ac205633d811f97a4826082586..eff40edd950728386a2bc5a8d466eb3b11bbe3ca 100644 (file)
@@ -1,3 +1,8 @@
+# elog/mod_save.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
 import os, time
 from portage.data import portage_uid, portage_gid
 
index eb453e58778aed54109c97b988a3d1a6572cb23a..aebc6f9aa8357a2395f915eca125fca8c0038bc2 100644 (file)
@@ -1,3 +1,8 @@
+# elog/mod_save_summary.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
 import os, time
 from portage.data import portage_uid, portage_gid
 
index 77e1d4ea683acc48081eae5681c104c8778dd573..28aa15b3ce34c8870aec8b23c8d5d06d9af191c8 100644 (file)
@@ -1,3 +1,8 @@
+# elog/mod_syslog.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
 import syslog
 from portage.const import EBUILD_PHASES