Merge pull request #2878 from SchoolGuy/submit_summary_to_devel

Submit summary to devel
This commit is contained in:
Stephan Kulow 2022-10-20 10:32:48 +02:00 committed by GitHub
commit 4765ffae64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

3
.gitignore vendored
View File

@ -6,3 +6,6 @@
.docker-tmp/
.bash_history
osc
.venv
.vscode
.idea

View File

@ -229,7 +229,7 @@ def binary_src_debug(binary):
@memoize(session=True)
def devel_project_get(apiurl, target_project, target_package):
def devel_project_get(apiurl: str, target_project: str, target_package: str):
try:
meta = ET.fromstringlist(show_package_meta(apiurl, target_project, target_package))
node = meta.find('devel')

View File

@ -12,6 +12,7 @@ from lxml import etree as ET
from osc.core import Package, checkout_package, http_GET, makeurl
from osclib.comments import CommentAPI
from osclib.core import devel_project_get
MARKER = 'PackageListDiff'
@ -165,7 +166,7 @@ class PkglistComments:
return 1
def is_approved(self, comment, comments: dict) -> str | None:
def is_approved(self, comment, comments: dict) -> Optional[str]:
if not comment:
return None
@ -309,8 +310,11 @@ class PkglistComments:
if not approver:
return
sections = self.parse_sections(comment['comment'])
project, package = devel_project_get(self.apiurl, target, '000package-groups')
if project is None or package is None:
raise ValueError('Could not determine devel project or package for the "000package-groups"!')
with tempfile.TemporaryDirectory() as tmpdirname:
checkout_package(self.apiurl, target, '000package-groups', expand_link=True, outdir=tmpdirname)
checkout_package(self.apiurl, project, package, expand_link=True, outdir=tmpdirname)
self.apply_commands(tmpdirname + '/summary-staging.txt', sections)
self.apply_changes(tmpdirname + '/package-groups.changes', sections, approver)
package = Package(tmpdirname)