From: Markus Niebel <[email protected]>

It would be good to have the possibility to extract license texts for
target packages. This would add a benefit to ptxdist since it makes
auditing a BSP easier.

This patch adds

- a new (optional) variable to package rule file to encode the
  license file(s) for this package
- set a pkg var with the value new var from the package rule
  or use default list of filenames
- copy the license text files in the targetinstall.post stage to
  a directory under $PTXDIST_PLATFORMDIR/<pkg>-<pkg_version>

Signed-off-by: Markus Niebel <[email protected]>
---
 rules/post/ptxd_make_world_common.make |  1 +
 scripts/lib/ptxd_make_xpkg_common.sh   |  3 +++
 scripts/lib/ptxd_make_xpkg_finish.sh   | 11 +++++++++++
 3 files changed, 15 insertions(+)

diff --git a/rules/post/ptxd_make_world_common.make 
b/rules/post/ptxd_make_world_common.make
index 4820d8c..01d2c88 100644
--- a/rules/post/ptxd_make_world_common.make
+++ b/rules/post/ptxd_make_world_common.make
@@ -55,6 +55,7 @@ world/env/impl = \
        pkg_pkg_dir="$(call ptx/escape,$($(1)_PKGDIR))"                         
\
        pkg_pkg_dev="$(call ptx/escape,$($(1)_DEVPKG))"                         
\
        pkg_license="$(call ptx/escape,$($(1)_LICENSE))"                        
\
+       pkg_license_text="$(call ptx/escape,$($(1)_LICENSE_TEXT))"      \
        pkg_build_deps="$(call ptx/escape,$(PTX_MAP_B_dep_$(1)))"               
\
        pkg_run_deps="$(call ptx/escape,$(PTX_MAP_R_dep_$(1)))"                 
\
                                                                                
\
diff --git a/scripts/lib/ptxd_make_xpkg_common.sh 
b/scripts/lib/ptxd_make_xpkg_common.sh
index 279348f..90501eb 100644
--- a/scripts/lib/ptxd_make_xpkg_common.sh
+++ b/scripts/lib/ptxd_make_xpkg_common.sh
@@ -87,6 +87,9 @@ ptxd_make_xpkg_init() {
     pkg_license="${pkg_license:-unknown}"
     pkg_xpkg_license="${pkg_xpkg_license:-${pkg_license}}"
     pkg_xpkg_license_file="${ptx_state_dir}/${pkg_xpkg}.license"
+    pkg_license_text="${pkg_license_text:-COPYING COPYING3 COPYING.LIB 
COPYING3.LIB}"
+    pkg_xpkg_license_text="${pkg_xpkg_license_text:-${pkg_license_text}}"
+    
pkg_xpkg_license_dir="${PTXDIST_PLATFORMDIR}/licenses/${pkg_xpkg}-${pkg_xpkg_version}"
 
     # packaging stuff
     pkg_xpkg_install_deps="${ptx_state_dir}/${pkg_xpkg}.deps"
diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh 
b/scripts/lib/ptxd_make_xpkg_finish.sh
index e56be89..ec28710 100644
--- a/scripts/lib/ptxd_make_xpkg_finish.sh
+++ b/scripts/lib/ptxd_make_xpkg_finish.sh
@@ -63,6 +63,17 @@ EOF
     #
     echo -n "xpkg_finish:      collecting license (${pkg_xpkg_license}) ... "
     echo "${pkg_xpkg_license}" > "${pkg_xpkg_license_file}"
+    #
+    # create a package specific dir to store the license information
+    #
+    mkdir -p "${pkg_xpkg_license_dir}"
+    cp "${pkg_xpkg_license_file}" "${pkg_xpkg_license_dir}/license"
+    for f in ${pkg_xpkg_license_text}
+    do
+        if [ -f "${pkg_dir}/${f}" ]; then
+            cp "${pkg_dir}/${f}" "${pkg_xpkg_license_dir}"
+        fi
+    done
     echo "done."
 
     #
-- 
2.2.1


-- 
ptxdist mailing list
[email protected]

Reply via email to