So currently the yum.conf documentation says:

[repository] OPTIONS
       The repository section(s) take the following form:

       Example:
              [repositoryid]
              name=Some name for this repository
              baseurl=url://path/to/repository/


       repositoryid
              Must be a unique name for each repository, one word.

...which heavily implies that "repositoryid" must not contain spaces,
however creating a repoid with spaces in it currently works fine as far
as I know[1] ... but I've just created the attached patch which changes
that, as you now won't be able to use --disableexcludes with a repoid
that has a space in it[2].
 So should we just ignore this, allow whitespace in repoid's ... or add
some code to check the repoid for valid chars (and then warn)?

 Also if anyone objects to the patch in general, feel free to
comment :).

[1] I know this because I tried it for a while, before I read the
documentation :).

[2] AFAIK no well known repos have whitespace in them.

-- 
James Antill <[EMAIL PROTECTED]>
Red Hat
diff --git a/cli.py b/cli.py
index 56bf057..fd7077b 100644
--- a/cli.py
+++ b/cli.py
@@ -160,7 +160,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                     optparser=self.optparser,
                     debuglevel=opts.debuglevel,
                     errorlevel=opts.errorlevel,
-                    disabled_plugins=opts.disableplugins)
+                    disabled_plugins=self._splitArg(opts.disableplugins))
                     
         except yum.Errors.ConfigError, e:
             self.logger.critical(_('Config Error: %s'), e)
@@ -1167,6 +1167,16 @@ class YumOptionParser(OptionParser):
             self.base.usage()
             sys.exit(1)
         return self.parse_args(args=args)[0]
+
+    @staticmethod
+    def _splitArg(seq):
+        """ Split all strings in seq, at "," and whitespace.
+            Returns a new list. """
+        ret = []
+        for arg in seq:
+            ret.extend(arg.replace(",", " ").split())
+        return ret
+
         
     def setupYumConfig(self):
         # Now parse the command line for real
@@ -1200,11 +1210,12 @@ class YumOptionParser(OptionParser):
                 self.base.conf.skip_broken = True
 
             if opts.disableexcludes:
-                self.base.conf.disable_excludes = opts.disableexcludes
+                disable_excludes = self._splitArg(opts.disableexcludes)
             else:
-                self.base.conf.disable_excludes = []
-                
-            for exclude in opts.exclude:
+                disable_excludes = []
+            self.base.conf.disable_excludes = disable_excludes
+
+            for exclude in self._splitArg(opts.exclude):
                 try:
                     excludelist = self.base.conf.exclude
                     excludelist.append(exclude)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to