Bug#1031327: gbp-rpm-ch: Wrong changelog header format (missing dash before version)

2023-02-24 Thread Guido Günther
control: -1 tags +pending

Hi Samuel,
On Tue, Feb 21, 2023 at 08:33:34PM +, Samuel Henrique wrote:
> Hello Guido,
> 
> > You need to fixup the tests too though
> 
> I have updated the Github PR and also attached the new patch with the
> unit tests fixed.

Appied. Thanks!
 -- Guido



Bug#1031327: gbp-rpm-ch: Wrong changelog header format (missing dash before version)

2023-02-21 Thread Samuel Henrique
Hello Guido,

> You need to fixup the tests too though

I have updated the Github PR and also attached the new patch with the
unit tests fixed.

Thank you,

-- 
Samuel Henrique 
From b2a7100730306d7e333ce84c00ccdaf693e6f081 Mon Sep 17 00:00:00 2001
From: Samuel Henrique 
Date: Mon, 1 Aug 2022 18:49:19 +0100
Subject: [PATCH] Fix RPM changelog header format (missing dash before version)

 As stated in the documentation at:
 https://rpm-packaging-guide.github.io/#working-with-spec-files

 "...
 Follow this format for the first line:

 * Day-of-Week Month Day Year Name Surname  - Version-Release
 ..."
---
 gbp/rpm/policy.py  |  2 +-
 tests/30_test_rpm_changelog.py | 26 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gbp/rpm/policy.py b/gbp/rpm/policy.py
index a2155e20..59989bb8 100644
--- a/gbp/rpm/policy.py
+++ b/gbp/rpm/policy.py
@@ -85,7 +85,7 @@ class Changelog(object):
 body_name_re = r'\[(?P.*)\]'
 
 # Changelog header format (when writing out changelog)
-header_format = "* %(time)s %(name)s <%(email)s> %(revision)s"
+header_format = "* %(time)s %(name)s <%(email)s> - %(revision)s"
 header_time_format = "%a %b %d %Y"
 header_rev_format = "%(version)s"
 
diff --git a/tests/30_test_rpm_changelog.py b/tests/30_test_rpm_changelog.py
index 85142a41..2a0d068d 100644
--- a/tests/30_test_rpm_changelog.py
+++ b/tests/30_test_rpm_changelog.py
@@ -34,7 +34,7 @@ def test_str_format(self):
 time = datetime(2014, 1, 29, 12, 13, 14)
 header = _ChangelogHeader(RpmPkgPolicy, time, name="John Doe",
   email="u...@host.com", revision="1")
-eq_(str(header), "* Wed Jan 29 2014 John Doe  1\n")
+eq_(str(header), "* Wed Jan 29 2014 John Doe  - 1\n")
 
 def test_str_format_err(self):
 """Test missing properties"""
@@ -79,7 +79,7 @@ def setup(self):
 def test_str_format(self):
 """Basic test"""
 section = self.default_sect
-eq_(str(section), "* Wed Jan 29 2014 J. D.  1\n- my change\n\n")
+eq_(str(section), "* Wed Jan 29 2014 J. D.  - 1\n- my change\n\n")
 
 def test_append_entry(self):
 """Test add_entry() method"""
@@ -87,7 +87,7 @@ def test_append_entry(self):
 entry = _ChangelogEntry(RpmPkgPolicy, author="",
 text="- another\n  change")
 new_entry = section.append_entry(entry)
-eq_(str(section), "* Wed Jan 29 2014 J. D.  1\n- my change\n"
+eq_(str(section), "* Wed Jan 29 2014 J. D.  - 1\n- my change\n"
   "- another\n  change\n\n")
 eq_(new_entry, section.entries[-1])
 
@@ -96,25 +96,25 @@ def test_set_header(self):
 section = self.default_sect
 time = datetime(2014, 1, 30)
 section.set_header(time=time, name="Jane", email="u@h", revision="1.1")
-eq_(str(section), "* Thu Jan 30 2014 Jane  1.1\n- my change\n\n")
+eq_(str(section), "* Thu Jan 30 2014 Jane  - 1.1\n- my change\n\n")
 
 
 class TestChangelogParser(object):
 """Test the default changelog parser"""
 
 cl_default_style = """\
-* Wed Jan 29 2014 Markus Lehtonen  0.3-1
+* Wed Jan 29 2014 Markus Lehtonen  - 0.3-1
 - Version bump
 - Drop foo.patch
 
-* Tue Jan 28 2014 Markus Lehtonen  0.2
+* Tue Jan 28 2014 Markus Lehtonen  - 0.2
 - Update to 0.2
 
-* Mon Jan 27 2014 Markus Lehtonen  0.1
+* Mon Jan 27 2014 Markus Lehtonen  - 0.1
 - Initial version
 """
 cl_with_authors = """\
-* Wed Jan 29 2014 Markus Lehtonen  0.3-1
+* Wed Jan 29 2014 Markus Lehtonen  - 0.3-1
 [Markus Lehtonen]
 - Version bump
 [John Doe]
@@ -122,17 +122,17 @@ class TestChangelogParser(object):
 """
 # Invalid timestamp / name
 cl_broken_header_1 = """\
-* Wed Jan 29 2014Markus Lehtonen  0.3-1
+* Wed Jan 29 2014Markus Lehtonen  - 0.3-1
 - Version bump
 """
 # Whitespace before the asterisk in the header
 cl_broken_header_2 = """\
- * Wed Jan 29 2014 Markus Lehtonen  0.3-1
+ * Wed Jan 29 2014 Markus Lehtonen  - 0.3-1
 - Version bump
 """
 # Invalid timestamp
 cl_broken_header_3 = """\
-* Wed Jan 32 2014 Markus Lehtonen  0.3-1
+* Wed Jan 32 2014 Markus Lehtonen  - 0.3-1
 - Version bump
 """
 # Missing email
@@ -143,7 +143,7 @@ class TestChangelogParser(object):
 # Garbage before section header
 cl_broken_header_5 = """\
 ---garbage---
-* Wed Jan 29 2014 Markus Lehtonen  0.3-1
+* Wed Jan 29 2014 Markus Lehtonen  - 0.3-1
 - Version bump
 """
 
@@ -222,5 +222,5 @@ def test_add_section(self):
 time = datetime(2014, 1, 30)
 new_section = changelog.add_section(time=time, name="Jane Doe",
 email="j...@doe.com", revision="1.2")
-eq_(str(changelog), "* Thu Jan 30 2014 Jane Doe  1.2\n\n")
+eq_(str(changelog), "* Thu Jan 30 2014 Jane Doe  - 1.2\n\n")
 eq_(new_section, changelog.sections[0])


Bug#1031327: gbp-rpm-ch: Wrong changelog header format (missing dash before version)

2023-02-19 Thread Guido Günther
Hi Samueloph,

On Tue, Feb 14, 2023 at 11:16:11PM +, Samuel Henrique wrote:
> Package: git-buildpackage
> X-Debbugs-Cc: samuel...@debian.org
> Version: 0.9.30
> Severity: normal
> Tags: patch
> 
> As stated in the title, the changelog header has the wrong format.
> 
> Specfile documentation:
> https://rpm-packaging-guide.github.io/#working-with-spec-files
> ...
>  Follow this format for the first line:
> 
>  * Day-of-Week Month Day Year Name Surname  - Version-Release
> ...

This makes sense. Fedora uses the same format, e.g.

   https://src.fedoraproject.org/rpms/phosh/blob/rawhide/f/phosh.spec

You need to fixup the tests too though, e.g.:

==
FAIL: Test set_header() method
--
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
  File 
"/var/scratch/src/git-buildpackage/git-buildpackage/tests/30_test_rpm_changelog.py",
 line 99, in test_set_header
eq_(str(section), "* Thu Jan 30 2014 Jane  1.1\n- my change\n\n")
AssertionError: '* Thu Jan 30 2014 Jane  - 1.1\n- my change\n\n' != '* Thu 
Jan 30 2014 Jane  1.1\n- my change\n\n'

Cheers,
 -- Guido




> 
> I have provided a patch on Github at
> https://github.com/agx/git-buildpackage/pull/89
> 
> The patch is also attached to this bug report.
> 
> Thank you,
> 
> -- 
> Samuel Henrique 

> From 310db2177f3a43e1584682f21c43ac0de6c495e6 Mon Sep 17 00:00:00 2001
> From: Samuel Henrique 
> Date: Mon, 1 Aug 2022 18:49:19 +0100
> Subject: [PATCH] Fix RPM changelog header format (missing dash before version)
> 
>  As stated in the documentation at:
>  https://rpm-packaging-guide.github.io/#working-with-spec-files
> 
>  "...
>  Follow this format for the first line:
> 
>  * Day-of-Week Month Day Year Name Surname  - Version-Release
>  ..."
> ---
>  gbp/rpm/policy.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gbp/rpm/policy.py b/gbp/rpm/policy.py
> index a2155e20..59989bb8 100644
> --- a/gbp/rpm/policy.py
> +++ b/gbp/rpm/policy.py
> @@ -85,7 +85,7 @@ class Changelog(object):
>  body_name_re = r'\[(?P.*)\]'
>  
>  # Changelog header format (when writing out changelog)
> -header_format = "* %(time)s %(name)s <%(email)s> %(revision)s"
> +header_format = "* %(time)s %(name)s <%(email)s> - %(revision)s"
>  header_time_format = "%a %b %d %Y"
>  header_rev_format = "%(version)s"
>  



Bug#1031327: gbp-rpm-ch: Wrong changelog header format (missing dash before version)

2023-02-14 Thread Samuel Henrique
Package: git-buildpackage
X-Debbugs-Cc: samuel...@debian.org
Version: 0.9.30
Severity: normal
Tags: patch

As stated in the title, the changelog header has the wrong format.

Specfile documentation:
https://rpm-packaging-guide.github.io/#working-with-spec-files
...
 Follow this format for the first line:

 * Day-of-Week Month Day Year Name Surname  - Version-Release
...

I have provided a patch on Github at
https://github.com/agx/git-buildpackage/pull/89

The patch is also attached to this bug report.

Thank you,

-- 
Samuel Henrique 
From 310db2177f3a43e1584682f21c43ac0de6c495e6 Mon Sep 17 00:00:00 2001
From: Samuel Henrique 
Date: Mon, 1 Aug 2022 18:49:19 +0100
Subject: [PATCH] Fix RPM changelog header format (missing dash before version)

 As stated in the documentation at:
 https://rpm-packaging-guide.github.io/#working-with-spec-files

 "...
 Follow this format for the first line:

 * Day-of-Week Month Day Year Name Surname  - Version-Release
 ..."
---
 gbp/rpm/policy.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gbp/rpm/policy.py b/gbp/rpm/policy.py
index a2155e20..59989bb8 100644
--- a/gbp/rpm/policy.py
+++ b/gbp/rpm/policy.py
@@ -85,7 +85,7 @@ class Changelog(object):
 body_name_re = r'\[(?P.*)\]'
 
 # Changelog header format (when writing out changelog)
-header_format = "* %(time)s %(name)s <%(email)s> %(revision)s"
+header_format = "* %(time)s %(name)s <%(email)s> - %(revision)s"
 header_time_format = "%a %b %d %Y"
 header_rev_format = "%(version)s"