diff options
author | Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> | 2012-09-11 04:13:45 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-12 15:13:42 +0100 |
commit | ed4836d319350e69052821d6a71682ee4b686c4b (patch) | |
tree | 13437da328773940a11243551d7195708de67314 /meta/classes | |
parent | 5dce00ff490792e9b20abeadc98753a12373ca27 (diff) | |
download | poky-ed4836d319350e69052821d6a71682ee4b686c4b.tar.gz |
classes/license: remove redundant nested if statements
Cosmetic change, which improves code perception. Also check for locale
packages firstly, this shall improve performance a little.
(From OE-Core rev: 100e457de4b223defb1a844d3b85af812caf2f79)
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/license.bbclass | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 021ab2ee17..8fb66be502 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -90,26 +90,32 @@ license_create_manifest() { | |||
90 | # not the best way to do this but licenses are not arch dependant iirc | 90 | # not the best way to do this but licenses are not arch dependant iirc |
91 | filename=`ls ${TMPDIR}/pkgdata/*/runtime-reverse/${pkg}| head -1` | 91 | filename=`ls ${TMPDIR}/pkgdata/*/runtime-reverse/${pkg}| head -1` |
92 | pkged_pn="$(sed -n 's/^PN: //p' ${filename})" | 92 | pkged_pn="$(sed -n 's/^PN: //p' ${filename})" |
93 | |||
94 | # exclude locale recipes | ||
95 | if [ "${pkged_pn}" = "*locale*" ]; then | ||
96 | continue | ||
97 | fi | ||
98 | |||
99 | # check to see if the package name exists in the manifest. if so, bail. | ||
100 | if grep -q "^PACKAGE NAME: ${pkg}" ${LICENSE_MANIFEST}; then | ||
101 | continue | ||
102 | fi | ||
103 | |||
93 | pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/ */ /g; p }' ${filename})" | 104 | pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/ */ /g; p }' ${filename})" |
94 | pkged_pv="$(sed -n 's/^PV: //p' ${filename})" | 105 | pkged_pv="$(sed -n 's/^PV: //p' ${filename})" |
95 | # check to see if the package name exists in the manifest. if so, bail. | 106 | |
96 | if ! grep -q "^PACKAGE NAME: ${pkg}" ${LICENSE_MANIFEST}; then | 107 | echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST} |
97 | # exclude local recipes | 108 | echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST} |
98 | if [ ! "${pkged_pn}" = "*locale*" ]; then | 109 | echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST} |
99 | echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST} | 110 | echo "LICENSE: " >> ${LICENSE_MANIFEST} |
100 | echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST} | 111 | for lic in ${pkged_lic}; do |
101 | echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST} | 112 | if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then |
102 | echo "LICENSE: " >> ${LICENSE_MANIFEST} | 113 | echo ${lic}|sed s'/generic_//'g >> ${LICENSE_MANIFEST} |
103 | for lic in ${pkged_lic}; do | 114 | else |
104 | if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then | 115 | echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn} >> ${LICENSE_MANIFEST} |
105 | echo ${lic}|sed s'/generic_//'g >> ${LICENSE_MANIFEST} | ||
106 | else | ||
107 | echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn} >> ${LICENSE_MANIFEST} | ||
108 | fi | ||
109 | done | ||
110 | echo "" >> ${LICENSE_MANIFEST} | ||
111 | fi | 116 | fi |
112 | fi | 117 | done |
118 | echo "" >> ${LICENSE_MANIFEST} | ||
113 | done | 119 | done |
114 | 120 | ||
115 | # Two options here: | 121 | # Two options here: |