aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2008-03-03 21:11:21 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2008-03-03 21:11:21 +0000
commit74df7c8e80bac7b44f148fbd702e523982698fdf (patch)
treea8b50d0c8416a08d736801e6ddfe992e89e1f710
parent977db706098e5fc8c9a89004c49af802e58d0d13 (diff)
downloadmgarepo-74df7c8e80bac7b44f148fbd702e523982698fdf.tar
mgarepo-74df7c8e80bac7b44f148fbd702e523982698fdf.tar.gz
mgarepo-74df7c8e80bac7b44f148fbd702e523982698fdf.tar.bz2
mgarepo-74df7c8e80bac7b44f148fbd702e523982698fdf.tar.xz
mgarepo-74df7c8e80bac7b44f148fbd702e523982698fdf.zip
Ensure sorted changelog entries will have correct spacing
Strip the spare changelog entries newlines in order to add again later and ensure that we will have the same spacing between all sorted changelog entries.
-rw-r--r--RepSys/log.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/RepSys/log.py b/RepSys/log.py
index 217a996..2eadbe2 100644
--- a/RepSys/log.py
+++ b/RepSys/log.py
@@ -469,10 +469,18 @@ def svn2rpm(pkgdirurl, rev=None, size=None, submit=False,
def _split_changelog(stream):
current = None
count = 0
+ def finish(entry):
+ lines = entry[2]
+ # strip newlines at the end
+ for i in xrange(len(lines)-1, -1, -1):
+ if lines[i] != "\n":
+ break
+ del lines[i]
+ return entry
for line in stream:
if line.startswith("*"):
if current:
- yield current
+ yield finish(current)
fields = line.split()
rawdate = " ".join(fields[:5])
try:
@@ -490,13 +498,14 @@ def _split_changelog(stream):
else:
pass # not good, but ignore
if current:
- yield current
+ yield finish(current)
def sort_changelog(stream):
entries = _split_changelog(stream)
log = StringIO()
for time, count, elines in sorted(entries, reverse=True):
log.writelines(elines)
+ log.write("\n")
return log
def split_spec_changelog(stream):