Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package openSUSE-release-tools for openSUSE:Factory checked in at 2022-11-02 12:46:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openSUSE-release-tools (Old) and /work/SRC/openSUSE:Factory/.openSUSE-release-tools.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openSUSE-release-tools" Wed Nov 2 12:46:48 2022 rev:455 rq:1032688 version:20221025.1ef34941 Changes: -------- --- /work/SRC/openSUSE:Factory/openSUSE-release-tools/openSUSE-release-tools.changes 2022-10-08 01:23:51.402041359 +0200 +++ /work/SRC/openSUSE:Factory/.openSUSE-release-tools.new.2275/openSUSE-release-tools.changes 2022-11-02 12:47:28.121667676 +0100 @@ -1,0 +2,42 @@ +Tue Oct 25 12:32:56 UTC 2022 - opensuse-releaset...@opensuse.org + +- Update to version 20221025.1ef34941: + * add configuration for ALP staging + +------------------------------------------------------------------- +Tue Oct 25 10:50:59 UTC 2022 - opensuse-releaset...@opensuse.org + +- Update to version 20221025.f4999b32: + * Don't hard code bash as interpreter for source_validator scripts + +------------------------------------------------------------------- +Mon Oct 24 03:22:40 UTC 2022 - opensuse-releaset...@opensuse.org + +- Update to version 20221024.39e322e2: + * gocd: add openSUSE:Leap:15.4:Images to pkglistgen pipeline for the Leap 15.4 CR + +------------------------------------------------------------------- +Thu Oct 20 08:34:34 UTC 2022 - opensuse-releaset...@opensuse.org + +- Update to version 20221020.4765ffae: + * osclib: Correct syntax error in typing + * osclib: Submit summary-staging.txt to the devel project + * osclib: Add typehints + * ignore: venv, vscode and IDEA config directories + +------------------------------------------------------------------- +Thu Oct 13 13:07:24 UTC 2022 - opensuse-releaset...@opensuse.org + +- Update to version 20221013.5e2a1716: + * pkglistgen: Convert sections to class + * Docs: Fix typos + * pkglistgen: Add type annotations + * osclib: Add type annotations + +------------------------------------------------------------------- +Thu Oct 13 05:28:07 UTC 2022 - opensuse-releaset...@opensuse.org + +- Update to version 20221013.21411e52: + * Fix the syncing of rebuild failures for multibuild flavors + +------------------------------------------------------------------- Old: ---- openSUSE-release-tools-20220929.aad22912.obscpio New: ---- openSUSE-release-tools-20221025.1ef34941.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openSUSE-release-tools.spec ++++++ --- /var/tmp/diff_new_pack.yMcwFv/_old 2022-11-02 12:47:31.789686295 +0100 +++ /var/tmp/diff_new_pack.yMcwFv/_new 2022-11-02 12:47:31.797686335 +0100 @@ -20,7 +20,7 @@ %define source_dir openSUSE-release-tools %define announcer_filename factory-package-news Name: openSUSE-release-tools -Version: 20220929.aad22912 +Version: 20221025.1ef34941 Release: 0 Summary: Tools to aid in staging and release work for openSUSE/SUSE License: GPL-2.0-or-later AND MIT ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.yMcwFv/_old 2022-11-02 12:47:31.857686640 +0100 +++ /var/tmp/diff_new_pack.yMcwFv/_new 2022-11-02 12:47:31.861686660 +0100 @@ -1,7 +1,7 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/openSUSE/openSUSE-release-tools.git</param> - <param name="changesrevision">80099735eb95c4e4e8ed4a8fd3766a0c9778b0f4</param> + <param name="changesrevision">1ef3494112b09f6c294bde5db13b1019ae3a6ad7</param> </service> </servicedata> ++++++ openSUSE-release-tools-20220929.aad22912.obscpio -> openSUSE-release-tools-20221025.1ef34941.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/.gitignore new/openSUSE-release-tools-20221025.1ef34941/.gitignore --- old/openSUSE-release-tools-20220929.aad22912/.gitignore 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/.gitignore 2022-10-25 14:31:16.000000000 +0200 @@ -6,3 +6,6 @@ .docker-tmp/ .bash_history osc +.venv +.vscode +.idea diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/check_source.py new/openSUSE-release-tools-20221025.1ef34941/check_source.py --- old/openSUSE-release-tools-20220929.aad22912/check_source.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/check_source.py 2022-10-25 14:31:16.000000000 +0200 @@ -585,7 +585,7 @@ for script in scripts: if os.path.isdir(script): continue - res = subprocess.run(['/bin/bash', script, '--batchmode', directory, old], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + res = subprocess.run([script, '--batchmode', directory, old], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if res.returncode: text = "Source validator failed. Try \"osc service runall source_validator\"\n" text += res.stdout.decode('utf-8') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/docs/pkglistgen.md new/openSUSE-release-tools-20221025.1ef34941/docs/pkglistgen.md --- old/openSUSE-release-tools-20220929.aad22912/docs/pkglistgen.md 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/docs/pkglistgen.md 2022-10-25 14:31:16.000000000 +0200 @@ -1,25 +1,25 @@ # Package List Generator -pkglistgen.py is a self contained script to generate and update OBS products for openSUSE and SLE. +pkglistgen.py is a self contained script to generate and update OBS products for openSUSE and SLE. It works on the products and its staging projects and ports. The main input is a package named 000package-groups and it will update the content of other packages from that. For that it will read [YAML](https://en.wikipedia.org/wiki/YAML) input from e.g. 000package-groups/groups.yml and generate .group files into 000product. The rest of 000package-groups is copied into 000product as well and it runs the OBS product converter service (See [OBS Documentation](https://en.opensuse.org/openSUSE:Build_Service_product_definition) for details) -The generated release spec files are split into 000release-packages to avoid needless rebuilds. +The generated release spec files are split into 000release-packages to avoid needless rebuilds. ## Input -The package list generator reads several files. The most important are group*.yml (tradionally only groups.yml) within 000package-groups. +The package list generator reads several files. The most important are group*.yml (traditionally only groups.yml) within 000package-groups. ### supportstatus.txt The file lists the packages and their support level. It's only necessary to list packages here that have a different level than the default level specificied in the groups. The format is plain text: <package name> <level> - the level is handed over 1:1 to KIWI file. Currently used values are: unsupported, l2 and l3 - + ### group*.yml The file is a list of package lists and the special hash 'OUTPUT'. OUTPUT contains an entry for every group file that needs to be written out. The group name of it needs to exist as package list as well. OUTPUT also contains flags for the groups. We currently support: * default-support - Sets the support level in case there is no explicitly entry in [supportstatus.txt](#supportstatus.txt), defaults to 'unsupported' + Sets the support level in case there is no explicitly entry in [supportstatus.txt](#supportstatustxt), defaults to 'unsupported' * recommends If the solver should take recommends into account when solving the package list, defaults to false. * includes @@ -31,7 +31,7 @@ Be aware that group names must not contain a '-'. -You can also adapt the solving on a package level by putting a hash into the package list. Normally the package name is a string, in case it's a hash the key needs to be the package name and the value is a list of following modifiers: +You can also adapt the solving on a package level by putting a hash into the package list. Normally the package name is a string, in case it's a hash the key needs to be the package name and the value is a list of following modifiers: * recommended Evaluate also 'Recommends' in package to determine dependencies. Otherwise only 'required' are considered. Used mainly for patterns in SLE. It can not be combined with platforms, For architecture specific recommends, use patterns. @@ -46,7 +46,7 @@ * required If the package is missing or is uninstallable, don't leave a comment but put the error as package entry for OBS to create unresolvable error to avoid building a DVD -Note that you can write yaml lists in 2 ways. You can put the modifier lists as multiple lines starting with -, but it's recommended to put them as [M1,M2] behind the package name. See the difference between pkg4 and pkg5 in the example. +Note that you can write yaml lists in 2 ways. You can put the modifier lists as multiple lines starting with -, but it's recommended to put them as [M1,M2] behind the package name. See the difference between pkg4 and pkg5 in the example. #### Example: @@ -68,32 +68,32 @@ - group3: includes: - list2 - + group1: - pkg1 - + group2: - pkg2: [locked] - pkg3 - + group3: - pkg4: [x86_64] - + list1: - pkg5: - x86_64 - + list2: - pkg6: [recommended] -``` +``` -## Overlap calculcation - TODO +## Overlap calculation + TODO ## Handling in staging workflow -If 000package-groups contains a file named summary-staging.txt, the bot will trigger a diff mode on staging projects. +If 000package-groups contains a file named summary-staging.txt, the bot will trigger a diff mode on staging projects. It will create an equal summary-staging.txt in 000product and create a comment with a human readable diff in the staging project. This comment can be replied to. If the reply starts with 'approve', staging accept will apply the diff to this txt file. If the reply starts with 'ignore', the bot will continue with the pipeline and do nothing on staging accept. -This way simple changes to the summary can be accepted without a submit request (of which there can only be one at a time). \ No newline at end of file +This way simple changes to the summary can be accepted without a submit request (of which there can only be one at a time). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/gocd/alp-stagings.gocd.yaml new/openSUSE-release-tools-20221025.1ef34941/gocd/alp-stagings.gocd.yaml --- old/openSUSE-release-tools-20220929.aad22912/gocd/alp-stagings.gocd.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/openSUSE-release-tools-20221025.1ef34941/gocd/alp-stagings.gocd.yaml 2022-10-25 14:31:16.000000000 +0200 @@ -0,0 +1,142 @@ +--- +format_version: 3 +pipelines: + ALP.Stagings.RelPkgs: + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + group: LEO + lock_behavior: unlockWhenFinished + timer: + spec: 0 0 * ? * * + only_on_changes: false + materials: + scripts: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Generate.Release.Package: + approval: manual + jobs: + ALP.Staging.A: + resources: + - repo-checker + tasks: + - script: ./pkglistgen.py -A https://api.opensuse.org update_and_solve --staging SUSE:ALP:Staging:A --only-release-packages --force + ALP.Staging.B: + resources: + - repo-checker + tasks: + - script: ./pkglistgen.py -A https://api.opensuse.org update_and_solve --staging SUSE:ALP:Staging:B --only-release-packages --force + + ALP.Staging.A: + environment_variables: + STAGING_PROJECT: SUSE:ALP:Staging:A + STAGING_API: https://api.opensuse.org + OSC_CONFIG: /home/go/config/oscrc-staging-bot + group: LEO + lock_behavior: unlockWhenFinished + materials: + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Checks: + jobs: + Check.Build.Succeeds: + resources: + - staging-bot + tasks: + - script: |- + export PYTHONPATH=$PWD/scripts + cd scripts/gocd + ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s pending + ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + Repo.Checker: + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + resources: + - repo-checker + tasks: + - script: |- + ./scripts/staging-installcheck.py -A $STAGING_API -p SUSE:ALP -s $STAGING_PROJECT + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + export PYTHONPATH=$PWD/scripts + cd scripts/gocd + + if ../pkglistgen.py --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s success + else + ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s failure + exit 1 + fi + + - Enable.images.repo: + resources: + - staging-bot + tasks: + - script: |- + osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build" + + ALP.Staging.B: + environment_variables: + STAGING_PROJECT: SUSE:ALP:Staging:B + STAGING_API: https://api.opensuse.org + OSC_CONFIG: /home/go/config/oscrc-staging-bot + group: LEO + lock_behavior: unlockWhenFinished + materials: + scripts: + auto_update: true + git: https://github.com/openSUSE/openSUSE-release-tools.git + whitelist: + - DO_NOT_TRIGGER + destination: scripts + stages: + - Checks: + jobs: + Check.Build.Succeeds: + resources: + - staging-bot + tasks: + - script: |- + export PYTHONPATH=$PWD/scripts + cd scripts/gocd + ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s pending + ./verify-repo-built-successful.py -A $STAGING_API -p $STAGING_PROJECT -r standard + Repo.Checker: + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + resources: + - repo-checker + tasks: + - script: |- + ./scripts/staging-installcheck.py -A $STAGING_API -p SUSE:ALP -s $STAGING_PROJECT + + - Update.000product: + resources: + - repo-checker + tasks: + - script: |- + export PYTHONPATH=$PWD/scripts + cd scripts/gocd + + if ../pkglistgen.py --debug -A $STAGING_API update_and_solve --staging $STAGING_PROJECT --force; then + ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s success + else + ./report-status.py -A $STAGING_API -p $STAGING_PROJECT -n packagelists -r standard -s failure + exit 1 + fi + + - Enable.images.repo: + resources: + - staging-bot + tasks: + - script: |- + osc -A $STAGING_API api -X POST "/source/$STAGING_PROJECT?cmd=remove_flag&repository=images&flag=build" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/gocd/pkglistgen.opensuse.gocd.yaml new/openSUSE-release-tools-20221025.1ef34941/gocd/pkglistgen.opensuse.gocd.yaml --- old/openSUSE-release-tools-20220929.aad22912/gocd/pkglistgen.opensuse.gocd.yaml 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/gocd/pkglistgen.opensuse.gocd.yaml 2022-10-25 14:31:16.000000000 +0200 @@ -145,7 +145,28 @@ tasks: - script: python3 ./skippkg-finder.py -A https://api.opensuse.org -o openSUSE:Leap:15.3:Update:Respin -t openSUSE:Leap:15.3:Update -s SUSE:SLE-15-SP3:Update - script: python3 ./pkglistgen.py -d -A https://api.opensuse.org update_and_solve -p openSUSE:Leap:15.3:Update:Respin -s target - + Pkglistgen.openSUSE_Leap_15.4_CR: + group: Leap + lock_behavior: unlockWhenFinished + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + timer: + spec: 0 40 * ? * * + only_on_changes: false + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - pkglistgen: + approval: + type: manual + jobs: + openSUSE_Leap_15.4_Images_target: + resources: + - repo-checker + tasks: + - script: python3 ./skippkg-finder.py -A https://api.opensuse.org -o openSUSE:Leap:15.4:Images -t openSUSE:Leap:15.4:Update -s SUSE:SLE-15-SP4:Update + - script: python3 ./pkglistgen.py -d -A https://api.opensuse.org update_and_solve -p openSUSE:Leap:15.4:Images -s target Update.Repos.Leap.openSUSE_Leap_15.5: group: Leap lock_behavior: unlockWhenFinished @@ -167,6 +188,27 @@ - repo-checker tasks: - script: python3 ./pkglistgen.py --apiurl https://api.opensuse.org handle_update_repos openSUSE:Leap:15.5 + Update.Repos.Leap.openSUSE_Leap_15.4_Images: + group: Leap + lock_behavior: unlockWhenFinished + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + timer: + spec: 0 0 0 */3 * ? + only_on_changes: false + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - Update: + approval: + type: manual + jobs: + openSUSE_Leap_15.4_Images: + resources: + - repo-checker + tasks: + - script: python3 ./pkglistgen.py --apiurl https://api.opensuse.org handle_update_repos openSUSE:Leap:15.4:Images Update.Repos.Leap.openSUSE_Leap_15.3_Update_Respin: group: Leap lock_behavior: unlockWhenFinished diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/gocd/pkglistgen.opensuse.gocd.yaml.erb new/openSUSE-release-tools-20221025.1ef34941/gocd/pkglistgen.opensuse.gocd.yaml.erb --- old/openSUSE-release-tools-20220929.aad22912/gocd/pkglistgen.opensuse.gocd.yaml.erb 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/gocd/pkglistgen.opensuse.gocd.yaml.erb 2022-10-25 14:31:16.000000000 +0200 @@ -119,8 +119,38 @@ - script: python3 ./skippkg-finder.py -A https://api.opensuse.org -o openSUSE:Leap:15.3:Update:Respin -t openSUSE:Leap:15.3:Update -s SUSE:SLE-15-SP3:Update - script: python3 ./pkglistgen.py -d -A https://api.opensuse.org update_and_solve -p <%= project[0] %><%= options %> <% end -%> - -<% %w(openSUSE:Leap:15.5 openSUSE:Leap:15.3:Update:Respin).each do |project| -%> + Pkglistgen.openSUSE_Leap_15.4_CR: + group: Leap + lock_behavior: unlockWhenFinished + environment_variables: + OSC_CONFIG: /home/go/config/oscrc-staging-bot + timer: + spec: 0 40 * ? * * + only_on_changes: false + materials: + git: + git: https://github.com/openSUSE/openSUSE-release-tools.git + stages: + - pkglistgen: + approval: + type: manual + jobs: +<% ['openSUSE:Leap:15.4:Images/target'].each do |project| + project=project.split('/') + name=project[0].gsub(':', '_') + if project.size > 1 + options=" -s #{project[1]}" + name = name + "_#{project[1]}" + end + -%> + <%= name %>: + resources: + - repo-checker + tasks: + - script: python3 ./skippkg-finder.py -A https://api.opensuse.org -o openSUSE:Leap:15.4:Images -t openSUSE:Leap:15.4:Update -s SUSE:SLE-15-SP4:Update + - script: python3 ./pkglistgen.py -d -A https://api.opensuse.org update_and_solve -p <%= project[0] %><%= options %> +<% end -%> +<% %w(openSUSE:Leap:15.5 openSUSE:Leap:15.4:Images openSUSE:Leap:15.3:Update:Respin).each do |project| -%> Update.Repos.Leap.<%= project.gsub(':', '_') %>: group: Leap lock_behavior: unlockWhenFinished diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/osclib/accept_command.py new/openSUSE-release-tools-20221025.1ef34941/osclib/accept_command.py --- old/openSUSE-release-tools-20220929.aad22912/osclib/accept_command.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/osclib/accept_command.py 2022-10-25 14:31:16.000000000 +0200 @@ -296,8 +296,6 @@ rebuild_result = self.api.check_pkgs(rebuild_result) result = set(rebuild_result) ^ set(fact_result) - print(sorted(result)) - for package in result: self.api.rebuild_pkg(package, self.api.project, arch, None) self.api.rebuild_pkg(package, self.api.crebuild, arch, None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/osclib/core.py new/openSUSE-release-tools-20221025.1ef34941/osclib/core.py --- old/openSUSE-release-tools-20220929.aad22912/osclib/core.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/osclib/core.py 2022-10-25 14:31:16.000000000 +0200 @@ -6,6 +6,7 @@ import logging from lxml import etree as ET from urllib.error import HTTPError +from typing import Optional from osc.core import create_submit_request from osc.core import get_binarylist @@ -228,7 +229,7 @@ @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') @@ -413,7 +414,7 @@ yield package -def attribute_value_load(apiurl, project, name, namespace='OSRT', package=None): +def attribute_value_load(apiurl: str, project: str, name: str, namespace='OSRT', package: Optional[str] = None): path = list(filter(None, ['source', project, package, '_attribute', namespace + ':' + name])) url = makeurl(apiurl, path) @@ -444,7 +445,14 @@ # Remember to create for both OBS and IBS as necessary. -def attribute_value_save(apiurl, project, name, value, namespace='OSRT', package=None): +def attribute_value_save( + apiurl: str, + project: str, + name: str, + value: str, + namespace='OSRT', + package: Optional[str] = None +): root = ET.Element('attributes') attribute = ET.SubElement(root, 'attribute') @@ -463,13 +471,13 @@ raise e -def attribute_value_delete(apiurl, project, name, namespace='OSRT', package=None): +def attribute_value_delete(apiurl: str, project: str, name: str, namespace='OSRT', package: Optional[str] = None): http_DELETE(makeurl( apiurl, list(filter(None, ['source', project, package, '_attribute', namespace + ':' + name])))) @memoize(session=True) -def repository_path_expand(apiurl, project, repo, visited_repos=None): +def repository_path_expand(apiurl: str, project: str, repo: str, visited_repos: Optional[set] = None): """Recursively list underlying projects.""" if visited_repos is None: visited_repos = set() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/osclib/pkglistgen_comments.py new/openSUSE-release-tools-20221025.1ef34941/osclib/pkglistgen_comments.py --- old/openSUSE-release-tools-20220929.aad22912/osclib/pkglistgen_comments.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/osclib/pkglistgen_comments.py 2022-10-25 14:31:16.000000000 +0200 @@ -1,27 +1,59 @@ import datetime -import textwrap -import re -import tempfile +import enum import logging import os +import re import sys +import tempfile +import textwrap +from typing import Dict, List, Optional + from lxml import etree as ET +from osc.core import Package, checkout_package, http_GET, makeurl from osclib.comments import CommentAPI -from osc.core import checkout_package, http_GET, makeurl -from osc.core import Package +from osclib.core import devel_project_get MARKER = 'PackageListDiff' -class PkglistComments(object): +class PkglistSectionCommend(enum.Enum): + ADD = "add" + REMOVE = "remove" + MOVE = "move" + + +class PkglistSection: + def __init__( + self, + command: PkglistSectionCommend, + pkgs: Optional[List[str]] = None, + to_module: Optional[List[str]] = None, + from_module: Optional[List[str]] = None + ): + self.command = command + if pkgs is None: + self.pkgs = [] + else: + self.pkgs = pkgs + if pkgs is None: + self.to_module = [] + else: + self.to_module = to_module + if pkgs is None: + self.from_module = [] + else: + self.from_module = from_module + + +class PkglistComments: """Handling staging comments of diffs""" - def __init__(self, apiurl): + def __init__(self, apiurl: str): self.apiurl = apiurl self.comment = CommentAPI(apiurl) - def read_summary_file(self, file): + def read_summary_file(self, file: str) -> Dict[str, List[str]]: ret = dict() with open(file, 'r') as f: for line in f: @@ -30,7 +62,7 @@ ret[pkg].append(group) return ret - def write_summary_file(self, file, content): + def write_summary_file(self, file: str, content: dict): output = [] for pkg in sorted(content): for group in sorted(content[pkg]): @@ -40,7 +72,7 @@ for line in sorted(output): f.write(line + '\n') - def calculcate_package_diff(self, old_file, new_file): + def calculcate_package_diff(self, old_file: str, new_file: str): old_file = self.read_summary_file(old_file) new_file = self.read_summary_file(new_file) @@ -102,7 +134,7 @@ return report.strip() - def handle_package_diff(self, project, old_file, new_file): + def handle_package_diff(self, project: str, old_file: str, new_file: str): comments = self.comment.get_comments(project_name=project) comment, _ = self.comment.comment_find(comments, MARKER) @@ -134,7 +166,7 @@ return 1 - def is_approved(self, comment, comments): + def is_approved(self, comment, comments: dict) -> Optional[str]: if not comment: return None @@ -145,19 +177,28 @@ return c['who'] return None - def parse_title(self, line): + def parse_title(self, line: str) -> Optional[PkglistSection]: m = re.match(r'\*\*Add to (.*)\*\*', line) if m: - return {'cmd': 'add', 'to': m.group(1).split(','), 'pkgs': []} + return PkglistSection(PkglistSectionCommend.ADD, pkgs=[], to_module=m.group(1).split(',')) m = re.match(r'\*\*Move from (.*) to (.*)\*\*', line) if m: - return {'cmd': 'move', 'from': m.group(1).split(','), 'to': m.group(2).split(','), 'pkgs': []} + return PkglistSection( + PkglistSectionCommend.MOVE, + pkgs=[], + from_module=m.group(1).split(','), + to_module=m.group(2).split(','), + ) m = re.match(r'\*\*Remove from (.*)\*\*', line) if m: - return {'cmd': 'remove', 'from': m.group(1).split(','), 'pkgs': []} + return PkglistSection( + PkglistSectionCommend.REMOVE, + pkgs=[], + from_module=m.group(1).split(','), + ) return None - def parse_sections(self, comment): + def parse_sections(self, comment: str) -> List[PkglistSection]: current_section = None sections = [] in_quote = False @@ -174,33 +215,33 @@ for pkg in line.split(','): pkg = pkg.strip() if pkg: - current_section['pkgs'].append(pkg) + current_section.pkgs.append(pkg) if current_section: sections.append(current_section) return sections - def apply_move(self, content, section): - for pkg in section['pkgs']: + def apply_move(self, content: Dict[str, List[str]], section: PkglistSection): + for pkg in section.pkgs: pkg_content = content[pkg] - for group in section['from']: + for group in section.from_module: try: pkg_content.remove(group) except ValueError: logging.error(f"Can't remove {pkg} from {group}, not there. Mismatch.") sys.exit(1) - for group in section['to']: + for group in section.to_module: pkg_content.append(group) content[pkg] = pkg_content - def apply_add(self, content, section): - for pkg in section['pkgs']: + def apply_add(self, content: Dict[str, List[str]], section: PkglistSection): + for pkg in section.pkgs: content.setdefault(pkg, []) - content[pkg] += section['to'] + content[pkg] += section.to_module - def apply_remove(self, content, section): - for pkg in section['pkgs']: + def apply_remove(self, content: Dict[str, List[str]], section: PkglistSection): + for pkg in section.pkgs: pkg_content = content[pkg] - for group in section['from']: + for group in section.from_module: try: pkg_content.remove(group) except ValueError: @@ -208,38 +249,38 @@ sys.exit(1) content[pkg] = pkg_content - def apply_commands(self, filename, sections): + def apply_commands(self, filename: str, sections: List[PkglistSection]): content = self.read_summary_file(filename) for section in sections: - if section['cmd'] == 'move': + if section.command == PkglistSectionCommend.MOVE: self.apply_move(content, section) - elif section['cmd'] == 'add': + elif section.command == PkglistSectionCommend.ADD: self.apply_add(content, section) - elif section['cmd'] == 'remove': + elif section.command == PkglistSectionCommend.REMOVE: self.apply_remove(content, section) self.write_summary_file(filename, content) - def format_pkgs(self, pkgs): + def format_pkgs(self, pkgs: List[str]): text = ', '.join(pkgs) return " " + "\n ".join(textwrap.wrap(text, width=68, break_long_words=False, break_on_hyphens=False)) + "\n\n" - def format_move(self, section): - gfrom = ','.join(section['from']) - gto = ','.join(section['to']) + def format_move(self, section: PkglistSection): + gfrom = ','.join(section.from_module) + gto = ','.join(section.to_module) text = f" * Move from {gfrom} to {gto}:\n" - return text + self.format_pkgs(section['pkgs']) + return text + self.format_pkgs(section.pkgs) - def format_add(self, section): - gto = ','.join(section['to']) + def format_add(self, section: PkglistSection): + gto = ','.join(section.to_module) text = f" * Add to {gto}:\n" - return text + self.format_pkgs(section['pkgs']) + return text + self.format_pkgs(section.pkgs) - def format_remove(self, section): - gfrom = ','.join(section['from']) + def format_remove(self, section: PkglistSection): + gfrom = ','.join(section.from_module) text = f" * Remove from {gfrom}:\n" - return text + self.format_pkgs(section['pkgs']) + return text + self.format_pkgs(section.pkgs) - def apply_changes(self, filename, sections, approver): + def apply_changes(self, filename: str, sections: List[PkglistSection], approver: str): text = "-------------------------------------------------------------------\n" now = datetime.datetime.utcnow() date = now.strftime("%a %b %d %H:%M:%S UTC %Y") @@ -249,11 +290,11 @@ email = root.find('email').text text += f"{date} - {realname} <{email}>\n\n- Approved changes to summary-staging.txt\n" for section in sections: - if section['cmd'] == 'move': + if section.command == PkglistSectionCommend.MOVE: text += self.format_move(section) - elif section['cmd'] == 'add': + elif section.command == PkglistSectionCommend.ADD: text += self.format_add(section) - elif section['cmd'] == 'remove': + elif section.command == PkglistSectionCommend.REMOVE: text += self.format_remove(section) with open(filename + '.new', 'w') as writer: writer.write(text) @@ -262,15 +303,18 @@ writer.write(line) os.rename(filename + '.new', filename) - def check_staging_accept(self, project, target): + def check_staging_accept(self, project: str, target: str): comments = self.comment.get_comments(project_name=project) comment, _ = self.comment.comment_find(comments, MARKER) approver = self.is_approved(comment, comments) 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/osclib/stagingapi.py new/openSUSE-release-tools-20221025.1ef34941/osclib/stagingapi.py --- old/openSUSE-release-tools-20220929.aad22912/osclib/stagingapi.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/osclib/stagingapi.py 2022-10-25 14:31:16.000000000 +0200 @@ -1,5 +1,6 @@ from io import StringIO from datetime import datetime +from typing import List import dateutil.parser import logging import textwrap @@ -52,7 +53,7 @@ Class containing various api calls to work with staging projects. """ - def __init__(self, apiurl, project): + def __init__(self, apiurl: str, project: str): """Initialize instance variables.""" self.apiurl = apiurl @@ -149,7 +150,7 @@ xpath = f'repository[@name="{repo_name}"]' return len(meta.xpath(xpath)) > 0 - def makeurl(self, paths, query=None): + def makeurl(self, paths: List[str], query=None) -> str: """ Wrapper around osc's makeurl passing our apiurl :return url made for l and query @@ -1307,8 +1308,16 @@ return pkglist - def check_pkgs(self, rebuild_list): - return list(set(rebuild_list) & set(self.list_packages(self.project))) + def check_pkgs(self, pkg_list): + """Filter the package list to those still existing in the project""" + project_packages = set(self.list_packages(self.project)) + ret = list() + for pkg in pkg_list: + # map multibuild flavors + source = pkg.split(':')[0] + if source in project_packages: + ret.append(pkg) + return ret def rebuild_pkg(self, package, prj, arch, code=None): query = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/pkglistgen/cli.py new/openSUSE-release-tools-20221025.1ef34941/pkglistgen/cli.py --- old/openSUSE-release-tools-20220929.aad22912/pkglistgen/cli.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/pkglistgen/cli.py 2022-10-25 14:31:16.000000000 +0200 @@ -86,7 +86,7 @@ if apiurl.find('opensuse.org') > 0: os.environ['OBS_NAME'] = 'build.opensuse.org' - def solve_project(project, scope): + def solve_project(project, scope: str): try: self.tool.reset() self.tool.dry_run = self.options.dry diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openSUSE-release-tools-20220929.aad22912/pkglistgen/tool.py new/openSUSE-release-tools-20221025.1ef34941/pkglistgen/tool.py --- old/openSUSE-release-tools-20220929.aad22912/pkglistgen/tool.py 2022-09-29 14:32:04.000000000 +0200 +++ new/openSUSE-release-tools-20221025.1ef34941/pkglistgen/tool.py 2022-10-25 14:31:16.000000000 +0200 @@ -8,6 +8,8 @@ import subprocess import yaml +from typing import Any, Mapping, Optional + from lxml import etree as ET from osc.core import checkout_package @@ -175,7 +177,7 @@ if package[0] not in g.solved_packages['*']: self.logger.error(f'Missing {package[0]} in {groupname} for {arch}') - def expand_repos(self, project, repo='standard'): + def expand_repos(self, project: str, repo='standard'): return repository_path_expand(self.apiurl, project, repo) def _check_supplements(self): @@ -506,7 +508,13 @@ print('%endif', file=output) output.flush() - def solve_project(self, ignore_unresolvable=False, ignore_recommended=False, locale=None, locales_from=None): + def solve_project( + self, + ignore_unresolvable=False, + ignore_recommended=False, + locale: Optional[str] = None, + locales_from: Optional[str] = None + ): self.load_all_groups() if not self.output: self.logger.error('OUTPUT not defined') @@ -601,9 +609,19 @@ new_lines.append(line.replace('<version></version>', product_version)) open(product_file, 'w').write(''.join(new_lines)) - def update_and_solve_target(self, api, target_project, target_config, main_repo, - project, scope, force, no_checkout, - only_release_packages, stop_after_solve): + def update_and_solve_target( + self, + api, + target_project: str, + target_config: Mapping[str, Any], + main_repo: str, + project: str, + scope: str, + force: bool, + no_checkout: bool, + only_release_packages: bool, + stop_after_solve: bool + ): self.all_architectures = target_config.get('pkglistgen-archs').split(' ') self.use_newest_version = str2bool(target_config.get('pkglistgen-use-newest-version', 'False')) self.repos = self.expand_repos(project, main_repo) @@ -682,11 +700,12 @@ self.load_all_groups() self.write_group_stubs() else: - summary = self.solve_project(ignore_unresolvable=str2bool(target_config.get('pkglistgen-ignore-unresolvable')), - ignore_recommended=str2bool( - target_config.get('pkglistgen-ignore-recommended')), - locale=target_config.get('pkglistgen-locale'), - locales_from=target_config.get('pkglistgen-locales-from')) + summary = self.solve_project( + ignore_unresolvable=str2bool(target_config.get('pkglistgen-ignore-unresolvable')), + ignore_recommended=str2bool(target_config.get('pkglistgen-ignore-recommended')), + locale=target_config.get('pkglistgen-locale'), + locales_from=target_config.get('pkglistgen-locales-from') + ) if stop_after_solve: return ++++++ openSUSE-release-tools.obsinfo ++++++ --- /var/tmp/diff_new_pack.yMcwFv/_old 2022-11-02 12:47:32.877691818 +0100 +++ /var/tmp/diff_new_pack.yMcwFv/_new 2022-11-02 12:47:32.885691858 +0100 @@ -1,5 +1,5 @@ name: openSUSE-release-tools -version: 20220929.aad22912 -mtime: 1664454724 -commit: aad2291289792ada630e14102b1e7ffe48f6ec67 +version: 20221025.1ef34941 +mtime: 1666701076 +commit: 1ef3494112b09f6c294bde5db13b1019ae3a6ad7