[azure] UBUNTU: [Debian] Support custom kernels in printchanges/insertchanges

Submitted by Marcelo Cerri on Feb. 27, 2017, 8:16 p.m.

Details

Message ID 1488226587-31312-1-git-send-email-marcelo.cerri@canonical.com
State New
Headers show

Commit Message

Marcelo Cerri Feb. 27, 2017, 8:16 p.m.
Ignore: yes

Currently printchanges/insertchanges do not work for custom kernels
because commit messages for each release follow the format
"UBUNTU: Ubuntu-${flavour}-${prev_fullver}" instead of
"UBUNTU: Ubuntu-${prev_fullver}". Also, for the first release, the
previous version in the changelog does not match the version in the
previous release commit.

This patch makes the base commit selection more flexible, allowing
commit messages in the format "UBUNTU: Ubuntu-*${prev_fullver}" and it
fallbacks to the latest release commit when a exact match is not found
in order to support the custom kernels in their initial releases.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---
 debian/rules.d/1-maintainer.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Marcelo Cerri Feb. 27, 2017, 8:23 p.m.
Although initially intended for azure I believe we can include that to
other custom kernels if it doesn't cause any unexpected side effects.

It might be a good idea to include on the regular kernels as well for
future custom kernels.
Kamal Mostafa Feb. 27, 2017, 8:38 p.m.

Stefan Bader Feb. 28, 2017, 2:22 p.m.
Yeah, I think this has changed when we started to name the tags differently.
Which in turn seemed to make it a good move to use the same string in the tagged
commit as well. Just the script did not catch up and is usually undetected as
topic branches are mostly only rebased.

-Stefan

Patch hide | download patch | download mbox

diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 0c579c8..042a1f9 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -97,9 +97,14 @@  printenv:
 
 printchanges:
 	@baseCommit=$$(git log --pretty=format:'%H %s' | \
-		gawk '/UBUNTU: '".*Ubuntu-`echo $(prev_fullver) | sed 's/+/\\\\+/'`"'$$/ { print $$1; exit }'); \
-		git log "$$baseCommit"..HEAD | \
-		$(DROOT)/scripts/misc/git-ubuntu-log $(ubuntu_log_opts)
+		gawk '/UBUNTU: '".*Ubuntu-.*`echo $(prev_fullver) | sed 's/+/\\\\+/'`"'$$/ { print $$1; exit }'); \
+	if [ -z "$$baseCommit" ]; then \
+		echo "WARNING: couldn't find a commit for the previous version. Using the lastest one." >&2; \
+		baseCommit=$$(git log --pretty=format:'%H %s' | \
+			gawk '/UBUNTU:\s*Ubuntu-.*$$/ { print $$1; exit }'); \
+	fi; \
+	git log "$$baseCommit"..HEAD | \
+	$(DROOT)/scripts/misc/git-ubuntu-log $(ubuntu_log_opts)
 
 insertchanges: autoreconstruct
 	@perl -w -f $(DROOT)/scripts/misc/insert-changes.pl $(DROOT) $(DEBIAN)