[asterisk-commits] mkrelease: Fix patch file on releases. (repotools[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Nov 2 08:51:00 CDT 2016
Matt Jordan has submitted this change and it was merged. ( https://gerrit.asterisk.org/4256 )
Change subject: mkrelease: Fix patch file on releases.
......................................................................
mkrelease: Fix patch file on releases.
This change makes it so that the patch file for releases
are the diff between the last released version and the
new one. This allows people who run only releases (not rc)
to use the patch to remain up to date. For the release
candidates they will remain as they are, the diff between
the last release version or last rc.
ASTERISK-26502 #close
Change-Id: I43807052719243747037f9eba12f995f97c8f49a
---
M mkrelease.py
1 file changed, 25 insertions(+), 4 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve; Verified
Matt Jordan: Looks good to me, approved
diff --git a/mkrelease.py b/mkrelease.py
index 1a6c478..047a327 100755
--- a/mkrelease.py
+++ b/mkrelease.py
@@ -475,7 +475,7 @@
gpg.sign_file(file_stream, detach=True, output=out_file)
-def create_patch_archive(options):
+def create_patch_archive(options, repo):
"""Create an archive of the diff between this release and the previous
Keyword Arguments:
@@ -489,14 +489,35 @@
"diff".format(version))
return
+ if len(version_object.modifiers) == 0:
+ # If this is a full release use the previously released version (including patch) to
+ # generate the patch from.
+ search = True
+ i = 0
+
+ # The previous version does not include the patch, so determine what the patch is up to
+ while search:
+ # If we are generating a patch version we want the previous and not ourselves
+ if prev_obj.major == version_object.major and prev_obj.minor == version_object.minor and i == version_object.patch:
+ search = False
+ elif not repo.tag_exists('{0}.{1}.{2}'.format(prev_obj.major, prev_obj.minor, i)):
+ search = False
+ else:
+ diff_version = '{0}.{1}.{2}'.format(prev_obj.major, prev_obj.minor, i)
+ i += 1
+ else:
+ # For non-full releases use the actual start of the history for the
+ # release.
+ diff_version = start_version
+
# Since we don't want to work with the diff, but merely dump it out,
# this is more easily done via the command line
curdir = os.getcwd()
os.chdir(os.path.join(options.local_root, options.project))
file_name = '{0}-patch'.format(release_name)
- LOGGER.debug("Generating diff from '{0}' to '{1}'".format(start_version,
+ LOGGER.debug("Generating diff from '{0}' to '{1}'".format(diff_version,
version))
- os.system('git diff {0}..{1} > {2}'.format(start_version,
+ os.system('git diff {0}..{1} > {2}'.format(diff_version,
version,
file_name))
os.chdir(curdir)
@@ -679,7 +700,7 @@
repo.push_changes()
prompt_to_continue("Proceeding to tarball.")
- create_patch_archive(options)
+ create_patch_archive(options, repo)
tag_archive = create_tag_archive(repo)
create_final_archive(tag_archive, options)
--
To view, visit https://gerrit.asterisk.org/4256
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I43807052719243747037f9eba12f995f97c8f49a
Gerrit-PatchSet: 2
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list