diff mbox

[kteam-tools] verify-release-ready: do not rely on debian/gbp.conf for tag name

Message ID 20170816142704.29848-1-kleber.souza@canonical.com
State New
Headers show

Commit Message

Kleber Sacilotto de Souza Aug. 16, 2017, 2:27 p.m. UTC
We currently rely on 'debian-tag' config from debian/gbp.conf, however
this value is not set correctly for all derivatives and backports.
Derive the tag name from the package name and version extracted from the
changelog instead.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 maintscripts/verify-release-ready | 33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

Comments

Stefan Bader Aug. 18, 2017, 1:13 p.m. UTC | #1
On 16.08.2017 16:27, Kleber Sacilotto de Souza wrote:
> We currently rely on 'debian-tag' config from debian/gbp.conf, however
> this value is not set correctly for all derivatives and backports.
> Derive the tag name from the package name and version extracted from the
> changelog instead.
> 
> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>

> ---
>  maintscripts/verify-release-ready | 33 +++++++++++----------------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
> 
> diff --git a/maintscripts/verify-release-ready b/maintscripts/verify-release-ready
> index 928fb544..3a4ccfd1 100755
> --- a/maintscripts/verify-release-ready
> +++ b/maintscripts/verify-release-ready
> @@ -12,7 +12,6 @@ from ktl.ubuntu                         import Ubuntu
>  from ktl.termcolor                      import colored
>  from launchpadlib.launchpad             import Launchpad
>  import re
> -import ConfigParser
>  
>  # AppError
>  #
> @@ -196,28 +195,18 @@ class VerifyReleaseReady():
>          # Construct the expected tag, and verify that it matches the
>          # latest commit tag
>          #
> -        config = ConfigParser.RawConfigParser()
> -        if config.read('debian/gbp.conf'):
> -            expect_tag_format = config.get('buildpackage', 'debian-tag')
> -
> -            # juergh: Derivatives have a different tag format, e.g., Ubuntu-raspi2-<version>
> -            pkg = cl1['package']
> -            if pkg.startswith('linux-') and not pkg.startswith('linux-lts-'):
> -                deriv = pkg[6:]   # strip 'linux-'
> -                expect_tag_format = expect_tag_format.replace('%(version)',
> -                                                              deriv + '-%(version)')
> -
> -            v = version
> -            # Starting with trusty, the lts backports closing commit and the tag
> -            # contain '~<series_version>' (e.g. '~14.04.1')
> -            if 'linux-lts-' in cl1['package']:
> -                v = cl1['version']
> -            expect_tag = expect_tag_format % {'version' : v}
> -            s.verify_tag(log, expect_tag)
> +        pkg = cl1['package']
> +        if pkg.startswith('linux-lts'):
> +            tag_prefix = 'Ubuntu-lts'
> +            v = cl1['version']
> +        elif pkg.startswith('linux-hwe'):
> +            tag_prefix = 'Ubuntu-hwe'
> +            v = cl1['version']
>          else:
> -            s.status('missing debian/gbp.conf', 'warning')
> -            if closed:
> -                s.verify_tag(log, expected_re)
> +            tag_prefix = pkg.replace('linux', 'Ubuntu')
> +            v = version
> +        expect_tag = "%s-%s" % (tag_prefix, v.replace('~', '_'))
> +        s.verify_tag(log, expect_tag)
>  
>          # Look to see if a tracking bug has been added to the changelog
>          #
>
Thadeu Lima de Souza Cascardo Aug. 29, 2017, 1:08 p.m. UTC | #2
On Wed, Aug 16, 2017 at 04:27:04PM +0200, Kleber Sacilotto de Souza wrote:
> We currently rely on 'debian-tag' config from debian/gbp.conf, however
> this value is not set correctly for all derivatives and backports.
> Derive the tag name from the package name and version extracted from the
> changelog instead.
> 
> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
> ---
>  maintscripts/verify-release-ready | 33 +++++++++++----------------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
> 
> diff --git a/maintscripts/verify-release-ready b/maintscripts/verify-release-ready
> index 928fb544..3a4ccfd1 100755
> --- a/maintscripts/verify-release-ready
> +++ b/maintscripts/verify-release-ready
> @@ -12,7 +12,6 @@ from ktl.ubuntu                         import Ubuntu
>  from ktl.termcolor                      import colored
>  from launchpadlib.launchpad             import Launchpad
>  import re
> -import ConfigParser
>  
>  # AppError
>  #
> @@ -196,28 +195,18 @@ class VerifyReleaseReady():
>          # Construct the expected tag, and verify that it matches the
>          # latest commit tag
>          #
> -        config = ConfigParser.RawConfigParser()
> -        if config.read('debian/gbp.conf'):
> -            expect_tag_format = config.get('buildpackage', 'debian-tag')
> -
> -            # juergh: Derivatives have a different tag format, e.g., Ubuntu-raspi2-<version>
> -            pkg = cl1['package']
> -            if pkg.startswith('linux-') and not pkg.startswith('linux-lts-'):
> -                deriv = pkg[6:]   # strip 'linux-'
> -                expect_tag_format = expect_tag_format.replace('%(version)',
> -                                                              deriv + '-%(version)')
> -
> -            v = version
> -            # Starting with trusty, the lts backports closing commit and the tag
> -            # contain '~<series_version>' (e.g. '~14.04.1')
> -            if 'linux-lts-' in cl1['package']:
> -                v = cl1['version']
> -            expect_tag = expect_tag_format % {'version' : v}
> -            s.verify_tag(log, expect_tag)
> +        pkg = cl1['package']
> +        if pkg.startswith('linux-lts'):
> +            tag_prefix = 'Ubuntu-lts'
> +            v = cl1['version']
> +        elif pkg.startswith('linux-hwe'):
> +            tag_prefix = 'Ubuntu-hwe'
> +            v = cl1['version']
>          else:
> -            s.status('missing debian/gbp.conf', 'warning')
> -            if closed:
> -                s.verify_tag(log, expected_re)
> +            tag_prefix = pkg.replace('linux', 'Ubuntu')
> +            v = version
> +        expect_tag = "%s-%s" % (tag_prefix, v.replace('~', '_'))

No need to do the replace here, as verify_tag already does it. But it
doesn't harm to have this here as well.

Aside from that, it's very similar to a previous patch of mine, and it
works with hwe-edge, which I guess was the only thing that my patch
didn't handle.

So,

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

> +        s.verify_tag(log, expect_tag)
>  
>          # Look to see if a tracking bug has been added to the changelog
>          #
> -- 
> 2.14.0
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Kleber Sacilotto de Souza Aug. 29, 2017, 1:18 p.m. UTC | #3
Applied to kteam-tools/master branch. Thanks.
diff mbox

Patch

diff --git a/maintscripts/verify-release-ready b/maintscripts/verify-release-ready
index 928fb544..3a4ccfd1 100755
--- a/maintscripts/verify-release-ready
+++ b/maintscripts/verify-release-ready
@@ -12,7 +12,6 @@  from ktl.ubuntu                         import Ubuntu
 from ktl.termcolor                      import colored
 from launchpadlib.launchpad             import Launchpad
 import re
-import ConfigParser
 
 # AppError
 #
@@ -196,28 +195,18 @@  class VerifyReleaseReady():
         # Construct the expected tag, and verify that it matches the
         # latest commit tag
         #
-        config = ConfigParser.RawConfigParser()
-        if config.read('debian/gbp.conf'):
-            expect_tag_format = config.get('buildpackage', 'debian-tag')
-
-            # juergh: Derivatives have a different tag format, e.g., Ubuntu-raspi2-<version>
-            pkg = cl1['package']
-            if pkg.startswith('linux-') and not pkg.startswith('linux-lts-'):
-                deriv = pkg[6:]   # strip 'linux-'
-                expect_tag_format = expect_tag_format.replace('%(version)',
-                                                              deriv + '-%(version)')
-
-            v = version
-            # Starting with trusty, the lts backports closing commit and the tag
-            # contain '~<series_version>' (e.g. '~14.04.1')
-            if 'linux-lts-' in cl1['package']:
-                v = cl1['version']
-            expect_tag = expect_tag_format % {'version' : v}
-            s.verify_tag(log, expect_tag)
+        pkg = cl1['package']
+        if pkg.startswith('linux-lts'):
+            tag_prefix = 'Ubuntu-lts'
+            v = cl1['version']
+        elif pkg.startswith('linux-hwe'):
+            tag_prefix = 'Ubuntu-hwe'
+            v = cl1['version']
         else:
-            s.status('missing debian/gbp.conf', 'warning')
-            if closed:
-                s.verify_tag(log, expected_re)
+            tag_prefix = pkg.replace('linux', 'Ubuntu')
+            v = version
+        expect_tag = "%s-%s" % (tag_prefix, v.replace('~', '_'))
+        s.verify_tag(log, expect_tag)
 
         # Look to see if a tracking bug has been added to the changelog
         #