From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/
Date: Thu, 22 Mar 2012 18:10:33 +0000 (UTC) [thread overview]
Message-ID: <1332439802.3a5f7f4993134022c094cb9247f9486061732b99.zmedico@gentoo> (raw)
commit: 3a5f7f4993134022c094cb9247f9486061732b99
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 22 17:15:10 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 22 18:10:02 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3a5f7f49
emerge --changelog: fix split ChangeLog bugs
This should fix possible missing content when displaying split
ChangeLogs (bug #389611), and also normalizes blank lines.
---
pym/_emerge/resolver/output.py | 10 ++----
pym/_emerge/resolver/output_helpers.py | 55 +++++++++++++++++++++++++-------
2 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index bec6619..a97658a 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -16,7 +16,7 @@ from portage.dbapi.dep_expand import dep_expand
from portage.dep import cpvequal, _repo_separator
from portage.exception import InvalidDependString, SignatureException
from portage.package.ebuild._spawn_nofetch import spawn_nofetch
-from portage.output import ( blue, bold, colorize, create_color_func,
+from portage.output import ( blue, colorize, create_color_func,
darkblue, darkgreen, green, nc_len, red, teal, turquoise, yellow )
bad = create_color_func("BAD")
from portage.util import writemsg_stdout
@@ -598,13 +598,9 @@ class Display(object):
def print_changelog(self):
"""Prints the changelog text to std_out
"""
- if not self.changelogs:
- return
- writemsg_stdout('\n', noiselevel=-1)
- for revision, text in self.changelogs:
- writemsg_stdout(bold('*'+revision) + '\n' + text,
+ for chunk in self.changelogs:
+ writemsg_stdout(chunk,
noiselevel=-1)
- return
def get_display_list(self, mylist):
diff --git a/pym/_emerge/resolver/output_helpers.py b/pym/_emerge/resolver/output_helpers.py
index cda0b08..ae84158 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -14,8 +14,8 @@ import sys
from portage import os
from portage import _encodings, _unicode_encode
from portage._sets.base import InternalPackageSet
-from portage.output import blue, colorize, create_color_func, green, red, \
- teal, yellow
+from portage.output import (blue, bold, colorize, create_color_func,
+ green, red, teal, yellow)
bad = create_color_func("BAD")
from portage.util import shlex_split, writemsg
from portage.versions import catpkgsplit
@@ -539,26 +539,57 @@ def _calc_changelog(ebuildpath,current,next):
divisions = divisions[i:]
break
- return divisions
+ output = []
+ prev_blank = False
+ prev_rev = False
+ for rev, lines in divisions:
+ if rev is not None:
+ if not (prev_blank or prev_rev):
+ output.append("\n")
+ output.append(bold('*' + rev) + '\n')
+ prev_rev = True
+ prev_blank = False
+ if lines:
+ prev_rev = False
+ if not prev_blank:
+ output.append("\n")
+ for l in lines:
+ output.append(l + "\n")
+ output.append("\n")
+ prev_blank = True
+ return output
+
+def _strip_header_comments(lines):
+ # strip leading and trailing blank or header/comment lines
+ i = 0
+ while i < len(lines) and (not lines[i] or lines[i][:1] == "#"):
+ i += 1
+ if i:
+ lines = lines[i:]
+ while lines and (not lines[-1] or lines[-1][:1] == "#"):
+ lines.pop()
+ return lines
def _find_changelog_tags(changelog):
divs = []
+ if not changelog:
+ return divs
release = None
- while 1:
- match = re.search(r'^\*\ ?([-a-zA-Z0-9_.+]*)(?:\ .*)?\n',changelog,re.M)
- if match is None:
- if release is not None:
- divs.append((release,changelog))
- return divs
- if release is not None:
- divs.append((release,changelog[:match.start()]))
- changelog = changelog[match.end():]
+ release_end = 0
+ for match in re.finditer(r'^\*\ ?([-a-zA-Z0-9_.+]*)(?:\ .*)?$',
+ changelog, re.M):
+ divs.append((release, _strip_header_comments(
+ changelog[release_end:match.start()].splitlines())))
+ release_end = match.end()
release = match.group(1)
if release.endswith('.ebuild'):
release = release[:-7]
if release.endswith('-r0'):
release = release[:-3]
+ divs.append((release,
+ _strip_header_comments(changelog[release_end:].splitlines())))
+ return divs
class PkgInfo(object):
"""Simple class to hold instance attributes for current
next reply other threads:[~2012-03-22 18:11 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 18:10 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-04 0:30 [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/ Zac Medico
2016-12-19 5:15 Zac Medico
2016-05-27 8:33 Alexander Berntsen
2015-08-03 18:36 Zac Medico
2015-07-29 18:44 Zac Medico
2014-12-13 14:51 Arfrever Frehtes Taifersar Arahesis
2014-08-23 7:21 Zac Medico
2014-02-23 21:38 Sebastian Luther
2014-02-05 19:42 Sebastian Luther
2014-02-05 19:42 Sebastian Luther
2013-03-20 20:32 Zac Medico
2013-03-20 19:23 Zac Medico
2013-03-18 21:28 Zac Medico
2013-03-18 21:12 Zac Medico
2013-03-18 20:58 Zac Medico
2013-02-28 0:25 Zac Medico
2013-02-28 0:12 Zac Medico
2013-02-27 23:39 Zac Medico
2013-01-24 1:18 Zac Medico
2012-10-15 17:17 Arfrever Frehtes Taifersar Arahesis
2012-10-15 4:06 Arfrever Frehtes Taifersar Arahesis
2012-10-14 20:02 Arfrever Frehtes Taifersar Arahesis
2012-10-14 19:54 Arfrever Frehtes Taifersar Arahesis
2012-10-14 2:53 Zac Medico
2012-10-14 2:44 Zac Medico
2012-09-25 2:00 Zac Medico
2012-09-24 3:12 Zac Medico
2012-09-14 2:08 Zac Medico
2012-09-14 1:04 Zac Medico
2012-06-27 21:56 Zac Medico
2012-06-23 6:00 Zac Medico
2012-06-21 4:43 Zac Medico
2012-06-20 21:24 Zac Medico
2012-04-05 19:37 Zac Medico
2012-03-22 19:00 Zac Medico
2012-03-22 17:38 Zac Medico
2012-03-22 17:15 Zac Medico
2012-03-13 17:22 Zac Medico
2012-01-28 2:23 Arfrever Frehtes Taifersar Arahesis
2012-01-28 1:51 Arfrever Frehtes Taifersar Arahesis
2012-01-23 17:13 Arfrever Frehtes Taifersar Arahesis
2012-01-22 3:57 Arfrever Frehtes Taifersar Arahesis
2012-01-22 3:47 Arfrever Frehtes Taifersar Arahesis
2011-11-18 5:58 Zac Medico
2011-11-18 1:43 Zac Medico
2011-11-07 18:34 Zac Medico
2011-11-07 7:37 Zac Medico
2011-10-19 21:32 Zac Medico
2011-10-19 21:25 Zac Medico
2011-10-02 20:11 Zac Medico
2011-09-17 17:51 Zac Medico
2011-07-27 10:34 Zac Medico
2011-07-10 13:35 Zac Medico
2011-07-10 12:23 Zac Medico
2011-07-10 10:41 Zac Medico
2011-07-10 1:58 Zac Medico
2011-07-10 1:31 Zac Medico
2011-07-09 22:24 Zac Medico
2011-06-21 8:15 Zac Medico
2011-06-11 1:31 Zac Medico
2011-03-15 22:59 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332439802.3a5f7f4993134022c094cb9247f9486061732b99.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox