|
|
fe6837 |
diff -up yum-utils-1.1.31/verifytree.py.orig yum-utils-1.1.31/verifytree.py
|
|
|
fe6837 |
--- yum-utils-1.1.31/verifytree.py.orig 2016-07-21 14:46:21.050199284 +0200
|
|
|
fe6837 |
+++ yum-utils-1.1.31/verifytree.py 2016-07-21 14:46:43.277058501 +0200
|
|
|
fe6837 |
@@ -47,8 +47,22 @@ plan_number = 13
|
|
|
fe6837 |
case_numbers = {'REPODATA': 56, 'CORE_PACKAGES': 57, 'COMPS': 58,
|
|
|
fe6837 |
'BOOT_IMAGES': 59}
|
|
|
fe6837 |
|
|
|
fe6837 |
-# URL for the RELAX NG schema for comps
|
|
|
fe6837 |
-SCHEMA = 'http://cvs.fedoraproject.org/viewcvs/*checkout*/comps/comps.rng'
|
|
|
fe6837 |
+def get_schema_path():
|
|
|
fe6837 |
+ """Return the local path to the RELAX NG comps schema."""
|
|
|
fe6837 |
+ # Depending on whether our distro uses versioned or unversioned docdirs
|
|
|
fe6837 |
+ # (the former is true for Fedora < 20, see bug 998579), the schema file
|
|
|
fe6837 |
+ # should be provided by yum at either of the following locations:
|
|
|
fe6837 |
+ paths = ['/usr/share/doc/yum%s/comps.rng' % s
|
|
|
fe6837 |
+ for s in ('', '-' + yum.__version__)]
|
|
|
fe6837 |
+ for path in paths:
|
|
|
fe6837 |
+ # Better than os.path.exists() as this also ensures we can actually
|
|
|
fe6837 |
+ # read the file
|
|
|
fe6837 |
+ try:
|
|
|
fe6837 |
+ with open(path):
|
|
|
fe6837 |
+ return path
|
|
|
fe6837 |
+ except IOError:
|
|
|
fe6837 |
+ continue
|
|
|
fe6837 |
+ raise IOError(paths)
|
|
|
fe6837 |
|
|
|
fe6837 |
def testopia_create_run(plan):
|
|
|
fe6837 |
'''Create a run of the given test plan. Returns the run ID.'''
|
|
|
fe6837 |
@@ -230,9 +244,19 @@ def main():
|
|
|
fe6837 |
|
|
|
fe6837 |
if not (retval & BAD_COMPS):
|
|
|
fe6837 |
print " verifying comps.xml grammar with xmllint"
|
|
|
fe6837 |
- comps = newrepo.getGroups()
|
|
|
fe6837 |
- r = os.system("xmllint --noout --nowarning --relaxng %s %s" %
|
|
|
fe6837 |
- (SCHEMA,comps))
|
|
|
fe6837 |
+ try:
|
|
|
fe6837 |
+ schema = get_schema_path()
|
|
|
fe6837 |
+ except IOError as e:
|
|
|
fe6837 |
+ print ' could not read schema file, paths tried:'
|
|
|
fe6837 |
+ for path in e.args[0]:
|
|
|
fe6837 |
+ print ' ' + path
|
|
|
fe6837 |
+ print (' make sure you have the latest version of yum '
|
|
|
fe6837 |
+ 'properly installed')
|
|
|
fe6837 |
+ r = 1
|
|
|
fe6837 |
+ else:
|
|
|
fe6837 |
+ comps = newrepo.getGroups()
|
|
|
fe6837 |
+ r = os.system("xmllint --noout --nowarning --relaxng %s %s" %
|
|
|
fe6837 |
+ (schema, comps))
|
|
|
fe6837 |
if r != 0:
|
|
|
fe6837 |
retval = retval | BAD_COMPS
|
|
|
fe6837 |
report('COMPS','FAILED')
|