Use a directory for the default set configuration.
authorMichał Górny <gentoo@mgorny.alt.pl>
Tue, 27 Jul 2010 07:31:47 +0000 (09:31 +0200)
committerZac Medico <zmedico@gentoo.org>
Tue, 27 Jul 2010 07:36:32 +0000 (00:36 -0700)
Expect /usr/share/portage/config/sets to be a directory containing any
number of set configuration files. The default Portage sets.conf should
be now installed as sets/portage.conf, and other ebuilds are free to
install their own set configuration files there.

cnf/sets/portage.conf [moved from cnf/sets.conf with 100% similarity]
doc/config/sets.docbook
man/emerge.1
pym/_emerge/main.py
pym/portage/sets/__init__.py

similarity index 100%
rename from cnf/sets.conf
rename to cnf/sets/portage.conf
index 35beef41d68b8e48e46baf82fa77aa0180fa34f8..edded8937a41c55473c7e61dd915241ddc0ef111 100644 (file)
@@ -9,8 +9,9 @@
                ignored.
                </para>
                <para>
-               At first it looks for the default configuration in 
-               <filename>/usr/share/portage/config</filename>.
+               At first it reads the default configuration from all of the files
+               located in <filename>/usr/share/portage/config/sets</filename>
+               directory.
                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>.
index 44cb292f8c43ec2fb8c427d1a26661d28ef9827d..29c40da0849e2e28c316a10f33320fee7cedf9a2 100644 (file)
@@ -67,7 +67,7 @@ packages deemed necessary for your system to run properly. \fBworld\fR
 encompasses both the \fBselected\fR and \fBsystem\fR sets. [See
 \fBFILES\fR below for more information.] Other sets can exist depending
 on the current configuration. The default set configuration is located
-in \fB/usr/share/portage/config/sets.conf\fR. Note that a \fIset\fR
+in the \fB/usr/share/portage/config/sets\fR directory. Note that a \fIset\fR
 is generally used in conjunction with \fB\-\-update\fR. When used as 
 arguments to \fBemerge\fR sets have to be prefixed with \fB@\fR to be
 recognized. Use the \fB\-\-list\-sets\fR action to display a list of
@@ -846,7 +846,7 @@ Zac Medico <zmedico@gentoo.org>
 Here is a common list of files you will probably be interested in.  For a 
 complete listing, please refer to the \fBportage\fR(5) man page.
 .TP
-.B /usr/share/portage/config/sets.conf
+.B /usr/share/portage/config/sets/
 Contains the default set configuration.
 .TP
 .B /var/lib/portage/world
index b553e15e34b19fac69afab87c8fe9e1c07fa6287..e4449e8059302365487447d630fa12a3b1204cb7 100644 (file)
@@ -1010,7 +1010,7 @@ def missing_sets_warning(root_config, missing_sets):
        if root_config.sets:
                msg.append("        sets defined: %s" % ", ".join(root_config.sets))
        msg.append("        This usually means that '%s'" % \
-               (os.path.join(portage.const.GLOBAL_CONFIG_PATH, "sets.conf"),))
+               (os.path.join(portage.const.GLOBAL_CONFIG_PATH, "sets/portage.conf"),))
        msg.append("        is missing or corrupt.")
        msg.append("        Falling back to default world and system set configuration!!!")
        for line in msg:
index fb87ce1043aad84d41a2f9791b66e6fb0891d38c..ab9869cee796b9f2cadde329c09d2cd9ce8d6ea7 100644 (file)
@@ -176,9 +176,17 @@ class SetConfig(object):
                return myatoms
 
 def load_default_config(settings, trees):
-       setconfigpaths = [os.path.join(GLOBAL_CONFIG_PATH, "sets.conf")]
-       setconfigpaths.append(os.path.join(settings["PORTDIR"], "sets.conf"))
-       setconfigpaths += [os.path.join(x, "sets.conf") for x in settings["PORTDIR_OVERLAY"].split()]
-       setconfigpaths.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
-               USER_CONFIG_PATH, "sets.conf"))
-       return SetConfig(setconfigpaths, settings, trees)
+       def _getfiles():
+               for path, dirs, files in os.walk(os.path.join(GLOBAL_CONFIG_PATH, "sets")):
+                       for f in files:
+                               yield os.path.join(path, f)
+
+               dbapi = trees["porttree"].dbapi
+               for repo in dbapi.getRepositories():
+                       path = dbapi.getRepositoryPath(repo)
+                       yield os.path.join(path, "sets.conf")
+
+               yield os.path.join(settings["PORTAGE_CONFIGROOT"],
+                       USER_CONFIG_PATH, "sets.conf")
+
+       return SetConfig(_getfiles(), settings, trees)