diff mbox

[ovs-dev] debian : upstream_version fix - resubmitted

Message ID 397FD63D94A70042B39B21380C6225A829B2A631@ESESSMB305.ericsson.se
State Changes Requested
Headers show

Commit Message

Zoltan Balogh March 24, 2016, 8:28 a.m. UTC
Hi,

The Debian Policy Manual (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version) says that the upstream_version may contain only alphanumerics and the characters . + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit.

Currently, the upstream_version is defined in the debian/rules file:

DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]:)*([^-]+).*,\2,p')

The version number is taken from the dpkg-parsechangelog printout then the first part of the version number which does not contain hyphen is filtered out with sed. However the Debian Policy Manual says that hyphen is allowed in the upstream_version. 

This is not a problem with current vanilla OVS debian version. But, if a postfix string including a hyphen is added to the upstream_version then installation of datapath-dkms package will fail. 

I think the following patch solves this problem.

Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com>

---

Comments

Simon Horman March 29, 2016, 12:51 a.m. UTC | #1
Hi Zoltánm

On Thu, Mar 24, 2016 at 08:28:53AM +0000, Zoltán Balogh wrote:
> Hi,
> 
> The Debian Policy Manual (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version) says that the upstream_version may contain only alphanumerics and the characters . + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit.
> 
> Currently, the upstream_version is defined in the debian/rules file:
> 
> DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
> 
> The version number is taken from the dpkg-parsechangelog printout then the first part of the version number which does not contain hyphen is filtered out with sed. However the Debian Policy Manual says that hyphen is allowed in the upstream_version. 
> 
> This is not a problem with current vanilla OVS debian version. But, if a postfix string including a hyphen is added to the upstream_version then installation of datapath-dkms package will fail. 
> 
> I think the following patch solves this problem.
> 
> Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com>

I wonder if the version manipulation could be expressed using sed, as the code
existing code does, rather than awk, sed, expr and shell.

Perhaps something like this:

sed -rne 's,^Version: ([0-9]+:)?([0-9][a-zA-Z0-9.+:~-]*)(-[a-zA-Z0-9*.~]*),\2,p'

Which I tested as follows:

Input: Version: 2.4.90-1
Output: 2.4.90

Input: Version: 1:2.4.90-1
Output: 2.4.90

Input: Version: 1:3:2.4.90-1
Output: 3:2.4.90

Input: Version: 2.4.90-xyz-1
Output: 2.4.90-xyz

Input: Version: 1:2.4.90-xyz-1
Output: 2.4.90-xyz

Input: Version: 1:3:2.4.90-xyz-1
Output: 3:2.4.90-xyz

N.B: Does not work without debian_version present
Input: Version: 2.4.90
Output: 

> 
> ---
> 
> diff --git a/debian/rules b/debian/rules
> index d8e90c7..70539ab 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -13,7 +13,9 @@
> 
>  PACKAGE=openvswitch
>  PACKAGE_DKMS=openvswitch-datapath-dkms
> -DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
> +DEB_VERSION=$(shell dpkg-parsechangelog | awk '/^Version: / {print $$2}' | sed -rne 's,([0-9]:)+([.])*,\2,p')
> +DEB_REVISION=$(shell expr "$(DEB_VERSION)" : '.*\(-.*\)' )
> +DEB_UPSTREAM_VERSION=$(shell version=$(DEB_VERSION); expr + $${version%"$(DEB_REVISION)"})
> 
>  ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
>  PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
> 
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Zoltan Balogh April 1, 2016, 7:43 a.m. UTC | #2
Hi Simon,

This is a simpler and better solution. For me it's ok, since our team uses debian_revision too.

Best regards,
Zoltán

-----Original Message-----
From: Simon Horman [mailto:simon.horman@netronome.com]

Sent: Tuesday, March 29, 2016 2:51 AM
To: Zoltán Balogh
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] debian : upstream_version fix - resubmitted

Hi Zoltánm

On Thu, Mar 24, 2016 at 08:28:53AM +0000, Zoltán Balogh wrote:
> Hi,

> 

> The Debian Policy Manual (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version) says that the upstream_version may contain only alphanumerics and the characters . + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit.

> 

> Currently, the upstream_version is defined in the debian/rules file:

> 

> DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne

> 's,^Version: ([0-9]:)*([^-]+).*,\2,p')

> 

> The version number is taken from the dpkg-parsechangelog printout then the first part of the version number which does not contain hyphen is filtered out with sed. However the Debian Policy Manual says that hyphen is allowed in the upstream_version. 

> 

> This is not a problem with current vanilla OVS debian version. But, if a postfix string including a hyphen is added to the upstream_version then installation of datapath-dkms package will fail. 

> 

> I think the following patch solves this problem.

> 

> Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com>


I wonder if the version manipulation could be expressed using sed, as the code existing code does, rather than awk, sed, expr and shell.

Perhaps something like this:

sed -rne 's,^Version: ([0-9]+:)?([0-9][a-zA-Z0-9.+:~-]*)(-[a-zA-Z0-9*.~]*),\2,p'

Which I tested as follows:

Input: Version: 2.4.90-1
Output: 2.4.90

Input: Version: 1:2.4.90-1
Output: 2.4.90

Input: Version: 1:3:2.4.90-1
Output: 3:2.4.90

Input: Version: 2.4.90-xyz-1
Output: 2.4.90-xyz

Input: Version: 1:2.4.90-xyz-1
Output: 2.4.90-xyz

Input: Version: 1:3:2.4.90-xyz-1
Output: 3:2.4.90-xyz

N.B: Does not work without debian_version present
Input: Version: 2.4.90
Output: 

> 

> ---

> 

> diff --git a/debian/rules b/debian/rules index d8e90c7..70539ab 100755

> --- a/debian/rules

> +++ b/debian/rules

> @@ -13,7 +13,9 @@

> 

>  PACKAGE=openvswitch

>  PACKAGE_DKMS=openvswitch-datapath-dkms

> -DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne

> 's,^Version: ([0-9]:)*([^-]+).*,\2,p')

> +DEB_VERSION=$(shell dpkg-parsechangelog | awk '/^Version: / {print 

> +$$2}' | sed -rne 's,([0-9]:)+([.])*,\2,p') DEB_REVISION=$(shell expr 

> +"$(DEB_VERSION)" : '.*\(-.*\)' ) DEB_UPSTREAM_VERSION=$(shell 

> +version=$(DEB_VERSION); expr + $${version%"$(DEB_REVISION)"})

> 

>  ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))  PARALLEL = 

> -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))

> 

> 

> _______________________________________________

> dev mailing list

> dev@openvswitch.org

> http://openvswitch.org/mailman/listinfo/dev
Ben Pfaff April 1, 2016, 3:55 p.m. UTC | #3
Will you submit a revised version of the patch, then?

Thanks,

Ben.

On Fri, Apr 01, 2016 at 07:43:09AM +0000, Zoltán Balogh wrote:
> Hi Simon,
> 
> This is a simpler and better solution. For me it's ok, since our team uses debian_revision too.
> 
> Best regards,
> Zoltán
> 
> -----Original Message-----
> From: Simon Horman [mailto:simon.horman@netronome.com]
> Sent: Tuesday, March 29, 2016 2:51 AM
> To: Zoltán Balogh
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] debian : upstream_version fix - resubmitted
> 
> Hi Zoltánm
> 
> On Thu, Mar 24, 2016 at 08:28:53AM +0000, Zoltán Balogh wrote:
> > Hi,
> > 
> > The Debian Policy Manual (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version) says that the upstream_version may contain only alphanumerics and the characters . + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit.
> > 
> > Currently, the upstream_version is defined in the debian/rules file:
> > 
> > DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne
> > 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
> > 
> > The version number is taken from the dpkg-parsechangelog printout then the first part of the version number which does not contain hyphen is filtered out with sed. However the Debian Policy Manual says that hyphen is allowed in the upstream_version. 
> > 
> > This is not a problem with current vanilla OVS debian version. But, if a postfix string including a hyphen is added to the upstream_version then installation of datapath-dkms package will fail. 
> > 
> > I think the following patch solves this problem.
> > 
> > Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
> 
> I wonder if the version manipulation could be expressed using sed, as the code existing code does, rather than awk, sed, expr and shell.
> 
> Perhaps something like this:
> 
> sed -rne 's,^Version: ([0-9]+:)?([0-9][a-zA-Z0-9.+:~-]*)(-[a-zA-Z0-9*.~]*),\2,p'
> 
> Which I tested as follows:
> 
> Input: Version: 2.4.90-1
> Output: 2.4.90
> 
> Input: Version: 1:2.4.90-1
> Output: 2.4.90
> 
> Input: Version: 1:3:2.4.90-1
> Output: 3:2.4.90
> 
> Input: Version: 2.4.90-xyz-1
> Output: 2.4.90-xyz
> 
> Input: Version: 1:2.4.90-xyz-1
> Output: 2.4.90-xyz
> 
> Input: Version: 1:3:2.4.90-xyz-1
> Output: 3:2.4.90-xyz
> 
> N.B: Does not work without debian_version present
> Input: Version: 2.4.90
> Output: 
> 
> > 
> > ---
> > 
> > diff --git a/debian/rules b/debian/rules index d8e90c7..70539ab 100755
> > --- a/debian/rules
> > +++ b/debian/rules
> > @@ -13,7 +13,9 @@
> > 
> >  PACKAGE=openvswitch
> >  PACKAGE_DKMS=openvswitch-datapath-dkms
> > -DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne
> > 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
> > +DEB_VERSION=$(shell dpkg-parsechangelog | awk '/^Version: / {print 
> > +$$2}' | sed -rne 's,([0-9]:)+([.])*,\2,p') DEB_REVISION=$(shell expr 
> > +"$(DEB_VERSION)" : '.*\(-.*\)' ) DEB_UPSTREAM_VERSION=$(shell 
> > +version=$(DEB_VERSION); expr + $${version%"$(DEB_REVISION)"})
> > 
> >  ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))  PARALLEL = 
> > -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
> > 
> > 
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/debian/rules b/debian/rules
index d8e90c7..70539ab 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,7 +13,9 @@ 

 PACKAGE=openvswitch
 PACKAGE_DKMS=openvswitch-datapath-dkms
-DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
+DEB_VERSION=$(shell dpkg-parsechangelog | awk '/^Version: / {print $$2}' | sed -rne 's,([0-9]:)+([.])*,\2,p')
+DEB_REVISION=$(shell expr "$(DEB_VERSION)" : '.*\(-.*\)' )
+DEB_UPSTREAM_VERSION=$(shell version=$(DEB_VERSION); expr + $${version%"$(DEB_REVISION)"})

 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))