blob: 2144aac93602e7b0dc63c6e1de28428780cd1b41 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/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 set LICENSE_FLAGS_WHITELIST appropriately in local.conf or "
29echo " you'll get false positives. For example, LICENSE_FLAGS_WHITELIST = \"Commercial\""
30
31for pkg in `bitbake -s | awk '{ print \$1 }'`; do
32 if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" ||
33 "$pkg" == "Recipe" ||
34 "$pkg" == "Parsing" || "$pkg" == "Package" ||
35 "$pkg" == "NOTE:" || "$pkg" == "WARNING:" ||
36 "$pkg" == "done." || "$pkg" == "===========" ]]
37 then
38 # Skip initial bitbake output
39 continue
40 fi
41 if [[ "$pkg" =~ -native$ || "$pkg" =~ -nativesdk$ ||
42 "$pkg" =~ -cross-canadian ]]; then
43 # Skip native/nativesdk/cross-canadian recipes
44 continue
45 fi
46 if [[ "$pkg" =~ ^meta- || "$pkg" =~ ^packagegroup- || "$pkg" =~ -image ]]; then
47 # Skip meta, task and image recipes
48 continue
49 fi
50 if [[ "$pkg" =~ ^glibc- || "$pkg" =~ ^libiconv$ ||
51 "$pkg" =~ -toolchain$ || "$pkg" =~ ^package-index$ ||
52 "$pkg" =~ ^linux- || "$pkg" =~ ^adt-installer$ ||
53 "$pkg" =~ ^eds-tools$ || "$pkg" =~ ^external-python-tarball$ ||
54 "$pkg" =~ ^qt4-embedded$ || "$pkg" =~ ^qt-mobility ]]; then
55 # Skip glibc, libiconv, -toolchain, and other recipes known
56 # to cause build conflicts or trigger false positives.
57 continue
58 fi
59
60 echo "Building package $pkg..."
61 bitbake $pkg > /dev/null
62 if [ $? -ne 0 ]; then
63 echo "There was an error building package $pkg" >> "$REPORT_MISSING_DETAIL"
64 echo "$pkg" >> $REPORT_BUILD_ERRORS
65
66 # Do not skip the remaining tests, as sometimes the
67 # exit status is 1 due to QA errors, and we can still
68 # perform the -doc checks.
69 fi
70
71 echo "$pkg built successfully, checking for a documentation package..."
72 WORKDIR=`bitbake -e $pkg | grep ^WORKDIR | awk -F '=' '{ print \$2 }' | awk -F '"' '{ print \$2 }'`
73 FIND_DOC_PKG=`find $WORKDIR/packages-split/*-doc -maxdepth 0 -type d`
74 if [ -z "$FIND_DOC_PKG" ]; then
75 # No -doc package was generated:
76 echo "No -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
77 echo "$pkg" >> $REPORT_MISSING_SIMPLE
78 continue
79 fi
80
81 FIND_DOC_FILES=`find $FIND_DOC_PKG -type f`
82 if [ -z "$FIND_DOC_FILES" ]; then
83 # No files shipped with the -doc package:
84 echo "No files shipped with the -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
85 echo "$pkg" >> $REPORT_MISSING_SIMPLE
86 continue
87 fi
88
89 echo "Documentation shipped with $pkg:" >> "$REPORT_DOC_DETAIL"
90 echo "$FIND_DOC_FILES" >> "$REPORT_DOC_DETAIL"
91 echo "" >> "$REPORT_DOC_DETAIL"
92
93 echo "$pkg" >> "$REPORT_DOC_SIMPLE"
94done