From 65af997801adb2f8b3476fa32b097aef111d4195 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 31 Oct 2016 18:31:04 +0000 Subject: [PATCH 1/7] Add support for priority, replaces, provides, conflicts, and virtual (all three). --- tools/onlpm.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/onlpm.py b/tools/onlpm.py index 1b32b738..fe407b54 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -399,6 +399,18 @@ class OnlPackage(object): for provides in onlu.sflatten(self.pkg.get('provides', [])): command = command + "--provides %s " % provides + for conflicts in onlu.sflatten(self.pkg.get('conflicts', [])): + command = command + "--conflicts %s " % conflicts + + for replaces in onlu.sflatten(self.pkg.get('replaces', [])): + command = command + "--replaces %s " % replaces + + if 'virtual' in self.pkg: + command = command + "--provides %(v)s --conflicts %(v)s --replaces %(v)s " % dict(v=self.pkg['virtual']) + + if 'priority' in self.pkg: + command = command + "--deb-priority %s " % self.pkg['priority'] + if 'init' in self.pkg: if not os.path.exists(self.pkg['init']): raise OnlPackageError("Init script '%s' does not exist." % self.pkg['init']) From cd61449e52ee1dbc9cc0eca8a39d704dc3c8415c Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 31 Oct 2016 20:22:53 +0000 Subject: [PATCH 2/7] 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. From de5264272480e41978016393d616cc990bf88037 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 31 Oct 2016 22:01:55 +0000 Subject: [PATCH 3/7] Latest --- sm/infra | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm/infra b/sm/infra index 3bfc913e..30c0ff62 160000 --- a/sm/infra +++ b/sm/infra @@ -1 +1 @@ -Subproject commit 3bfc913ed88ef6000f8393a58bf142061b68d61a +Subproject commit 30c0ff6247f993a00dba706fca337fcf37a18de4 From b87ec658e041a1ab7644fe8fdc3c51a8858cc989 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 31 Oct 2016 22:02:16 +0000 Subject: [PATCH 4/7] Add option to generate ASRE documentation from the root filesystem. --- tools/onlrfs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/onlrfs.py b/tools/onlrfs.py index 440bf49f..05b06534 100755 --- a/tools/onlrfs.py +++ b/tools/onlrfs.py @@ -410,7 +410,7 @@ rm -f /usr/sbin/policy-rc.d logger.info("Cleaning Filesystem...") onlu.execute('sudo chroot %s /usr/bin/apt-get clean' % dir_) onlu.execute('sudo chroot %s /usr/sbin/localepurge' % dir_ ) - onlu.execute('sudo chroot %s find /usr/share/doc -type f -delete' % dir_) + onlu.execute('sudo chroot %s find /usr/share/doc -type f -not -name asre.json -delete' % dir_) onlu.execute('sudo chroot %s find /usr/share/man -type f -delete' % dir_) if 'PermitRootLogin' in options: @@ -458,6 +458,11 @@ rm -f /usr/sbin/policy-rc.d ua.chmod('go-w', f) ua.chmod('go-w', os.path.dirname(f)) + if options.get('asre', False): + logger.info("Generating ASRE documentation...") + onlu.execute("sudo %s/sm/infra/tools/asre-merge.py %s %s" % (os.getenv('ONL'), + dir_, + os.path.join(dir_, options.get('asre')))) for (mf, fields) in Configure.get('manifests', {}).iteritems(): logger.info("Configuring manifest %s..." % mf) @@ -520,6 +525,8 @@ rm -f /usr/sbin/policy-rc.d f.write("%s" % issue) onlu.execute("sudo chmod a-w %s" % fn) + + finally: onlu.execute("sudo umount -l %s %s" % (os.path.join(dir_, "dev"), os.path.join(dir_, "proc"))) From 51f23a3c7ac3ced0e708b160d1eca24dc3d73930 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 31 Oct 2016 22:10:47 +0000 Subject: [PATCH 5/7] Make asre generation configurable. --- tools/onlpm.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index f6e98827..27759977 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -427,12 +427,13 @@ class OnlPackage(object): # 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') - ]) + if self.pkg.get('asre', True): + subprocess.check_call(['%s/sm/infra/tools/asre.py' % os.getenv('ONL'), + workdir, + '--overwrite', + '--out', + os.path.join(docpath, 'asre.json') + ]) onlu.execute(command) From 08977b8e4c89268618da403dad6362fcfa1f47cb Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 1 Nov 2016 19:23:55 +0000 Subject: [PATCH 6/7] Use new unified infra asr too. --- tools/onlpm.py | 20 ++++++++++---------- tools/onlrfs.py | 15 +++++++++------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index 27759977..7a5bfc7c 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -422,19 +422,19 @@ class OnlPackage(object): if self.pkg.get('init-after-remove', True): command = command + "--after-remove %s " % OnlPackageAfterRemoveScript(self.pkg['init'], dir=workdir).name + if self.pkg.get('asr', True): + # Generate the ASR documentation for this package. + sys.path.append("%s/sm/infra/tools" % os.getenv('ONL')) + import asr + asro = asr.AimSyslogReference() + asro.extract(workdir) + asro.format(os.path.join(docpath, asr.AimSyslogReference.ASR_NAME), 'json') + + ############################################################ + if logger.level < logging.INFO: command = command + "--verbose " - - # Generate the ASRE documentation for this package. - if self.pkg.get('asre', True): - 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. diff --git a/tools/onlrfs.py b/tools/onlrfs.py index 05b06534..8152731f 100755 --- a/tools/onlrfs.py +++ b/tools/onlrfs.py @@ -410,7 +410,7 @@ rm -f /usr/sbin/policy-rc.d logger.info("Cleaning Filesystem...") onlu.execute('sudo chroot %s /usr/bin/apt-get clean' % dir_) onlu.execute('sudo chroot %s /usr/sbin/localepurge' % dir_ ) - onlu.execute('sudo chroot %s find /usr/share/doc -type f -not -name asre.json -delete' % dir_) + onlu.execute('sudo chroot %s find /usr/share/doc -type f -not -name asr.json -delete' % dir_) onlu.execute('sudo chroot %s find /usr/share/man -type f -delete' % dir_) if 'PermitRootLogin' in options: @@ -458,11 +458,14 @@ rm -f /usr/sbin/policy-rc.d ua.chmod('go-w', f) ua.chmod('go-w', os.path.dirname(f)) - if options.get('asre', False): - logger.info("Generating ASRE documentation...") - onlu.execute("sudo %s/sm/infra/tools/asre-merge.py %s %s" % (os.getenv('ONL'), - dir_, - os.path.join(dir_, options.get('asre')))) + if options.get('asr', None): + asropts = options.get('asr') + logger.info("Gathering ASR documentation...") + sys.path.append("%s/sm/infra/tools" % os.getenv('ONL')) + import asr + asro = asr.AimSyslogReference() + asro.merge(dir_) + asro.format(os.path.join(dir_, asropts['file']), fmt=asropts['format']) for (mf, fields) in Configure.get('manifests', {}).iteritems(): logger.info("Configuring manifest %s..." % mf) From 955dccc63caddda4999719a62b6e8b4b4f1eb664 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 1 Nov 2016 19:24:17 +0000 Subject: [PATCH 7/7] Latest --- sm/infra | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm/infra b/sm/infra index 30c0ff62..b0e02165 160000 --- a/sm/infra +++ b/sm/infra @@ -1 +1 @@ -Subproject commit 30c0ff6247f993a00dba706fca337fcf37a18de4 +Subproject commit b0e02165a733c268c4891e51da6edc3d5ae9ffbb