diff --git a/lmp/build.sh b/lmp/build.sh index d58f96c0..85df63e8 100755 --- a/lmp/build.sh +++ b/lmp/build.sh @@ -81,17 +81,38 @@ rm -f ${DEPLOY_DIR_IMAGE}/*.txt ## Only publish wic.gz rm -f ${DEPLOY_DIR_IMAGE}/*.wic +set -x + # Link the license manifest for all the images produced by the build -for img in ${DEPLOY_DIR_IMAGE}/*${MACHINE}.manifest; do +for img in ${DEPLOY_DIR_IMAGE}/*${MACHINE}*.manifest; do + status "Post-build processing (license)" + if [ "${DISTRO}" = "lmp-mfgtool" ]; then + status "Image manifest not exist in this distro, skipping" + break + fi + if ! [ -e "${img}" ]; then + status "Image manifest not found on ${DEPLOY_DIR_IMAGE}, license manifest can't be collected" + eixt 1 + fi + # only consider symbolic links + if ! [ -h "${img}" ]; then + continue + fi image_name=`basename ${img} | sed -e "s/.manifest//"` - image_name_id=`readlink ${img} | sed -e "s/\..*manifest//"` - if [ -f ${DEPLOY_DIR}/licenses/${image_name_id}/license.manifest ]; then - cp ${DEPLOY_DIR}/licenses/${image_name_id}/license.manifest ${DEPLOY_DIR_IMAGE}/${image_name_id}.license.manifest + image_path=`find ${DEPLOY_DIR}/licenses -name "${image_name}*" -type d` + image_name_id=`basename ${image_path}` + if [ -f ${image_path}/license.manifest ]; then + cp ${image_path}/license.manifest ${DEPLOY_DIR_IMAGE}/${image_name_id}.license.manifest ln -sf ${image_name_id}.license.manifest ${DEPLOY_DIR_IMAGE}/${image_name}.license.manifest + else + status "Image ${image_name} license manifest not found on ${DEPLOY_DIR}/licenses, license manifest can't be collected" + # FIXME: there is a bug in oe-core and sometimes the lic folder is empty + # https://bugzilla.yoctoproject.org/show_bug.cgi?id=15394 + #eixt 1 fi # Also take care of the image_license, which contains the binaries used by wic outside the rootfs - if [ -f ${DEPLOY_DIR}/licenses/${image_name_id}/image_license.manifest ]; then - cp ${DEPLOY_DIR}/licenses/${image_name_id}/image_license.manifest ${DEPLOY_DIR_IMAGE}/${image_name_id}.image_license.manifest + if [ -f ${image_path}/image_license.manifest ]; then + cp ${image_path}/image_license.manifest ${DEPLOY_DIR_IMAGE}/${image_name_id}.image_license.manifest ln -sf ${image_name_id}.image_license.manifest ${DEPLOY_DIR_IMAGE}/${image_name}.image_license.manifest fi done @@ -99,6 +120,7 @@ done # Generate a tarball containing the source code of *GPL* packages (based on yocto dev-manual) DEPLOY_SOURCES="${DEPLOY_DIR_IMAGE}/source-release" if [ -d ${DEPLOY_DIR}/sources ]; then + status "Post-build processing (source release)" mkdir -p ${DEPLOY_SOURCES} for sarch in ${DEPLOY_DIR}/sources/*; do for pkg in ${sarch}/*; do @@ -111,18 +133,18 @@ if [ -d ${DEPLOY_DIR}/sources ]; then grep -q "NAME: ${p}$" ${DEPLOY_DIR_IMAGE}/*.manifest || continue # Only archive GPL packages (update *GPL* regex for additional licenses) - numfiles=`ls ${DEPLOY_DIR}/licenses/${p}/*GPL* 2> /dev/null | wc -l` - if [ ${numfiles} -gt 0 ]; then - mkdir -p ${DEPLOY_SOURCES}/${p}/source - cp -f ${pkg}/* ${DEPLOY_SOURCES}/${p}/source 2> /dev/null - mkdir -p ${DEPLOY_SOURCES}/${p}/license - cp -f ${DEPLOY_DIR}/licenses/${p}/* ${DEPLOY_SOURCES}/${p}/license 2> /dev/null - fi + find ${DEPLOY_DIR}/licenses -name "*GPL*" -type f 2> /dev/null || continue + mkdir -p ${DEPLOY_SOURCES}/${p}/source + cp -f ${pkg}/* ${DEPLOY_SOURCES}/${p}/source 2> /dev/null + mkdir -p ${DEPLOY_SOURCES}/${p}/license + license=`find ${DEPLOY_DIR}/licenses -name "${p}" -type d` + cp -f ${license}/* ${DEPLOY_SOURCES}/${p}/license 2> /dev/null done done fi if [ -d "${archive}" ] ; then + status "Post-build processing (archive)" mkdir ${archive}/other mkdir ${archive}/sdk