Fixes for building
* Fix path to ha build script * Do not force building of books if --api-site is given, the code is correct, it just falls over invalid xml. Patches have been sent to fix the XML. * Validate also XML files that are in samples directory or in wadls directory - but only validate for proper XML, do not validate against any schema Change-Id: Ifca12ddf8f3fbd23bacf77e4d5930e450162ee05
This commit is contained in:
parent
93be0e5e62
commit
9271c348dd
@ -403,7 +403,7 @@ def check_deleted_files(rootdir, file_exceptions, verbose):
|
|||||||
|
|
||||||
|
|
||||||
def validate_one_file(schema, rootdir, path, verbose,
|
def validate_one_file(schema, rootdir, path, verbose,
|
||||||
check_syntax, check_niceness):
|
check_syntax, check_niceness, validate_schema):
|
||||||
"""Validate a single file."""
|
"""Validate a single file."""
|
||||||
# We pass schema in as a way of caching it, generating it is expensive
|
# We pass schema in as a way of caching it, generating it is expensive
|
||||||
|
|
||||||
@ -413,11 +413,12 @@ def validate_one_file(schema, rootdir, path, verbose,
|
|||||||
try:
|
try:
|
||||||
if check_syntax:
|
if check_syntax:
|
||||||
doc = etree.parse(path)
|
doc = etree.parse(path)
|
||||||
if validation_failed(schema, doc):
|
if validate_schema:
|
||||||
any_failures = True
|
if validation_failed(schema, doc):
|
||||||
print(error_message(schema.error_log))
|
any_failures = True
|
||||||
verify_section_tags_have_xmid(doc)
|
print(error_message(schema.error_log))
|
||||||
verify_profiling(doc)
|
verify_section_tags_have_xmid(doc)
|
||||||
|
verify_profiling(doc)
|
||||||
if check_niceness:
|
if check_niceness:
|
||||||
verify_nice_usage_of_whitespaces(path)
|
verify_nice_usage_of_whitespaces(path)
|
||||||
except etree.XMLSyntaxError as e:
|
except etree.XMLSyntaxError as e:
|
||||||
@ -478,31 +479,28 @@ def validate_individual_files(files_to_check, rootdir, exceptions, verbose,
|
|||||||
base_f in exceptions):
|
base_f in exceptions):
|
||||||
continue
|
continue
|
||||||
# Files ending with ".xml" in subdirectories of
|
# Files ending with ".xml" in subdirectories of
|
||||||
# wadls and samples files are not docbook files
|
# wadls and samples files are not docbook files.
|
||||||
# Currently we cannot validate these, so skip validation
|
# We cannot validate with a schema for these
|
||||||
# for them.
|
|
||||||
if (is_api_site and ("wadls" in f or "samples" in f)):
|
if (is_api_site and ("wadls" in f or "samples" in f)):
|
||||||
skip_xml_validation = True
|
validate_schema = False
|
||||||
else:
|
else:
|
||||||
skip_xml_validation = False
|
validate_schema = True
|
||||||
|
|
||||||
if (is_api_site and is_wadl(f)):
|
if (is_api_site and is_wadl(f)):
|
||||||
any_failures = validate_one_file(wadl_schema, rootdir, f,
|
any_failures = validate_one_file(wadl_schema, rootdir, f,
|
||||||
verbose,
|
verbose,
|
||||||
check_syntax,
|
check_syntax,
|
||||||
check_niceness)
|
check_niceness,
|
||||||
if any_failures:
|
validate_schema)
|
||||||
no_failed = no_failed + 1
|
else:
|
||||||
no_validated = no_validated + 1
|
|
||||||
elif (check_syntax and not skip_xml_validation) or check_niceness:
|
|
||||||
any_failures = validate_one_file(schema, rootdir, f,
|
any_failures = validate_one_file(schema, rootdir, f,
|
||||||
verbose,
|
verbose,
|
||||||
check_syntax and
|
check_syntax,
|
||||||
not skip_xml_validation,
|
check_niceness,
|
||||||
check_niceness)
|
validate_schema)
|
||||||
if any_failures:
|
if any_failures:
|
||||||
no_failed = no_failed + 1
|
no_failed = no_failed + 1
|
||||||
no_validated = no_validated + 1
|
no_validated = no_validated + 1
|
||||||
|
|
||||||
if no_failed > 0:
|
if no_failed > 0:
|
||||||
print("Check failed, validated %d xml/wadl files with %d failures.\n"
|
print("Check failed, validated %d xml/wadl files with %d failures.\n"
|
||||||
@ -618,7 +616,7 @@ def build_book(book):
|
|||||||
base_book = "install-guide (for Debian, Fedora, openSUSE, Ubuntu)"
|
base_book = "install-guide (for Debian, Fedora, openSUSE, Ubuntu)"
|
||||||
elif base_book == "high-availability-guide":
|
elif base_book == "high-availability-guide":
|
||||||
output = subprocess.check_output(
|
output = subprocess.check_output(
|
||||||
["../../tools/build-ha-guide.sh", ],
|
["build-ha-guide.sh", ],
|
||||||
stderr=subprocess.STDOUT
|
stderr=subprocess.STDOUT
|
||||||
)
|
)
|
||||||
output = subprocess.check_output(
|
output = subprocess.check_output(
|
||||||
@ -799,8 +797,7 @@ def find_affected_books(rootdir, book_exceptions, verbose,
|
|||||||
|
|
||||||
|
|
||||||
def build_affected_books(rootdir, book_exceptions,
|
def build_affected_books(rootdir, book_exceptions,
|
||||||
verbose, force=False, ignore_errors=False,
|
verbose, force=False, ignore_errors=False):
|
||||||
is_api_site=False):
|
|
||||||
"""Build all the books which are affected by modified files.
|
"""Build all the books which are affected by modified files.
|
||||||
|
|
||||||
Looks for all directories with "pom.xml" and checks if a
|
Looks for all directories with "pom.xml" and checks if a
|
||||||
@ -811,11 +808,6 @@ def build_affected_books(rootdir, book_exceptions,
|
|||||||
This will throw an exception if a book fails to build
|
This will throw an exception if a book fails to build
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Dependency generation in api projects does not work currently,
|
|
||||||
# thus build all books
|
|
||||||
if is_api_site:
|
|
||||||
force = True
|
|
||||||
|
|
||||||
books = find_affected_books(rootdir, book_exceptions,
|
books = find_affected_books(rootdir, book_exceptions,
|
||||||
verbose, force)
|
verbose, force)
|
||||||
|
|
||||||
@ -931,8 +923,7 @@ def main():
|
|||||||
if prog_args.check_build:
|
if prog_args.check_build:
|
||||||
build_affected_books(prog_args.path, BOOK_EXCEPTIONS,
|
build_affected_books(prog_args.path, BOOK_EXCEPTIONS,
|
||||||
prog_args.verbose, prog_args.force,
|
prog_args.verbose, prog_args.force,
|
||||||
prog_args.ignore_errors,
|
prog_args.ignore_errors)
|
||||||
prog_args.api_site)
|
|
||||||
|
|
||||||
|
|
||||||
def default_root():
|
def default_root():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user