From: Fabian Groffen Date: Mon, 8 Oct 2007 17:17:39 +0000 (-0000) Subject: Merged from trunk 7976:7984 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=0b204cf342d781e8a7f6f565633898263c4ca7bc;p=portage.git Merged from trunk 7976:7984 | 7977 | default set configuration, should probably go into | | genone | /usr/share/portage | | 7978 | Add some documentation about set configuration | | genone | | | 7979 | Also look for sets.conf in overlays | | genone | | | 7980 | Also clean portage.txt | | genone | | | 7981 | clean up module namespace | | genone | | | 7982 | Add @localhost to default PORTAGE_ELOG_MAILFROM to account | | genone | for mail servers that don't accept mails without a domainname | | 7983 | let dohtml handle weird filenames, patch by TGL (bug #171272) | | genone | | | 7984 | Handle Exceptions in mod_mail_summary.finalize() and check if | | genone | the server actually supports TLS, bug #183808 | svn path=/main/branches/prefix/; revision=8003 --- diff --git a/bin/dohtml b/bin/dohtml index b0fce399a..aaebb7169 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -34,17 +34,17 @@ import sys import types def dodir(path): - os.system("install -d '%s'" % path) + os.spawnlp(os.P_WAIT, "install", "install", "-d", path) def dofile(src,dst): - - os.system("install -m 0644 '%s' '%s'" % (src, dst)) + os.spawnlp(os.P_WAIT, "install", "install", "-m0644", src, dst) def install(basename, dirname, options, prefix=""): - fullpath = basename - if prefix: fullpath = prefix + "/" + fullpath - if dirname: fullpath = dirname + "/" + fullpath + if prefix: + fullpath = prefix + "/" + fullpath + if dirname: + fullpath = dirname + "/" + fullpath if options.DOCDESTTREE: destdir = options.ED + "/usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix diff --git a/cnf/make.globals b/cnf/make.globals index 94b7aa548..aa5e025f9 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -82,7 +82,7 @@ PORTAGE_ELOG_SYSTEM="save_summary echo" PORTAGE_ELOG_MAILURI="@rootuser@" PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}" -PORTAGE_ELOG_MAILFROM="@portageuser@" +PORTAGE_ELOG_MAILFROM="@portageuser@@localhost" # ***************************** # ** DO NOT EDIT THIS FILE ** diff --git a/cnf/sets.conf b/cnf/sets.conf new file mode 100644 index 000000000..8f7852b85 --- /dev/null +++ b/cnf/sets.conf @@ -0,0 +1,34 @@ +# WARNING: default set configuration, DO NOT CHANGE. +# If you want to change anything redefine the relevant section in +# /etc/portage/sets.conf. Any changes to this file will be lost on the next +# portage update, and configuration errors here might upset portage in +# unexpected ways. + +# Not much that could be changed for world, so better leave it alone +[world] +class = portage.sets.files.WorldSet + +# Same as for world, though later portage versions might use a different class +[system] +class = portage.sets.profiles.PackagesSystemSet + +# For security there are multiple classes available, but differences are +# rather small (normally there should be no visible difference): +# - AffectedSet: include all GLSAs that cover a vulnerable package +# - NewAffectedSet: include all GLSAs that cover a vulnerable package and +# haven't been applied previously +# - NewGlsaSet: include all GLSAs that haven't been applied +# - SecuritySet: include all GLSAs +[security] +class = portage.sets.security.NewAffectedSet + +# Again, not much to change here, though people might prefer a different name +[everything] +class = portage.sets.dbapi.EverythingSet + +# The following treats all files in /etc/portage/sets as a package set called +# 'sets/$filename'. +[usersets] +class = portage.sets.files.StaticFileSet +multiset = true +directory = /etc/portage/sets diff --git a/doc/Makefile b/doc/Makefile index c829639ca..5c2ab0ba9 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -5,7 +5,7 @@ man pdf txt xhtml xhtml-nochunks: xmlto $@ $(XMLTO_FLAGS_$@) portage.docbook clean distclean: - rm -f *.1 *.html + rm -f *.1 *.html portage.txt .PHONY: all clean distclean \ man pdf txt xhtml xhtml-nochunks diff --git a/doc/config.docbook b/doc/config.docbook new file mode 100644 index 000000000..39c560080 --- /dev/null +++ b/doc/config.docbook @@ -0,0 +1,4 @@ + +Configuration +&config_set; + diff --git a/doc/config/sets.docbook b/doc/config/sets.docbook new file mode 100644 index 000000000..5657b2cdc --- /dev/null +++ b/doc/config/sets.docbook @@ -0,0 +1,114 @@ + + Package Set Configuration + + sets.conf locations + + There are multiple locations where portage looks for set configuration + files, which are usually named sets.conf. Not all + of these locations have to contain a sets.conf, missing files are simply + ignored. + + + At first it looks for the default configuration in + /usr/share/portage/config. + The default config includes sets that are expected on all systems and + often critical for normal operation, like world, + system or security. + + After that it will read repository specific configurations from + PORTDIR and PORTDIR_OVERLAYthat might + include definitions of sets included in the repository. + Finally a system-specific set configuration may reside in + /etc/portage to either define additional sets or + alter the default and repository sets. + + + + sets.conf Syntax + + Unlike other Portage configuration files sets.conf + uses Pythons ConfigParser module, which implements + the syntax usually found in .ini files. At it's core it allows various + named sections that each can contain any number of key-value pairs, see + the Python documentation + for the full details. + + + In a sets.conf file, a section can define either a + single package set, or a complete class of sets. These cases are handled + in different ways, and will be explained in detail in the following sections. + + + Single Set Configuration + + The configuration of a single set can be very simple as in most cases + it only requires a single option class to be + complete. That option defines which handler class should be used to + create the set. Another universal option available for single sets is + name, however it's usually not needed as the name + of the set is generated from the section name if name + is missing. Some handler classes might require additional + options for their configuration, these will be covered later in + this chapter. + + + Here are a few examples for single sets taken from the default + configuration file: + + # The classic world set + [world] + class = portage.sets.files.WorldSet + + # The classic system set + [system] + class = portage.sets.profiles.PackagesSystemSet + + + + + + Multi Set Configuration + + As configuring each single set manually could be quite annoying if + you want many sets with the same options Portage also allows to + define whole classes of sets in a single section. Like with single + sets each section still requires the class option, + but to indicate that the section should generate multiple sets it's + also necessary to set the multiset option to + true. + + + As it doesn't make much sense to specify a single name for multiple sets + the name option isn't available for multiset sections. + Most handler classes will have a reasonable default for generating names, + and usually you can (but don't have to) set the + name_pattern option to change the naming rules. That + option generally has to include a (handler-specific) placeholder that + will be replaced with a unique identifier (e.g. for category sets the + category name). As with single sets handler classes might require and/or + support additional options, these will be discussed later. + + + Some examples for multiset configurations: + + # generate a set for each file in /etc/portage/sets + # this section is also in the default configuration + [user sets] + class = portage.sets.files.StaticFileSet + multiset = true + directory = /etc/portage/sets + + # Generate a set for each category that includes all installed packages + # from that category. The sets will be named <category>/* + [installed category packages] + class = portage.sets.dbapi.CategorySet + multiset = true + repository = vartree + name_pattern = $category/* + + + + + + diff --git a/doc/portage.docbook b/doc/portage.docbook index 1ca868722..ac1061310 100644 --- a/doc/portage.docbook +++ b/doc/portage.docbook @@ -8,6 +8,8 @@ + + ]> @@ -27,6 +29,7 @@ &date; +&config; &qa; diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index bea5cd26e..d7aca4850 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -6464,8 +6464,10 @@ def emerge_main(): print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n") break - setconfigpaths = ["/usr/share/portage/config/sets.conf", os.path.join(settings["PORTDIR"], "sets.conf"), \ - os.path.join(os.sep, settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "sets.conf")] + setconfigpaths = ["/usr/share/portage/config/sets.conf"] + setconfigpaths.append(os.path.join(settings["PORTDIR"], "sets.conf")) + setconfigpaths += [os.path.join(x, "sets.conf") for x in settings["PORDIR_OVERLAY"].split()] + setconfigpaths.append(os.path.join(os.sep, settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "sets.conf")) #setconfig = SetConfig(setconfigpaths, settings, trees[settings["ROOT"]]) setconfig = make_default_config(settings, trees[settings["ROOT"]]) del setconfigpaths diff --git a/pym/portage/elog/mod_mail_summary.py b/pym/portage/elog/mod_mail_summary.py index 7410f05af..d0b2577ae 100644 --- a/pym/portage/elog/mod_mail_summary.py +++ b/pym/portage/elog/mod_mail_summary.py @@ -4,6 +4,7 @@ # $Id$ import portage.mail, socket, os, time +from portage.exception import PortageException from email.MIMEText import MIMEText as TextMessage _items = {} @@ -48,6 +49,9 @@ def _finalize(mysettings, items): mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, mybody, attachments=items.values()) - portage.mail.send_mail(mysettings, mymessage) + try: + portage.mail.send_mail(mysettings, mymessage) + except PortageException, e: + print str(e) return diff --git a/pym/portage/mail.py b/pym/portage/mail.py index 0c39b4cc9..cf6ebd134 100644 --- a/pym/portage/mail.py +++ b/pym/portage/mail.py @@ -74,7 +74,11 @@ def send_mail(mysettings, message): try: if int(mymailport) > 100000: myconn = smtplib.SMTP(mymailhost, int(mymailport) - 100000) + myconn.ehlo() + if not myconn.has_extn("STARTTLS"): + raise portage.exception.PortageException("!!! TLS support requested for logmail but not suported by server") myconn.starttls() + myconn.ehlo() else: myconn = smtplib.SMTP(mymailhost, mymailport) if mymailuser != "" and mymailpasswd != "": diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index de588fb4f..9cf90600a 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -14,6 +14,9 @@ DEFAULT_SETS = ["world", "system", "everything", "security"] \ +["package_"+x for x in ["mask", "unmask", "use", "keywords"]] del x +__all__ = ["PackageSet", "EditablePackageSet", "InternalPackageSet", \ + "SetConfigError", "SetConfig", "make_default_config"] + class PackageSet(object): # Set this to operations that are supported by your subclass. While # technically there is no difference between "merge" and "unmerge" regarding @@ -270,7 +273,6 @@ if __name__ == "__main__": import portage sc = make_default_config(portage.settings, portage.db["/"]) l, e = sc.getSets() - print l, e for x in l: print x+":" print "DESCRIPTION = %s" % l[x].getMetadata("Description") diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py index 1a7a66907..164027943 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/sets/dbapi.py @@ -5,6 +5,8 @@ from portage.versions import catsplit from portage.sets import PackageSet, SetConfigError +__all__ = ["CategorySet", "EverythingSet"] + class EverythingSet(PackageSet): _operations = ["merge", "unmerge"] description = "Package set containing all installed packages" diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py index ab04dc846..889e7f973 100644 --- a/pym/portage/sets/files.py +++ b/pym/portage/sets/files.py @@ -12,6 +12,8 @@ from portage.sets import PackageSet, EditablePackageSet, SetConfigError from portage.env.loaders import ItemFileLoader, KeyListFileLoader from portage.env.validators import ValidAtomValidator +__all__ = ["StaticFileSet", "ConfigFileSet", "WorldSet"] + class StaticFileSet(EditablePackageSet): _operations = ["merge", "unmerge"] diff --git a/pym/portage/sets/profiles.py b/pym/portage/sets/profiles.py index 6d629fc67..fcefaff88 100644 --- a/pym/portage/sets/profiles.py +++ b/pym/portage/sets/profiles.py @@ -6,6 +6,8 @@ import os from portage.util import grabfile_package, stack_lists from portage.sets import PackageSet +__all__ = ["PackagesSystemSet"] + class PackagesSystemSet(PackageSet): _operations = ["merge"] diff --git a/pym/portage/sets/security.py b/pym/portage/sets/security.py index 576009364..f58e725f9 100644 --- a/pym/portage/sets/security.py +++ b/pym/portage/sets/security.py @@ -8,6 +8,8 @@ from portage.util import grabfile, write_atomic from portage.const import CACHE_PATH from portage.sets import PackageSet +__all__ = ["SecuritySet", "NewGlsaSet", "NewAffectedSet", "AffectedSet"] + class SecuritySet(PackageSet): _operations = ["merge"] _skip_applied = False diff --git a/pym/portage/sets/shell.py b/pym/portage/sets/shell.py index d61c116ce..56b8ef5ef 100644 --- a/pym/portage/sets/shell.py +++ b/pym/portage/sets/shell.py @@ -7,6 +7,8 @@ import os from portage.sets import PackageSet, SetConfigError +__all__ = ["CommandOutputSet"] + class CommandOutputSet(PackageSet): """This class creates a PackageSet from the output of a shell command. The shell command should produce one atom per line, that is: