Patchwork [1/1] Create a script for SUMMARY audit in recipes

login
register
mail settings
Submitter Shane Wang
Date Dec. 17, 2011, 3:07 p.m.
Message ID <aec7142fcdb265b6bab0b3328043d62e8fe10a8a.1324132972.git.shane.wang@intel.com>
Download mbox | patch
Permalink /patch/17187/
State New
Headers show

Comments

Shane Wang - Dec. 17, 2011, 3:07 p.m.
Some recipes don't contain SUMMARY, which HOB will use for descriptions.
If the summary is missing, bitbake will create a default value for summary.
That is PN plus string " version " plus its version. Every maintainer should add and update the summary fields according to audit results.

[YOCTO #1804] got fixed, and maintainers should follow up.

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 scripts/contrib/summary-audit.sh |   53 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100755 scripts/contrib/summary-audit.sh
Henning Heinold - Dec. 17, 2011, 3:38 p.m.
On Sat, Dec 17, 2011 at 11:07:12PM +0800, Shane Wang wrote:
> Some recipes don't contain SUMMARY, which HOB will use for descriptions.
> If the summary is missing, bitbake will create a default value for summary.
> That is PN plus string " version " plus its version. Every maintainer should add and update the summary fields according to audit results.
> 
> [YOCTO #1804] got fixed, and maintainers should follow up.
> 
> Signed-off-by: Shane Wang <shane.wang@intel.com>
> ---
>  scripts/contrib/summary-audit.sh |   53 ++++++++++++++++++++++++++++++++++++++
>  1 files changed, 53 insertions(+), 0 deletions(-)
>  create mode 100755 scripts/contrib/summary-audit.sh
> 
> diff --git a/scripts/contrib/summary-audit.sh b/scripts/contrib/summary-audit.sh
> new file mode 100755
> index 0000000..068e283
> --- /dev/null
> +++ b/scripts/contrib/summary-audit.sh
> @@ -0,0 +1,53 @@
> +#!/bin/bash
> +#

Hm,

where do you need special bash features? 

Bye Henning
Shane Wang - Dec. 17, 2011, 5:18 p.m.
Henning Heinold wrote on 2011-12-17:

> On Sat, Dec 17, 2011 at 11:07:12PM +0800, Shane Wang wrote:
>> Some recipes don't contain SUMMARY, which HOB will use for
>> descriptions. If the summary is missing, bitbake will create a default
>> value for summary. That is PN plus string " version " plus its version.
>> Every maintainer should add and update the summary fields according to
>> audit results.
>> 
>> [YOCTO #1804] got fixed, and maintainers should follow up.
>> 
>> Signed-off-by: Shane Wang <shane.wang@intel.com>
>> ---
>>  scripts/contrib/summary-audit.sh |   53
>>  ++++++++++++++++++++++++++++++++++++++ 1 files changed, 53
>>  insertions(+), 0 deletions(-) create mode 100755
>>  scripts/contrib/summary-audit.sh
>> diff --git a/scripts/contrib/summary-audit.sh
>> b/scripts/contrib/summary-audit.sh new file mode 100755 index
>> 0000000..068e283 --- /dev/null +++ b/scripts/contrib/summary-audit.sh
>> @@ -0,0 +1,53 @@ +#!/bin/bash +#
> 
> Hm,
> 
> where do you need special bash features?
> 
> Bye Henning

OK, nowhere. I tested with sh just now, it also worked. Will change that.

--
Shane
Henning Heinold - Dec. 17, 2011, 5:52 p.m.
On Sun, Dec 18, 2011 at 01:18:15AM +0800, Wang, Shane wrote:
> Henning Heinold wrote on 2011-12-17:
> 
> > On Sat, Dec 17, 2011 at 11:07:12PM +0800, Shane Wang wrote:
> >> Some recipes don't contain SUMMARY, which HOB will use for
> >> descriptions. If the summary is missing, bitbake will create a default
> >> value for summary. That is PN plus string " version " plus its version.
> >> Every maintainer should add and update the summary fields according to
> >> audit results.
> >> 
> >> [YOCTO #1804] got fixed, and maintainers should follow up.
> >> 
> >> Signed-off-by: Shane Wang <shane.wang@intel.com>
> >> ---
> >>  scripts/contrib/summary-audit.sh |   53
> >>  ++++++++++++++++++++++++++++++++++++++ 1 files changed, 53
> >>  insertions(+), 0 deletions(-) create mode 100755
> >>  scripts/contrib/summary-audit.sh
> >> diff --git a/scripts/contrib/summary-audit.sh
> >> b/scripts/contrib/summary-audit.sh new file mode 100755 index
> >> 0000000..068e283 --- /dev/null +++ b/scripts/contrib/summary-audit.sh
> >> @@ -0,0 +1,53 @@ +#!/bin/bash +#
> > 
> > Hm,
> > 
> > where do you need special bash features?
> > 
> > Bye Henning
> 
> OK, nowhere. I tested with sh just now, it also worked. Will change that.

I think you used some == you have to change them.

Bye Henning
Otavio Salvador - Dec. 17, 2011, 5:53 p.m.
On Sat, Dec 17, 2011 at 15:18, Wang, Shane <shane.wang@intel.com> wrote:

> OK, nowhere. I tested with sh just now, it also worked. Will change that.


Test it with dash please.
Shane Wang - Dec. 20, 2011, 3:57 p.m.
Henning Heinold wrote on 2011-12-18:

> I think you used some == you have to change them.

Why do I need to change ==, for /bin/sh or dash?

--
Shane

Patch

diff --git a/scripts/contrib/summary-audit.sh b/scripts/contrib/summary-audit.sh
new file mode 100755
index 0000000..068e283
--- /dev/null
+++ b/scripts/contrib/summary-audit.sh
@@ -0,0 +1,53 @@ 
+#!/bin/bash
+#
+# Perform an audit of which recipes provide summary and which
+# are missing for HOB2.
+#
+# Setup requirements: Run this script after source'ing the build
+# environment script, so you're running it from build/ directory.
+#
+# Maintainer: Shane Wang <shane.wang@intel.com>
+
+DISTRO_TRACKING_FILE="../meta/conf/distro/include/distro_tracking_fields.inc"
+REPORT_MISSING_SUMMARY="summary.txt"
+REPORT_LOG="summary.log"
+
+rm -rf $REPORT_MISSING_SUMMARY $REPORT_LOG
+
+BITBAKE=`which bitbake`
+if [ -z "$BITBAKE" ]; then
+	echo "Error: bitbake command not found."
+	echo "Did you forget to source the build environment script?"
+	exit 1
+fi
+
+packages=(`bitbake -s | awk '{ print \$1 }'`)
+versions=(`bitbake -s | awk '{ print \$2 }'`)
+
+echo "Package Num: ${#packages[*]} Version Num: ${#versions[*]}" >> "$REPORT_LOG"
+len=${#packages[*]}
+
+for (( i=0; i < "$len"; i++ )); do
+	pkg=${packages[$i]}
+
+	if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" ||
+          "$pkg" == "Parsing" || "$pkg" == "Package" ||
+          "$pkg" == "NOTE:"   || "$pkg" == "WARNING:" ||
+          "$pkg" == "done."   || "$pkg" == "============" ]]
+	then
+		# Skip initial bitbake output
+		continue
+	fi
+
+	SUMMARY=`bitbake -e $pkg | grep -e "^SUMMARY *=" | awk -F '=' '{ print \$2 }' | awk -F '"' '{ print \$2 }'`
+	ver=${versions[$i]#*:} # remove ':' in the version
+	echo "Handling package $pkg ($i out of $len) ..."
+	echo "HANDLING SUMMARY of package $pkg ... $SUMMARY <---NOT---> $pkg version $ver" >> "$REPORT_LOG"
+
+	if [[ "$SUMMARY" =~ "$pkg"" version ""$ver" ]]; then
+		# find which summary is missing and report
+		maintainer=`cat ../meta/conf/distro/include/distro_tracking_fields.inc | grep -e "^RECIPE_MAINTAINER_pn-"$pkg" *=" | cut -d= -f2`
+		echo "$pkg"" = ""$maintainer" >> "$REPORT_MISSING_SUMMARY"
+	fi
+done
+echo "DONE!" >> "$REPORT_LOG"