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
|
||||
#
|
||||
# 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):
|
||||
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)
|
||||
import json
|
||||
try:
|
||||
text = json.loads(text)
|
||||
text = json.loads(text)
|
||||
except ValueError:
|
||||
return False
|
||||
return False
|
||||
try:
|
||||
dver = text.get('dest', {}).get('version', None)
|
||||
sver = text.get('src', {}).get('version', None)
|
||||
dver = text.get('dest', {}).get('version', None)
|
||||
sver = text.get('src', {}).get('version', None)
|
||||
except AttributeError:
|
||||
return False
|
||||
return False
|
||||
if dver and sver and dver != sver:
|
||||
return True
|
||||
return True
|
||||
return False
|
||||
|
||||
def _find_legal_reviews(self, project, package, opts):
|
||||
@ -42,29 +42,29 @@ def _find_legal_reviews(self, project, package, opts):
|
||||
rqs = {}
|
||||
for rq in root.findall('request'):
|
||||
#print(ET.dump(rq))
|
||||
id = rq.attrib['id']
|
||||
id = rq.attrib['id']
|
||||
for review in rq.findall('review'):
|
||||
if not review.attrib.get('when'): continue
|
||||
when = time.strptime(review.attrib['when'], '%Y-%m-%dT%H:%M:%S')
|
||||
|
||||
if review.attrib.get('by_group') == 'legal-auto':
|
||||
if self._find_legal_get_versions_update(review) and not lastupdate:
|
||||
lastupdate=when
|
||||
continue
|
||||
if review.attrib.get('by_group') != 'legal-team': continue
|
||||
who = review.attrib.get('who')
|
||||
if review.attrib.get('by_group') == 'legal-auto':
|
||||
if self._find_legal_get_versions_update(review) and not lastupdate:
|
||||
lastupdate=when
|
||||
continue
|
||||
if review.attrib.get('by_group') != 'legal-team': continue
|
||||
who = review.attrib.get('who')
|
||||
if who == 'factory-maintainer': continue
|
||||
if when > lastreview:
|
||||
lastreview = when
|
||||
lastwho=who
|
||||
lastupdate=None
|
||||
lastreview = when
|
||||
lastwho=who
|
||||
lastupdate=None
|
||||
return lastreview, lastwho, lastupdate
|
||||
|
||||
def do_find_legals(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: checker review of submit requests.
|
||||
|
||||
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.
|
||||
|
||||
${cmd_option_list}
|
||||
@ -73,17 +73,17 @@ def do_find_legals(self, subcmd, opts, *args):
|
||||
opts.apiurl = self.get_api_url()
|
||||
|
||||
def _find_legal_cmp(t1, t2):
|
||||
if t1[1] < t2[1]:
|
||||
return -1
|
||||
if t1[1] > t2[1]:
|
||||
return 1
|
||||
if t1 and t2 and t1[2] < t2[2]:
|
||||
return 1
|
||||
if t1 and not t2:
|
||||
return -1
|
||||
if t2 and not t1:
|
||||
return 1
|
||||
return -1
|
||||
if t1[1] < t2[1]:
|
||||
return -1
|
||||
if t1[1] > t2[1]:
|
||||
return 1
|
||||
if t1 and t2 and t1[2] < t2[2]:
|
||||
return 1
|
||||
if t1 and not t2:
|
||||
return -1
|
||||
if t2 and not t1:
|
||||
return 1
|
||||
return -1
|
||||
|
||||
packages = list()
|
||||
for p in args[:]:
|
||||
@ -92,10 +92,10 @@ def do_find_legals(self, subcmd, opts, *args):
|
||||
packages = sorted(packages, cmp=_find_legal_cmp)
|
||||
print("ORDER")
|
||||
for p in packages:
|
||||
update = 'never'
|
||||
if p[2]:
|
||||
update = time.asctime(p[2])
|
||||
print(p[0], time.asctime(p[1]), update)
|
||||
update = 'never'
|
||||
if p[2]:
|
||||
update = time.asctime(p[2])
|
||||
print(p[0], time.asctime(p[1]), update)
|
||||
|
||||
#Local Variables:
|
||||
#mode: python
|
||||
|
Loading…
x
Reference in New Issue
Block a user