Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package osc for openSUSE:Factory checked in at 2023-10-19 22:50:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/osc (Old) and /work/SRC/openSUSE:Factory/.osc.new.1945 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "osc" Thu Oct 19 22:50:18 2023 rev:184 rq:1118971 version:1.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/osc/osc.changes 2023-10-17 20:24:23.894021535 +0200 +++ /work/SRC/openSUSE:Factory/.osc.new.1945/osc.changes 2023-10-19 22:52:35.629909895 +0200 @@ -1,0 +2,7 @@ +Thu Oct 19 13:04:55 UTC 2023 - Daniel Mach <[email protected]> + +- 1.4.3 + - Configuration: + - Allow undefined fields in Options and HostOptions + +------------------------------------------------------------------- Old: ---- osc-1.4.2.tar.gz New: ---- osc-1.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ osc.spec ++++++ --- /var/tmp/diff_new_pack.yCkmoI/_old 2023-10-19 22:52:36.201930642 +0200 +++ /var/tmp/diff_new_pack.yCkmoI/_new 2023-10-19 22:52:36.201930642 +0200 @@ -56,7 +56,7 @@ %endif Name: osc -Version: 1.4.2 +Version: 1.4.3 Release: 0 Summary: Command-line client for the Open Build Service License: GPL-2.0-or-later ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.yCkmoI/_old 2023-10-19 22:52:36.229931657 +0200 +++ /var/tmp/diff_new_pack.yCkmoI/_new 2023-10-19 22:52:36.229931657 +0200 @@ -1,5 +1,5 @@ pkgname=osc -pkgver=1.4.2 +pkgver=1.4.3 pkgrel=0 pkgdesc="Command-line client for the Open Build Service" arch=('x86_64') ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.yCkmoI/_old 2023-10-19 22:52:36.265932963 +0200 +++ /var/tmp/diff_new_pack.yCkmoI/_new 2023-10-19 22:52:36.269933108 +0200 @@ -1,4 +1,4 @@ -osc (1.4.2-0) unstable; urgency=low +osc (1.4.3-0) unstable; urgency=low * Placeholder ++++++ osc-1.4.2.tar.gz -> osc-1.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-1.4.2/NEWS new/osc-1.4.3/NEWS --- old/osc-1.4.2/NEWS 2023-10-16 13:54:06.000000000 +0200 +++ new/osc-1.4.3/NEWS 2023-10-19 15:02:47.000000000 +0200 @@ -1,3 +1,7 @@ +- 1.4.3 + - Configuration: + - Allow undefined fields in Options and HostOptions + - 1.4.2 - Command-line: - Change NoPBTextMeter to display no output at all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-1.4.2/osc/__init__.py new/osc-1.4.3/osc/__init__.py --- old/osc-1.4.2/osc/__init__.py 2023-10-16 13:54:06.000000000 +0200 +++ new/osc-1.4.3/osc/__init__.py 2023-10-19 15:02:47.000000000 +0200 @@ -13,7 +13,7 @@ from .util import git_version -__version__ = git_version.get_version('1.4.2') +__version__ = git_version.get_version('1.4.3') # vim: sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-1.4.2/osc/conf.py new/osc-1.4.3/osc/conf.py --- old/osc-1.4.2/osc/conf.py 2023-10-16 13:54:06.000000000 +0200 +++ new/osc-1.4.3/osc/conf.py 2023-10-19 15:02:47.000000000 +0200 @@ -124,6 +124,10 @@ class OscOptions(BaseModel): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.extra_fields = {} + # compat function with the config dict def _get_field_name(self, name): if name in self.__fields__: @@ -139,8 +143,10 @@ # compat function with the config dict def __getitem__(self, name): field_name = self._get_field_name(name) + if field_name is None: - field_name = name + return self.extra_fields[name] + try: return getattr(self, field_name) except AttributeError: @@ -149,8 +155,11 @@ # compat function with the config dict def __setitem__(self, name, value): field_name = self._get_field_name(name) + if field_name is None: - field_name = name + self.extra_fields[name] = value + return + setattr(self, field_name, value) # compat function with the config dict @@ -1836,6 +1845,17 @@ config = Options() config.conffile = conffile + # read 'debug' value before it gets properly stored into Options for early debug messages + if override_debug: + debug_str = str(override_debug) + elif "OSC_DEBUG" in os.environ: + debug_str = os.environ["OSC_DEBUG"] + elif "debug" in cp["general"]: + debug_str = cp["general"]["debug"] + else: + debug_str = "0" + debug = True if debug_str.strip().lower() in ("1", "yes", "true", "on") else False + # read host options first in order to populate apiurl aliases urls = [i for i in cp.sections() if i != "general"] for url in urls: @@ -1845,8 +1865,10 @@ raise oscerr.ConfigMissingCredentialsError(f"No user found in section {url}", conffile, url) host_options = HostOptions(apiurl=apiurl, username=username, _parent=config) + known_ini_keys = set() for name, field in host_options.__fields__.items(): ini_key = field.extra.get("ini_key", name) + known_ini_keys.add(ini_key) if name == "password": # we need to handle the password first because it may be stored in a keyring instead of a config file @@ -1862,6 +1884,15 @@ host_options.set_value_from_string(name, value) + for key, value in cp[url].items(): + if key.startswith("_"): + continue + if key in known_ini_keys: + continue + if debug: + print(f"DEBUG: Config option '[{url}]/{key}' doesn't map to any HostOptions field", file=sys.stderr) + host_options[key] = value + scheme = urlsplit(apiurl)[0] if scheme == "http" and not host_options.allow_http: msg = "The apiurl '{apiurl}' uses HTTP protocol without any encryption.\n" @@ -1872,8 +1903,10 @@ config.api_host_options[apiurl] = host_options # read the main options + known_ini_keys = set() for name, field in config.__fields__.items(): ini_key = field.extra.get("ini_key", name) + known_ini_keys.add(ini_key) env_key = f"OSC_{name.upper()}" # priority: env, overrides, config @@ -1900,6 +1933,15 @@ config.set_value_from_string(name, value) + for key, value in cp["general"].items(): + if key.startswith("_"): + continue + if key in known_ini_keys: + continue + if debug: + print(f"DEBUG: Config option '[general]/{key}' doesn't map to any Options field", file=sys.stderr) + config[key] = value + if overrides: unused_overrides_str = ", ".join((f"'{i}'" for i in overrides)) raise oscerr.ConfigError(f"Unknown config options: {unused_overrides_str}", "<command-line>") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-1.4.2/osc/util/git_version.py new/osc-1.4.3/osc/util/git_version.py --- old/osc-1.4.2/osc/util/git_version.py 2023-10-16 13:54:06.000000000 +0200 +++ new/osc-1.4.3/osc/util/git_version.py 2023-10-19 15:02:47.000000000 +0200 @@ -9,7 +9,7 @@ """ # the `version` variable contents get substituted during `git archive` # it requires adding this to .gitattributes: <path to this file> export-subst - version = "1.4.2" + version = "1.4.3" if version.startswith(("$", "%")): # "$": version hasn't been substituted during `git archive` # "%": "Format:" and "$" characters get removed from the version string (a GitHub bug?) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-1.4.2/tests/test_conf.py new/osc-1.4.3/tests/test_conf.py --- old/osc-1.4.2/tests/test_conf.py 2023-10-16 13:54:06.000000000 +0200 +++ new/osc-1.4.3/tests/test_conf.py 2023-10-19 15:02:47.000000000 +0200 @@ -78,6 +78,7 @@ show_download_progress = 0 vc-cmd = /usr/lib/build/vc status_mtime_heuristic = 0 +plugin-option = plugin-general-option [https://api.opensuse.org] credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager @@ -97,6 +98,7 @@ downloadurl = http://example.com/ sshkey = ~/.ssh/id_rsa.pub disable_hdrmd5_check = 0 +plugin-option = plugin-host-option """ @@ -401,6 +403,22 @@ host_options = self.config["api_host_options"][self.config["apiurl"]] self.assertEqual(host_options["disable_hdrmd5_check"], False) + def test_extra_fields(self): + self.assertEqual(self.config["plugin-option"], "plugin-general-option") + self.assertEqual(self.config.extra_fields, {"plugin-option": "plugin-general-option"}) + + self.config["new-option"] = "value" + self.assertEqual(self.config["new-option"], "value") + self.assertEqual(self.config.extra_fields, {"plugin-option": "plugin-general-option", "new-option": "value"}) + + host_options = self.config["api_host_options"][self.config["apiurl"]] + self.assertEqual(host_options["plugin-option"], "plugin-host-option") + self.assertEqual(host_options.extra_fields, {"plugin-option": "plugin-host-option"}) + + host_options["new-option"] = "value" + self.assertEqual(host_options["new-option"], "value") + self.assertEqual(host_options.extra_fields, {"plugin-option": "plugin-host-option", "new-option": "value"}) + class TestFromParent(unittest.TestCase): def setUp(self): ++++++ osc.dsc ++++++ --- /var/tmp/diff_new_pack.yCkmoI/_old 2023-10-19 22:52:36.649946891 +0200 +++ /var/tmp/diff_new_pack.yCkmoI/_new 2023-10-19 22:52:36.653947035 +0200 @@ -1,6 +1,6 @@ Format: 1.0 Source: osc -Version: 1.4.2-0 +Version: 1.4.3-0 Binary: osc Maintainer: Adrian Schroeter <[email protected]> Architecture: any
