summaryrefslogtreecommitdiffstats
path: root/scripts/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-xscripts/contrib/documentation-audit.sh92
1 files changed, 92 insertions, 0 deletions
diff --git a/scripts/contrib/documentation-audit.sh b/scripts/contrib/documentation-audit.sh
new file mode 100755
index 0000000000..5070fee8a0
--- /dev/null
+++ b/scripts/contrib/documentation-audit.sh
@@ -0,0 +1,92 @@
1#!/bin/bash
2#
3# Perform an audit of which packages provide documentation and which
4# are missing -doc packages.
5#
6# Setup requirements: be sure to be building for MACHINE=qemux86. Run
7# this script after source'ing the build environment script, so you're
8# running it from build/ directory.
9#
10# Maintainer: Scott Garman <scott.a.garman@intel.com>
11
12REPORT_DOC_SIMPLE="documentation_exists.txt"
13REPORT_DOC_DETAIL="documentation_exists_detail.txt"
14REPORT_MISSING_SIMPLE="documentation_missing.txt"
15REPORT_MISSING_DETAIL="documentation_missing_detail.txt"
16REPORT_BUILD_ERRORS="build_errors.txt"
17
18rm -rf $REPORT_DOC_SIMPLE $REPORT_DOC_DETAIL $REPORT_MISSING_SIMPLE $REPORT_MISSING_DETAIL
19
20BITBAKE=`which bitbake`
21if [ -z "$BITBAKE" ]; then
22 echo "Error: bitbake command not found."
23 echo "Did you forget to source the build environment script?"
24 exit 1
25fi
26
27echo "REMINDER: you need to build for MACHINE=qemux86 or you won't get useful results"
28echo "REMINDER: you need to have COMMERCIAL_LICENSE = \"\" in local.conf or you'll get false positives"
29
30for pkg in `bitbake -s | awk '{ print \$1 }'`; do
31 if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" ||
32 "$pkg" == "Parsing" || "$pkg" == "Package" ||
33 "$pkg" == "NOTE:" || "$pkg" == "WARNING:" ||
34 "$pkg" == "done." || "$pkg" == "============" ]]
35 then
36 # Skip initial bitbake output
37 continue
38 fi
39 if [[ "$pkg" =~ -native$ || "$pkg" =~ -nativesdk$ ||
40 "$pkg" =~ -cross-canadian ]]; then
41 # Skip native/nativesdk/cross-canadian recipes
42 continue
43 fi
44 if [[ "$pkg" =~ ^meta- || "$pkg" =~ ^task- || "$pkg" =~ -image ]]; then
45 # Skip meta, task and image recipes
46 continue
47 fi
48 if [[ "$pkg" =~ ^glibc- || "$pkg" =~ ^libiconv$ ||
49 "$pkg" =~ -toolchain$ || "$pkg" =~ ^package-index$ ||
50 "$pkg" =~ ^linux- || "$pkg" =~ ^adt-installer$ ||
51 "$pkg" =~ ^eds-tools$ || "$pkg" =~ ^external-python-tarball$ ||
52 "$pkg" =~ ^qt4-embedded$ || "$pkg" =~ ^qt-mobility ]]; then
53 # Skip glibc, libiconv, -toolchain, and other recipes known
54 # to cause build conflicts or trigger false positives.
55 continue
56 fi
57
58 echo "Building package $pkg..."
59 bitbake $pkg > /dev/null
60 if [ $? -ne 0 ]; then
61 echo "There was an error building package $pkg" >> "$REPORT_MISSING_DETAIL"
62 echo "$pkg" >> $REPORT_BUILD_ERRORS
63
64 # Do not skip the remaining tests, as sometimes the
65 # exit status is 1 due to QA errors, and we can still
66 # perform the -doc checks.
67 fi
68
69 echo "$pkg built successfully, checking for a documentation package..."
70 WORKDIR=`bitbake -e $pkg | grep ^WORKDIR | awk -F '=' '{ print \$2 }' | awk -F '"' '{ print \$2 }'`
71 FIND_DOC_PKG=`find $WORKDIR/packages-split/*-doc -maxdepth 0 -type d`
72 if [ -z "$FIND_DOC_PKG" ]; then
73 # No -doc package was generated:
74 echo "No -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
75 echo "$pkg" >> $REPORT_MISSING_SIMPLE
76 continue
77 fi
78
79 FIND_DOC_FILES=`find $FIND_DOC_PKG -type f`
80 if [ -z "$FIND_DOC_FILES" ]; then
81 # No files shipped with the -doc package:
82 echo "No files shipped with the -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
83 echo "$pkg" >> $REPORT_MISSING_SIMPLE
84 continue
85 fi
86
87 echo "Documentation shipped with $pkg:" >> "$REPORT_DOC_DETAIL"
88 echo "$FIND_DOC_FILES" >> "$REPORT_DOC_DETAIL"
89 echo "" >> "$REPORT_DOC_DETAIL"
90
91 echo "$pkg" >> "$REPORT_DOC_SIMPLE"
92done