[pkg-nagios-changes] [Git][nagios-team/pkg-nagios-plugins-contrib][master] 2 commits: port debian/packaging-helper.py to python3; partially addresses #937103
Sandro Tosi
gitlab at salsa.debian.org
Sat Apr 11 03:15:35 BST 2020
Sandro Tosi pushed to branch master at Debian Nagios Maintainer Group / pkg-nagios-plugins-contrib
Commits:
86796fb5 by Sandro Tosi at 2020-04-10T22:13:45-04:00
port debian/packaging-helper.py to python3; partially addresses #937103
- - - - -
52e6b074 by Sandro Tosi at 2020-04-10T22:14:14-04:00
releasing package nagios-plugins-contrib version 25.20191015+2
- - - - -
5 changed files:
- debian/changelog
- debian/control
- debian/control.in
- debian/packaging-helper.py
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -1,8 +1,13 @@
-nagios-plugins-contrib (25.20191015+2) UNRELEASED; urgency=medium
+nagios-plugins-contrib (25.20191015+2) unstable; urgency=medium
- * UNRELEASED
+ [ Bas Couwenberg ]
+ * [87cc630] Fix check_haproxy_stats/interpreter patch. (closes: #945272)
+
+ [ Sandro Tosi ]
+ * [86796fb] port debian/packaging-helper.py to python3; partially addresses
+ #937103
- -- Jan Wagner <waja at cyconet.org> Tue, 15 Oct 2019 13:50:31 +0200
+ -- Sandro Tosi <morph at debian.org> Fri, 10 Apr 2020 22:13:52 -0400
nagios-plugins-contrib (25.20191015+1) unstable; urgency=medium
=====================================
debian/control
=====================================
@@ -6,7 +6,7 @@ Uploaders: Bernd Zeimetz <bzed at debian.org>, Jan Wagner <waja at cyconet.org>, Stefa
Build-Depends: debhelper (>= 8.0.0),
dh-autoreconf,
python,
- python-debian,
+ python3, python3-debian,
quilt (>= 0.46-7),
autotools-dev, flex, libmemcached-dev [!hurd-i386], pkg-config
Standards-Version: 4.4.1.0
=====================================
debian/control.in
=====================================
@@ -6,7 +6,7 @@ Uploaders: #AUTO_UPDATE_Uploaders#
Build-Depends: debhelper (>= 8.0.0),
dh-autoreconf,
python,
- python-debian,
+ python3, python3-debian,
quilt (>= 0.46-7),
#AUTO_UPDATE_Build-Depends#
Standards-Version: 4.4.1.0
=====================================
debian/packaging-helper.py
=====================================
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
@@ -35,8 +35,8 @@ def __get_control_data__():
# returns (plug, parsed control field data)
# We look at the first paragraph only!
for plugin in __plugins__:
- data=(plugin, [x for x in deb822.Packages.iter_paragraphs(file(__basedir__ + os.path.sep+ plugin + os.path.sep + 'control'))][0])
- for key in data[1].iterkeys():
+ data=(plugin, [x for x in deb822.Packages.iter_paragraphs(open(__basedir__ + os.path.sep+ plugin + os.path.sep + 'control'))][0])
+ for key in data[1].keys():
if key not in ALLOWED_FIELDS:
raise Exception("Unknown control field in plugin %s: %s" %(data[0],key))
yield data
@@ -47,8 +47,8 @@ def __get_tests_data__():
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():
+ data=(plugin, [x for x in deb822.Packages.iter_paragraphs(open(tests_file))][0])
+ for key in data[1].keys():
if key not in ALLOWED_TESTS_FIELDS:
raise Exception("Unknown tests/control field in plugin %s: %s" %(data[0],key))
yield data
@@ -59,7 +59,7 @@ def generate_debian_readme_plugins():
plugins_depends[plugin]={}
# look trough keys we might want to merge
for key in ['Suggests', 'Recommends']:
- if _control.has_key(key):
+ if key in _control:
plugins_depends[plugin][key]=deb822.PkgRelation.parse_relations(_control[key])
# check for generated substvars files
@@ -69,7 +69,7 @@ def generate_debian_readme_plugins():
substvars = fd.read()
try:
rel = deb822.PkgRelation.parse_relations(__shlibs_re__.findall(substvars)[0])
- if plugins_depends[plugin].has_key('Recommends'):
+ if 'Recommends' in plugins_depends[plugin]:
plugins_depends[plugin]['Recommends'].extend(rel)
else:
plugins_depends[plugin]['Recommends']=rel
@@ -81,12 +81,12 @@ def generate_debian_readme_plugins():
for plugin in __plugins__:
if len(plugins_depends[plugin]) > 0:
rtext = '%s:' %(plugin,)
- if plugins_depends[plugin].has_key('Recommends'):
+ if 'Recommends' in plugins_depends[plugin]:
rtext = '%s\n Required Packages: %s' %(
rtext,
deb822.PkgRelation.str(plugins_depends[plugin]['Recommends'])
)
- if plugins_depends[plugin].has_key('Suggests'):
+ if 'Suggests' in plugins_depends[plugin]:
rtext = '%s\n Optional Packages: %s' %(
rtext,
deb822.PkgRelation.str(plugins_depends[plugin]['Suggests'])
@@ -115,22 +115,22 @@ def update_control():
for plugin, _control in __get_control_data__():
# look trough keys we might want to merge
- if _control.has_key('Depends'):
- print "Don't use 'Depends' in %s/control - use 'Recommends' instead" %(plugin,)
+ if 'Depends' in _control:
+ print("Don't use 'Depends' in %s/control - use 'Recommends' instead" %(plugin,))
sys.exit(1)
for key in ['Build-Depends', 'Suggests', 'Recommends']:
- if _control.has_key(key):
+ if key in _control:
for rel in deb822.PkgRelation.parse_relations(_control[key]):
if not rel in control_data[key]:
control_data[key].append(rel)
# extract description
description = ' * %s' %(plugin,)
- if _control.has_key('Version'):
+ if 'Version' in _control:
description = '%s (%s)' %(description, _control['Version'])
try:
description = '%s: %s' %(description, _control['Description'].replace('\n','\n '))
except KeyError:
- print 'Description for plugin %s missing!' %(plugin,)
+ print('Description for plugin %s missing!' %(plugin,))
sys.exit(1)
try:
@@ -151,11 +151,11 @@ def update_control():
with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'control.in', 'r') as f:
control_in = f.read()
- for k, v in control_data.iteritems():
+ for k, v in control_data.items():
if k == 'Description':
- control_in = control_in.replace('#AUTO_UPDATE_Description#', u'\n'.join(v))
+ control_in = control_in.replace('#AUTO_UPDATE_Description#', '\n'.join(v))
elif k == 'Uploaders':
- control_in = control_in.replace('#AUTO_UPDATE_Uploaders#', u', '.join(v))
+ control_in = control_in.replace('#AUTO_UPDATE_Uploaders#', ', '.join(v))
else:
control_in = control_in.replace('#AUTO_UPDATE_%s#' %(k, ), deb822.PkgRelation.str(v))
@@ -177,25 +177,25 @@ def update_copyright():
copyrights = []
for plugin, _control in __get_control_data__():
_p_copyright = '%s:\n\n' %(plugin,)
- if _control.has_key('Homepage'):
+ if 'Homepage' in _control:
_p_copyright = '%sThe plugin was downloaded from: \n%s\n\n' %(_p_copyright, _control['Homepage'])
try:
with open(__basedir__ + os.path.sep + plugin + os.path.sep + 'copyright', 'r') as f:
- _p_copyright = '%s %s' %(_p_copyright, f.read().decode('utf-8').replace('\n','\n '))
+ _p_copyright = '%s %s' %(_p_copyright, f.read().replace('\n','\n '))
except IOError:
- print 'copyright file for plugin %s missing!' %(plugin,)
+ print('copyright file for plugin %s missing!' %(plugin,))
sys.exit(1)
copyrights.append(_p_copyright)
with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'copyright.in', 'r') as f:
- copyright_in = f.read().decode('utf-8')
+ copyright_in = f.read()
- copyright_in = copyright_in.replace('#AUTO_UPDATE_Copyright#', u'\n\n------------------------------------------------------------------------------\n\n'.join(copyrights))
+ copyright_in = copyright_in.replace('#AUTO_UPDATE_Copyright#', '\n\n------------------------------------------------------------------------------\n\n'.join(copyrights))
with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'copyright', 'w') as f:
- f.write(copyright_in.encode('utf-8'))
+ f.write(copyright_in)
def watch():
@@ -205,39 +205,39 @@ def watch():
import hashlib
- import urllib2
- url_opener = urllib2.build_opener()
+ import urllib.request, urllib.error, urllib.parse
+ url_opener = urllib.request.build_opener()
url_opener.addheaders = [('User-agent', 'Debian nagios-plugins-contrib 1.0')]
watch_re = re.compile(r'([^ ]+) (.+)')
whitespace_re = re.compile(r'\s')
for plugin, _control in __get_control_data__():
- if not _control.has_key('Watch'):
- print 'WARNING: %s - missing watch information!' %(plugin,)
+ if 'Watch' not in _control:
+ print('WARNING: %s - missing watch information!' %(plugin,))
continue
try:
url, check = watch_re.findall(_control['Watch'])[0]
except IndexError:
- print 'WARNING: %s - failed to parse Watch line!' %(plugin,)
+ print('WARNING: %s - failed to parse Watch line!' %(plugin,))
continue
try:
f=url_opener.open(url)
- content = f.read()
+ content = f.read().decode('utf-8')
f.close()
except IOError:
- print 'WARNING: %s - failed to retrieve %s !' %(plugin,url)
+ print('WARNING: %s - failed to retrieve %s !' %(plugin,url))
continue
check=check.strip()
if check.startswith('SHA1:'):
check=check.replace('SHA1:','')
new_sha=hashlib.sha1(content).hexdigest()
if check != new_sha:
- print 'UPDATE NECESSARY: %s - SHA1 checksum does not match! New checksum: %s' %(plugin,new_sha)
+ print('UPDATE NECESSARY: %s - SHA1 checksum does not match! New checksum: %s' %(plugin,new_sha))
else:
- print 'OK: %s' %(plugin,)
+ print('OK: %s' %(plugin,))
else:
- if not _control.has_key('Version'):
- print 'WARNING: %s - missing current version information!' %(plugin,)
+ if 'Version' not in _control:
+ print('WARNING: %s - missing current version information!' %(plugin,))
continue
check_re=re.compile(check)
# check for simple matches
@@ -248,7 +248,7 @@ def watch():
if not v in found_versions:
found_versions.append(v)
if not found_versions:
- print "WARNING: %s - regex does not match!" %(plugin)
+ print("WARNING: %s - regex does not match!" %(plugin))
continue
new_version = found_versions[0]
@@ -256,11 +256,11 @@ def watch():
if (apt_pkg.version_compare(v, found_versions[0]) > 0):
new_version = v
if (apt_pkg.version_compare(new_version, _control['Version'].strip()) > 0):
- print 'UPDATE NECESSARY: %s - found new version %s' %(plugin, new_version)
+ print('UPDATE NECESSARY: %s - found new version %s' %(plugin, new_version))
elif (apt_pkg.version_compare(new_version, _control['Version'].strip()) < 0):
- print 'WARNING: %s - could not find the current version (found: %s, control says: %s)!' %(plugin, new_version, _control['Version'])
+ print('WARNING: %s - could not find the current version (found: %s, control says: %s)!' %(plugin, new_version, _control['Version']))
else:
- print 'OK: %s' %(plugin,)
+ print('OK: %s' %(plugin,))
=====================================
debian/rules
=====================================
@@ -14,7 +14,7 @@ override_dh_auto_build:
dh_auto_build
$(PACKAGING_HELPER) --generate-readme
-PACKAGING_HELPER = /usr/bin/python $(CURDIR)/debian/packaging-helper.py
+PACKAGING_HELPER = /usr/bin/python3 $(CURDIR)/debian/packaging-helper.py
clean: debian/copyright debian/control debian/tests/control
View it on GitLab: https://salsa.debian.org/nagios-team/pkg-nagios-plugins-contrib/-/compare/87cc6306631c59d6323cbfce5fad0ce269e687e7...52e6b0745643794271b86c6ba101925e71431329
--
View it on GitLab: https://salsa.debian.org/nagios-team/pkg-nagios-plugins-contrib/-/compare/87cc6306631c59d6323cbfce5fad0ce269e687e7...52e6b0745643794271b86c6ba101925e71431329
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20200411/3b6e2cf6/attachment-0001.html>
More information about the pkg-nagios-changes
mailing list