[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 30/32: implement generating a DEP-8 compatible tests control file
Jan Wagner
waja at moszumanska.debian.org
Fri Nov 18 17:23:04 UTC 2016
This is an automated email from the git hooks/post-receive script.
waja pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.
commit 970fde4d41b2a496a5230bb2683c268c7bfdd595
Author: Evgeni Golov <evgeni at debian.org>
Date: Sun Sep 25 14:02:56 2016 +0200
implement generating a DEP-8 compatible tests control file
---
debian/changelog | 6 ++++++
debian/packaging-helper.py | 36 +++++++++++++++++++++++++++++++++++-
debian/rules | 7 ++++++-
debian/tests/control | 6 ++++++
4 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 1724fde..cc96889 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+nagios-plugins-contrib (16.20151226+nmu1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+
+ -- Evgeni Golov <evgeni at debian.org> Sat, 24 Sep 2016 23:04:27 +0200
+
nagios-plugins-contrib (16.20151226) unstable; urgency=medium
[ Jan Wagner ]
diff --git a/debian/packaging-helper.py b/debian/packaging-helper.py
index 42bf5f5..9ab99d5 100755
--- a/debian/packaging-helper.py
+++ b/debian/packaging-helper.py
@@ -16,6 +16,10 @@ ALLOWED_FIELDS = ('Suggests',
'Description',
'Build-Depends')
+ALLOWED_TESTS_FIELDS = ('Depends',
+ 'Tests',
+ 'Test-Command')
+
# find all plugins
__basedir__ = os.path.realpath(os.path.dirname(sys.argv[0]) + os.path.sep + '..')
__plugins__ = [p for p in os.listdir(__basedir__)
@@ -36,6 +40,18 @@ def __get_control_data__():
raise Exception("Unknown control field in plugin %s: %s" %(data[0],key))
yield data
+def __get_tests_data__():
+ # returns (plug, parsed control field data)
+ # We look at the first paragraph only!
+ for plugin in __plugins__:
+ tests_file = __basedir__ + os.path.sep+ plugin + os.path.sep + 'tests'
+ if os.path.exists(tests_file):
+ data=(plugin, [x for x in deb822.Packages.iter_paragraphs(file(tests_file))][0])
+ for key in data[1].iterkeys():
+ if key not in ALLOWED_TESTS_FIELDS:
+ raise Exception("Unknown tests/control field in plugin %s: %s" %(data[0],key))
+ yield data
+
def generate_debian_readme_plugins():
plugins_depends={}
for plugin, _control in __get_control_data__():
@@ -146,6 +162,13 @@ def update_control():
f.write(control_in)
+def update_tests():
+ with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'tests' + os.path.sep + 'control', 'w') as f:
+ for plugin, _control in __get_tests_data__():
+ if 'Depends' in _control and '@' not in _control['Depends']:
+ _control['Depends'] += ', @'
+ f.write(str(_control))
+ f.write("\n")
def update_copyright():
@@ -263,6 +286,14 @@ if __name__ == '__main__':
)
parser.add_option(
+ '--tests',
+ dest='tests',
+ action='store_true',
+ default=False,
+ help='Update debian/tests/control'
+ )
+
+ parser.add_option(
'--watch',
dest='watch',
action='store_true',
@@ -278,13 +309,16 @@ if __name__ == '__main__':
)
(options, args) = parser.parse_args()
- if not (options.control or options.copyright or options.watch or options.generate_readme):
+ if not (options.control or options.copyright or options.watch or options.tests or options.generate_readme):
parser.print_help()
sys.exit(1)
if options.control:
update_control()
+ if options.tests:
+ update_tests()
+
if options.copyright:
update_copyright()
diff --git a/debian/rules b/debian/rules
index 5b90491..e6c707a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,12 +17,13 @@ override_dh_auto_build:
PACKAGING_HELPER = /usr/bin/python $(CURDIR)/debian/packaging-helper.py
-clean: debian/copyright debian/control
+clean: debian/copyright debian/control debian/tests/control
dh $@ --with quilt,python2
rm -f debian/README.Debian.plugins
CONTROL_FILES := $(shell for p in $(PLUGINS); do echo $$p/control; done)
COPYRIGHT_FILES := $(shell for p in $(PLUGINS); do echo $$p/copyright; done)
+TESTS_FILES := $(wildcard */tests)
debian/copyright: debian/copyright.in debian/packaging-helper.py $(CONTROL_FILES) $(COPYRIGHT_FILES)
$(PACKAGING_HELPER) --copyright
-if [ -d .git ]; then git add $@; git commit -m 'Auto update of $@' $@; fi
@@ -31,6 +32,10 @@ debian/control: debian/control.in debian/packaging-helper.py $(CONTROL_FILES)
$(PACKAGING_HELPER) --control
-if [ -d .git ]; then git add $@; git commit -m 'Auto update of $@' $@; fi
+debian/tests/control: debian/packaging-helper.py $(TESTS_FILES)
+ $(PACKAGING_HELPER) --tests
+ -if [ -d .git ]; then git add $@; git commit -m 'Auto update of $@' $@; fi
+
watch:
@$(PACKAGING_HELPER) --watch
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..b0f6e45
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,6 @@
+Depends: cups, libdate-manip-perl, libmonitoring-plugin-perl, libnet-cups-perl, @
+Test-Command: /usr/lib/nagios/plugins/check_cups -H localhost
+
+Depends: apache2, liblocale-gettext-perl, libmonitoring-plugin-perl, liblwp-useragent-determined-perl, @
+Test-Command: /usr/lib/nagios/plugins/check_httpd_status -H localhost
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git
More information about the Pkg-nagios-changes
mailing list