Patchwork archiver.bbclass: DISTRO is not required variable so deal with it

login
register
mail settings
Submitter Marcin Juszkiewicz
Date Nov. 22, 2012, 9:19 a.m.
Message ID <1353575950-7484-1-git-send-email-marcin.juszkiewicz@linaro.org>
Download mbox | patch
Permalink /patch/39461/
State New
Headers show

Comments

Marcin Juszkiewicz - Nov. 22, 2012, 9:19 a.m.
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 meta/classes/archiver.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Paul Eggleton - Nov. 22, 2012, 10:06 a.m.
On Thursday 22 November 2012 10:19:10 Marcin Juszkiewicz wrote:
> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> ---
>  meta/classes/archiver.bbclass | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index 160a3aa..ac6e401 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -8,7 +8,6 @@
> 
>  ARCHIVE_EXCLUDE_FROM ?= ".pc autom4te.cache"
>  ARCHIVE_TYPE ?= "tar srpm"
> -DISTRO ?= "poky"
>  PATCHES_ARCHIVE_WITH_SERIES = 'yes'
>  SOURCE_ARCHIVE_LOG_WITH_SCRIPTS ?= '${@d.getVarFlag('ARCHIVER_MODE',
> 'log_type') \ if d.getVarFlag('ARCHIVER_MODE', 'log_type') != 'none' else
> 'logs_with_scripts'}' @@ -492,6 +491,8 @@ def create_diff_gz(d):
> 
>      s=d.getVar('S', True)
>      distro = d.getVar('DISTRO',True)
> +    if not distro:
> +        distro = ""
>      dest = s + '/' + distro + '/files'
>      if not os.path.exists(dest):
>          bb.mkdirhier(dest)

A more pythonic way to deal with this (as used elsewhere) would be:

distro = d.getVar('DISTRO',True) or ""

Cheers,
Paul

Patch

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 160a3aa..ac6e401 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -8,7 +8,6 @@ 
 
 ARCHIVE_EXCLUDE_FROM ?= ".pc autom4te.cache"
 ARCHIVE_TYPE ?= "tar srpm"
-DISTRO ?= "poky"
 PATCHES_ARCHIVE_WITH_SERIES = 'yes'
 SOURCE_ARCHIVE_LOG_WITH_SCRIPTS ?= '${@d.getVarFlag('ARCHIVER_MODE', 'log_type') \
     if d.getVarFlag('ARCHIVER_MODE', 'log_type') != 'none' else 'logs_with_scripts'}'
@@ -492,6 +491,8 @@  def create_diff_gz(d):
 
     s=d.getVar('S', True)
     distro = d.getVar('DISTRO',True)
+    if not distro:
+        distro = ""
     dest = s + '/' + distro + '/files'
     if not os.path.exists(dest):
         bb.mkdirhier(dest)