All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] sanity.bbclass: support wildcards in SANITY_TESTED_DISTROS
@ 2014-02-28 15:00 Olof Johansson
  2014-02-28 15:28 ` Chris Larson
  0 siblings, 1 reply; 3+ messages in thread
From: Olof Johansson @ 2014-02-28 15:00 UTC (permalink / raw)
  To: openembedded-core

With this change, you can use wildcards for entries in
SANITY_TESTED_DISTROS. This makes it possible to say that, e.g. "all
Debian 7 Wheezy releases are supported" with the entry "Debian-7.*".

[YOCTO #5265]

Signed-off-by: Olof Johansson <olof.johansson@axis.com>
---
 meta/classes/sanity.bbclass | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index bae010d..59f663b 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -245,6 +245,15 @@ def check_connectivity(d):
 
     return retval
 
+def _distro_match_glob(distro, supported):
+    if not '*' in supported:
+        return distro == supported
+
+    bb.debug(2, "Glob matching found for %s. Trying to match against %s" % (
+        supported, distro))
+    prefix, sufix = supported.split('*', 1)
+    return distro.startswith(prefix) and distro.endswith(sufix)
+
 def check_supported_distro(sanity_data):
     tested_distros = sanity_data.getVar('SANITY_TESTED_DISTROS', True)
     if not tested_distros:
@@ -255,12 +264,15 @@ def check_supported_distro(sanity_data):
     except Exception:
         distro = None
 
-    if distro:
-        if distro not in [x.strip() for x in tested_distros.split('\\n')]:
-            bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro)
-    else:
+    if not distro:
         bb.warn('Host distribution could not be determined; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.')
 
+    for supported in [x.strip() for x in tested_distros.split('\\n')]:
+        if _distro_match_glob(distro, supported):
+            return
+
+    bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro)
+
 # Checks we should only make if MACHINE is set correctly
 def check_sanity_validmachine(sanity_data):
     messages = ""
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] sanity.bbclass: support wildcards in SANITY_TESTED_DISTROS
  2014-02-28 15:00 [RFC] sanity.bbclass: support wildcards in SANITY_TESTED_DISTROS Olof Johansson
@ 2014-02-28 15:28 ` Chris Larson
  2014-03-01 18:05   ` Olof Johansson
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Larson @ 2014-02-28 15:28 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

On Fri, Feb 28, 2014 at 8:00 AM, Olof Johansson <olof.johansson@axis.com>wrote:

> With this change, you can use wildcards for entries in
> SANITY_TESTED_DISTROS. This makes it possible to say that, e.g. "all
> Debian 7 Wheezy releases are supported" with the entry "Debian-7.*".
>
> [YOCTO #5265]
>
> Signed-off-by: Olof Johansson <olof.johansson@axis.com>
>

Out of curiosity, why not just use fnmatch for this implementation?
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1085 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] sanity.bbclass: support wildcards in SANITY_TESTED_DISTROS
  2014-02-28 15:28 ` Chris Larson
@ 2014-03-01 18:05   ` Olof Johansson
  0 siblings, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2014-03-01 18:05 UTC (permalink / raw)
  To: Chris Larson; +Cc: Patches and discussions about the oe-core layer

On 14-02-28 16:28 +0100, Chris Larson wrote:
> Out of curiosity, why not just use fnmatch for this
> implementation?

No reason. That would probably be far superior. I'll send a
revised patch some time early next week! Thanks!

-- 
olofjn


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-01 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-28 15:00 [RFC] sanity.bbclass: support wildcards in SANITY_TESTED_DISTROS Olof Johansson
2014-02-28 15:28 ` Chris Larson
2014-03-01 18:05   ` Olof Johansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.