Merge pull request #23 from jnweiger/master
usage and comment now show the correct name.
This commit is contained in:
commit
31914cfd9e
@ -3,7 +3,7 @@
|
|||||||
# Distribute under GPLv2 or GPLv3
|
# Distribute under GPLv2 or GPLv3
|
||||||
#
|
#
|
||||||
# Copy this script to ~/.osc-plugins/ or /var/lib/osc-plugins .
|
# Copy this script to ~/.osc-plugins/ or /var/lib/osc-plugins .
|
||||||
# Then try to run 'osc checker --help' to see the usage.
|
# Then try to run 'osc find_legals --help' to see the usage.
|
||||||
|
|
||||||
def _find_legals(self, package, opts):
|
def _find_legals(self, package, opts):
|
||||||
factory_time, factory_who, version_updates = self._find_legal_reviews("openSUSE:Factory", package, opts)
|
factory_time, factory_who, version_updates = self._find_legal_reviews("openSUSE:Factory", package, opts)
|
||||||
@ -20,16 +20,16 @@ def _find_legal_get_versions_update(self, review):
|
|||||||
text = re.sub(r'-->.*', '', text)
|
text = re.sub(r'-->.*', '', text)
|
||||||
import json
|
import json
|
||||||
try:
|
try:
|
||||||
text = json.loads(text)
|
text = json.loads(text)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
dver = text.get('dest', {}).get('version', None)
|
dver = text.get('dest', {}).get('version', None)
|
||||||
sver = text.get('src', {}).get('version', None)
|
sver = text.get('src', {}).get('version', None)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return False
|
return False
|
||||||
if dver and sver and dver != sver:
|
if dver and sver and dver != sver:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _find_legal_reviews(self, project, package, opts):
|
def _find_legal_reviews(self, project, package, opts):
|
||||||
@ -42,29 +42,29 @@ def _find_legal_reviews(self, project, package, opts):
|
|||||||
rqs = {}
|
rqs = {}
|
||||||
for rq in root.findall('request'):
|
for rq in root.findall('request'):
|
||||||
#print(ET.dump(rq))
|
#print(ET.dump(rq))
|
||||||
id = rq.attrib['id']
|
id = rq.attrib['id']
|
||||||
for review in rq.findall('review'):
|
for review in rq.findall('review'):
|
||||||
if not review.attrib.get('when'): continue
|
if not review.attrib.get('when'): continue
|
||||||
when = time.strptime(review.attrib['when'], '%Y-%m-%dT%H:%M:%S')
|
when = time.strptime(review.attrib['when'], '%Y-%m-%dT%H:%M:%S')
|
||||||
|
|
||||||
if review.attrib.get('by_group') == 'legal-auto':
|
if review.attrib.get('by_group') == 'legal-auto':
|
||||||
if self._find_legal_get_versions_update(review) and not lastupdate:
|
if self._find_legal_get_versions_update(review) and not lastupdate:
|
||||||
lastupdate=when
|
lastupdate=when
|
||||||
continue
|
continue
|
||||||
if review.attrib.get('by_group') != 'legal-team': continue
|
if review.attrib.get('by_group') != 'legal-team': continue
|
||||||
who = review.attrib.get('who')
|
who = review.attrib.get('who')
|
||||||
if who == 'factory-maintainer': continue
|
if who == 'factory-maintainer': continue
|
||||||
if when > lastreview:
|
if when > lastreview:
|
||||||
lastreview = when
|
lastreview = when
|
||||||
lastwho=who
|
lastwho=who
|
||||||
lastupdate=None
|
lastupdate=None
|
||||||
return lastreview, lastwho, lastupdate
|
return lastreview, lastwho, lastupdate
|
||||||
|
|
||||||
def do_find_legals(self, subcmd, opts, *args):
|
def do_find_legals(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: checker review of submit requests.
|
"""${cmd_name}: checker review of submit requests.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
osc check_dups [OPT] [list] [FILTER|PACKAGE_SRC]
|
osc find_legals [OPT] [list] [FILTER|PACKAGE_SRC]
|
||||||
Shows pending review requests and their current state.
|
Shows pending review requests and their current state.
|
||||||
|
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
@ -73,17 +73,17 @@ def do_find_legals(self, subcmd, opts, *args):
|
|||||||
opts.apiurl = self.get_api_url()
|
opts.apiurl = self.get_api_url()
|
||||||
|
|
||||||
def _find_legal_cmp(t1, t2):
|
def _find_legal_cmp(t1, t2):
|
||||||
if t1[1] < t2[1]:
|
if t1[1] < t2[1]:
|
||||||
return -1
|
return -1
|
||||||
if t1[1] > t2[1]:
|
if t1[1] > t2[1]:
|
||||||
return 1
|
return 1
|
||||||
if t1 and t2 and t1[2] < t2[2]:
|
if t1 and t2 and t1[2] < t2[2]:
|
||||||
return 1
|
return 1
|
||||||
if t1 and not t2:
|
if t1 and not t2:
|
||||||
return -1
|
return -1
|
||||||
if t2 and not t1:
|
if t2 and not t1:
|
||||||
return 1
|
return 1
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
packages = list()
|
packages = list()
|
||||||
for p in args[:]:
|
for p in args[:]:
|
||||||
@ -92,10 +92,10 @@ def do_find_legals(self, subcmd, opts, *args):
|
|||||||
packages = sorted(packages, cmp=_find_legal_cmp)
|
packages = sorted(packages, cmp=_find_legal_cmp)
|
||||||
print("ORDER")
|
print("ORDER")
|
||||||
for p in packages:
|
for p in packages:
|
||||||
update = 'never'
|
update = 'never'
|
||||||
if p[2]:
|
if p[2]:
|
||||||
update = time.asctime(p[2])
|
update = time.asctime(p[2])
|
||||||
print(p[0], time.asctime(p[1]), update)
|
print(p[0], time.asctime(p[1]), update)
|
||||||
|
|
||||||
#Local Variables:
|
#Local Variables:
|
||||||
#mode: python
|
#mode: python
|
||||||
|
Loading…
x
Reference in New Issue
Block a user