diff mbox series

[RFC] ktl/ubuntu.py: fix series lookup for custom backports

Message ID 20171013075533.8502-1-juerg.haefliger@canonical.com
State New
Headers show
Series [RFC] ktl/ubuntu.py: fix series lookup for custom backports | expand

Commit Message

Juerg Haefliger Oct. 13, 2017, 7:55 a.m. UTC
Currently, only linux-azure is checked against the list of backports.
Relax that check and compare all packages against the list of backports,
and if found, return its target series.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 ktl/ubuntu.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

Juerg Haefliger Oct. 13, 2017, 7:59 a.m. UTC | #1
This fixes the verify-release-ready release check for linux-aws and
linux-gcp. But the generic checking of all packages against the list of
backports concerns me a little. Can we have backport packages with the
same name in different series? Specifically, there is a linux-aws
derivative in xenial and a linux-aws xenial backport for trusty.

On the other hand, modifying verify-release-ready every time we add
another of these custom thingies isn't the best thing to do.

...Juerg


On 10/13/2017 09:55 AM, Juerg Haefliger wrote:
> Currently, only linux-azure is checked against the list of backports.
> Relax that check and compare all packages against the list of backports,
> and if found, return its target series.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  ktl/ubuntu.py | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/ktl/ubuntu.py b/ktl/ubuntu.py
> index 884ed9765605..0bc2aa182125 100644
> --- a/ktl/ubuntu.py
> +++ b/ktl/ubuntu.py
> @@ -234,16 +234,15 @@ class Ubuntu:
>                          retval = entry['name']
>                          series_version = entry['series_version']
>  
> -            # linux-azure is a backport that doesn't contain the 'upstream'
> -            # series number on the package name, so we need to look for it
> -            # first and then look for the target series.
> -            if package.startswith('linux-azure'):
> -                for entry in self.db.values():
> -                    try:
> -                        if len(set(['linux', series_version]) & set(entry['backport-packages'][package])) == 2:
> -                            retval = entry['name']
> -                    except KeyError:
> -                        pass
> +            # Check if the package is a 'custom' backport and if so, return
> +            # its target series name
> +            for entry in self.db.values():
> +                try:
> +                    if entry['backport-packages'][package] == ['linux', series_version]:
> +                        retval = entry['name']
> +                        break
> +                except KeyError:
> +                    pass
>  
>          return retval
>  
>
Stefan Bader Oct. 17, 2017, 9:05 a.m. UTC | #2
On 13.10.2017 09:59, Juerg Haefliger wrote:
> This fixes the verify-release-ready release check for linux-aws and
> linux-gcp. But the generic checking of all packages against the list of
> backports concerns me a little. Can we have backport packages with the
> same name in different series? Specifically, there is a linux-aws
> derivative in xenial and a linux-aws xenial backport for trusty.

Hm, to me this sounds like you answered your question right after asking it. But
I guess from the code, the question is probably "is it ok". I think in this
case, yes as long as both linux-aws packages are backports and if the returned
series would not matter.

I am not sure, does this check iterate over the whole db or "just" over the keys
of one series? Probably all, so returned name would be rather a list. I see that
we soon get the problem with hwe/hwe-edge once there is the next LTS and we
stick to the naming...

-Stefan
> 
> On the other hand, modifying verify-release-ready every time we add
> another of these custom thingies isn't the best thing to do.
> 
> ...Juerg
> 
> 
> On 10/13/2017 09:55 AM, Juerg Haefliger wrote:
>> Currently, only linux-azure is checked against the list of backports.
>> Relax that check and compare all packages against the list of backports,
>> and if found, return its target series.
>>
>> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
>> ---
>>  ktl/ubuntu.py | 19 +++++++++----------
>>  1 file changed, 9 insertions(+), 10 deletions(-)
>>
>> diff --git a/ktl/ubuntu.py b/ktl/ubuntu.py
>> index 884ed9765605..0bc2aa182125 100644
>> --- a/ktl/ubuntu.py
>> +++ b/ktl/ubuntu.py
>> @@ -234,16 +234,15 @@ class Ubuntu:
>>                          retval = entry['name']
>>                          series_version = entry['series_version']
>>  
>> -            # linux-azure is a backport that doesn't contain the 'upstream'
>> -            # series number on the package name, so we need to look for it
>> -            # first and then look for the target series.
>> -            if package.startswith('linux-azure'):
>> -                for entry in self.db.values():
>> -                    try:
>> -                        if len(set(['linux', series_version]) & set(entry['backport-packages'][package])) == 2:
>> -                            retval = entry['name']
>> -                    except KeyError:
>> -                        pass
>> +            # Check if the package is a 'custom' backport and if so, return
>> +            # its target series name
>> +            for entry in self.db.values():
>> +                try:
>> +                    if entry['backport-packages'][package] == ['linux', series_version]:
>> +                        retval = entry['name']
>> +                        break
>> +                except KeyError:
>> +                    pass
>>  
>>          return retval
>>  
>>
> 
> 
>
diff mbox series

Patch

diff --git a/ktl/ubuntu.py b/ktl/ubuntu.py
index 884ed9765605..0bc2aa182125 100644
--- a/ktl/ubuntu.py
+++ b/ktl/ubuntu.py
@@ -234,16 +234,15 @@  class Ubuntu:
                         retval = entry['name']
                         series_version = entry['series_version']
 
-            # linux-azure is a backport that doesn't contain the 'upstream'
-            # series number on the package name, so we need to look for it
-            # first and then look for the target series.
-            if package.startswith('linux-azure'):
-                for entry in self.db.values():
-                    try:
-                        if len(set(['linux', series_version]) & set(entry['backport-packages'][package])) == 2:
-                            retval = entry['name']
-                    except KeyError:
-                        pass
+            # Check if the package is a 'custom' backport and if so, return
+            # its target series name
+            for entry in self.db.values():
+                try:
+                    if entry['backport-packages'][package] == ['linux', series_version]:
+                        retval = entry['name']
+                        break
+                except KeyError:
+                    pass
 
         return retval