Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:adrianSuSE
meta-package
generate_conflicts.py
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File generate_conflicts.py of Package meta-package
import sys import xml.etree.ElementTree as ET if len(sys.argv) < 2: print("ERRIR: Require at least the updateinfo.xml file name") sys.exit(1) filename = sys.argv[1] timestamp = None if len(sys.argv) > 2: timestamp = sys.argv[2] tree = ET.parse(filename) root = tree.getroot() package_versions = {} package_versions_skip = [] for update in root: patch_id = update.find("id").text issued_date = int(update.find('issued').attrib['date']) pkglist = update.find("pkglist").find("collection") # updates which are newer than the time stamp should be blocked (conflict of the released version) # if there were more patches with it, it applies to all of them if timestamp is None or issued_date > timestamp: for package in pkglist: name = package.attrib['name'] version = package.attrib['version'] release = package.attrib['release'] package_versions_skip.append({ "name" : name, "version" : version, "release" : release, }) continue for package in pkglist: name = package.attrib['name'] version = package.attrib['version'] release = package.attrib['release'] # if there is a newer patch already known, ignore the old one if name in package_versions: if issued_date < package_versions[name]["issued"]: print("Older patch, skipping ", name, file=sys.stderr) continue package_versions[name] = { "version" : version, "release" : release, "issued" : issued_date } # list of conflict statements for the .spec-file conflicts = [] for package in package_versions.keys(): older = "Conflicts: {0} < {1}-{2}".format(package, package_versions[package]["version"], package_versions[package]["release"]) newer = "Conflicts: {0} > {1}-{2}".format(package, package_versions[package]["version"], package_versions[package]["release"]) conflicts.append(older) conflicts.append(newer) for package in package_versions_skip: # if specific version is enforced, no need to additionally conflict newer releases if package["name"] in package_versions: continue conflict = "Conflicts: {0} = {1}-{2}".format(package["name"], package["version"], package["release"]) conflicts.append(conflict) conflicts = list(dict.fromkeys(conflicts)) conflicts.sort() for conflict in conflicts: print(conflict)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor