Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package b4 for openSUSE:Factory checked in at 2023-01-02 15:02:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/b4 (Old) and /work/SRC/openSUSE:Factory/.b4.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "b4" Mon Jan 2 15:02:30 2023 rev:29 rq:1046132 version:0.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/b4/b4.changes 2022-12-20 20:21:33.350229681 +0100 +++ /work/SRC/openSUSE:Factory/.b4.new.1563/b4.changes 2023-01-02 15:02:35.929496096 +0100 @@ -1,0 +2,8 @@ +Mon Jan 2 10:12:19 UTC 2023 - Dirk Müller <[email protected]> + +- update to 0.11.1: + * ez: use default web endpoint when in the kernel repo + * ez: give better error message when patatt signing fails + * ez: don't crash when there's no [sendemail] section + +------------------------------------------------------------------- Old: ---- b4-0.11.0.tar.gz New: ---- b4-0.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ b4.spec ++++++ --- /var/tmp/diff_new_pack.wsmABR/_old 2023-01-02 15:02:36.305498210 +0100 +++ /var/tmp/diff_new_pack.wsmABR/_new 2023-01-02 15:02:36.309498233 +0100 @@ -1,7 +1,7 @@ # # spec file for package b4 # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: b4 -Version: 0.11.0 +Version: 0.11.1 Release: 0 Summary: Helper scripts for kernel.org patches License: GPL-2.0-or-later ++++++ b4-0.11.0.tar.gz -> b4-0.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/b4-0.11.0/b4/__init__.py new/b4-0.11.1/b4/__init__.py --- old/b4-0.11.0/b4/__init__.py 2022-12-19 22:04:51.000000000 +0100 +++ new/b4-0.11.1/b4/__init__.py 2022-12-21 15:38:47.000000000 +0100 @@ -53,7 +53,7 @@ # global setting allowing us to turn off networking can_network = True -__VERSION__ = '0.11.0' +__VERSION__ = '0.11.1' PW_REST_API_VERSION = '1.2' @@ -3046,11 +3046,11 @@ # Use this identity to override what we got from the default one sconfig = get_config_from_git(rf'sendemail\.{identity}\..*', defaults=_basecfg) sectname = f'sendemail.{identity}' + if not len(sconfig): + raise smtplib.SMTPException('Unable to find %s settings in any applicable git config' % sectname) else: sconfig = _basecfg sectname = 'sendemail' - if not len(sconfig): - raise smtplib.SMTPException('Unable to find %s settings in any applicable git config' % sectname) logger.debug('Using values from %s', sectname) SENDEMAIL_CONFIG = sconfig @@ -3207,11 +3207,12 @@ fromaddr: Optional[str], destaddrs: Optional[Union[set, list]] = None, patatt_sign: bool = False, dryrun: bool = False, maxheaderlen: Optional[int] = None, output_dir: Optional[str] = None, - use_web_endpoint: bool = False, reflect: bool = False) -> Optional[int]: + web_endpoint: Optional[str] = None, reflect: bool = False) -> Optional[int]: tosend = list() if output_dir is not None: dryrun = True + for msg in msgs: if not msg.get('X-Mailer'): msg.add_header('X-Mailer', f'b4 {__VERSION__}') @@ -3235,7 +3236,7 @@ else: # Use SMTP policy if we're actually going to send things out msg = sevenbitify_headers(msg) - if dryrun or use_web_endpoint: + if dryrun or web_endpoint: # Use SMTP policy, but no CRLF policy = email.policy.SMTP.clone(linesep='\n') else: @@ -3247,7 +3248,15 @@ if patatt_sign: import patatt # patatt.logger = logger - bdata = patatt.rfc2822_sign(bdata) + try: + bdata = patatt.rfc2822_sign(bdata) + except patatt.NoKeyError as ex: + logger.critical('CRITICAL: Error signing: no key configured') + logger.critical(' Run "patatt genkey" or configure "user.signingKey" to use PGP') + logger.critical(' As a last resort, rerun with --no-sign') + raise RuntimeError(str(ex)) + except patatt.SigningError as ex: + raise RuntimeError('Failure trying to patatt-sign: %s' % str(ex)) if dryrun: if output_dir: filen = '%s.eml' % ls.get_slug(sep='-') @@ -3273,24 +3282,19 @@ return 0 logger.info('---') - # Do we have an endpoint defined? - config = get_main_config() - endpoint = config.get('send-endpoint-web', '') - if not re.search(r'^https?://', endpoint): - endpoint = None - if use_web_endpoint and endpoint: + if web_endpoint: if reflect: - logger.info('Reflecting via web endpoint %s', endpoint) + logger.info('Reflecting via web endpoint %s', web_endpoint) wpaction = 'reflect' else: - logger.info('Sending via web endpoint %s', endpoint) + logger.info('Sending via web endpoint %s', web_endpoint) wpaction = 'receive' req = { 'action': wpaction, 'messages': [x[1].decode() for x in tosend], } ses = get_requests_session() - res = ses.post(endpoint, json=req) + res = ses.post(web_endpoint, json=req) try: rdata = res.json() if rdata.get('result') == 'success': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/b4-0.11.0/b4/ez.py new/b4-0.11.1/b4/ez.py --- old/b4-0.11.0/b4/ez.py 2022-12-19 22:04:51.000000000 +0100 +++ new/b4-0.11.1/b4/ez.py 2022-12-21 15:38:47.000000000 +0100 @@ -47,6 +47,8 @@ # Make this configurable? SENT_TAG_PREFIX = 'sent/' +DEFAULT_ENDPOINT = 'https://lkml.kernel.org/_b4_submit' + DEFAULT_COVER_TEMPLATE = """ ${cover} @@ -79,7 +81,13 @@ endpoint = None if not endpoint: - raise RuntimeError('Web submission endpoint (b4.send-endpoint-web) is not defined, or is not a web URL.') + # Use the default endpoint if we are in the kernel repo + topdir = b4.git_get_toplevel() + if os.path.exists(os.path.join(topdir, 'Kconfig')): + logger.debug('No sendemail configs found, will use the default web endpoint') + endpoint = DEFAULT_ENDPOINT + else: + raise RuntimeError('Web submission endpoint (b4.send-endpoint-web) is not defined, or is not a web URL.') usercfg = b4.get_user_config() myemail = usercfg.get('email') @@ -1372,9 +1380,16 @@ logger.info('Will write out messages into %s', cmdargs.output_dir) pathlib.Path(cmdargs.output_dir).mkdir(parents=True, exist_ok=True) + sconfig = b4.get_sendemail_config() endpoint = config.get('send-endpoint-web', '') if not re.search(r'^https?://', endpoint): endpoint = None + if not endpoint and not sconfig.get('smtpserver'): + # Use the default endpoint if we are in the kernel repo + topdir = b4.git_get_toplevel() + if os.path.exists(os.path.join(topdir, 'Kconfig')): + logger.debug('No sendemail configs found, will use the default web endpoint') + endpoint = DEFAULT_ENDPOINT # Give the user the last opportunity to bail out if not cmdargs.dryrun: @@ -1405,7 +1420,6 @@ logger.info(' - send the above messages to actual recipients') logger.info(' - via web endpoint: %s', endpoint) else: - sconfig = b4.get_sendemail_config() if sconfig.get('from'): fromaddr = sconfig.get('from') if cmdargs.reflect: @@ -1486,13 +1500,17 @@ if endpoint: # Web endpoint always requires signing if not sign: - logger.critical('CRITICAL: Web endpoint is defined for sending, but signing is turned off') + logger.critical('CRITICAL: Web endpoint will be used for sending, but signing is turned off') logger.critical(' Please re-enable signing or use SMTP') sys.exit(1) - sent = b4.send_mail(None, send_msgs, fromaddr=None, patatt_sign=True, - dryrun=cmdargs.dryrun, output_dir=cmdargs.output_dir, use_web_endpoint=True, - reflect=cmdargs.reflect) + try: + sent = b4.send_mail(None, send_msgs, fromaddr=None, patatt_sign=True, + dryrun=cmdargs.dryrun, output_dir=cmdargs.output_dir, web_endpoint=endpoint, + reflect=cmdargs.reflect) + except RuntimeError as ex: + logger.critical('CRITICAL: %s', ex) + sys.exit(1) else: try: smtp, fromaddr = b4.get_smtp(dryrun=cmdargs.dryrun) @@ -1501,9 +1519,13 @@ logger.critical(ex) sys.exit(1) - sent = b4.send_mail(smtp, send_msgs, fromaddr=fromaddr, patatt_sign=sign, - dryrun=cmdargs.dryrun, output_dir=cmdargs.output_dir, use_web_endpoint=False, - reflect=cmdargs.reflect) + try: + sent = b4.send_mail(smtp, send_msgs, fromaddr=fromaddr, patatt_sign=sign, + dryrun=cmdargs.dryrun, output_dir=cmdargs.output_dir, + reflect=cmdargs.reflect) + except RuntimeError as ex: + logger.critical('CRITICAL: %s', ex) + sys.exit(1) logger.info('---') if cmdargs.dryrun: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/b4-0.11.0/b4/ty.py new/b4-0.11.1/b4/ty.py --- old/b4-0.11.0/b4/ty.py 2022-12-19 22:04:51.000000000 +0100 +++ new/b4-0.11.1/b4/ty.py 2022-12-21 15:38:47.000000000 +0100 @@ -431,8 +431,7 @@ if not fromaddr: fromaddr = jsondata['myemail'] logger.info(' Sending: %s', b4.LoreMessage.clean_header(msg.get('subject'))) - # We never want to use the web endpoint for this (it's only for submitting patches) - b4.send_mail(smtp, [msg], fromaddr, dryrun=cmdargs.dryrun, use_web_endpoint=False) + b4.send_mail(smtp, [msg], fromaddr, dryrun=cmdargs.dryrun) else: slug_from = re.sub(r'\W', '_', jsondata['fromemail']) slug_subj = re.sub(r'\W', '_', jsondata['subject']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/b4-0.11.0/misc/send-receive.py new/b4-0.11.1/misc/send-receive.py --- old/b4-0.11.0/misc/send-receive.py 2022-12-19 22:04:51.000000000 +0100 +++ new/b4-0.11.1/misc/send-receive.py 2022-12-21 15:38:47.000000000 +0100 @@ -324,7 +324,7 @@ try: identity, selector, auth_id = self.validate_message(conn, t_auth, bdata) except patatt.NoKeyError as ex: # noqa - self.send_error(resp, message='No matching record found, maybe you need to auth-verify first?') + self.send_error(resp, message='No matching key, please complete web auth first.') return except Exception as ex: self.send_error(resp, message='Signature validation failed: %s' % ex)
