[packages/pldnotify/py] check version from anitya
glen
glen at pld-linux.org
Tue Nov 3 23:04:52 CET 2015
commit 970d990b062352a9bc9247c66fd2b3038538f5a6
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Wed Nov 4 00:04:21 2015 +0200
check version from anitya
pldnotify.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/pldnotify.py b/pldnotify.py
index 3dbbd8a..81a61e3 100755
--- a/pldnotify.py
+++ b/pldnotify.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
import argparse
+import requests
import rpm
import sys
@@ -36,12 +37,28 @@ class RPMSpec:
return self._macros
+"""
+Check for update from release-monitoring.org.
+Raise ValueError or version from anitya project.
+"""
+def rmo_check(name):
+ distro = "pld-linux"
+ url = "https://release-monitoring.org/api/project/%s/%s" % (distro, name)
+ response = requests.get(url)
+ data = response.json()
+ if 'error' in data:
+ raise ValueError, data['error']
+
+ return data['version']
+
def check_package(package):
s = RPMSpec(package)
macros = s.macros()
name = macros['name']
version = macros['version']
print "%s: %s" % (name, version)
+ ver = rmo_check(name)
+ print "Anitya: %s" % ver
def main():
parser = argparse.ArgumentParser(description='PLD-Notify: project to monitor upstream releases.')
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/pldnotify.git/commitdiff/fcec27be944de51ecb8c9455fdd09b310398d362
More information about the pld-cvs-commit
mailing list