]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Cleanup QA scripts.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 7 Oct 2010 17:59:09 +0000 (19:59 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 7 Oct 2010 17:59:09 +0000 (19:59 +0200)
tools/quality-agent.d/001-remove-info-files
tools/quality-agent.d/001-remove-static-libs
tools/quality-agent.d/001-unsafe-files
tools/quality-agent.d/002-bad-symlinks
tools/quality-agent.d/003-libs-location
tools/quality-agent.d/050-root-links-to-usr
tools/quality-agent.d/090-python-hardlinks
tools/quality-agent.d/090-remove-empty-dirs
tools/quality-agent.d/099-strip

index 131e55bff3794a7304ec197c49948527a17a7043..e742dc97757974539dc3adf995f27dcb3b863652 100755 (executable)
@@ -2,13 +2,16 @@
 
 . $(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
+
index cbeabf21ecc402771cc30641765f431958e0a784..e5c6e541f522769237e0f86465d82a1f6ae50819 100755 (executable)
@@ -2,20 +2,23 @@
 
 . $(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
index 547a1b1ce5f558642f0c4ca8de9acfc6ae63b224..93a5dc8d3b05358a0b16690536298d91193ed9f5 100755 (executable)
@@ -2,25 +2,32 @@
 
 . $(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
+
index 7c8678f7c26953e46978593ef3f619c2c26a76de..595a7c5b6b2cb790750eccb441f41ff4b355da0b 100755 (executable)
@@ -7,21 +7,27 @@
 
 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
+
index 3d29bea7aa5a60d0886a69ce8e1cf7f46cddbfd1..185f44f0690f1debb13333ee4f05790bacd63183 100755 (executable)
@@ -2,19 +2,22 @@
 
 . $(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}
index 18b4d295e1f2a6ca17851e7d4fe4cc33277b7221..98385c5b8149932328fe8cb5ac6b9235e8269c73 100755 (executable)
@@ -2,24 +2,30 @@
 
 . $(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
index 8bcf6ead25f9ddfbd9d5b11c1aa61e223e579599..e2abf76a95a4183909649bc4273575efdf8ddb33 100755 (executable)
@@ -2,16 +2,19 @@
 
 . $(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
index de859ba136dd335c8955915b68a5aefca69aea0c..f8a39fd05fad4439454e483794eea99bd73f3e7e 100755 (executable)
@@ -2,15 +2,17 @@
 
 . $(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
index 6afc8ad39a4700301f21d39f770cea883ad70ab5..f79b9a3ef7ed733100a4e4f1fce9f284cd2047cd 100755 (executable)
@@ -2,19 +2,23 @@
 
 . $(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