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

Juerg Haefliger juerg.haefliger at canonical.com
Fri Mar 1 09:50:32 UTC 2019


On Wed, 20 Feb 2019 20:15:14 -0300
Marcelo Henrique Cerri <marcelo.cerri at canonical.com> wrote:

> 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.

Ah, this line is part of a subshell command. Yes, that makes a difference, so in
that case is should be fine.

 
> 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

Well this confuses me. I was always under the impression that the above should
error out on the first line.

 
> 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.

OK. Yes, I see it :-(

Now that I think about I believe where my confusion comes from is that I used
foo && bar in Makefiles which errors out if foo is false so I had to change
those lines to ! foo || bar.

Thanks for solving that mystery :-)

...Juerg


 
> > 
> > ...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." \  
> >   
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20190301/a03795f5/attachment.sig>


More information about the kernel-team mailing list