blob: 7197a2fcea7e240bffbee67cbae481b7b03193cd [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/bash
2#
Patrick Williams92b42cb2022-09-03 06:53:57 -05003# Copyright OpenEmbedded Contributors
4#
Brad Bishopc342db32019-05-15 21:57:59 -04005# SPDX-License-Identifier: GPL-2.0-only
6#
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007# Perform an audit of which packages provide documentation and which
8# are missing -doc packages.
9#
10# Setup requirements: be sure to be building for MACHINE=qemux86. Run
11# this script after source'ing the build environment script, so you're
12# running it from build/ directory.
13#
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15REPORT_DOC_SIMPLE="documentation_exists.txt"
16REPORT_DOC_DETAIL="documentation_exists_detail.txt"
17REPORT_MISSING_SIMPLE="documentation_missing.txt"
18REPORT_MISSING_DETAIL="documentation_missing_detail.txt"
19REPORT_BUILD_ERRORS="build_errors.txt"
20
21rm -rf $REPORT_DOC_SIMPLE $REPORT_DOC_DETAIL $REPORT_MISSING_SIMPLE $REPORT_MISSING_DETAIL
22
23BITBAKE=`which bitbake`
24if [ -z "$BITBAKE" ]; then
25 echo "Error: bitbake command not found."
26 echo "Did you forget to source the build environment script?"
27 exit 1
28fi
29
30echo "REMINDER: you need to build for MACHINE=qemux86 or you won't get useful results"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000031echo "REMINDER: you need to set LICENSE_FLAGS_ACCEPTED appropriately in local.conf or "
32echo " you'll get false positives. For example, LICENSE_FLAGS_ACCEPTED = \"commercial\""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033
34for pkg in `bitbake -s | awk '{ print \$1 }'`; do
35 if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" ||
36 "$pkg" == "Recipe" ||
37 "$pkg" == "Parsing" || "$pkg" == "Package" ||
38 "$pkg" == "NOTE:" || "$pkg" == "WARNING:" ||
39 "$pkg" == "done." || "$pkg" == "===========" ]]
40 then
41 # Skip initial bitbake output
42 continue
43 fi
44 if [[ "$pkg" =~ -native$ || "$pkg" =~ -nativesdk$ ||
45 "$pkg" =~ -cross-canadian ]]; then
46 # Skip native/nativesdk/cross-canadian recipes
47 continue
48 fi
49 if [[ "$pkg" =~ ^meta- || "$pkg" =~ ^packagegroup- || "$pkg" =~ -image ]]; then
50 # Skip meta, task and image recipes
51 continue
52 fi
53 if [[ "$pkg" =~ ^glibc- || "$pkg" =~ ^libiconv$ ||
54 "$pkg" =~ -toolchain$ || "$pkg" =~ ^package-index$ ||
55 "$pkg" =~ ^linux- || "$pkg" =~ ^adt-installer$ ||
56 "$pkg" =~ ^eds-tools$ || "$pkg" =~ ^external-python-tarball$ ||
57 "$pkg" =~ ^qt4-embedded$ || "$pkg" =~ ^qt-mobility ]]; then
58 # Skip glibc, libiconv, -toolchain, and other recipes known
59 # to cause build conflicts or trigger false positives.
60 continue
61 fi
62
63 echo "Building package $pkg..."
64 bitbake $pkg > /dev/null
65 if [ $? -ne 0 ]; then
66 echo "There was an error building package $pkg" >> "$REPORT_MISSING_DETAIL"
67 echo "$pkg" >> $REPORT_BUILD_ERRORS
68
69 # Do not skip the remaining tests, as sometimes the
70 # exit status is 1 due to QA errors, and we can still
71 # perform the -doc checks.
72 fi
73
74 echo "$pkg built successfully, checking for a documentation package..."
75 WORKDIR=`bitbake -e $pkg | grep ^WORKDIR | awk -F '=' '{ print \$2 }' | awk -F '"' '{ print \$2 }'`
76 FIND_DOC_PKG=`find $WORKDIR/packages-split/*-doc -maxdepth 0 -type d`
77 if [ -z "$FIND_DOC_PKG" ]; then
78 # No -doc package was generated:
79 echo "No -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
80 echo "$pkg" >> $REPORT_MISSING_SIMPLE
81 continue
82 fi
83
84 FIND_DOC_FILES=`find $FIND_DOC_PKG -type f`
85 if [ -z "$FIND_DOC_FILES" ]; then
86 # No files shipped with the -doc package:
87 echo "No files shipped with the -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
88 echo "$pkg" >> $REPORT_MISSING_SIMPLE
89 continue
90 fi
91
92 echo "Documentation shipped with $pkg:" >> "$REPORT_DOC_DETAIL"
93 echo "$FIND_DOC_FILES" >> "$REPORT_DOC_DETAIL"
94 echo "" >> "$REPORT_DOC_DETAIL"
95
96 echo "$pkg" >> "$REPORT_DOC_SIMPLE"
97done