Browse Source

Rebuild HA Guide if files modified

Special case the HA Guide since it is using asciidoc. We do not
check for includes and simply rebuild it whenever a file in the
directory is changed.

Change-Id: Ib4226a326f0d3c9f95d68950241f22f4c38c1d10
changes/60/60060/1
Andreas Jaeger 8 years ago
parent
commit
c4b3ab669b
  1. 27
      test.py
  2. 24
      validate.py

27
test.py

@ -166,6 +166,25 @@ def only_www_touched():
return www_changed and not other_changed
# Check whether only files in www got updated
def ha_guide_touched():
"""Check whether files in high-availability-guide directory are touched"""
try:
args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = check_output(args).strip().split()
except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e)
sys.exit(1)
ha_changed = False
for f in modified_files:
if f.startswith("doc/high-availability-guide/"):
ha_changed = True
return ha_changed
def get_modified_files(rootdir, filtering=None):
"""Get modified files below doc directory"""
@ -457,10 +476,16 @@ def build_affected_books(rootdir, book_exceptions, file_exceptions,
os.chdir(root)
# ha-guide uses asciidoc which we do not track.
# Just check whether any file is touched in that directory
if root.endswith('doc/high-availability-guide'):
if ha_guide_touched():
affected_books.append(book_root)
# We can scan only for depth of one of inclusion
# therefore skip the common directory since there's no
# book build in it.
if not root.endswith('doc/common'):
elif not root.endswith('doc/common'):
for f in files:
if (f.endswith('.xml') and
f != 'pom.xml' and

24
validate.py

@ -169,6 +169,24 @@ def only_www_touched():
return www_changed and not other_changed
def ha_guide_touched():
"""Check whether files in high-availability-guide directory are touched"""
try:
args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = check_output(args).strip().split()
except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e)
sys.exit(1)
ha_changed = False
for f in modified_files:
if f.startswith("doc/high-availability-guide/"):
ha_changed = True
return ha_changed
def get_modified_files(rootdir, filtering=None):
"""Get modified files below doc directory"""
@ -449,6 +467,12 @@ def build_affected_books(rootdir, book_exceptions, file_exceptions, force):
os.chdir(root)
# ha-guide uses asciidoc which we do not track.
# Just check whether any file is touched in that directory
if root.endswith('doc/high-availability-guide'):
if ha_guide_touched():
affected_books.append(book_root)
# We can scan only for depth of one of inclusion
# therefore skip the common directory since there's no
# book build in it.

Loading…
Cancel
Save