Hello community, here is the log from the commit of package b4 for openSUSE:Factory checked in at 2020-06-16 13:45:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/b4 (Old) and /work/SRC/openSUSE:Factory/.b4.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "b4" Tue Jun 16 13:45:44 2020 rev:3 rq:814833 version:0.5.0+git20200612.g5c4ec14b Changes: -------- --- /work/SRC/openSUSE:Factory/b4/b4.changes 2020-06-15 20:32:59.970903089 +0200 +++ /work/SRC/openSUSE:Factory/.b4.new.3606/b4.changes 2020-06-16 13:46:26.486136519 +0200 @@ -1,0 +2,12 @@ +Tue Jun 16 06:23:16 UTC 2020 - jsl...@suse.com + +- Update to version 0.5.0+git20200612.g5c4ec14b: + * Fix crash with unbalanced [] in subject + * Fix regression with oddball charsets + * Fix mbox naming inconsistencies + * Output less confusing trailer mismatch messages + * Fix bug with threading when cover ref is missing + * Fix body part parsing when '---' is not used + * Use proper charset when reading back mailinfo + +------------------------------------------------------------------- Old: ---- b4-0.5.0+git20200528.g204416b80fbb.tar.xz New: ---- b4-0.5.0+git20200612.g5c4ec14b.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ b4.spec ++++++ --- /var/tmp/diff_new_pack.tC0tmC/_old 2020-06-16 13:46:27.454144304 +0200 +++ /var/tmp/diff_new_pack.tC0tmC/_new 2020-06-16 13:46:27.458144336 +0200 @@ -17,9 +17,9 @@ %define skip_python2 1 -%define version_unconverted 0.5.0+git20200528.g204416b80fbb +%define version_unconverted 0.5.0+git20200612.g5c4ec14b Name: b4 -Version: 0.5.0+git20200528.g204416b80fbb +Version: 0.5.0+git20200612.g5c4ec14b Release: 0 Summary: Helper scripts for kernel.org patches License: GPL-2.0-or-later @@ -41,6 +41,9 @@ %prep %autosetup -p1 +# ditch shebang from .py files, they are non-executables anyway +sed -i.old '1{/#!.*/d}' b4/*.py + %build %python_build ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.tC0tmC/_old 2020-06-16 13:46:27.514144786 +0200 +++ /var/tmp/diff_new_pack.tC0tmC/_new 2020-06-16 13:46:27.514144786 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://git.kernel.org/pub/scm/utils/b4/b4.git</param> - <param name="changesrevision">204416b80fbb5853d87e6a7cfbf35a0a719c4516</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">5c4ec14b2c003031885d44a6249c0c58099672fc</param></service></servicedata> \ No newline at end of file ++++++ b4-0.5.0+git20200528.g204416b80fbb.tar.xz -> b4-0.5.0+git20200612.g5c4ec14b.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/b4-0.5.0+git20200528.g204416b80fbb/b4/__init__.py new/b4-0.5.0+git20200612.g5c4ec14b/b4/__init__.py --- old/b4-0.5.0+git20200528.g204416b80fbb/b4/__init__.py 2020-05-28 18:12:16.000000000 +0200 +++ new/b4-0.5.0+git20200612.g5c4ec14b/b4/__init__.py 2020-06-12 16:44:42.000000000 +0200 @@ -284,7 +284,7 @@ trailers, mismatches = fmsg.get_trailers(sloppy=sloppytrailers) for tname, tvalue in mismatches: - lser.trailer_mismatches.add((tvalue, fmsg.fromname, fmsg.fromemail)) + lser.trailer_mismatches.add((tname, tvalue, fmsg.fromname, fmsg.fromemail)) lvl = 1 while True: logger.debug('%sParent: %s', ' ' * lvl, pmsg.full_subject) @@ -775,6 +775,7 @@ # Body and body-based info self.body = None + self.charset = 'utf-8' self.has_diff = False self.has_diffstat = False self.trailers = set() @@ -830,6 +831,7 @@ mcharset = self.msg.get_content_charset() if not mcharset: mcharset = 'utf-8' + self.charset = mcharset for part in msg.walk(): cte = part.get_content_type() @@ -843,11 +845,13 @@ pcharset = mcharset try: payload = payload.decode(pcharset, errors='replace') + self.charset = pcharset except LookupError: # what kind of encoding is that? # Whatever, we'll use utf-8 and hope for the best payload = payload.decode('utf-8', errors='replace') part.set_param('charset', 'utf-8') + self.charset = 'utf-8' if self.body is None: self.body = payload continue @@ -878,7 +882,7 @@ # Do we have something that looks like a person-trailer? matches = re.findall(r'^\s*([\w-]+):[ \t]+(.*<\S+>)\s*$', self.body, re.MULTILINE) # These are commonly part of patch/commit metadata - badtrailers = ('from', 'author') + badtrailers = ('from', 'author', 'cc') if matches: for tname, tvalue in matches: if tname.lower() not in badtrailers: @@ -1131,6 +1135,7 @@ def load_hashes(self): if self.attestation is not None: return + logger.debug('Calculating hashes for: %s', self.full_subject) msg_out = mkstemp() patch_out = mkstemp() cmdargs = ['mailinfo', '--encoding=UTF-8', msg_out[1], patch_out[1]] @@ -1157,8 +1162,8 @@ os.unlink(msg_out[1]) p = None - with open(patch_out[1], 'r') as pfh: - patch = pfh.read() + with open(patch_out[1], 'rb') as pfh: + patch = pfh.read().decode(self.charset, errors='replace') if len(patch.strip()): diff = LoreMessage.get_clean_diff(patch) phasher = hashlib.sha256() @@ -1195,6 +1200,11 @@ parts = body.split('\n---\n', 1) if len(parts) == 2: basement = parts[1].rstrip('\n') + elif body.find('\ndiff ') >= 0: + parts = body.split('\ndiff ', 1) + if len(parts) == 2: + parts[1] = 'diff ' + parts[1] + basement = parts[1].rstrip('\n') mbody = parts[0].strip('\n') @@ -1372,6 +1382,8 @@ # Find all [foo] in the title while subject.find('[') == 0: matches = re.search(r'^\[([^\]]*)\]', subject) + if not matches: + break for chunk in matches.groups()[0].split(): # Remove any trailing commas or semicolons chunk = chunk.strip(',;') @@ -1919,8 +1931,12 @@ logger.debug('Looking at: %s', c_msgid) refs = set() - for ref in msg.get('References', msg.get('In-Reply-To', '')).split(): - ref = ref.strip().strip('<>') + msgrefs = list() + if msg.get('In-Reply-To', None): + msgrefs += email.utils.getaddresses([str(x) for x in msg.get_all('in-reply-to', [])]) + if msg.get('References', None): + msgrefs += email.utils.getaddresses([str(x) for x in msg.get_all('references', [])]) + for ref in set([x[1] for x in msgrefs]): if ref in got or ref in want: want.add(c_msgid) elif len(ref): @@ -1941,6 +1957,11 @@ # Add all these to want want.update(maybe[c_msgid]) maybe.pop(c_msgid) + # Add all maybes that have the same ref into want + for ref in refs: + if ref in maybe: + want.update(maybe[ref]) + maybe.pop(ref) # Remove any entries not in "seen" (missing messages) for c_msgid in set(want): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/b4-0.5.0+git20200528.g204416b80fbb/b4/mbox.py new/b4-0.5.0+git20200612.g5c4ec14b/b4/mbox.py --- old/b4-0.5.0+git20200528.g204416b80fbb/b4/mbox.py 2020-05-28 18:12:16.000000000 +0200 +++ new/b4-0.5.0+git20200612.g5c4ec14b/b4/mbox.py 2020-06-12 16:44:42.000000000 +0200 @@ -127,9 +127,9 @@ if len(lser.trailer_mismatches): logger.critical('---') logger.critical('NOTE: some trailers ignored due to from/email mismatches:') - for tvalue, fname, femail in lser.trailer_mismatches: - logger.critical(' ! Trailer: %s', tvalue) - logger.critical(' From: %s <%s>', fname, femail) + for tname, tvalue, fname, femail in lser.trailer_mismatches: + logger.critical(' ! Trailer: %s: %s', tname, tvalue) + logger.critical(' Msg From: %s <%s>', fname, femail) logger.critical('NOTE: Rerun with -S to apply them anyway') topdir = None @@ -472,26 +472,14 @@ # Force nocache mode cmdargs.nocache = True + savefile = mkstemp('b4-mbox')[1] + if not cmdargs.localmbox: msgid = b4.get_msgid(cmdargs) - wantname = cmdargs.wantname - outdir = cmdargs.outdir - if outdir == '-': - savefile = mkstemp('b4-mbox')[1] - elif wantname: - savefile = os.path.join(outdir, wantname) - else: - # Save it into msgid.mbox - savefile = '%s.t.mbx' % msgid - savefile = os.path.join(outdir, savefile) - mboxfile = b4.get_pi_thread_by_msgid(msgid, savefile, useproject=cmdargs.useproject, nocache=cmdargs.nocache) - if mboxfile is None: + threadmbox = b4.get_pi_thread_by_msgid(msgid, savefile, useproject=cmdargs.useproject, nocache=cmdargs.nocache) + if threadmbox is None: return - - # Move it into -thread - threadmbox = '%s-thread' % mboxfile - os.rename(mboxfile, threadmbox) else: if os.path.exists(cmdargs.localmbox): threadmbox = cmdargs.localmbox @@ -508,7 +496,6 @@ os.unlink(threadmbox) else: mbx = mailbox.mbox(threadmbox) - logger.critical('Saved %s', threadmbox) logger.critical('%s messages in the thread', len(mbx)) mbx.close() if cmdargs.outdir == '-': @@ -516,3 +503,14 @@ with open(threadmbox, 'r') as fh: shutil.copyfileobj(fh, sys.stdout) os.unlink(threadmbox) + return + + if cmdargs.wantname: + savefile = os.path.join(cmdargs.outdir, cmdargs.wantname) + else: + savefile = os.path.join(cmdargs.outdir, '%s.mbx' % msgid) + + shutil.copy(threadmbox, savefile) + logger.info('Saved %s', savefile) + if not cmdargs.localmbox: + os.unlink(threadmbox)