From cd61449e52ee1dbc9cc0eca8a39d704dc3c8415c Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 31 Oct 2016 20:22:53 +0000 Subject: [PATCH] Automatically generate ASRE documentation for each package. --- tools/onlpm.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index fe407b54..f6e98827 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -352,14 +352,14 @@ class OnlPackage(object): # FPM doesn't seem to have a doc option so we copy documentation # files directly into place. # + docpath = os.path.join(root, "usr/share/doc/%(name)s" % self.pkg) + if not os.path.exists(docpath): + os.makedirs(docpath) + for src in self.pkg.get('docs', []): if not os.path.exists(src): raise OnlPackageError("Documentation source file '%s' does not exist." % src) - - dstpath = os.path.join(root, "usr/share/doc/%(name)s" % self.pkg) - if not os.path.exists(dstpath): - os.makedirs(dstpath) - shutil.copy(src, dstpath) + shutil.copy(src, docpath) changelog = os.path.join(workdir, 'changelog') copyright_ = os.path.join(workdir, 'copyright') @@ -425,6 +425,15 @@ class OnlPackage(object): if logger.level < logging.INFO: command = command + "--verbose " + + # Generate the ASRE documentation for this package. + subprocess.check_call(['%s/sm/infra/tools/asre.py' % os.getenv('ONL'), + workdir, + '--overwrite', + '--out', + os.path.join(docpath, 'asre.json') + ]) + onlu.execute(command) # Grab the package from the workdir. There can be only one.