Skip to contentSkip to conversation

sanity.bbclass: Add sanity check that TUNE_PKGARCH appears in PACKAGE_ARCHS

PATCH In review Kumar Gala 2 participants 6 messages Jul 29, 2011 – Aug 2, 2011

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 sanity.bbclass: Add sanity check that TUNE_PKGARCH appears in PACKAGE_ARCHS

Its possible we get duplications if we explicity add TUNE_PKGARCH to PACKAGE_ARCHS so instead just add a sanity check to verify it.

---
 meta/classes/sanity.bbclass |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
meta/classes/sanity.bbclass +9 -1
index b054146..999e15d 100644
@@ -375,8 +375,10 @@ def check_sanity(e):
     elif oeroot.find (' ') != -1:
         messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS
+    # Check that we don't have duplicate entries in PACKAGE_ARCHS & that TUNE_PKGARCH is in PACKAGE_ARCHS
     pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True)
+    tunepkg = data.getVar('TUNE_PKGARCH', e.data, True)
+    tunefound = False
     seen = {}
     dups = []
 
@@ -385,9 +387,15 @@ def check_sanity(e):
 	    dups.append(pa)
 	else:
 	    seen[pa] = 1
+	if pa == tunepkg:
+	    tunefound = True
+
     if len(dups):
        messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
 
+    if tunefound == False:
+       messages = messages + "Error, the PACKAGE_ARCHS variable does not contain TUNE_PKGARCH (%s)." % tunepkg
+
     if messages != "":
         raise_sanity_error(messages)
 
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 25 lines · Kumar Gala

Its possible we get duplications if we explicity add TUNE_PKGARCH to PACKAGE_ARCHS so instead just add a sanity check to verify it.

---
  meta/classes/sanity.bbclass |   10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)
meta/classes/sanity.bbclass +3 -1
index b054146..999e15d 100644
@@ -375,8 +375,10 @@ def check_sanity(e):
      elif oeroot.find (' ') != -1:
          messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS
+    # Check that we don't have duplicate entries in PACKAGE_ARCHS&  that TUNE_PKGARCH is in PACKAGE_ARCHS
      pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True)
+    tunepkg = data.getVar('TUNE_PKGARCH', e.data, True)
+    tunefound = False
      seen = {}
      dups = []
 

meta/classes/sanity.bbclass def check_sanity(e): · line 395

Quoted 9 lines
meta/classes/sanity.bbclass +3 -0
@@ -385,9 +387,15 @@ def check_sanity(e):
  	    dups.append(pa)
  	else:
  	    seen[pa] = 1
+	if pa == tunepkg:
+	    tunefound = True
+
      if len(dups):
         messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
 

Kumar,

Thanks for the patch, some questions.

Is this correct, do you still want to report the error, if there is a dup?

Would it not just be better to just drop the dup if it is the TUNE_PKGARCH?

Sau!

Quoted 6 lines
meta/classes/sanity.bbclass +3 -0
+    if tunefound == False:
+       messages = messages + "Error, the PACKAGE_ARCHS variable does not contain TUNE_PKGARCH (%s)." % tunepkg
+
      if messages != "":
          raise_sanity_error(messages)
 
author
#2 lore raw
Quoted 37 lines · Saul Wold
Quoted 25 lines · Kumar Gala

Its possible we get duplications if we explicity add TUNE_PKGARCH to PACKAGE_ARCHS so instead just add a sanity check to verify it.

---
 meta/classes/sanity.bbclass |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
meta/classes/sanity.bbclass +3 -1
index b054146..999e15d 100644
@@ -375,8 +375,10 @@ def check_sanity(e):
     elif oeroot.find (' ') != -1:
         messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS
+    # Check that we don't have duplicate entries in PACKAGE_ARCHS&  that TUNE_PKGARCH is in PACKAGE_ARCHS
     pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True)
+    tunepkg = data.getVar('TUNE_PKGARCH', e.data, True)
+    tunefound = False
     seen = {}
     dups = []
 

meta/classes/sanity.bbclass def check_sanity(e): · line 395

Quoted 9 lines
meta/classes/sanity.bbclass +3 -0
@@ -385,9 +387,15 @@ def check_sanity(e):
 	    dups.append(pa)
 	else:
 	    seen[pa] = 1
+	if pa == tunepkg:
+	    tunefound = True
+
     if len(dups):
        messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
 

Kumar,

Quoted 5 lines

Thanks for the patch, some questions.

Is this correct, do you still want to report the error, if there is a dup?

Would it not just be better to just drop the dup if it is the TUNE_PKGARCH?

I wasn't sure how to drop the dup. :)

If there is a way to uniq PACKAGE_ARCHS that would be fine

- k

#3 lore raw
Quoted 42 lines · Kumar Gala
Quoted 39 lines · Saul Wold
Quoted 25 lines · Kumar Gala

Its possible we get duplications if we explicity add TUNE_PKGARCH to PACKAGE_ARCHS so instead just add a sanity check to verify it.

---
  meta/classes/sanity.bbclass |   10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)
meta/classes/sanity.bbclass +3 -1
index b054146..999e15d 100644
@@ -375,8 +375,10 @@ def check_sanity(e):
      elif oeroot.find (' ') != -1:
          messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS
+    # Check that we don't have duplicate entries in PACKAGE_ARCHS&   that TUNE_PKGARCH is in PACKAGE_ARCHS
      pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True)
+    tunepkg = data.getVar('TUNE_PKGARCH', e.data, True)
+    tunefound = False
      seen = {}
      dups = []
 

meta/classes/sanity.bbclass def check_sanity(e): · line 395

Quoted 9 lines
meta/classes/sanity.bbclass +3 -0
@@ -385,9 +387,15 @@ def check_sanity(e):
  	    dups.append(pa)
  	else:
  	    seen[pa] = 1
+	if pa == tunepkg:
+	    tunefound = True
+
      if len(dups):
         messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
 

Kumar,

Thanks for the patch, some questions.

Quoted 8 lines
Quoted 3 lines

Is this correct, do you still want to report the error, if there is a dup?

Would it not just be better to just drop the dup if it is the TUNE_PKGARCH?

I wasn't sure how to drop the dup. :)

If there is a way to uniq PACKAGE_ARCHS that would be fine

Would this be what your looking for, it "uniq"s only the tunepkg value.

- if seen.get(pa, 0) == 1:
+ if pa == tunepkg:
+ tunefound = True
+ if seen.get(pa, 0) == 1:
+ pkgarchs.remove(pa)
+ elif seen.get(pa, 0) == 1:

            dups.append(pa)
        else:
            seen[pa] = 1

- if pa == tunepkg:
- tunefound = True

Quoted 1 line

- k

author
#4 lore raw
Quoted 54 lines · Saul Wold
Quoted 42 lines · Kumar Gala
Quoted 39 lines · Saul Wold
Quoted 25 lines · Kumar Gala

Its possible we get duplications if we explicity add TUNE_PKGARCH to PACKAGE_ARCHS so instead just add a sanity check to verify it.

---
 meta/classes/sanity.bbclass |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
meta/classes/sanity.bbclass +3 -1
index b054146..999e15d 100644
@@ -375,8 +375,10 @@ def check_sanity(e):
     elif oeroot.find (' ') != -1:
         messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS
+    # Check that we don't have duplicate entries in PACKAGE_ARCHS&   that TUNE_PKGARCH is in PACKAGE_ARCHS
     pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True)
+    tunepkg = data.getVar('TUNE_PKGARCH', e.data, True)
+    tunefound = False
     seen = {}
     dups = []
 

meta/classes/sanity.bbclass def check_sanity(e): · line 395

Quoted 9 lines
meta/classes/sanity.bbclass +3 -0
@@ -385,9 +387,15 @@ def check_sanity(e):
 	    dups.append(pa)
 	else:
 	    seen[pa] = 1
+	if pa == tunepkg:
+	    tunefound = True
+
     if len(dups):
        messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
 

Kumar,

Thanks for the patch, some questions.

Quoted 8 lines
Quoted 3 lines

Is this correct, do you still want to report the error, if there is a dup?

Would it not just be better to just drop the dup if it is the TUNE_PKGARCH?

I wasn't sure how to drop the dup. :)

If there is a way to uniq PACKAGE_ARCHS that would be fine

Would this be what your looking for, it "uniq"s only the tunepkg value.

(quoted diff) +0 -1
-       if seen.get(pa, 0) == 1:

Review

Quoted 10 lines
(quoted diff) +5 -2
+       if pa == tunepkg:
+           tunefound = True
+            if seen.get(pa, 0) == 1:
+                pkgarchs.remove(pa)
+       elif seen.get(pa, 0) == 1:
           dups.append(pa)
       else:
           seen[pa] = 1
-       if pa == tunepkg:
-           tunefound = True

No, I don't thing that's right. TUNE_PKGARCH is a singleton. The other check was to make sure that we didn't have ANY duplicates in PACKAGE_ARCHS. I think that is still valid as the code stands.

- k

#5 lore raw
In reply to Kumar Gala
Quoted 30 lines · Kumar Gala

Its possible we get duplications if we explicity add TUNE_PKGARCH to PACKAGE_ARCHS so instead just add a sanity check to verify it.

---
  meta/classes/sanity.bbclass |   10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)
meta/classes/sanity.bbclass +5 -1
index b054146..999e15d 100644
@@ -375,8 +375,10 @@ def check_sanity(e):
      elif oeroot.find (' ') != -1:
          messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
-    # Check that we don't have duplicate entries in PACKAGE_ARCHS
+    # Check that we don't have duplicate entries in PACKAGE_ARCHS&  that TUNE_PKGARCH is in PACKAGE_ARCHS
      pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True)
+    tunepkg = data.getVar('TUNE_PKGARCH', e.data, True)
+    tunefound = False
      seen = {}
      dups = []
 
@@ -385,9 +387,15 @@ def check_sanity(e):
  	    dups.append(pa)
  	else:
  	    seen[pa] = 1
+	if pa == tunepkg:
+	    tunefound = True

meta/classes/sanity.bbclass def check_sanity(e): · line 401

Quoted 10 lines
meta/classes/sanity.bbclass +4 -0
+
      if len(dups):
         messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
 
+    if tunefound == False:
+       messages = messages + "Error, the PACKAGE_ARCHS variable does not contain TUNE_PKGARCH (%s)." % tunepkg
+
      if messages != "":
          raise_sanity_error(messages)
 

Merged as is into OE-Core, we still want to check for duplicates since it means something else might be wrong.

Thanks
Sau!