[python-debian/master] parse "properly" deps with uppercase letters

Stefano Zacchiroli zack at upsilon.cc
Fri Jun 20 07:05:27 UTC 2008


in theory that kind of deps are forbidden by policy, but they do appear
in the archive. Parse them properly accordinging to the philosophy of
being lax in deb822 dependency parser
---
 debian_bundle/deb822.py  |    2 +-
 examples/deb822/depgraph |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian_bundle/deb822.py b/debian_bundle/deb822.py
index 4a4c875..d67dcb8 100644
--- a/debian_bundle/deb822.py
+++ b/debian_bundle/deb822.py
@@ -405,7 +405,7 @@ class PkgRelation(object):
     # just parse as much as we need to split the various parts composing a
     # dependency, checking their correctness wrt policy is out of scope
     __dep_RE = re.compile( \
-            r'^\s*(?P<name>[a-z0-9.+\-]{2,})(\s*\(\s*(?P<relop>[>=<]+)\s*(?P<version>[0-9a-zA-Z:\-+~.]+)\s*\))?(\s*\[(?P<archs>[\s!\w\-]+)\])?\s*$')
+            r'^\s*(?P<name>[a-zA-Z0-9.+\-]{2,})(\s*\(\s*(?P<relop>[>=<]+)\s*(?P<version>[0-9a-zA-Z:\-+~.]+)\s*\))?(\s*\[(?P<archs>[\s!\w\-]+)\])?\s*$')
     __comma_sep_RE = re.compile(r'\s*,\s*')
     __pipe_sep_RE = re.compile(r'\s*\|\s*')
     __blank_sep_RE = re.compile(r'\s*')
diff --git a/examples/deb822/depgraph b/examples/deb822/depgraph
index 7423a48..150662c 100755
--- a/examples/deb822/depgraph
+++ b/examples/deb822/depgraph
@@ -48,7 +48,10 @@ def main():
                 emit_arc(name, or_node)
                 emit_node(or_node, 'OR')
                 for dep in deps:
-                    emit_arc(or_node, dep['name'])
+                    emit_arc(or_node, dep['name'].lower())
+                    # even though it is forbidden by policy, there are some
+                    # dependencies with upper case letter in the archive,
+                    # apparently apt-get turn them to lowercase ...
     print "}"
 
 if __name__ == '__main__':
-- 
1.5.4.2





More information about the pkg-python-debian-commits mailing list