Modify owner-sync-pagure to use the releng user as the owner in Koji
This commit is contained in:
parent
a8d59c5678
commit
bf97b87714
1 changed files with 11 additions and 26 deletions
|
@ -160,17 +160,16 @@ def get_repo_name_and_arches(tag, version):
|
||||||
|
|
||||||
def get_pagure_projects(session, namespace):
|
def get_pagure_projects(session, namespace):
|
||||||
url = urljoin(PAGURE_URL, 'api/0/projects?namespace={0}'.format(namespace))
|
url = urljoin(PAGURE_URL, 'api/0/projects?namespace={0}'.format(namespace))
|
||||||
url = url + "&page=1&per_page=50"
|
url = url + "&page=1&per_page=50&fork=false&short=true"
|
||||||
while url:
|
while url:
|
||||||
response = session.get(url, verify=VERIFY, timeout=120)
|
response = session.get(url, verify=VERIFY, timeout=120)
|
||||||
if not bool(response):
|
if not bool(response):
|
||||||
print("Failed to talk to %r %r." % (
|
print("Failed to talk to %r %r." % (
|
||||||
response.request.url, response), file=sys.stderr)
|
response.request.url, response), file=sys.stderr)
|
||||||
|
break
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
for project in data['projects']:
|
for project in data['projects']:
|
||||||
# Skip forks
|
|
||||||
if not project['fullname'].startswith('forks/'):
|
|
||||||
yield project
|
yield project
|
||||||
url = data['pagination']['next']
|
url = data['pagination']['next']
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@ def get_project_ownership(tag, namespace):
|
||||||
project_branches_url = '{0}api/0/{1}/{2}/git/branches'.format(
|
project_branches_url = '{0}api/0/{1}/{2}/git/branches'.format(
|
||||||
PAGURE_URL, namespace, project['name'])
|
PAGURE_URL, namespace, project['name'])
|
||||||
project_branches_rv = session.get(
|
project_branches_rv = session.get(
|
||||||
project_branches_url, verify=VERIFY, timeout=30)
|
project_branches_url, verify=VERIFY, timeout=60)
|
||||||
|
|
||||||
# If the project's branches can't be reported, let's skip the project
|
# If the project's branches can't be reported, let's skip the project
|
||||||
# for now.
|
# for now.
|
||||||
|
@ -193,17 +192,14 @@ def get_project_ownership(tag, namespace):
|
||||||
project_branches_rv_json = project_branches_rv.json()
|
project_branches_rv_json = project_branches_rv.json()
|
||||||
|
|
||||||
# The tag and branch names are the same for "old-style" branches
|
# The tag and branch names are the same for "old-style" branches
|
||||||
if tag in project_branches_rv_json['branches']:
|
if tag in project_branches_rv_json['branches'] or tag == 'f' + RAWHIDE:
|
||||||
# Although this is a list, Pagure only supports one owner for now
|
yield project['name']
|
||||||
projects[project['name']] = project['access_users']['owner'][0]
|
|
||||||
|
|
||||||
if tag == 'module-package-list' and not 'module-build-macros' in projects:
|
# This is a special project, not in dist-git, but which needs to be in the package list.
|
||||||
projects['module-build-macros'] = 'releng'
|
yield 'module-build-macros'
|
||||||
|
|
||||||
return projects
|
|
||||||
|
|
||||||
|
|
||||||
def set_koji_ownership(pkgs_to_ownership, arches):
|
def set_koji_ownership(packages, arches):
|
||||||
koji_options = get_options()
|
koji_options = get_options()
|
||||||
|
|
||||||
for arch in arches:
|
for arch in arches:
|
||||||
|
@ -231,23 +227,12 @@ def set_koji_ownership(pkgs_to_ownership, arches):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
koji_pkgs = {}
|
koji_pkgs = {}
|
||||||
koji_users = [user['name'] for user in session.listUsers()]
|
|
||||||
|
|
||||||
for p in session.listPackages(tagID=tag, inherited=True):
|
for p in session.listPackages(tagID=tag, inherited=True):
|
||||||
koji_pkgs[p['package_name']] = p
|
koji_pkgs[p['package_name']] = p
|
||||||
|
|
||||||
for pkg in sorted(pkgs_to_ownership.keys()):
|
for pkg in packages:
|
||||||
owner = pkgs[pkg]
|
owner = 'releng' # always
|
||||||
|
|
||||||
if owner not in koji_users:
|
|
||||||
# add the user first
|
|
||||||
try:
|
|
||||||
session.createUser(owner)
|
|
||||||
except:
|
|
||||||
# user already exists
|
|
||||||
continue
|
|
||||||
koji_users.append(owner)
|
|
||||||
|
|
||||||
if pkg not in koji_pkgs:
|
if pkg not in koji_pkgs:
|
||||||
extra_arches = None
|
extra_arches = None
|
||||||
if pkg in EXTRA_ARCH_LIST:
|
if pkg in EXTRA_ARCH_LIST:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue