# # $Id: frontend.in,v 1.27 2004/02/03 22:59:09 jmmv Exp $ # bt_lint's frontend. # # buildtool # Copyright (c) 2002, 2003, 2004 Julio M. Merino Vidal. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. Neither the name of the author nor the names of contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # Fatal=0 Warn=0 check_rootfiles() { local res echo "=> Checking root files" if [ ! -f README.bt ]; then warn "README.bt not found; it is highly recommended" else grep -v "\$Id.*\$" @DIR_SHARE@/templates/README.bt > test.1 # NOLINT grep -v "\$Id.*\$" README.bt > test.2 # NOLINT res=$(cmp test.1 test.2) rm -f test.1 test.2 if [ -n "${res}" ]; then warn "README.bt found but it is outdated or modified" fi fi if [ ! -f CHANGES ]; then warn "CHANGES not found; it is recommended" fi if [ ! -f COPYING ]; then warn "COPYING not found; it is highly recommended" fi if [ ! -f PEOPLE ]; then warn "PEOPLE not found; it is recommended" fi if [ ! -f README ]; then warn "README not found; it is recommended" fi if [ -f AUTHORS ]; then warn "AUTHORS found; PEOPLE is suggested instead" fi if [ -f THANKS ]; then warn "THANKS found; PEOPLE is suggested instead" fi if [ -f Config.bt -o -f Defs.bt -o -f Docs.bt -o -f Logic.bt ]; then warn "it is recommended that you use the unified Generic.bt file in top dir" # NOLINT fi } check_config() { echo "=> Checking configuration script (${ConfigFile})" if grep bt_check_hdr_std ${ConfigFile} >/dev/null; then warn "avoid using bt_check_hdr_std; switch to bt_check_env_{c,cxx}" fi if grep bt_check_prog_cc ${ConfigFile} >/dev/null; then warn "avoid using bt_check_prog_cc; switch to bt_check_env_c" fi if grep bt_check_prog_cpp ${ConfigFile} >/dev/null; then warn "avoid using bt_check_prog_cpp; switch to bt_check_env_{c,cxx}" fi if grep bt_check_prog_cxx ${ConfigFile} >/dev/null; then warn "avoid using bt_check_prog_cxx; switch to bt_check_env_cxx" fi if grep bt_check_prog_ld ${ConfigFile} >/dev/null; then warn "avoid using bt_check_prog_ld; switch to bt_check_env_{c,cxx}" fi } check_defs() { echo "=> Checking definitions (${DefsFile})" [ -z "${BT_REQUIRE}" ] && fatal "no Buildtool version explicitly required" [ ${BT_REQUIRE} != @VERSION@ ] && \ warn "BT_REQUIRE does not match current Buildtool version (@VERSION@)" [ -z "${BT_PKG_NAME}" ] && fatal "no package name" [ -z "${BT_PKG_VERSION}" ] && fatal "no package version" [ -z "${BT_PKG_LICENSE}" ] && warn "no package license" [ -z "${BT_PKG_COMMENT}" ] && warn "no package comment" [ -z "${BT_PKG_MAINTAINER}" ] && warn "no package maintainer" [ -z "${BT_PKG_HOMEPAGE}" ] && warn "no package homepage" } fatal() { echo "FATAL: $*" Fatal=$((${Fatal} + 1)) } warn() { echo "WARN: $*" Warn=$((${Warn} + 1)) } main() { btcmn_req_runtime btcmn_req_project check_rootfiles check_defs check_config echo "=> Summary" if [ ${Fatal} -gt 0 ]; then btcmn_err "package is INVALID; ${Fatal} fatal errors" fi if [ ${Warn} -gt 0 ]; then btcmn_warn "package should be corrected; ${Warn} warnings" else echo "Package is OK!" fi return 0 } # Local Variables: *** # mode: shell-script *** # End: *** # vim: syntax=sh