Skip to contentSkip to conversation

License: dash fix, deb support and ast parse fix

PATCH Applied Beth Flanagan 2 participants 5 messages Dec 10, 2011

lore
Share & tools
lore
#0 lore raw

cover License: dash fix, deb support and ast parse fix

Three patches here, one of which requires 4a13766c7b223d.

- Fixed the bashism during license manifest creation.
- Add deb as a valid pkg type for manifest creation. This requires 4a137766c
- Handle LICENSE fields that ast chokes on nicer.

The following changes since commit af7fbd6083f4b5f1770e58fe0a2262951037c176:

connman: disable ntp support (2011-12-09 19:18:24 +0000)

are available in the git repository at:
git://git.yoctoproject.org/poky-contrib eflanagan/license_fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=eflanagan/license_fixes

Elizabeth Flanagan (3):
license.bbclass: remove bashism.
license.bbclass: remove deb exlusion
license/copyleft: exception for ast parse

 meta/classes/copyleft_compliance.bbclass |    2 +
 meta/classes/license.bbclass             |   54 +++++++++++++++---------------
 2 files changed, 29 insertions(+), 27 deletions(-)
#1 lore raw

PATCH 1/3 license.bbclass: remove bashism.

From: Elizabeth Flanagan <[email protected]>

bashism in create_license_manifest removed.

---
 meta/classes/license.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/license.bbclass +1 -1
index 8c64e4c..e520a4c 100644
@@ -88,7 +88,7 @@ license_create_manifest() {
                 # check to see if the package name exists in the manifest. if so, bail.
                 if ! grep -q "PACKAGE NAME: ${pkg}" ${filename}; then
                     # exclude local recipes
-                    if [ ! ${pkged_pn} == "*locale*" ]; then
+                    if [ ! "${pkged_pn}" = "*locale*" ]; then
                         echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
                         echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
                         echo "LICENSE: " >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/3 license.bbclass: remove deb exlusion

From: Elizabeth Flanagan <[email protected]>

This commit requires 4a13766c7b223d as it removes the exclusion of deb package types from license manifest creation.

---
 meta/classes/license.bbclass |   49 +++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 26 deletions(-)
meta/classes/license.bbclass +23 -26
index e520a4c..96fdb46 100644
@@ -77,34 +77,31 @@ license_create_manifest() {
     list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest
     INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest`
     # list of installed packages is broken for deb
-    if [ ${IMAGE_PKGTYPE} != "deb" ]; then
-
-        for pkg in ${INSTALLED_PKGS}; do
-            # not the best way to do this but licenses are not arch dependant iirc
-            files=`find ${TMPDIR}/pkgdata/*/runtime -name ${pkg}| head -1`
-            for filename in $files; do
-                pkged_pn="$(sed -n 's/^PN: //p' ${filename})"
-                pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/  */ /g; p }' ${filename})"
-                # check to see if the package name exists in the manifest. if so, bail.
-                if ! grep -q "PACKAGE NAME: ${pkg}" ${filename}; then
-                    # exclude local recipes
-                    if [ ! "${pkged_pn}" = "*locale*" ]; then
-                        echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
-                        echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
-                        echo "LICENSE: " >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
-                        for lic in ${pkged_lic}; do
-                            if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then
-                                echo ${lic}|sed s'/generic_//'g >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
-                            else
-                                echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn}>> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
-                            fi
-                        done
-                        echo "" >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
-                    fi
+    for pkg in ${INSTALLED_PKGS}; do
+        # not the best way to do this but licenses are not arch dependant iirc
+        files=`find ${TMPDIR}/pkgdata/*/runtime -name ${pkg}| head -1`
+        for filename in $files; do
+            pkged_pn="$(sed -n 's/^PN: //p' ${filename})"
+            pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/  */ /g; p }' ${filename})"
+            # check to see if the package name exists in the manifest. if so, bail.
+            if ! grep -q "PACKAGE NAME: ${pkg}" ${filename}; then
+                # exclude local recipes
+                if [ ! "${pkged_pn}" = "*locale*" ]; then
+                    echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+                    echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+                    echo "LICENSE: " >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+                    for lic in ${pkged_lic}; do
+                        if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then
+                            echo ${lic}|sed s'/generic_//'g >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+                        else
+                            echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn}>> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+                        fi
+                    done
+                    echo "" >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
                 fi
-            done
+            fi
         done
-    fi
+    done
 
     # Two options here:
     # - Just copy the manifest
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/3 license/copyleft: exception for ast parse

In reply to Beth Flanagan

From: Elizabeth Flanagan <[email protected]>

As the standard for LICENSE format is not well defined, we may well run into issues where LICENSE cannot be parsed via ast. In cases like this, we need to warn and continue.

---
 meta/classes/copyleft_compliance.bbclass |    2 ++
 meta/classes/license.bbclass             |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletions(-)
meta/classes/copyleft_compliance.bbclass +2 -0
index 5d9ab11..2fe524b 100644
@@ -48,6 +48,8 @@ def copyleft_should_include(d):
         licenses = oe.license.flattened_licenses(d.getVar('LICENSE', True), choose_licenses)
     except oe.license.InvalidLicense as exc:
         bb.fatal('%s: %s' % (d.getVar('PF', True), exc))
+    except SyntaxError:
+        bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF', True)))
 
     return all(include_license(lic) for lic in licenses)
 
meta/classes/license.bbclass +4 -1
index 96fdb46..4689aaf 100644
@@ -231,7 +231,10 @@ python do_populate_lic() {
     try:
         v.visit_string(license_types)
     except oe.license.InvalidLicense as exc:
-        bb.fatal("%s: %s" % (d.getVar('PF', True), exc))
+        bb.fatal('%s: %s' % (d.getVar('PF', True), exc))
+    except SyntaxError:
+        bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF', True)))
+
 }
 
 SSTATETASKS += "do_populate_lic"
Signature · 1 line
1.7.1
#4 lore raw
In reply to Beth Flanagan
Quoted 10 lines · Beth Flanagan

Three patches here, one of which requires 4a13766c7b223d.

- Fixed the bashism during license manifest creation.
- Add deb as a valid pkg type for manifest creation. This requires 4a137766c
- Handle LICENSE fields that ast chokes on nicer.

The following changes since commit af7fbd6083f4b5f1770e58fe0a2262951037c176:

connman: disable ntp support (2011-12-09 19:18:24 +0000)

Quoted 8 lines

are available in the git repository at:
git://git.yoctoproject.org/poky-contrib eflanagan/license_fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=eflanagan/license_fixes

Elizabeth Flanagan (3):
license.bbclass: remove bashism.
license.bbclass: remove deb exlusion
license/copyleft: exception for ast parse

Merged to master, thanks.

Richard