replace category sets in test configuration with user sets
authorMarius Mauch <genone@gentoo.org>
Fri, 5 Oct 2007 20:05:43 +0000 (20:05 -0000)
committerMarius Mauch <genone@gentoo.org>
Fri, 5 Oct 2007 20:05:43 +0000 (20:05 -0000)
svn path=/main/trunk/; revision=7959

pym/emerge/__init__.py
pym/portage/sets/__init__.py
pym/portage/sets/files.py

index eb47084a18a3bafbf5602e7daf1f8f60048fe5bb..764f555105ae63407f492429f26a2695f04ff2db 100644 (file)
@@ -6395,6 +6395,8 @@ def emerge_main():
                                        print "emerge: the given set %s does not support unmerge operations" % s
                                        sys.exit(1)
                                myfiles.extend(packagesets[s].getAtoms())
+                               for e in packagesets[s].errors:
+                                       print e
                                myfiles.remove(s)
 
        if ("--tree" in myopts) and ("--columns" in myopts):
index 481fa8b7abb2e4139e7e97c69bee03f234de8aad..de588fb4f2f31900a1a159c31452488e26aab2b4 100644 (file)
@@ -27,6 +27,7 @@ class PackageSet(object):
                self._atommap = {}
                self._loaded = False
                self._loading = False
+               self.errors = []
 
        def __contains__(self, atom):
                return atom in self.getAtoms()
@@ -258,11 +259,9 @@ def make_default_config(settings, trees):
        sc.set("config", "class", "portage.sets.files.ConfigFileSet")
        sc.set("config", "multiset", "true")
        
-       sc.add_section("categories_installed")
-       sc.set("categories_installed", "class", "portage.sets.dbapi.CategorySet")
-       sc.set("categories_installed", "multiset", "true")
-       sc.set("categories_installed", "repository", "vartree")
-       sc.set("categories_installed", "name_pattern", "installed/$category")
+       sc.add_section("user_sets")
+       sc.set("user_sets", "class", "portage.sets.files.StaticFileSet")
+       sc.set("user_sets", "multiset", "true")
        
        return sc
 
index 8a7f395492d039b9eafed64b53618d596baceb2b..b2b4191bf4c949f0954f3def7218b8dc78a0f247 100644 (file)
@@ -53,6 +53,9 @@ class StaticFileSet(EditablePackageSet):
                if (not self._loaded or self._mtime != mtime):
                        try:
                                data, errors = self.loader.load()
+                               for fname in errors:
+                                       for e in errors[fname]:
+                                               self.errors.append(fname+": "+e)
                        except EnvironmentError, e:
                                if e.errno != errno.ENOENT:
                                        raise
@@ -73,10 +76,11 @@ class StaticFileSet(EditablePackageSet):
                name_pattern = options.get("name_pattern", "sets/$name")
                if not "$name" in name_pattern and not "${name}" in name_pattern:
                        raise SetConfigError("name_pattern doesn't include $name placeholder")
-               for filename in os.listdir(directory):
-                       myname = name_pattern.replace("$name", filename)
-                       myname = myname.replace("${name}", filename)
-                       rValue[myname] = StaticFileSet(os.path.join(directory, filename))
+               if os.path.isdir(directory):
+                       for filename in os.listdir(directory):
+                               myname = name_pattern.replace("$name", filename)
+                               myname = myname.replace("${name}", filename)
+                               rValue[myname] = StaticFileSet(os.path.join(directory, filename))
                return rValue
        multiBuilder = classmethod(multiBuilder)
        
@@ -129,6 +133,5 @@ class WorldSet(StaticFileSet):
                self._lock = None
 
        def singleBuilder(self, options, settings, trees):
-               print "world.build"
                return WorldSet(settings["ROOT"])
        singleBuilder = classmethod(singleBuilder)