[u, d, c, b, x, t][PATCH] UBUNTU: [Packaging] startnewrelease: Add support for backport versioning

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Wed Feb 20 23:15:14 UTC 2019


On Wed, Feb 20, 2019 at 10:16:54AM +0100, Juerg Haefliger wrote:
> On Tue, 19 Feb 2019 13:17:48 -0300
> Marcelo Henrique Cerri <marcelo.cerri at canonical.com> wrote:
> 
> > Ignore: yes
> > 
> > Use the parent kernel version as base for the new release version if
> > the BACKPORT_SUFFIX variable is set in the update.conf file.
> > 
> > Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
> > ---
> >  debian/rules.d/1-maintainer.mk | 16 +++++++++++++---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> > 
> > diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
> > index ee8010ba7fa0..d57145b644d9 100644
> > --- a/debian/rules.d/1-maintainer.mk
> > +++ b/debian/rules.d/1-maintainer.mk
> > @@ -126,10 +126,20 @@ diffupstream:
> >  
> >  startnewrelease:
> >  	dh_testdir
> > -	@ver=$$(echo "$(revision)" | perl -ne 'if (/^(\d*)\.(\d*)(.*)?$$/) { printf("%d.%d%s\n", $$1 + 1, $$2 +1, $$3) }'); \
> > +	@[ -f "$(DEBIAN)/etc/update.conf" ] && . "$(DEBIAN)/etc/update.conf"; \
> 
> This being a Makefile, doesn't the above trigger a failure if there's no
> $(DEBIAN)/etc/update.conf?

No. I don't think Makefile runs the shell with the exit on error flag
set (set -e), but even with that flag, the shell will not abort when the
return code of the && operation is non zero.

I have tested it on the master kernels (those kernels don't have an
update.conf file) and it works fine.

As an example, the following snippet should print "End":

   #!/bin/sh -e
   [ 1 = 0 ] && echo OK
   echo End

The -e description in sh(1) man page:

If not interactive, exit immediately if any untested command
fails. The exit status of a command is considered to be explicitly
tested if the command is used to control an if, elif, while, or until;
or if the command is the left hand operand of an “&&” or “||”
operator.

> 
> ...Juerg
> 
> > +	if [ -n "$$BACKPORT_SUFFIX" ]; then \
> > +		ver="$$(dpkg-parsechangelog -l"$$DEBIAN_MASTER/changelog" -SVersion)~$${BACKPORT_SUFFIX}.1"; \
> > +		prev_ver="$$(dpkg-parsechangelog -l"$(DEBIAN)/changelog" -SVersion)"; \
> > +		if [ "$${ver%.*}" = "$${prev_ver%.*}" ]; then \
> > +			ver="$${ver%.*}.$$(( $${prev_ver##*.} +1 ))"; \
> > +		fi; \
> > +	else \
> > +		ver="$(release)-$$(echo "$(revision)" | \
> > +			perl -ne 'if (/^(\d*)\.(\d*)(.*)?$$/) { printf("%d.%d%s\n", $$1 + 1, $$2 +1, $$3) }')"; \
> > +	fi; \
> >  	now="$(shell date -R)"; \
> > -	echo "Creating new changelog set for $(release)-$$ver..."; \
> > -	echo -e "$(src_pkg_name) ($(release)-$$ver) UNRELEASED; urgency=medium\n" > $(DEBIAN)/changelog.new; \
> > +	echo "Creating new changelog set for $$ver..."; \
> > +	echo -e "$(src_pkg_name) ($$ver) UNRELEASED; urgency=medium\n" > $(DEBIAN)/changelog.new; \
> >  	echo "  CHANGELOG: Do not edit directly. Autogenerated at release." >> \
> >  		$(DEBIAN)/changelog.new; \
> >  	echo "  CHANGELOG: Use the printchanges target to see the curent changes." \
> 



-- 
Regards,
Marcelo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20190220/f7ed8628/attachment.sig>


More information about the kernel-team mailing list