tizen: Scan for licences to be shipped in package
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 6 Oct 2016 09:29:15 +0000 (11:29 +0200)
committerZiran Sun <ziran.sun@samsung.com>
Wed, 12 Oct 2016 14:54:38 +0000 (14:54 +0000)
It's important to have this generated at buildtime,
 specially if tree is patched with missing dependencies,
 like those mentionned at:

 https://wiki.iotivity.org/build

Change-Id: Ie8d9dc0685ddc2df37545e92da4a662ee496bd07
Credit-to: Jaehong Jo <jaehong.jo@samsung.com>
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8177
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
tools/tizen/iotivity.spec

index 91e7c29..16b8a74 100644 (file)
@@ -80,7 +80,24 @@ developing applications that use %{name}.
 %setup -q
 chmod g-w %_sourcedir/*
 
-cp LICENSE.md LICENSE.APLv2
+find . \
+     -iname "LICEN*E*"  \
+     -o -name "*BSD*" \
+     -o -name "*COPYING*" \
+     -o -name "*GPL*" \
+     -o -name "*MIT*" \
+     | sort | uniq \
+     | while read file ; do \
+          dir=$(dirname -- "$file")
+          echo "Files: ${dir}/*"
+          echo "License: ${file}"
+          sed 's/^/ /' "${file}"
+          echo ""
+          echo ""
+     done > tmp.tmp && mv tmp.tmp LICENSE
+
+cat LICENSE
+
 cp %{SOURCE1001} .
 %if 0%{?tizen_version_major} < 3
 cp %{SOURCE1002} .
@@ -181,10 +198,12 @@ cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.dat
 
 %if 0%{?tizen_version_major} < 3
 mkdir -p %{buildroot}/%{_datadir}/license
-cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}
-cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-service
-cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test
+cp LICENSE %{buildroot}/%{_datadir}/license/%{name}
+cp LICENSE %{buildroot}/%{_datadir}/license/%{name}-devel
+cp LICENSE %{buildroot}/%{_datadir}/license/%{name}-service
+cp LICENSE %{buildroot}/%{_datadir}/license/%{name}-test
 %endif
+
 cp resource/c_common/*.h %{buildroot}%{_includedir}
 cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir}
 cp resource/csdk/logger/include/*.h %{buildroot}%{_includedir}
@@ -214,7 +233,7 @@ ln -fs ../c_common %{buildroot}%{_includedir}/iotivity/
 %if 0%{?tizen_version_major} < 3
 %{_datadir}/license/%{name}
 %else
-%license LICENSE.APLv2
+%license LICENSE
 %endif
 
 %files service
@@ -241,7 +260,7 @@ ln -fs ../c_common %{buildroot}%{_includedir}/iotivity/
 %if 0%{?tizen_version_major} < 3
 %{_datadir}/license/%{name}-service
 %else
-%license LICENSE.APLv2
+%license LICENSE
 %endif
 
 %files test
@@ -251,11 +270,12 @@ ln -fs ../c_common %{buildroot}%{_includedir}/iotivity/
 %if 0%{?tizen_version_major} < 3
 %{_datadir}/license/%{name}-test
 %else
-%license LICENSE.APLv2
+%license LICENSE
 %endif
 
 %files devel
 %defattr(-,root,root,-)
+%license LICENSE
 %{_libdir}/lib*.a
 %{_libdir}/pkgconfig/%{name}.pc
 %{_includedir}/*