mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-28 10:46:15 +01:00
- fix for 0a6ca4f6c2
(also adjusted variables)
This commit is contained in:
parent
1f979150a5
commit
bcbcf6426c
@ -2762,12 +2762,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
print apiurl, project, package, repository, arch
|
print apiurl, project, package, repository, arch
|
||||||
xml = show_package_trigger_reason(apiurl, project, package, repository, arch)
|
xml = show_package_trigger_reason(apiurl, project, package, repository, arch)
|
||||||
tree = ET.fromstring(xml)
|
root = ET.fromstring(xml)
|
||||||
reason = tree.find('explain').text
|
reason = root.find('explain').text
|
||||||
print reason
|
print reason
|
||||||
if reason == "meta change":
|
if reason == "meta change":
|
||||||
print "changed keys:"
|
print "changed keys:"
|
||||||
for package in tree.findall('packagechange'):
|
for package in root.findall('packagechange'):
|
||||||
print " ", package.get('change'), package.get('key')
|
print " ", package.get('change'), package.get('key')
|
||||||
|
|
||||||
|
|
||||||
@ -2838,8 +2838,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
xml = get_dependson(apiurl, project, repository, arch, packages, reverse)
|
xml = get_dependson(apiurl, project, repository, arch, packages, reverse)
|
||||||
|
|
||||||
tree = ET.fromstring(xml)
|
root = ET.fromstring(xml)
|
||||||
for package in tree.findall('package'):
|
for package in root.findall('package'):
|
||||||
print package.get('name'), ":"
|
print package.get('name'), ":"
|
||||||
for dep in package.findall('pkgdep'):
|
for dep in package.findall('pkgdep'):
|
||||||
print " ", dep.text
|
print " ", dep.text
|
||||||
@ -4000,7 +4000,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
pac = None
|
pac = None
|
||||||
tree = None
|
root = None
|
||||||
roles = [ 'bugowner', 'maintainer' ]
|
roles = [ 'bugowner', 'maintainer' ]
|
||||||
if len(opts.role):
|
if len(opts.role):
|
||||||
roles = opts.role
|
roles = opts.role
|
||||||
@ -4010,25 +4010,25 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
prj = args[0]
|
prj = args[0]
|
||||||
m = show_project_meta(conf.config['apiurl'], prj)
|
m = show_project_meta(conf.config['apiurl'], prj)
|
||||||
tree = ET.fromstring(''.join(m))
|
root = ET.fromstring(''.join(m))
|
||||||
elif len(args) == 2:
|
elif len(args) == 2:
|
||||||
prj = args[0]
|
prj = args[0]
|
||||||
pac = args[1]
|
pac = args[1]
|
||||||
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
||||||
tree = ET.fromstring(''.join(m))
|
root = ET.fromstring(''.join(m))
|
||||||
if not opts.nodevelproject and not opts.delete and not opts.add:
|
if not opts.nodevelproject and not opts.delete and not opts.add:
|
||||||
while tree.findall('devel'):
|
while root.findall('devel'):
|
||||||
d = tree.find('devel')
|
d = root.find('devel')
|
||||||
prj = d.get('project', prj)
|
prj = d.get('project', prj)
|
||||||
pac = d.get('package', pac)
|
pac = d.get('package', pac)
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
print "Following to the development space:", prj, "/", pac
|
print "Following to the development space:", prj, "/", pac
|
||||||
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
||||||
tree = ET.fromstring(''.join(m))
|
root = ET.fromstring(''.join(m))
|
||||||
if not tree.findall('person'):
|
if not root.findall('person'):
|
||||||
print "No dedicated persons in package defined, showing the project persons !"
|
print "No dedicated persons in package defined, showing the project persons !"
|
||||||
m = show_project_meta(conf.config['apiurl'], prj)
|
m = show_project_meta(conf.config['apiurl'], prj)
|
||||||
tree = ET.fromstring(''.join(m))
|
root = ET.fromstring(''.join(m))
|
||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('I need at least one argument.')
|
raise oscerr.WrongArgs('I need at least one argument.')
|
||||||
|
|
||||||
@ -4044,7 +4044,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
else:
|
else:
|
||||||
# showing the maintainers
|
# showing the maintainers
|
||||||
maintainers = {}
|
maintainers = {}
|
||||||
for person in tree.findall('person'):
|
for person in root.findall('person'):
|
||||||
maintainers.setdefault(person.get('role'), []).append(person.get('userid'))
|
maintainers.setdefault(person.get('role'), []).append(person.get('userid'))
|
||||||
for role in roles:
|
for role in roles:
|
||||||
if opts.bugowner and not len(maintainers.get(role, [])):
|
if opts.bugowner and not len(maintainers.get(role, [])):
|
||||||
@ -4205,7 +4205,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
u = makeurl(apiurl, ['source', prj, package], query=query)
|
u = makeurl(apiurl, ['source', prj, package], query=query)
|
||||||
f = http_GET(u)
|
f = http_GET(u)
|
||||||
meta = f.readlines()
|
meta = f.readlines()
|
||||||
root_new = ET.fromstring(''.join(meta)).getroot()
|
root_new = ET.fromstring(''.join(meta))
|
||||||
dir_new = { 'apiurl': apiurl, 'project': prj, 'package': package }
|
dir_new = { 'apiurl': apiurl, 'project': prj, 'package': package }
|
||||||
dir_new['srcmd5'] = root_new.get('srcmd5')
|
dir_new['srcmd5'] = root_new.get('srcmd5')
|
||||||
dir_new['entries'] = [[n.get('name'), n.get('md5')] for n in root_new.findall('entry')]
|
dir_new['entries'] = [[n.get('name'), n.get('md5')] for n in root_new.findall('entry')]
|
||||||
|
62
osc/core.py
62
osc/core.py
@ -1219,22 +1219,22 @@ rev: %s
|
|||||||
|
|
||||||
m = ''.join(show_package_meta(self.apiurl, self.prjname, self.name))
|
m = ''.join(show_package_meta(self.apiurl, self.prjname, self.name))
|
||||||
|
|
||||||
tree = ET.fromstring(m)
|
root = ET.fromstring(m)
|
||||||
tree.find('title').text = self.summary
|
root.find('title').text = self.summary
|
||||||
tree.find('description').text = ''.join(self.descr)
|
root.find('description').text = ''.join(self.descr)
|
||||||
url = tree.find('url')
|
url = root.find('url')
|
||||||
if url == None:
|
if url == None:
|
||||||
url = ET.SubElement(tree, 'url')
|
url = ET.SubElement(root, 'url')
|
||||||
url.text = self.url
|
url.text = self.url
|
||||||
|
|
||||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name, '_meta'])
|
u = makeurl(self.apiurl, ['source', self.prjname, self.name, '_meta'])
|
||||||
mf = metafile(u, ET.tostring(tree))
|
mf = metafile(u, ET.tostring(root))
|
||||||
|
|
||||||
if not force:
|
if not force:
|
||||||
print '*' * 36, 'old', '*' * 36
|
print '*' * 36, 'old', '*' * 36
|
||||||
print m
|
print m
|
||||||
print '*' * 36, 'new', '*' * 36
|
print '*' * 36, 'new', '*' * 36
|
||||||
print ET.tostring(tree)
|
print ET.tostring(root)
|
||||||
print '*' * 72
|
print '*' * 72
|
||||||
repl = raw_input('Write? (y/N/e) ')
|
repl = raw_input('Write? (y/N/e) ')
|
||||||
else:
|
else:
|
||||||
@ -2097,7 +2097,7 @@ def show_attribute_meta(apiurl, prj, pac, subpac, attribute, with_defaults, with
|
|||||||
def show_develproject(apiurl, prj, pac):
|
def show_develproject(apiurl, prj, pac):
|
||||||
m = show_package_meta(apiurl, prj, pac)
|
m = show_package_meta(apiurl, prj, pac)
|
||||||
try:
|
try:
|
||||||
return ET.fromstring(''.join(m)).getroot().find('devel').get('project')
|
return ET.fromstring(''.join(m)).find('devel').get('project')
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -2301,14 +2301,14 @@ def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None,
|
|||||||
|
|
||||||
def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None):
|
def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None):
|
||||||
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision)
|
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision)
|
||||||
return ET.fromstring(''.join(m)).getroot().get('srcmd5')
|
return ET.fromstring(''.join(m)).get('srcmd5')
|
||||||
|
|
||||||
|
|
||||||
def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False):
|
def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False):
|
||||||
m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair)
|
m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair)
|
||||||
try:
|
try:
|
||||||
# only source link packages have a <linkinfo> element.
|
# only source link packages have a <linkinfo> element.
|
||||||
li_node = ET.fromstring(''.join(m)).getroot().find('linkinfo')
|
li_node = ET.fromstring(''.join(m)).find('linkinfo')
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -2322,7 +2322,7 @@ def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrep
|
|||||||
|
|
||||||
def show_upstream_rev(apiurl, prj, pac):
|
def show_upstream_rev(apiurl, prj, pac):
|
||||||
m = show_files_meta(apiurl, prj, pac)
|
m = show_files_meta(apiurl, prj, pac)
|
||||||
return ET.fromstring(''.join(m)).getroot().get('rev')
|
return ET.fromstring(''.join(m)).get('rev')
|
||||||
|
|
||||||
|
|
||||||
def read_meta_from_spec(specfile, *args):
|
def read_meta_from_spec(specfile, *args):
|
||||||
@ -3320,9 +3320,9 @@ def get_platforms_of_project(apiurl, prj):
|
|||||||
|
|
||||||
def get_repositories_of_project(apiurl, prj):
|
def get_repositories_of_project(apiurl, prj):
|
||||||
f = show_project_meta(apiurl, prj)
|
f = show_project_meta(apiurl, prj)
|
||||||
tree = ET.fromstring(''.join(f))
|
root = ET.fromstring(''.join(f))
|
||||||
|
|
||||||
r = [ node.get('name') for node in tree.findall('repository')]
|
r = [ node.get('name') for node in root.findall('repository')]
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
@ -3338,9 +3338,9 @@ class Repo:
|
|||||||
|
|
||||||
def get_repos_of_project(apiurl, prj):
|
def get_repos_of_project(apiurl, prj):
|
||||||
f = show_project_meta(apiurl, prj)
|
f = show_project_meta(apiurl, prj)
|
||||||
tree = ET.fromstring(''.join(f))
|
root = ET.fromstring(''.join(f))
|
||||||
|
|
||||||
for node in tree.findall('repository'):
|
for node in root.findall('repository'):
|
||||||
for node2 in node.findall('arch'):
|
for node2 in node.findall('arch'):
|
||||||
yield Repo(node.get('name'), node2.text)
|
yield Repo(node.get('name'), node2.text)
|
||||||
|
|
||||||
@ -3396,8 +3396,7 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[]):
|
|||||||
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
|
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
|
||||||
|
|
||||||
f = show_results_meta(apiurl, prj, package, lastbuild, repository, arch)
|
f = show_results_meta(apiurl, prj, package, lastbuild, repository, arch)
|
||||||
tree = ET.fromstring(''.join(f))
|
root = ET.fromstring(''.join(f))
|
||||||
root = tree.getroot()
|
|
||||||
|
|
||||||
for node in root.findall('result'):
|
for node in root.findall('result'):
|
||||||
rmap = {}
|
rmap = {}
|
||||||
@ -3431,8 +3430,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
|
|||||||
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
|
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
|
||||||
|
|
||||||
f = show_prj_results_meta(apiurl, prj)
|
f = show_prj_results_meta(apiurl, prj)
|
||||||
tree = ET.fromstring(''.join(f))
|
root = ET.fromstring(''.join(f))
|
||||||
root = tree.getroot()
|
|
||||||
|
|
||||||
pacs = []
|
pacs = []
|
||||||
# sequence of (repo,arch) tuples
|
# sequence of (repo,arch) tuples
|
||||||
@ -4143,20 +4141,20 @@ def addPerson(apiurl, prj, pac, user, role="maintainer"):
|
|||||||
create_new=False)
|
create_new=False)
|
||||||
|
|
||||||
if data and get_user_meta(apiurl, user) != None:
|
if data and get_user_meta(apiurl, user) != None:
|
||||||
tree = ET.fromstring(''.join(data))
|
root = ET.fromstring(''.join(data))
|
||||||
found = False
|
found = False
|
||||||
for person in tree.getiterator('person'):
|
for person in root.getiterator('person'):
|
||||||
if person.get('userid') == user and person.get('role') == role:
|
if person.get('userid') == user and person.get('role') == role:
|
||||||
found = True
|
found = True
|
||||||
print "user already exists"
|
print "user already exists"
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
# the xml has a fixed structure
|
# the xml has a fixed structure
|
||||||
tree.insert(2, ET.Element('person', role=role, userid=user))
|
root.insert(2, ET.Element('person', role=role, userid=user))
|
||||||
print 'user \'%s\' added to \'%s\'' % (user, pac or prj)
|
print 'user \'%s\' added to \'%s\'' % (user, pac or prj)
|
||||||
edit_meta(metatype=kind,
|
edit_meta(metatype=kind,
|
||||||
path_args=path,
|
path_args=path,
|
||||||
data=ET.tostring(tree))
|
data=ET.tostring(root))
|
||||||
else:
|
else:
|
||||||
print "osc: an error occured"
|
print "osc: an error occured"
|
||||||
|
|
||||||
@ -4176,17 +4174,17 @@ def delPerson(apiurl, prj, pac, user, role="maintainer"):
|
|||||||
template_args=None,
|
template_args=None,
|
||||||
create_new=False)
|
create_new=False)
|
||||||
if data:
|
if data:
|
||||||
tree = ET.fromstring(''.join(data))
|
root = ET.fromstring(''.join(data))
|
||||||
found = False
|
found = False
|
||||||
for person in tree.getiterator('person'):
|
for person in root.getiterator('person'):
|
||||||
if person.get('userid') == user and person.get('role') == role:
|
if person.get('userid') == user and person.get('role') == role:
|
||||||
tree.remove(person)
|
root.remove(person)
|
||||||
found = True
|
found = True
|
||||||
print "user \'%s\' removed" % user
|
print "user \'%s\' removed" % user
|
||||||
if found:
|
if found:
|
||||||
edit_meta(metatype=kind,
|
edit_meta(metatype=kind,
|
||||||
path_args=path,
|
path_args=path,
|
||||||
data=ET.tostring(tree))
|
data=ET.tostring(root))
|
||||||
else:
|
else:
|
||||||
print "user \'%s\' not found in \'%s\'" % (user, pac or prj)
|
print "user \'%s\' not found in \'%s\'" % (user, pac or prj)
|
||||||
else:
|
else:
|
||||||
@ -4201,10 +4199,10 @@ def setDevelProject(apiurl, prj, pac, dprj, dpkg=None):
|
|||||||
create_new=False)
|
create_new=False)
|
||||||
|
|
||||||
if data and show_project_meta(apiurl, dprj) != None:
|
if data and show_project_meta(apiurl, dprj) != None:
|
||||||
tree = ET.fromstring(''.join(data))
|
root = ET.fromstring(''.join(data))
|
||||||
if not tree.find('devel') != None:
|
if not root.find('devel') != None:
|
||||||
ET.SubElement(tree, 'devel')
|
ET.SubElement(root, 'devel')
|
||||||
elem = tree.find('devel')
|
elem = root.find('devel')
|
||||||
if dprj:
|
if dprj:
|
||||||
elem.attrib['project'] = dprj
|
elem.attrib['project'] = dprj
|
||||||
else:
|
else:
|
||||||
@ -4217,7 +4215,7 @@ def setDevelProject(apiurl, prj, pac, dprj, dpkg=None):
|
|||||||
del elem.attrib['package']
|
del elem.attrib['package']
|
||||||
edit_meta(metatype='pkg',
|
edit_meta(metatype='pkg',
|
||||||
path_args=path,
|
path_args=path,
|
||||||
data=ET.tostring(tree))
|
data=ET.tostring(root))
|
||||||
else:
|
else:
|
||||||
print "osc: an error occured"
|
print "osc: an error occured"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user