[Yum-devel] [PATCH] Subclass ConfigParser so that the options don't get lowercased. This is important given that they are path names.

Jesse Keating jkeating at j2solutions.net
Fri Oct 3 16:34:44 UTC 2008


This patch is necessary, as we store file paths as config options.  By
default, ConfigParser will both create and read options as all lower
case.  That plays havoc with files that have upper case in them, like
*-PAE.  I've patched pungi to write the config file out verbatim, and
this patch will cause verifytree to read them verbatim.

---
 verifytree.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/verifytree.py b/verifytree.py
index 434d095..bac8913 100755
--- a/verifytree.py
+++ b/verifytree.py
@@ -23,6 +23,14 @@ from yum import Errors
 from optparse import OptionParser
 import ConfigParser
 
+# Subclass ConfigParser so that the options don't get lowercased.  This is
+# important given that they are path names.
+class MyConfigParser(ConfigParser.ConfigParser):
+    """A subclass of ConfigParser which does not lowercase options"""
+
+    def optionxform(self, optionstr):
+        return optionstr
+
 ####
 # take a file path to a repo as an option, verify all the metadata vs repomd.xml
 # optionally go through packages and verify them vs the checksum in the primary
@@ -74,7 +82,7 @@ def treeinfo_checksum(treeinfo):
     # read treeinfo file into cp
     # take checksums section
     result = 0
-    cp = ConfigParser.ConfigParser()
+    cp = MyConfigParser()
     try:
         cp.read(treeinfo)
     except ConfigParser.MissingSectionHeaderError:
-- 
1.6.0.1
-- 
Jesse Keating RHCE      (http://jkeating.livejournal.com)
Fedora Project          (http://fedoraproject.org/wiki/JesseKeating)
GPG Public Key          (geek.j2solutions.net/jkeating.j2solutions.pub)
identi.ca               (http://identi.ca/jkeating)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20081003/541bc200/attachment.pgp 


More information about the Yum-devel mailing list