diff options
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index eab630e47b..394a6d4480 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -75,63 +75,63 @@ SPDXLICENSEMAP[AFLv1] = "AFL-1.2" | |||
75 | SPDXLICENSEMAP[EPLv1.0] = "EPL-1.0" | 75 | SPDXLICENSEMAP[EPLv1.0] = "EPL-1.0" |
76 | 76 | ||
77 | license_create_manifest() { | 77 | license_create_manifest() { |
78 | mkdir -p ${LICENSE_DIRECTORY}/${IMAGE_NAME} | 78 | mkdir -p ${LICENSE_DIRECTORY}/${IMAGE_NAME} |
79 | # Get list of installed packages | 79 | # Get list of installed packages |
80 | list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest | 80 | list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest |
81 | INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest` | 81 | INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest` |
82 | # list of installed packages is broken for deb | 82 | # list of installed packages is broken for deb |
83 | for pkg in ${INSTALLED_PKGS}; do | 83 | for pkg in ${INSTALLED_PKGS}; do |
84 | # not the best way to do this but licenses are not arch dependant iirc | 84 | # not the best way to do this but licenses are not arch dependant iirc |
85 | files=`find ${TMPDIR}/pkgdata/*/runtime -name ${pkg}| head -1` | 85 | files=`find ${TMPDIR}/pkgdata/*/runtime -name ${pkg}| head -1` |
86 | for filename in $files; do | 86 | for filename in $files; do |
87 | pkged_pn="$(sed -n 's/^PN: //p' ${filename})" | 87 | pkged_pn="$(sed -n 's/^PN: //p' ${filename})" |
88 | pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/ */ /g; p }' ${filename})" | 88 | pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/ */ /g; p }' ${filename})" |
89 | # check to see if the package name exists in the manifest. if so, bail. | 89 | # check to see if the package name exists in the manifest. if so, bail. |
90 | if ! grep -q "PACKAGE NAME: ${pkg}" ${filename}; then | 90 | if ! grep -q "PACKAGE NAME: ${pkg}" ${filename}; then |
91 | # exclude local recipes | 91 | # exclude local recipes |
92 | if [ ! "${pkged_pn}" = "*locale*" ]; then | 92 | if [ ! "${pkged_pn}" = "*locale*" ]; then |
93 | echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest | 93 | echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest |
94 | echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest | 94 | echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest |
95 | echo "LICENSE: " >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest | 95 | echo "LICENSE: " >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest |
96 | for lic in ${pkged_lic}; do | 96 | for lic in ${pkged_lic}; do |
97 | if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then | 97 | if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then |
98 | echo ${lic}|sed s'/generic_//'g >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest | 98 | echo ${lic}|sed s'/generic_//'g >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest |
99 | else | 99 | else |
100 | echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn}>> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest | 100 | echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn}>> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest |
101 | fi | 101 | fi |
102 | done | 102 | done |
103 | echo "" >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest | 103 | echo "" >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest |
104 | fi | 104 | fi |
105 | fi | 105 | fi |
106 | done | 106 | done |
107 | done | 107 | done |
108 | 108 | ||
109 | # Two options here: | 109 | # Two options here: |
110 | # - Just copy the manifest | 110 | # - Just copy the manifest |
111 | # - Copy the manifest and the license directories | 111 | # - Copy the manifest and the license directories |
112 | # With both options set we see a .5 M increase in core-image-minimal | 112 | # With both options set we see a .5 M increase in core-image-minimal |
113 | if [ -n "${COPY_LIC_MANIFEST}" ]; then | 113 | if [ -n "${COPY_LIC_MANIFEST}" ]; then |
114 | mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/ | 114 | mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/ |
115 | cp ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ${IMAGE_ROOTFS}/usr/share/common-licenses/license.manifest | 115 | cp ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ${IMAGE_ROOTFS}/usr/share/common-licenses/license.manifest |
116 | if [ -n "${COPY_LIC_DIRS}" ]; then | 116 | if [ -n "${COPY_LIC_DIRS}" ]; then |
117 | for pkg in ${INSTALLED_PKGS}; do | 117 | for pkg in ${INSTALLED_PKGS}; do |
118 | mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} | 118 | mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} |
119 | for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do | 119 | for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do |
120 | # Really don't need to copy the generics as they're | 120 | # Really don't need to copy the generics as they're |
121 | # represented in the manifest and in the actual pkg licenses | 121 | # represented in the manifest and in the actual pkg licenses |
122 | # Doing so would make your image quite a bit larger | 122 | # Doing so would make your image quite a bit larger |
123 | if [[ "${lic}" != "generic_"* ]]; then | 123 | if [[ "${lic}" != "generic_"* ]]; then |
124 | cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} | 124 | cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} |
125 | elif [[ "${lic}" == "generic_"* ]]; then | 125 | elif [[ "${lic}" == "generic_"* ]]; then |
126 | if [ ! -f ${IMAGE_ROOTFS}/usr/share/common-licenses/${lic} ]; then | 126 | if [ ! -f ${IMAGE_ROOTFS}/usr/share/common-licenses/${lic} ]; then |
127 | cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/ | 127 | cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/ |
128 | fi | 128 | fi |
129 | ln -s ../${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} | 129 | ln -s ../${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} |
130 | fi | 130 | fi |
131 | done | 131 | done |
132 | done | 132 | done |
133 | fi | 133 | fi |
134 | fi | 134 | fi |
135 | 135 | ||
136 | } | 136 | } |
137 | 137 | ||