. $(dirname ${0})/qa-include
-# Remove documentation files
-log_debug "Removing documentation files..."
-for dir in ${BUILDROOT}/usr/{,share}/{doc,gtk-doc,info}; do
- if [ -d "${dir}" ]; then
- log_debug " Removing: ${dir}"
- rm -rf ${dir} || exit $?
- fi
-done
-
-exit 0
+DESC="Remove documentation files."
+
+function check() {
+ for dir in ${BUILDROOT}/usr/{,share}/{doc,gtk-doc,info}; do
+ if [ -d "${dir}" ]; then
+ log DEBUG " Removing: ${dir}"
+ rm -rf ${dir} || exit $?
+ fi
+ done
+}
+
+run
+
. $(dirname ${0})/qa-include
-# Remove unwanted files
-log_debug "Removing unwanted files: *.a *.la"
-for file in $(find ${BUILDROOT} -name "*.a" -or -name "*.la"); do
+DESC="Removing unwanted files: *.a *.la"
+
+function check() {
+ for file in $(find ${BUILDROOT} -name "*.a" -or -name "*.la"); do
- # Don't remove libc_nonshared.a. It is used by gcc/ld.
- [ "${file##*/}" = "libc_nonshared.a" ] && continue
- [ "${file##*/}" = "libpthread_nonshared.a" ] && continue
- [ "${file##*/}" = "libgcc.a" ] && continue
- [ "${file##*/}" = "libgcc_eh.a" ] && continue
- [ "${file##*/}" = "libfl_pic.a" ] && continue
- [ "${file##*/}" = "libpython2.6.a" ] && continue
+ # Don't remove libc_nonshared.a. It is used by gcc/ld.
+ [ "${file##*/}" = "libc_nonshared.a" ] && continue
+ [ "${file##*/}" = "libpthread_nonshared.a" ] && continue
+ [ "${file##*/}" = "libgcc.a" ] && continue
+ [ "${file##*/}" = "libgcc_eh.a" ] && continue
+ [ "${file##*/}" = "libfl_pic.a" ] && continue
+ [ "${file##*/}" = "libpython2.6.a" ] && continue
- log_debug " Removing: ${file}"
- rm -f ${file} || exit $?
-done
+ log DEBUG " Removing: ${file}"
+ rm -f ${file} || exit $?
+ done
+}
+
+run
-exit 0
. $(dirname ${0})/qa-include
-log_debug "Searching for world-writeable files..."
-
-files=$(find ${BUILDROOT} -type f -perm -2 2>/dev/null)
-if [ -n "${files}" ]; then
- log_error " QA Security Notice:"
- log_error " - The folloing files will be world writable."
- log_error " - This may or may not be a security problem, most of the time it is one."
- log_error " - Please double check that these files really need a world writeable bit and file bugs accordingly."
- log_error
- log_error "${files}"
- exit 1
-fi
-
-files=$(find ${BUILDROOT} -type f '(' -perm -2002 -o -perm -4002 ')')
-if [ -n "${files}" ]; then
- log_error " QA Notice: Unsafe files detected (set*id and world writable)"
- log_error
- log_error "${files}"
- exit 1
-fi
-
-exit 0
+DESC="Searching for world-writeable files..."
+
+function check() {
+ local ret=0
+
+ local files=$(find ${BUILDROOT} -type f -perm -2 2>/dev/null)
+ if [ -n "${files}" ]; then
+ log ERROR " QA Security Notice:"
+ log ERROR " - The folloing files will be world writable."
+ log ERROR " - This may or may not be a security problem, most of the time it is one."
+ log ERROR " - Please double check that these files really need a world writeable bit and file bugs accordingly."
+ log ERROR
+ log ERROR "${files}"
+ ret=1
+ fi
+
+ files=$(find ${BUILDROOT} -type f '(' -perm -2002 -o -perm -4002 ')')
+ if [ -n "${files}" ]; then
+ log ERROR " QA Notice: Unsafe files detected (set*id and world writable)"
+ log ERROR
+ log ERROR "${files}"
+ ret=1
+ fi
+
+ return ${ret}
+}
+
+run
+
log_debug "Search for absolute symlinks"
-failed=0
-for link in $(find ${BUILDROOT} -type l); do
- if fgrep -q "/lib/udev/devices" <<<${link}; then
- continue
- fi
-
- destination=$(readlink ${link})
- if [ "${destination:0:1}" = "/" ]; then
- log_error " absolute symlink: ${link}"
- failed=1
- fi
- if [ ! -e "${link%/*}/${destination}" ]; then
- log_error " not existant destination: ${link} -> ${destination}"
- failed=1
- fi
-done
-
-exit ${failed}
+function check() {
+ local failed=0
+
+ for link in $(find ${BUILDROOT} -type l); do
+ if fgrep -q "/lib/udev/devices" <<<${link}; then
+ continue
+ fi
+
+ destination=$(readlink ${link})
+ if [ "${destination:0:1}" = "/" ]; then
+ log ERROR " Absolute symlink: ${link}"
+ failed=1
+ fi
+ if [ ! -e "${link%/*}/${destination}" ]; then
+ log ERROR " Not existant destination: ${link} -> ${destination}"
+ failed=1
+ fi
+ done
+
+ return ${failed}
+}
+
+run
+
. $(dirname ${0})/qa-include
-# Check for libs that are missing in /usr/lib.
+DESC="Checking correct installation of libraries"
-log_debug "Checking correct installation of libraries"
+function check() {
+ local failed=0
+ for lib in $(find ${BUILDROOT}/lib -type f -name "lib*.so.*" 2>/dev/null); do
+ lib=${lib##*/}
+ lib=${lib%%.so*}
-failed=0
-for lib in $(find ${BUILDROOT}/lib -type f -name "lib*.so.*" 2>/dev/null); do
- lib=${lib##*/}
- lib=${lib%%.so*}
+ if [ ! -e "${BUILDROOT}/usr/lib/${lib}.so" ]; then
+ log ERROR " /usr/lib/${lib}.so is missing"
+ failed=1
+ fi
+ done
- if [ ! -e "${BUILDROOT}/usr/lib/${lib}.so" ]; then
- failed=1
- log_error " /usr/lib/${lib}.so is missing"
- fi
-done
+ return ${failed}
+}
+
+run
-exit ${failed}
. $(dirname ${0})/qa-include
-log "Check for binaries in /bin or /sbin that link to /usr/..."
-
-for file in $(find ${BUILDROOT}/{bin,lib,sbin}/* 2>/dev/null); do
- [ -f "${file}" ] || continue
- log " ${file}"
-
- interpreter=$(file_get_interpreter ${file})
- if [ ! -e "${interpreter}" ]; then
- log " SKIPPED because interpreter is not available"
- continue
- fi
-
- libs=$(ldd ${file})
- if grep -q /usr/lib <<<${libs}; then
- log "ERROR: ${file} links to libs in /usr/lib..."
- log " ${libs}"
- exit 1
- fi
-done
-
-exit 0
+DESC="Check for binaries in /bin or /sbin that link to /usr/..."
+
+function check() {
+ local ret=0
+
+ for file in $(find ${BUILDROOT}/{bin,lib,sbin}/* 2>/dev/null); do
+ [ -f "${file}" ] || continue
+ log DEBUG " ${file}"
+
+ interpreter=$(file_get_interpreter ${file})
+ if [ ! -e "${interpreter}" ]; then
+ log WARN " SKIPPED because interpreter is not available"
+ continue
+ fi
+
+ libs=$(ldd ${file})
+ if grep -q /usr/lib <<<${libs}; then
+ log ERROR "${file} links to libs in /usr/lib..."
+ log ERROR " ${libs}"
+ ret=1
+ fi
+ done
+
+ return ${ret}
+}
+
+run
. $(dirname ${0})/qa-include
-# If the pyc and pyo files are the same, we can hardlink them
-log "Hard-linking python bytecode files"
+DESC="Python byte-code files could be hardlinked if the optimized one is equal"
+DESC="${DESC} to the other one."
-for py in $(find ${BUILDROOT} -type f -name "*.py"); do
- if [ -e "${py}c" ] && [ -e "${py}o" ]; then
- if cmp -s "${py}c" "${py}o"; then
- log " ${py}c -> ${py}o"
- ln -f "${py}c" "${py}o"
+function check() {
+ for py in $(find ${BUILDROOT} -type f -name "*.py"); do
+ if [ -e "${py}c" ] && [ -e "${py}o" ]; then
+ if cmp -s "${py}c" "${py}o"; then
+ log DEBUG " ${py}c -> ${py}o"
+ ln -f "${py}c" "${py}o"
+ fi
fi
- fi
-done
+ done
+}
+
+run
-exit 0
. $(dirname ${0})/qa-include
-# Remove unwanted files
-log "Remove empty directories"
+DESC="Remove unwanted files."
-for dir in {,/usr}/{{,s}bin,lib{,exec}} /usr/share/man{,/man{0,1,2,3,4,5,6,7,8,9}}; do
- dir="${BUILDROOT}/${dir}"
- if [ -d "${dir}" ] && [ "$(ls -1A ${dir} | wc -l)" = "0" ]; then
- log " Removing ${dir}"
- rm -rf ${dir}
- fi
-done
+function check() {
+ for dir in {,/usr}/{{,s}bin,lib{,exec}} /usr/share/man{,/man{0,1,2,3,4,5,6,7,8,9}}; do
+ dir="${BUILDROOT}/${dir}"
+ if [ -d "${dir}" ] && [ "$(ls -1A ${dir} | wc -l)" = "0" ]; then
+ log DEBUG " Removing ${dir}"
+ rm -rf ${dir}
+ fi
+ done
+}
+
+run
-exit 0
. $(dirname ${0})/qa-include
-# Strip debugging symbols
-log "Strip debugging symbols"
-for f in $(find ${BUILDROOT} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \)); do
- if (file $f | grep -q ' shared object,'); then
- strip --strip-debug "$f" || :
- fi
-done
+DESC="Stripping reduces size of binary files."
-log "Strip unneeded symbols"
-for f in $(find ${BUILDROOT} -type f); do
- if (file $f | grep -q ' shared object,'); then
- strip --strip-unneeded "$f" || :
- fi
-done
+function check() {
+ # Strip debugging symbols
+ for f in $(find ${BUILDROOT} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \)); do
+ if (file $f | grep -q ' shared object,'); then
+ strip --strip-debug "$f" || :
+ fi
+ done
+
+ log "Strip unneeded symbols"
+ for f in $(find ${BUILDROOT} -type f); do
+ if (file $f | grep -q ' shared object,'); then
+ strip --strip-unneeded "$f" || :
+ fi
+ done
+}
+
+run
-exit 0