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
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 **
--- /dev/null
+# 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
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
--- /dev/null
+<part id='config'>
+<title>Configuration</title>
+&config_set;
+</part>
--- /dev/null
+<chapter id='config-set'>
+ <title>Package Set Configuration</title>
+ <sect1 id='config-set-locations'>
+ <title>sets.conf locations</title>
+ <para>
+ There are multiple locations where portage looks for set configuration
+ files, which are usually named <filename>sets.conf</filename>. Not all
+ of these locations have to contain a sets.conf, missing files are simply
+ ignored.
+ </para>
+ <para>
+ At first it looks for the default configuration in
+ <filename>/usr/share/portage/config</filename>.
+ The default config includes sets that are expected on all systems and
+ often critical for normal operation, like <varname>world</varname>,
+ <varname>system</varname> or <varname>security</varname>.
+ <!-- TODO: Add reference to currently non-existing documentation about
+ set usage and default sets -->
+ After that it will read repository specific configurations from
+ <envar>PORTDIR</envar> and <envar>PORTDIR_OVERLAY</envar>that might
+ include definitions of sets included in the repository.
+ Finally a system-specific set configuration may reside in
+ <filename>/etc/portage</filename> to either define additional sets or
+ alter the default and repository sets.
+ </para>
+ </sect1>
+ <sect1 id='config-set-syntax'>
+ <title>sets.conf Syntax</title>
+ <para>
+ Unlike other Portage configuration files <filename>sets.conf</filename>
+ uses Pythons <classname>ConfigParser</classname> 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 <ulink url="http://doc.python.org/lib/module-ConfigParser.html" type="text/html">Python documentation</ulink>
+ for the full details.
+ </para>
+ <para>
+ In a <filename>sets.conf</filename> 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.
+ </para>
+ <sect2 id='config-set-syntax-single'>
+ <title>Single Set Configuration</title>
+ <para>
+ The configuration of a single set can be very simple as in most cases
+ it only requires a single option <varname>class</varname> to be
+ complete. That option defines which handler class should be used to
+ create the set. Another universal option available for single sets is
+ <varname>name</varname>, however it's usually not needed as the name
+ of the set is generated from the section name if <varname>name</varname>
+ is missing. Some handler classes might require additional
+ options for their configuration, these will be covered later in
+ this chapter.
+ </para>
+ <para>
+ Here are a few examples for single sets taken from the default
+ configuration file:
+ <programlisting>
+ # The classic world set
+ [world]
+ class = portage.sets.files.WorldSet
+
+ # The classic system set
+ [system]
+ class = portage.sets.profiles.PackagesSystemSet
+ </programlisting>
+ <!-- TODO: reference list of available set handler classes here -->
+ </para>
+ </sect2>
+ <sect2 id='config-set-syntax-multi'>
+ <title>Multi Set Configuration</title>
+ <para>
+ 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 <varname>class</varname> option,
+ but to indicate that the section should generate multiple sets it's
+ also necessary to set the <varname>multiset</varname> option to
+ <parameter>true</parameter>.
+ </para>
+ <para>
+ As it doesn't make much sense to specify a single name for multiple sets
+ the <varname>name</varname> 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
+ <varname>name_pattern</varname> 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.
+ </para>
+ <para>
+ Some examples for multiset configurations:
+ <programlisting>
+ # 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/*
+ </programlisting>
+ </para>
+ <!-- TODO: reference list of available set handler classes here -->
+ </sect2>
+ </sect1>
+</chapter>
<!ENTITY project "portage">
<!ENTITY qa SYSTEM "qa.docbook">
+ <!ENTITY config SYSTEM "config.docbook">
+ <!ENTITY config_set SYSTEM "config/sets.docbook">
]>
<book id="portage" lang="en">
&date;
</bookinfo>
+&config;
&qa;
</book>
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
# $Id$
import portage.mail, socket, os, time
+from portage.exception import PortageException
from email.MIMEText import MIMEText as TextMessage
_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
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 != "":
+["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
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")
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"
from portage.env.loaders import ItemFileLoader, KeyListFileLoader
from portage.env.validators import ValidAtomValidator
+__all__ = ["StaticFileSet", "ConfigFileSet", "WorldSet"]
+
class StaticFileSet(EditablePackageSet):
_operations = ["merge", "unmerge"]
from portage.util import grabfile_package, stack_lists
from portage.sets import PackageSet
+__all__ = ["PackagesSystemSet"]
+
class PackagesSystemSet(PackageSet):
_operations = ["merge"]
from portage.const import CACHE_PATH
from portage.sets import PackageSet
+__all__ = ["SecuritySet", "NewGlsaSet", "NewAffectedSet", "AffectedSet"]
+
class SecuritySet(PackageSet):
_operations = ["merge"]
_skip_applied = False
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: