Merged from trunk -r14200:14209
authorFabian Groffen <grobian@gentoo.org>
Sun, 13 Sep 2009 18:56:52 +0000 (18:56 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 13 Sep 2009 18:56:52 +0000 (18:56 -0000)
   | 14201   | Use _unicode_decode() on the string returned from            |
   | zmedico | time.strftime(), in order to avoid a potential               |
   |         | UnicodeDecodeError later. Thanks to Markus Duft              |
   |         | <mduft@gentoo.org> for reporting.                            |

   | 14202   | Inside Scheduler._check_manifests(), display all broken      |
   | zmedico | manifests instead of returning after the first one. Thanks   |
   |         | to Vlastimil Babka <caster@g.o> for the suggestion.          |

   | 14203   | Add a vardbapi._pkgs_changed attribute to use instead of     |
   | zmedico | PORTAGE_COUNTER_HASH for emerge to check whether any         |
   |         | packages have been added/removed. This is an optimization,   |
   |         | since vardbapi._counter_hash() can be somewhat slow on       |
   |         | embedded systems. Thanks to Marat Radchenko                  |
   |         | <slonopotamusorama@gmail.com> for reporting.                 |

   | 14204   | Add ACCEPT_LICENSE and ACCEPT_PROPERTIES to the Packages     |
   | zmedico | file header.                                                 |

   | 14205   | Document ACCEPT_LICENSE and package.license.                 |
   | zmedico |                                                              |

   | 14206   | Document ACCEPT_PROPERTIES and package.properties.           |
   | zmedico |                                                              |

   | 14207   | Remove unused vardbapi._counter_hash() method.               |
   | zmedico |                                                              |

   | 14208   | In display_news_notification(), use the exising vartree      |
   | zmedico | instance to populate settings.treeVirtuals, to avoid having  |
   |         | a temporary one instantiated. Thanks to Marat Radchenko      |
   |         | <slonopotamusorama@gmail.com> for reporting.                 |

   | 14209   | Handle AttributeError instead of using getattr. Thanks to    |
   | zmedico | Marat Radchenko <slonopotamusorama@gmail.com> for reporting. |

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

13 files changed:
man/emerge.1
man/make.conf.5
man/portage.5
pym/_emerge/Scheduler.py
pym/_emerge/Task.py
pym/_emerge/actions.py
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/elog/mod_mail_summary.py
pym/portage/elog/mod_save.py
pym/portage/glsa.py

index acc2dc8d36d8a467cd43c1402371f47e0fac00e9..683af7e38c309a3820c87c8196717b14f95d52b8 100644 (file)
@@ -652,6 +652,22 @@ variable to allow or disallow the emerging of a package masked by
 versions of packages, you should update your 
 \fI/etc/portage/package.keywords\fR file to list the packages you want the 
 \'testing\' version.  See \fBportage\fR(5) for more information.
+.TP
+.BR LICENSE
+The \fBLICENSE\fR variable in an \fBebuild\fR file can be used to mask
+packages based on licensing restrictions. \fBemerge\fR examines the
+\fBACCEPT_LICENSE\fR environment variable to allow or disallow the emerging
+of a package masked by \fBLICENSE\fR. See \fBmake.conf\fR(5) for information
+about \fBACCEPT_LICENSE\fR, and see \fBportage\fR(5) for information about
+\fI/etc/portage/package.license\fR.
+.TP
+.BR PROPERTIES
+The \fBPROPERTIES\fR variable in an \fBebuild\fR file can be used to mask
+packages based on properties restrictions. \fBemerge\fR examines the
+\fBACCEPT_PROPERTIES\fR environment variable to allow or disallow the emerging
+of a package masked by \fBPROPERTIES\fR. See \fBmake.conf\fR(5) for information
+about \fBACCEPT_PROPERTIES\fR, and see \fBportage\fR(5) for information about
+\fI/etc/portage/package.properties\fR.
 .SH "CONFIGURATION FILES"
 Portage has a special feature called "config file protection". The purpose of
 this feature is to prevent new package installs from clobbering existing
index 229e50b3fb49b470ccc76bd202dd721bb7043fa5..be4b1ab9d9b402adde74b9a7fd24c1666a4bbcf7 100644 (file)
@@ -36,6 +36,17 @@ set this to '~ppc'.  This is an incremental variable.  Only define a
 .br
 Defaults to the value of $ARCH.
 .TP
+\fBACCEPT_LICENSE\fR = \fI[space delimited list of licenses or groups]\fR
+This variable is used to mask packages based on licensing restrictions.
+.br
+Defaults to the value of * -@EULA.
+.TP
+\fBACCEPT_PROPERTIES\fR = \fI[space delimited list of properties]\fR
+This variable is used to mask packages based on PROPERTIES restrictions.
+See \fBebuild\fR(5) for more information about PROPERTIES.
+.br
+Defaults to the value of *.
+.TP
 .B CBUILD
 This variable is passed by the \fIebuild scripts\fR to the \fIconfigure\fR
 as \fI\-\-build=${CBUILD}\fR only if it is defined.  Do not set this yourself
index 9ce5b5552a9eccca29d19adc5783a7ea615f8797..36805f815e3c41a8e785c1cb1398ea4caf9d92b1 100644 (file)
@@ -51,7 +51,9 @@ color.map
 mirrors
 modules
 package.keywords
+package.license
 package.mask
+package.properties
 package.unmask
 package.use
 repos.conf
@@ -512,6 +514,15 @@ package.keywords like this:
 
 games-fps/quake3-demo x86
 
+.TP
+.BR package.license
+This will allow ACCEPT_LICENSE to be augmented for a single package.
+
+.I Format:
+.nf
+\- comment lines begin with # (no inline comments)
+\- one DEPEND atom per line followed by additional licenses or groups
+.fi
 .TP
 .BR package.mask
 A list of package atoms to mask.  Useful if specific versions of packages do
@@ -532,6 +543,15 @@ versions earlier than 1.0.4496.  No problem!
 >=media\-video/nvidia\-glx\-1.0.4496
 .fi
 .TP
+.BR package.properties
+This will allow ACCEPT_PROPERTIES to be augmented for a single package.
+
+.I Format:
+.nf
+\- comment lines begin with # (no inline comments)
+\- one DEPEND atom per line followed by additional properties
+.fi
+.TP
 .BR package.unmask
 Just like package.mask above, except here you list packages you want to 
 unmask.  Useful for overriding the global package.mask file (see 
index 6a44d0e2f2890c9330bf205697b3ebba8e490b53..06074c932511b226bbd3cb92fff739dcd60ef0ee 100644 (file)
@@ -607,6 +607,8 @@ class Scheduler(PollScheduler):
                        quiet_settings[myroot] = quiet_config
                        del quiet_config
 
+               failures = 0
+
                for x in self._mergelist:
                        if not isinstance(x, Package) or \
                                x.type_name != "ebuild":
@@ -624,8 +626,10 @@ class Scheduler(PollScheduler):
                        quiet_config = quiet_settings[root_config.root]
                        quiet_config["O"] = os.path.dirname(portdb.findname(x.cpv))
                        if not portage.digestcheck([], quiet_config, strict=True):
-                               return 1
+                               failures |= 1
 
+               if failures:
+                       return 1
                return os.EX_OK
 
        def _add_prefetchers(self):
index d218ba360d3b682ccb99e717d35b0544e7f295cc..0cd545500b1d7cbffd06e4e38790c99c3c4fe677 100644 (file)
@@ -7,10 +7,10 @@ class Task(SlotObject):
        __slots__ = ("_hash_key", "_hash_value")
 
        def _get_hash_key(self):
-               hash_key = getattr(self, "_hash_key", None)
-               if hash_key is None:
+               try:
+                       return self._hash_key
+               except AttributeError:
                        raise NotImplementedError(self)
-               return hash_key
 
        def __eq__(self, other):
                return self._get_hash_key() == other
index 1fc509114fdc5126a85eeee6a3ea90f778e20f83..10d6577194d16e6240935ed802a2a8afd799d2bb 100644 (file)
@@ -2674,6 +2674,12 @@ def display_news_notification(root_config, myopts):
        newsReaderDisplay = False
        update = "--pretend" not in myopts
 
+       if not settings.treeVirtuals:
+               # Populate these using our existing vartree, to avoid
+               # having a temporary one instantiated.
+               settings.treeVirtuals = portage.util.map_dictlist_vals(
+                       portage.getCPFromCPV, trees["vartree"].get_all_provides())
+
        for repo in portdb.getRepositories():
                unreadItems = checkUpdatedNewsItems(
                        portdb, vardb, NEWS_PATH, UNREAD_PATH, repo, update=update)
index 19f076c41f5d330a60660b67a6ee41692754be78..25726265c08959d4746ac0a63be97a0133a63545 100644 (file)
@@ -9,6 +9,8 @@ import textwrap
 import platform
 import portage
 from portage import os
+from portage import _encodings
+from portage import _unicode_decode
 import _emerge.help
 import portage.xpak, commands, errno, re, time
 from portage.output import colorize, xtermTitle, xtermTitleReset
@@ -313,9 +315,7 @@ def post_emerge(root_config, myopts, mtimedb, retval):
 
        _flush_elog_mod_echo()
 
-       counter_hash = settings.get("PORTAGE_COUNTER_HASH")
-       if "--pretend" in myopts or (counter_hash is not None and \
-               counter_hash == vardbapi._counter_hash()):
+       if not vardbapi._pkgs_changed:
                display_news_notification(root_config, myopts)
                # If vdb state has not changed then there's nothing else to do.
                sys.exit(retval)
@@ -1074,11 +1074,6 @@ def emerge_main():
                mysettings =  trees[myroot]["vartree"].settings
                mysettings.unlock()
                adjust_config(myopts, mysettings)
-               if '--pretend' not in myopts and myaction in \
-                       (None, 'clean', 'depclean', 'prune', 'unmerge'):
-                       mysettings["PORTAGE_COUNTER_HASH"] = \
-                               trees[myroot]["vartree"].dbapi._counter_hash()
-                       mysettings.backup_changes("PORTAGE_COUNTER_HASH")
                mysettings.lock()
                del myroot, mysettings
 
@@ -1298,7 +1293,9 @@ def emerge_main():
 
        if not "--pretend" in myopts:
                emergelog(xterm_titles, "Started emerge on: "+\
-                       time.strftime("%b %d, %Y %H:%M:%S", time.localtime()))
+                       _unicode_decode(
+                               time.strftime("%b %d, %Y %H:%M:%S", time.localtime()),
+                               encoding=_encodings['content'], errors='replace'))
                myelogstr=""
                if myopts:
                        myelogstr=" ".join(myopts)
index d69ef042d927a9cd1c835773808b966d01f7b0fd..274af057366a9a10648132f3949b3c14c3a77a07 100644 (file)
@@ -1445,7 +1445,6 @@ class config(object):
                "GENTOO_MIRRORS", "NOCONFMEM", "O",
                "PORTAGE_BACKGROUND",
                "PORTAGE_BINHOST_CHUNKSIZE", "PORTAGE_CALLER",
-               "PORTAGE_COUNTER_HASH",
                "PORTAGE_ELOG_CLASSES",
                "PORTAGE_ELOG_MAILFROM", "PORTAGE_ELOG_MAILSUBJECT",
                "PORTAGE_ELOG_MAILURI", "PORTAGE_ELOG_SYSTEM",
@@ -6292,8 +6291,9 @@ def _prepare_workdir(mysettings):
                logid_path = os.path.join(mysettings["PORTAGE_BUILDDIR"], ".logid")
                if not os.path.exists(logid_path):
                        open(_unicode_encode(logid_path), 'w')
-               logid_time = time.strftime("%Y%m%d-%H%M%S",
-                       time.gmtime(os.stat(logid_path).st_mtime))
+               logid_time = _unicode_decode(time.strftime("%Y%m%d-%H%M%S",
+                       time.gmtime(os.stat(logid_path).st_mtime)),
+                       encoding=_encodings['content'], errors='replace')
                mysettings["PORTAGE_LOG_FILE"] = os.path.join(
                        mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \
                        (mysettings["CATEGORY"], mysettings["PF"], logid_time))
index 8fbe0c977d6593516127c7acfa83f8e6739871b7..57fc627942b586e22f4f22362d4d9d0e57ef3e04 100644 (file)
@@ -188,7 +188,9 @@ class binarytree(object):
                        self._pkgindex_use_evaluated_keys = \
                                ("LICENSE", "RDEPEND", "DEPEND",
                                "PDEPEND", "PROPERTIES", "PROVIDE")
-                       self._pkgindex_header_keys = set(["ACCEPT_KEYWORDS", "CBUILD",
+                       self._pkgindex_header_keys = set([
+                               "ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
+                               "ACCEPT_PROPERTIES", "CBUILD",
                                "CHOST", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES",
                                "GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE", "EPREFIX"])
                        self._pkgindex_default_pkg_data = {
index 91262c200f47d133c5509fe19e00e36bd36b8732..42b51e337690e3a958377637ad848b41938ae57a 100644 (file)
@@ -1498,6 +1498,10 @@ class vardbapi(dbapi):
                self.root = _unicode_decode(root,
                        encoding=_encodings['content'], errors='strict')
 
+               # Used by emerge to check whether any packages
+               # have been added or removed.
+               self._pkgs_changed = False
+
                #cache for category directory mtimes
                self.mtdircache = {}
 
@@ -1565,25 +1569,6 @@ class vardbapi(dbapi):
                        level=logging.ERROR, noiselevel=-1)
                return 0
 
-       def _counter_hash(self):
-               try:
-                       from hashlib import md5 as new_hash
-               except ImportError:
-                       from md5 import new as new_hash
-               h = new_hash()
-               aux_keys = ["COUNTER"]
-               cpv_list = self.cpv_all()
-               cpv_list.sort()
-               for cpv in cpv_list:
-                       try:
-                               counter, = self.aux_get(cpv, aux_keys)
-                       except KeyError:
-                               continue
-                       h.update(_unicode_encode(counter,
-                               encoding=_encodings['repo.content'],
-                               errors='backslashreplace'))
-               return h.hexdigest()
-
        def cpv_inject(self, mycpv):
                "injects a real package into our on-disk database; assumes mycpv is valid and doesn't already exist"
                os.makedirs(self.getpath(mycpv))
@@ -1757,9 +1742,11 @@ class vardbapi(dbapi):
                self._aux_cache_obj = None
 
        def _add(self, pkg_dblink):
+               self._pkgs_changed = True
                self._clear_pkg_cache(pkg_dblink)
 
        def _remove(self, pkg_dblink):
+               self._pkgs_changed = True
                self._clear_pkg_cache(pkg_dblink)
 
        def _clear_pkg_cache(self, pkg_dblink):
index adffd4640941c53167e01106229b19d9bad2b3da..e642dc044726203f4a4ccecbdc7c162c1aa1e851 100644 (file)
@@ -8,6 +8,8 @@ from portage.exception import PortageException
 from portage.localization import _
 from portage.util import writemsg
 from portage import os
+from portage import _encodings
+from portage import _unicode_decode
 
 import socket
 import time
@@ -15,8 +17,11 @@ import time
 _items = {}
 def process(mysettings, key, logentries, fulltext):
        global _items
+       time_str = _unicode_decode(
+               time.strftime("%Y%m%d-%H%M%S %Z", time.localtime(time.time())),
+               encoding=_encodings['content'], errors='replace')
        header = _(">>> Messages generated for package %(pkg)s by process %(pid)d on %(time)s:\n\n") % \
-               {"pkg": key, "pid": os.getpid(), "time": time.strftime("%Y%m%d-%H%M%S %Z", time.localtime(time.time()))}
+               {"pkg": key, "pid": os.getpid(), "time": time_str}
        config_root = mysettings["PORTAGE_CONFIGROOT"]
        mysettings, items = _items.setdefault(config_root, (mysettings, {}))
        items[key] = header + fulltext
index ca76e23be6792692c42fc7bea5100ba44e3cf1e2..fedccbeeb0a8012ece5e104f518607ecd1228b88 100644 (file)
@@ -7,6 +7,7 @@ import codecs
 import time
 from portage import os
 from portage import _encodings
+from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.data import portage_uid, portage_gid
 from portage.util import ensure_dirs
@@ -21,7 +22,9 @@ def process(mysettings, key, logentries, fulltext):
                elogdir = os.path.join(EPREFIX, "var", "log", "portage", "elog")
        ensure_dirs(elogdir, uid=portage_uid, gid=portage_gid, mode=02770)
 
-       elogfilename = elogdir+"/"+path+":"+time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time()))+".log"
+       elogfilename = os.path.join(elogdir, path + ":" + _unicode_decode(
+               time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time())),
+               encoding=_encodings['content'], errors='replace') + ".log")
        elogfile = codecs.open(_unicode_encode(elogfilename,
                encoding=_encodings['fs'], errors='strict'),
                mode='w', encoding=_encodings['content'], errors='backslashreplace')
index 6dc73ac67eb38a6564a5d7d9d7272be15929a7c6..95c3c813c13e96a755f93f1d3f763bbe7b0fc32a 100644 (file)
@@ -404,7 +404,8 @@ def format_date(datestr):
                return datestr
        
        # TODO We could format to local date format '%x' here?
-       return d.strftime("%B %d, %Y")
+       return _unicode_decode(d.strftime("%B %d, %Y"),
+               encoding=_encodings['content'], errors='replace')
 
 # simple Exception classes to catch specific errors
 class GlsaTypeException(Exception):