Delete sync-rebuild.py
Its functionality was already merged to the accept command
This commit is contained in:
parent
a9d6db325f
commit
c10ef71528
12
CONTENTS.md
12
CONTENTS.md
@ -107,18 +107,6 @@ Finds unmaintained binaries sourced from SLE.
|
||||
* Package: openSUSE-release-tools
|
||||
* Usage: obsolete
|
||||
|
||||
#### sync-rebuild
|
||||
|
||||
Syncs openSUSE:Factory and openSUSE:Factory:Rebuild. This feature was already
|
||||
merged into the [accept
|
||||
command](https://github.com/openSUSE/openSUSE-release-tools/commit/87c891662015f14421c2315210c248e712e697c8)
|
||||
of the staging projects plug-in.
|
||||
|
||||
* Sources: [sync-rebuild.py](sync-rebuild.py)
|
||||
* Documentation: --
|
||||
* Package: openSUSE-release-tools
|
||||
* Usage: obsolete
|
||||
|
||||
#### bugowner
|
||||
|
||||
Manages bugowner information
|
||||
|
1
dist/package/openSUSE-release-tools.spec
vendored
1
dist/package/openSUSE-release-tools.spec
vendored
@ -397,7 +397,6 @@ exit 0
|
||||
%{_bindir}/osrt-openqa-maintenance
|
||||
%{_bindir}/osrt-requestfinder
|
||||
%{_bindir}/osrt-scan_baselibs
|
||||
%{_bindir}/osrt-sync-rebuild
|
||||
%{_bindir}/osrt-unmaintained
|
||||
%{_bindir}/osrt-totest-manager
|
||||
%{_datadir}/%{source_dir}
|
||||
|
103
sync-rebuild.py
103
sync-rebuild.py
@ -1,103 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import osc
|
||||
import osc.core
|
||||
import osc.conf
|
||||
import xml.etree.ElementTree as ET
|
||||
import re
|
||||
|
||||
|
||||
results = []
|
||||
repo = ""
|
||||
architectures = ["x86_64", "i586"]
|
||||
pkg = ""
|
||||
projects = ['openSUSE:Factory', 'openSUSE:Factory:Rebuild']
|
||||
|
||||
# initialize osc config
|
||||
osc.conf.get_config()
|
||||
|
||||
def get_prj_results(prj, arch):
|
||||
url = osc.core.makeurl(osc.conf.config['apiurl'], ['build', prj, 'standard', arch, "_jobhistory?code=lastfailures"])
|
||||
f = osc.core.http_GET(url)
|
||||
xml = f.read()
|
||||
results = []
|
||||
|
||||
root = ET.fromstring(xml)
|
||||
|
||||
xmllines = root.findall("./jobhist")
|
||||
|
||||
for pkg in xmllines:
|
||||
if pkg.attrib['code'] == 'failed':
|
||||
results.append(pkg.attrib['package'])
|
||||
|
||||
return results
|
||||
|
||||
def compare_results(factory, rebuild, testmode):
|
||||
|
||||
com_res = set(rebuild).symmetric_difference(set(factory))
|
||||
|
||||
if testmode != False:
|
||||
print(com_res)
|
||||
|
||||
return com_res
|
||||
|
||||
def check_pkgs(rebuild_list):
|
||||
url = osc.core.makeurl(osc.conf.config['apiurl'], ['source', 'openSUSE:Factory'])
|
||||
f = osc.core.http_GET(url)
|
||||
xml = f.read()
|
||||
pkglist = []
|
||||
|
||||
root = ET.fromstring(xml)
|
||||
|
||||
xmllines = root.findall("./entry")
|
||||
|
||||
for pkg in xmllines:
|
||||
if pkg.attrib['name'] in rebuild_list:
|
||||
pkglist.append(pkg.attrib['name'])
|
||||
|
||||
return pkglist
|
||||
|
||||
def rebuild_pkg_in_factory(package, prj, arch, testmode, code=None):
|
||||
query = { 'cmd': 'rebuild', 'arch': arch }
|
||||
if package:
|
||||
query['package'] = package
|
||||
pkg = query['package']
|
||||
|
||||
u = osc.core.makeurl(osc.conf.config['apiurl'], ['build', prj], query=query)
|
||||
|
||||
if testmode != False:
|
||||
print("Trigger rebuild for this package: " + u)
|
||||
|
||||
else:
|
||||
try:
|
||||
print('tried to trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg))
|
||||
f = osc.core.http_POST(u)
|
||||
|
||||
except:
|
||||
print('could not trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg))
|
||||
|
||||
testmode = False
|
||||
try:
|
||||
if sys.argv[1] != None:
|
||||
if sys.argv[1] == '-test':
|
||||
testmode = True
|
||||
print("testmode: " + str(testmode))
|
||||
else:
|
||||
testmode = False
|
||||
except:
|
||||
pass
|
||||
|
||||
for arch in architectures:
|
||||
fact_result = get_prj_results('openSUSE:Factory', arch)
|
||||
rebuild_result = get_prj_results('openSUSE:Factory:Rebuild', arch)
|
||||
rebuild_result = check_pkgs(rebuild_result)
|
||||
fact_result = check_pkgs(fact_result)
|
||||
result = compare_results(fact_result, rebuild_result, testmode)
|
||||
|
||||
print(sorted(result))
|
||||
|
||||
for package in result:
|
||||
rebuild_pkg_in_factory(package, 'openSUSE:Factory', arch, testmode, None)
|
||||
rebuild_pkg_in_factory(package, 'openSUSE:Factory:Rebuild', arch, testmode, None)
|
Loading…
x
Reference in New Issue
Block a user