[Lsb-messages] /var/www/bzr/lsb/devel/appbat r1018: adjust how we skip xml comments in entity files

Mats Wichmann mats at linuxfoundation.org
Fri Jan 6 16:23:17 UTC 2017


------------------------------------------------------------
revno: 1018
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: appbat
timestamp: Fri 2017-01-06 09:23:17 -0700
message:
  adjust how we skip xml comments in entity files
modified:
  extras/entitycheck.py
  extras/entitycheck_new.py
-------------- next part --------------
=== modified file 'extras/entitycheck.py'
--- a/extras/entitycheck.py	2017-01-05 16:21:55 +0000
+++ b/extras/entitycheck.py	2017-01-06 16:23:17 +0000
@@ -177,7 +177,8 @@
 def parse_packages():
     """Look for package files in the entities file.
 
-    Desired lines look like the following, but need to skip XML comments:
+    Desired lines look like the following, but need to skip ones
+    commented out:
     <!ENTITY foo-package "foo-1.2.tar.bz2">
     Returns a match object.
     """
@@ -187,7 +188,7 @@
         usage(1, 'Cannot open entity file: \n\t%s' % message)
 
     for line in entities.readlines():
-        if not re.search('<!--', line):
+        if re.search('<!ENT', line):
             yield re.search(r'(\S+)-package\s+"([^"]+)"', line)
 
     entities.close()
@@ -196,7 +197,8 @@
 def parse_patches():
     """Look for patch files in the entities file.
 
-    Desired lines look like the following, but need to skip XML comments:
+    Desired lines look like the following, but need to skip ones
+    commented out:
     <!ENTITY foo-patch "foo-1.2.patch">
     Returns a match object.
     """
@@ -206,7 +208,7 @@
         usage(1, 'Cannot open entity file: \n\t%s' % message)
 
     for line in entities.readlines():
-        if not re.search('<!--', line):
+        if re.search('<!ENT', line):
             yield re.search(r'(\S+)-patch\s+"([^"]+)"', line)
 
     entities.close()

=== modified file 'extras/entitycheck_new.py'
--- a/extras/entitycheck_new.py	2017-01-05 16:21:55 +0000
+++ b/extras/entitycheck_new.py	2017-01-06 16:23:17 +0000
@@ -171,26 +171,28 @@
 def parse_packages():
     """Look for package files in the entities file.
 
-    Desired lines look like the following, but need to skip XML comments:
+    Desired lines look like the following, but need to skip ones
+    commented out:
     <!ENTITY foo-package "foo-1.2.tar.bz2">
     Returns a match object.
     """
     with open(epaths['entity_file']) as entities:
         for line in entities.readlines():
-            if not re.search('<!--', line):
+            if re.search('<!ENT', line):
                 yield re.search(r'(\S+)-package\s+"([^"]+)"', line)
 
 
 def parse_patches():
     """Look for patch files in the entities file.
 
-    Desired lines look like the following, but need to skip XML comments:
+    Desired lines look like the following, but need to skip ones
+    commented out:
     <!ENTITY foo-patch "foo-1.2.patch">
     Returns a match object.
     """
     with open(epaths['entity_file']) as entities:
         for line in entities.readlines():
-            if not re.search('<!--', line):
+            if re.search('<!ENT', line):
                 yield re.search(r'(\S+)-patch\s+"([^"]+)"', line)
 
 



More information about the lsb-messages mailing list