Patchwork [meta-oe] classes/testlab: Enhance to dump license information

login
register
mail settings
Submitter Khem Raj
Date July 14, 2011, 6:54 a.m.
Message ID <1310626478-31452-1-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/7591/
State Superseded, archived
Headers show

Comments

Khem Raj - July 14, 2011, 6:54 a.m.
It will now additionally create a new file which will
contain list of licenses of installed packages in a given
image.

The fix to get the package name is there because the packages
which contains epoch PE in the version string were not
being constructed correctly since opkg-cl would dump
'epoch:version' for Version string but the real ipk
did not have 'epoch' in its name. e.g.

for armv5te/libopkg0_0.1.8+svnr609-r2_armv5te.ipk

Package: libopkg0
Version: 1:0.1.8+svnr609-r2

as you can see version contained in ipk is not
containing the 'epoch'

so we have to eliminate 'epoch' from version we get from
opkg-cl to for the installed ipk name correctly.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta-oe/classes/testlab.bbclass |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
Koen Kooi - July 14, 2011, 7:23 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Op 14-07-11 08:54, Khem Raj schreef:
> It will now additionally create a new file which will contain list of licenses of installed packages in a given image.
> 
> The fix to get the package name is there because the packages which contains epoch PE in the version string were not being constructed correctly since opkg-cl would dump 'epoch:version' for Version string but the real ipk did not have 'epoch' in its name. e.g.
> 
> for armv5te/libopkg0_0.1.8+svnr609-r2_armv5te.ipk
> 
> Package: libopkg0 Version: 1:0.1.8+svnr609-r2
> 
> as you can see version contained in ipk is not containing the 'epoch'
> 
> so we have to eliminate 'epoch' from version we get from opkg-cl to for the installed ipk name correctly.
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com> --- meta-oe/classes/testlab.bbclass |    8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/meta-oe/classes/testlab.bbclass b/meta-oe/classes/testlab.bbclass index cd59782..fd37242 100644 --- a/meta-oe/classes/testlab.bbclass +++ b/meta-oe/classes/testlab.bbclass @@ -36,7 +36,10 @@ if [ -e  ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" echo -e
> "digraph depends {\n    node [shape=plaintext]" > ${TESTLAB_DIR}/depends.dot
> 
> for pkg in $(opkg-cl ${IPKG_ARGS} list_installed | awk '{print $1}') ; do -		opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"} /^Version/ {printf $2"_"} /^Archi/ {print $2".ipk"}'  >> ${TESTLAB_DIR}/installed-packages.txt 
> +		name=`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"}'` +		name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk -F: '/^Version/ {printf $NF"_"}' | sed
> 's/^\s*//g'` +		name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Archi/ {print $2".ipk"}'` +		echo $name >>${TESTLAB_DIR}/installed-packages.txt
> 
> for depends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Depends) ; do echo "$pkg OPP $depends;" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Depends" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot @@ -65,6 +68,9 @@ if [ -e
> ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" du -k $(find ${DEPLOY_DIR_IPK} -name "$file") | head -n1 done | grep "\.ipk" | sed -e s:${DEPLOY_DIR_IPK}::g | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${TESTLAB_DIR}/installed-package-sizes.txt
> 
> +	for file in $(cat ${TESTLAB_DIR}/installed-packages.txt) ; do +		echo "`find ${DEPLOY_DIR_IPK} -name "$file" | xargs opkg-list-fields | grep ^License | sed -e 's/^.*:[ \t]*//g'`" '=' $file +	done | awk -F= '{printf("%50s:%s\n", $1, $2)}' > ${TESTLAB_DIR}/installed-package-licenses.txt # Log
> results to a git controlled directory structure than can be pushed to a remote location if [ "${TESTLABLOG}" = "remote" ] && [ -n "${TESTLABREMOTEDIR}" ] ; then TESTLABLOGDIR="${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}"

I like the idea, but I'm not fond of the formatting:

                                              MIT : angstrom-feed-configs_1.0-r15_qemuarm.ipk
                                              MIT : angstrom-task-boot_1.0-r1_qemuarm.ipk
                                              MIT : angstrom-version_v2011.07-core-r9_qemuarm.ipk
                               GPLv2+ & LGPLv2.1+ : avahi-daemon_0.6.30-r4_armv5te.ipk
                               GPLv2+ & LGPLv2.1+ : avahi-systemd_0.6.30-r4_armv5te.ipk

[..]

                       GPLv2 & LGPLv2 & BSD & MIT : libext2fs2_1.41.14-r1_armv5te.ipk
GCC RUNTIME LIBRARY EXCEPTION & GPLv2 & GPLv3 & LGPLv2.1 & LGPLv3 : libgcc1_4.5-r39.1+svnr175127_armv5te.ipk
                               GPLv2+ & LGPLv2.1+ : libgcrypt11_1.4.6-r0_armv5te.ipk
                               LGPLv2+ & BSD & PD : libglib-2.0-0_2.28.8-r2_armv5te.ipk

As you can see it breaks with stupidly long licenses like gcc. I'm wondering if we shouldn't just add an extra column in install*packages*.

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFOH0I8MkyGM64RGpERAkT+AJ4h2TQz0kfhB8Gr90S+zyFl66vruACgn/9K
s1qBVPCzyTzj6+tJpbDylyc=
=E1O3
-----END PGP SIGNATURE-----
Khem Raj - July 14, 2011, 7:41 p.m.
On Thu, Jul 14, 2011 at 12:23 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Op 14-07-11 08:54, Khem Raj schreef:
>> It will now additionally create a new file which will contain list of licenses of installed packages in a given image.
>>
>> The fix to get the package name is there because the packages which contains epoch PE in the version string were not being constructed correctly since opkg-cl would dump 'epoch:version' for Version string but the real ipk did not have 'epoch' in its name. e.g.
>>
>> for armv5te/libopkg0_0.1.8+svnr609-r2_armv5te.ipk
>>
>> Package: libopkg0 Version: 1:0.1.8+svnr609-r2
>>
>> as you can see version contained in ipk is not containing the 'epoch'
>>
>> so we have to eliminate 'epoch' from version we get from opkg-cl to for the installed ipk name correctly.
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com> --- meta-oe/classes/testlab.bbclass |    8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
>>
>> diff --git a/meta-oe/classes/testlab.bbclass b/meta-oe/classes/testlab.bbclass index cd59782..fd37242 100644 --- a/meta-oe/classes/testlab.bbclass +++ b/meta-oe/classes/testlab.bbclass @@ -36,7 +36,10 @@ if [ -e  ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" echo -e
>> "digraph depends {\n    node [shape=plaintext]" > ${TESTLAB_DIR}/depends.dot
>>
>> for pkg in $(opkg-cl ${IPKG_ARGS} list_installed | awk '{print $1}') ; do -           opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"} /^Version/ {printf $2"_"} /^Archi/ {print $2".ipk"}'  >> ${TESTLAB_DIR}/installed-packages.txt
>> +             name=`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"}'` +          name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk -F: '/^Version/ {printf $NF"_"}' | sed
>> 's/^\s*//g'` +                name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Archi/ {print $2".ipk"}'` +             echo $name >>${TESTLAB_DIR}/installed-packages.txt
>>
>> for depends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Depends) ; do echo "$pkg OPP $depends;" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Depends" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot @@ -65,6 +68,9 @@ if [ -e
>> ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" du -k $(find ${DEPLOY_DIR_IPK} -name "$file") | head -n1 done | grep "\.ipk" | sed -e s:${DEPLOY_DIR_IPK}::g | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${TESTLAB_DIR}/installed-package-sizes.txt
>>
>> +     for file in $(cat ${TESTLAB_DIR}/installed-packages.txt) ; do +         echo "`find ${DEPLOY_DIR_IPK} -name "$file" | xargs opkg-list-fields | grep ^License | sed -e 's/^.*:[ \t]*//g'`" '=' $file +   done | awk -F= '{printf("%50s:%s\n", $1, $2)}' > ${TESTLAB_DIR}/installed-package-licenses.txt # Log
>> results to a git controlled directory structure than can be pushed to a remote location if [ "${TESTLABLOG}" = "remote" ] && [ -n "${TESTLABREMOTEDIR}" ] ; then TESTLABLOGDIR="${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}"
>
> I like the idea, but I'm not fond of the formatting:
>
>                                              MIT : angstrom-feed-configs_1.0-r15_qemuarm.ipk
>                                              MIT : angstrom-task-boot_1.0-r1_qemuarm.ipk
>                                              MIT : angstrom-version_v2011.07-core-r9_qemuarm.ipk
>                               GPLv2+ & LGPLv2.1+ : avahi-daemon_0.6.30-r4_armv5te.ipk
>                               GPLv2+ & LGPLv2.1+ : avahi-systemd_0.6.30-r4_armv5te.ipk
>
> [..]
>
>                       GPLv2 & LGPLv2 & BSD & MIT : libext2fs2_1.41.14-r1_armv5te.ipk
> GCC RUNTIME LIBRARY EXCEPTION & GPLv2 & GPLv3 & LGPLv2.1 & LGPLv3 : libgcc1_4.5-r39.1+svnr175127_armv5te.ipk
>                               GPLv2+ & LGPLv2.1+ : libgcrypt11_1.4.6-r0_armv5te.ipk
>                               LGPLv2+ & BSD & PD : libglib-2.0-0_2.28.8-r2_armv5te.ipk
>
> As you can see it breaks with stupidly long licenses like gcc.

yes. I tried several formats the license strings can go as long as 100
columns so I decided to use something average
I also thought of reversing the columns but ipk names can be
horrendously long as well.

I'm wondering if we shouldn't just add an extra column in install*packages*.

I am not averse to do that but it might be better telling if license
infos are in a file of its own. plus if we have to run
supposedly newer pass of some other feature then we wont be able to
use installed_packages.txt with our processing.

>
> regards,
>
> Koen
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (Darwin)
>
> iD8DBQFOH0I8MkyGM64RGpERAkT+AJ4h2TQz0kfhB8Gr90S+zyFl66vruACgn/9K
> s1qBVPCzyTzj6+tJpbDylyc=
> =E1O3
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>

Patch

diff --git a/meta-oe/classes/testlab.bbclass b/meta-oe/classes/testlab.bbclass
index cd59782..fd37242 100644
--- a/meta-oe/classes/testlab.bbclass
+++ b/meta-oe/classes/testlab.bbclass
@@ -36,7 +36,10 @@  if [ -e  ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full"
 	echo -e "digraph depends {\n    node [shape=plaintext]" > ${TESTLAB_DIR}/depends.dot
 
 	for pkg in $(opkg-cl ${IPKG_ARGS} list_installed | awk '{print $1}') ; do 
-		opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"} /^Version/ {printf $2"_"} /^Archi/ {print $2".ipk"}'  >> ${TESTLAB_DIR}/installed-packages.txt
+		name=`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"}'`
+		name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk -F: '/^Version/ {printf $NF"_"}' | sed 's/^\s*//g'`
+		name=$name`opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Archi/ {print $2".ipk"}'`
+		echo $name >>${TESTLAB_DIR}/installed-packages.txt
 
     		for depends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Depends) ; do 
         		echo "$pkg OPP $depends;" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Depends" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot
@@ -65,6 +68,9 @@  if [ -e  ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full"
      		du -k $(find ${DEPLOY_DIR_IPK} -name "$file") | head -n1
 	done | grep "\.ipk" | sed -e s:${DEPLOY_DIR_IPK}::g | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${TESTLAB_DIR}/installed-package-sizes.txt
 
+	for file in $(cat ${TESTLAB_DIR}/installed-packages.txt) ; do
+		echo "`find ${DEPLOY_DIR_IPK} -name "$file" | xargs opkg-list-fields | grep ^License | sed -e 's/^.*:[ \t]*//g'`" '=' $file
+	done | awk -F= '{printf("%50s:%s\n", $1, $2)}' > ${TESTLAB_DIR}/installed-package-licenses.txt
 	# Log results to a git controlled directory structure than can be pushed to a remote location
 	if [ "${TESTLABLOG}" = "remote" ] && [ -n "${TESTLABREMOTEDIR}" ] ; then
 		TESTLABLOGDIR="${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}"