Patchwork [1/6] classes/license: define LICENSE_MANIFEST variable

login
register
mail settings
Submitter Vladimir Zapolskiy
Date Sept. 11, 2012, 1:13 a.m.
Message ID <1347326028-32469-2-git-send-email-vladimir_zapolskiy@mentor.com>
Download mbox | patch
Permalink /patch/36245/
State Accepted
Commit 0ac50f848cf0f897333cff9340976519fc95fdc4
Headers show

Comments

Vladimir Zapolskiy - Sept. 11, 2012, 1:13 a.m.
Cosmetic change, saves space and reduces code line length.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 meta/classes/license.bbclass |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Patch

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 432e580..0335f41 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -80,9 +80,10 @@  license_create_manifest() {
 	# Get list of installed packages
 	list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest
 	INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest`
+	LICENSE_MANIFEST="${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest"
 	# remove existing license.manifest file
-	if [ -f ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ]; then
-		rm ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+	if [ -f ${LICENSE_MANIFEST} ]; then
+		rm ${LICENSE_MANIFEST}
 	fi
 	# list of installed packages is broken for deb
 	for pkg in ${INSTALLED_PKGS}; do
@@ -95,18 +96,18 @@  license_create_manifest() {
 		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 "PACKAGE VERSION:" ${pkged_pv} >> ${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
+				echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST}
+				echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST}
+				echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST}
+				echo "LICENSE: " >> ${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
+						echo ${lic}|sed s'/generic_//'g >> ${LICENSE_MANIFEST}
 					else
-						echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn}>> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+						echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn} >> ${LICENSE_MANIFEST}
 					fi
 				done
-				echo "" >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest
+				echo "" >> ${LICENSE_MANIFEST}
 			fi
 		fi
 	done
@@ -117,7 +118,7 @@  license_create_manifest() {
 	# With both options set we see a .5 M increase in core-image-minimal
 	if [ -n "${COPY_LIC_MANIFEST}" ]; then
 		mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/
-		cp ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ${IMAGE_ROOTFS}/usr/share/common-licenses/license.manifest
+		cp ${LICENSE_MANIFEST} ${IMAGE_ROOTFS}/usr/share/common-licenses/license.manifest
 		if [ -n "${COPY_LIC_DIRS}" ]; then
 			for pkg in ${INSTALLED_PKGS}; do
 				mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}