Your message dated Tue, 28 Nov 2017 12:49:15 +0000
with message-id <[email protected]>
and subject line Bug#669171: fixed in git-buildpackage 0.9.4
has caused the Debian Bug report #669171,
regarding git-buildpackage: Create changelog if it does not exist
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
669171: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=669171
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: git-buildpackage
Version: 0.6.0~git20120404
Severity: wishlist
File: /usr/bin/git-dch

Dear Maintainer,

In my attempts to automate my debian packaging handling by git workflow,
I attach a preview patch to get some comments.

My wish is to let git-dch handle debian/changelog automatically and let
that file out of my way (it's present only on tagged debian version).

This works nice with a preexisting package, to release a new version:

1. I never edit myself debian/changelog, nor run git-dch or dch on my
   packaging development branch

2. when I want to build a new package, I checkout the previous tagged
   debian version in my "debian_branch"

3. I merge my packaging development branch in the "debian_branch"

4. I run "git-dch -a --spawn-editor=none debian/", this calculate the new 
version number
   based on upstream tag

When I start a new package, I want:

1. dh_make to get things mostly done

2. rm debian/changelog

3. edit debian/* and commit that

4. do the same as above for preexisting packages


My current caveats are:

- Pass the package name to dch

- Pass the distribution to dch[1]

- Make the "dch --create" silent according to git-dch --spawn-editor
  option


To be noted when removing the debian/changelog from an existing package
to handle it this way: 

git-dch do not get to the "git rm debian/changelog" commit

So, to avoid loosing commit messages:

1. all commit logs before the "git rm debian/changelog" must be packaged
   (with a tagged debian version for point 2 in my release workflow)

2. the "git rm debian/changelog" commit must be "alone" or the commit
   message will be lost.

Regards.

diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 3a4a02a..2b060d1 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -112,9 +112,9 @@ def guess_version_from_upstream(repo, upstream_tag_format, cp):
         version = repo.tag_to_version(tag, upstream_tag_format)
         if version:
             gbp.log.debug("Found upstream version %s." % version)
-            if cp.has_epoch():
+            if hasattr(cp, 'has_epoch') and cp.has_epoch():
                 version = "%s:%s" % (cp.epoch, version)
-            if compare_versions(version, cp.version) > 0:
+            if compare_versions(version, cp['Version']) > 0:
                 return "%s-1" % version
     except GitRepositoryError:
         gbp.log.debug("No tag found matching pattern %s." % pattern)
@@ -124,7 +124,7 @@ def guess_version_from_upstream(repo, upstream_tag_format, cp):
 def add_changelog_section(msg, distribution, repo, options, cp,
                           author=None, email=None, version={}, dch_options=''):
     """Add a new section to the changelog"""
-    if not version and not cp.is_native():
+    if not version and not (hasattr(cp,'is_native') and cp.is_native()):
         v = guess_version_from_upstream(repo, options.upstream_tag, cp)
         if v:
             version['version'] = v
@@ -270,7 +270,7 @@ def guess_snapshot_commit(cp, repo, options):
     # If the current topmost changelog entry has already been tagged rely on
     # the version information only. The upper level relies then on the version
     # info anyway:
-    if repo.find_version(options.debian_tag, cp.version):
+    if repo.find_version(options.debian_tag, cp['Version']):
         return None
     # If we didn't find a snapshot header we look at the point the changelog
     # was last touched.
@@ -416,7 +416,12 @@ def main(argv):
             gbp.log.err("You are not on branch '%s' but on '%s'" % (options.debian_branch, branch))
             raise GbpError, "Use --ignore-branch to ignore or --debian-branch to set the branch name."
 
-        cp = ChangeLog(filename=changelog)
+        try:
+            cp = ChangeLog(filename=changelog)
+        except NoChangeLogError, err:
+            gbp.log.info("No debian/changelog: create a new one")
+            cp = {'Changes': '', 'Version': ''}
+            dch_options += " --create"
 
         if options.since:
             since = options.since
@@ -429,7 +434,7 @@ def main(argv):
                     found_snapshot_header = True
                 else:
                     gbp.log.info("Couldn't find snapshot header, using version info")
-            if not since:
+            if dch_options.find(" --create") == -1 and not since:
                 since = repo.find_version(options.debian_tag, cp['Version'])
                 if not since:
                     raise GbpError, "Version %s not found" % cp['Version']
@@ -441,14 +446,14 @@ def main(argv):
         commits.reverse()
 
         # add a new changelog section if:
-        if options.new_version or options.bpo or options.nmu or options.qa:
+        if options.new_version or options.bpo or options.nmu or options.qa or dch_options.find(" --create") != -1:
             if options.bpo:
                 version_change['increment'] = '--bpo'
             elif  options.nmu:
                 version_change['increment'] = '--nmu'
             elif  options.qa:
                 version_change['increment'] = '--qa'
-            else:
+            elif dch_options.find(" --create") == -1:
                 version_change['version'] = options.new_version
             # the user wants to force a new version
             add_section = True
@@ -484,6 +489,8 @@ def main(argv):
                                       cp=cp)
                 # Adding a section only needs to happen once.
                 add_section = False
+                # Like creating new changelog
+                dch_options = dch_options.replace(' --create', '')
             else:
                 add_changelog_entry(commit_msg, commit_author, commit_email, dch_options)
 
@@ -516,7 +523,7 @@ def main(argv):
         if editor_cmd:
             gbpc.Command(editor_cmd, ["debian/changelog"])()
 
-    except (GbpError, GitRepositoryError, NoChangeLogError), err:
+    except (GbpError, GitRepositoryError), err:
         if len(err.__str__()):
             gbp.log.err(err)
         ret = 1
-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (90, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.4+hati.1+ (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages git-buildpackage depends on:
ii  devscripts       2.11.6
ii  git              1:1.7.9.5-1
ii  python           2.7.2-10
ii  python-dateutil  1.5-1
ii  python2.6        2.6.7-4
ii  python2.7        2.7.3~rc2-2

Versions of packages git-buildpackage recommends:
ii  cowbuilder    <none>
ii  pristine-tar  1.24

Versions of packages git-buildpackage suggests:
ii  python-notify  0.1.1-3
ii  unzip          6.0-6

-- no debconf information


Footnotes: 
[1]  http://bugs.debian.org/646684

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF

Attachment: pgpqS1xK9QIVW.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: git-buildpackage
Source-Version: 0.9.4

We believe that the bug you reported is fixed in the latest version of
git-buildpackage, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guido Günther <[email protected]> (supplier of updated git-buildpackage package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 28 Nov 2017 12:32:01 +0100
Source: git-buildpackage
Binary: git-buildpackage git-buildpackage-rpm
Architecture: source
Version: 0.9.4
Distribution: unstable
Urgency: medium
Maintainer: Guido Günther <[email protected]>
Changed-By: Guido Günther <[email protected]>
Description:
 git-buildpackage - Suite to help with Debian packages in Git repositories
 git-buildpackage-rpm - Suite to help with RPM packages in Git repositories
Closes: 669171 882984
Changes:
 git-buildpackage (0.9.4) unstable; urgency=medium
 .
   * [868e8ae] Bump standards version
   * [5c078f7] docs: Add --git-overlay to synopsis
   * [015f1a7] import-orig: use separate exit code when uscan did not find
     anything new
   * [45a0652] dch: Create changelog if missing.
     Thanks to Daniel Dehennin for the groundwork on this (Closes: #669171)
   * [c90cb78] git-pbuilder: properly escape -? (Closes: #882984)
   * gbp-try-ff improvements
Checksums-Sha1:
 ebfc88f2b65191baebdbda95cc93178a42112f72 2273 git-buildpackage_0.9.4.dsc
 7e19ef3999ea5a7c6a4547686f42dac92a0b9a0a 2378672 git-buildpackage_0.9.4.tar.xz
 a9c6dd8e40875e14f04e79098bcf2533c2cbd3e2 11537 
git-buildpackage_0.9.4_amd64.buildinfo
Checksums-Sha256:
 a33fbd329ce852744762e85e50af53ec4f28a0eeaa6dcb1b15b9a309727d07ef 2273 
git-buildpackage_0.9.4.dsc
 354b692a922cad86b4c3103d1605f4a19c337f02c5c44386174b39ed03308d0d 2378672 
git-buildpackage_0.9.4.tar.xz
 d8f980608fc5919529a137edab333d06a45a40da9c740af3204b6e57035879ac 11537 
git-buildpackage_0.9.4_amd64.buildinfo
Files:
 e6e267cbd3fc68567b2af53542d3128a 2273 vcs optional git-buildpackage_0.9.4.dsc
 b9f5f3d85ceaf30dc50b0ad05f9cb3a8 2378672 vcs optional 
git-buildpackage_0.9.4.tar.xz
 0aed3be5e66e7ab303c5b042cb845073 11537 vcs optional 
git-buildpackage_0.9.4_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEvHzQcjh1660F3xzZB7i3sOqYEgsFAlodV4AACgkQB7i3sOqY
Egtx8w//XgBmMeGd0Uf8D93zRXCTdiKWaYTj86rgW6wycZjm5qsgcUut+lA/wmO4
yux5ErgMsGAZrj494DpMNrkzio+24G2uO1O22wadv6063uB9tirNs+YkinK97tgW
xdKmdWANEhsQtRa4zjVBSlHOmhyOI6SsKpnRR/YNsJcReTW5KGZiBIZ08A7ztyqE
Raz2rmM1pyzV9u+7N1ey8AZX7lIA7/h8AlIGYpN61j249AfMgXDAnjq/gsiUxWdR
W+zqZ59Jj1YOWxOQwYRLt7cLv6dMidLYYjGz1Kd+MgfJ9LM/2uBzGCG00ScxP7Q6
pXXcZ0hA5qz6nj9eF8LrPE5OZoVe9gVcfjHYCgS/JTiABl40rDd8yoBoE8ZgyZ7B
+ykEGP1M4w0QcmRBdwdkR/o1VD1RjztlRMHjCWwuiUkigmmMQrDWn5hnzhZjPz5r
SuYj0S/KsPzzFrNRRXYL5x0C5gd29ote0c7HxZFw5RO1yuyJb3zLEgd3jLNi7qce
7Mk/chX7gEXFY5IJ4yTsWAj27DbB6UDqilwrxOHP0jYO1JYoyin4Q9aEYyFtMJFY
kzG6+9+2ZfVIqKh7uFNCUm29Jz4FIAS340G+IJ81PSTLeIzdnnrYfD2zbU0tLYny
NaSA+/kMmEYMhM5QKnc+yxJnRI7/ZVLKmFeQ5L5e9BxgmrSyQxw=
=Ccu7
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to