Patchwork license.py: remove duplicate '&' or '|' from LICENSE

login
register
mail settings
Submitter Andrei Gherzan
Date Jan. 11, 2012, 12:45 p.m.
Message ID <1326285902-31525-1-git-send-email-andrei@gherzan.ro>
Download mbox | patch
Permalink /patch/19067/
State New
Headers show

Comments

Andrei Gherzan - Jan. 11, 2012, 12:45 p.m.
From: Andrei Gherzan <andrei.gherzan@windriver.com>

Some upstream layers (ex: meta-oe) use '&&' or '||' syntax in LICENSE
variable. Because of my last commit, these bbfiles are failing as LICENSE
is tested with oe.license where '&&' and '||' are the bug source.
The fix is to replace multiple characters of '&' or '|' with a single one.

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
---
 meta/lib/oe/license.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Paul Eggleton - Jan. 11, 2012, 1:56 p.m.
On Wednesday 11 January 2012 14:45:02 Andrei Gherzan wrote:
> Some upstream layers (ex: meta-oe) use '&&' or '||' syntax in LICENSE
> variable. Because of my last commit, these bbfiles are failing as LICENSE
> is tested with oe.license where '&&' and '||' are the bug source.
> The fix is to replace multiple characters of '&' or '|' with a single one.

Sorry to be a pain but could we not just fix those layers to use the accepted 
syntax? Doing so should be just a one-line find/sed command.

Cheers,
Paul
Andrei Gherzan - Jan. 11, 2012, 2:11 p.m.
On 01/11/2012 03:56 PM, Paul Eggleton wrote:
> On Wednesday 11 January 2012 14:45:02 Andrei Gherzan wrote:
>> Some upstream layers (ex: meta-oe) use '&&' or '||' syntax in LICENSE
>> variable. Because of my last commit, these bbfiles are failing as LICENSE
>> is tested with oe.license where '&&' and '||' are the bug source.
>> The fix is to replace multiple characters of '&' or '|' with a single one.
> Sorry to be a pain but could we not just fix those layers to use the accepted
> syntax? Doing so should be just a one-line find/sed command.
>
> Cheers,
> Paul
>
That'd be a solution as well but because those files were accepted this 
way until now i thought that this is an accepted syntax. More, this 
would scale and give a little freedom to the developers especially for 
those that are coming from "C" part or the world. (smile)

ag
Saul Wold - Jan. 12, 2012, 7:19 a.m.
On 01/11/2012 06:11 AM, Andrei Gherzan wrote:
> On 01/11/2012 03:56 PM, Paul Eggleton wrote:
>> On Wednesday 11 January 2012 14:45:02 Andrei Gherzan wrote:
>>> Some upstream layers (ex: meta-oe) use '&&' or '||' syntax in LICENSE
>>> variable. Because of my last commit, these bbfiles are failing as
>>> LICENSE
>>> is tested with oe.license where '&&' and '||' are the bug source.
>>> The fix is to replace multiple characters of '&' or '|' with a single
>>> one.
>> Sorry to be a pain but could we not just fix those layers to use the
>> accepted
>> syntax? Doing so should be just a one-line find/sed command.
>>
>> Cheers,
>> Paul
>>
> That'd be a solution as well but because those files were accepted this
> way until now i thought that this is an accepted syntax. More, this
> would scale and give a little freedom to the developers especially for
> those that are coming from "C" part or the world. (smile)
>
I think I agree with Paul here, Beth has sent out a proposal for that 
and by making a change here may allow the bad behavior to continue.

Sau!

> ag
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Andrei Gherzan - Jan. 12, 2012, 11:55 a.m.
On 01/12/2012 09:19 AM, Saul Wold wrote:
> I think I agree with Paul here, Beth has sent out a proposal for that 
> and by making a change here may allow the bad behavior to continue.
>
> Sau!

In this case we can drop this and the problem will remain (will have to 
be fixed) in meta-oe layers.

@g

Patch

diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 7ab66e7..5b8d47c 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -18,6 +18,7 @@  license_pattern = re.compile('[a-zA-Z0-9.+_\-]+$')
 class LicenseVisitor(ast.NodeVisitor):
     """Syntax tree visitor which can accept OpenEmbedded license strings"""
     def visit_string(self, licensestr):
+	licensestr = re.sub(r'([|&])\1+', r'\1', licensestr)
         new_elements = []
         elements = filter(lambda x: x.strip(), license_operator.split(licensestr))
         for pos, element in enumerate(elements):