[asterisk-commits] mkrelease: Fix changelog generation for initial full releases. (repotools[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 27 10:00:30 CDT 2016


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4194 )

Change subject: mkrelease: Fix changelog generation for initial full releases.
......................................................................


mkrelease: Fix changelog generation for initial full releases.

When creating the most recent releases of Asterisk, the mkrelease.py
script was asserting because it was trying to create progress bars with
zero items in them. The reason for this was that we were creating a
change log that was pulling in log messages for zero commits.

In my case, I was releasing 11.24.0, and the change log was pulling in
all commits between 11.24.0-rc1 and 11.24.0. Since the contents of the
two were the same, there were zero commits.

But wait! Why didn't this ever happen before? A recent change to
mkrelease.py made it so that when making a release, we save up all
changes and perform a single commit at the end of the operation. Prior
to this change, the change log generation would pull in commits that had
been done as part of the release (e.g. updating .lastclean and
.version).

The fix here is to special case the creation of an Asterisk release with
patch version 0 and with no version modifiers (e.g. -beta1 or -rc3).
Since the first full release will always be identical to the most recent
RC, there is no point in trying to pull in any changes for the change
log. Now, the only thing written to the change log is the line showing
that the new version has been released.

Change-Id: I1d6755e6c4b9fab88026d492302bc2225d2c3b49
---
M mkrelease.py
1 file changed, 23 insertions(+), 14 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, approved; Verified
  Corey Farrell: Looks good to me, but someone else must approve



diff --git a/mkrelease.py b/mkrelease.py
index 682f6fc..1a6c478 100755
--- a/mkrelease.py
+++ b/mkrelease.py
@@ -270,18 +270,26 @@
         # simply contain the history of the previous release candidates.
         # Since the two are not the same in that case, we have to regenerate
         # the history.
+        #
+        # This really only applies when generating a ChangeLog for an RC or
+        # beta. Full releases will have no changes between the latest RC and
+        # HEAD. Therefore, you're guaranteed to try to create a summary of zero
+        # changes.
         if version_object.patch == 0:
-            sum_opts = ReleaseSummaryOptions()
-            sum_opts.start_tag = start_version
-            sum_opts.end_tag = 'HEAD'
-            sum_opts.previous_version = prev_version
-            sum_opts.version = version
-            sum_opts.local_root = options.local_root
-            sum_opts.project = options.project
-            sum_opts.branch = branch
+            if len(version_object.modifiers) != 0:
+                sum_opts = ReleaseSummaryOptions()
+                sum_opts.start_tag = start_version
+                sum_opts.end_tag = 'HEAD'
+                sum_opts.previous_version = prev_version
+                sum_opts.version = version
+                sum_opts.local_root = options.local_root
+                sum_opts.project = options.project
+                sum_opts.branch = branch
 
-            summary = ReleaseSummary(
-                sum_opts, debug=options.loglevel == logging.DEBUG)
+                summary = ReleaseSummary(
+                    sum_opts, debug=options.loglevel == logging.DEBUG)
+            else:
+                summary = None
 
         if os.path.isfile(change_log_path):
             LOGGER.debug("Removing old ChangeLog")
@@ -294,10 +302,11 @@
                          "<asteriskteam at digium.com>\n\n".format(today))
             c_file.write("\t* {0} {1} Released.\n\n".format(options.project,
                                                             version))
-            for log_message in summary.raw_log_messages:
-                if log_message.raw and len(log_message.raw.parents) > 1:
-                    continue
-                c_file.write(unicode(log_message.get_change_log()).encode('utf-8'))
+            if summary:
+                for log_message in summary.raw_log_messages:
+                    if log_message.raw and len(log_message.raw.parents) > 1:
+                        continue
+                    c_file.write(unicode(log_message.get_change_log()).encode('utf-8'))
 
             with open(old_log_path, 'r') as old_file:
                 for line in old_file:

-- 
To view, visit https://gerrit.asterisk.org/4194
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1d6755e6c4b9fab88026d492302bc2225d2c3b49
Gerrit-PatchSet: 1
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list