Import the newer scripts from DeforaOS configure
This commit is contained in:
parent
e7c887d6d5
commit
0d5c409a90
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2016-2019 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2016-2020 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/clint.sh}/../config.sh"
|
||||
CFLAGS=
|
||||
CPPFLAGS=
|
||||
PROGNAME="clint.sh"
|
||||
|
@ -35,16 +36,19 @@ DEBUG="_debug"
|
|||
FIND="find"
|
||||
GREP="grep"
|
||||
LINT="lint -g"
|
||||
MKDIR="mkdir -p"
|
||||
SORT="sort -n"
|
||||
TR="tr"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#clint
|
||||
_clint()
|
||||
{
|
||||
ret=0
|
||||
subdirs="data doc src tests tools"
|
||||
res=0
|
||||
subdirs=
|
||||
|
||||
$DATE
|
||||
while read line; do
|
||||
|
@ -58,6 +62,10 @@ _clint()
|
|||
;;
|
||||
esac
|
||||
done < "$PROJECTCONF"
|
||||
if [ ! -n "$subdirs" ]; then
|
||||
_error "Could not locate directories to analyze"
|
||||
return $?
|
||||
fi
|
||||
for subdir in $subdirs; do
|
||||
[ -d "../$subdir" ] || continue
|
||||
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
||||
|
@ -79,13 +87,13 @@ _clint()
|
|||
if [ $? -ne 0 ]; then
|
||||
echo "FAIL"
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
ret=2
|
||||
res=2
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
done
|
||||
done
|
||||
return $ret
|
||||
return $res
|
||||
}
|
||||
|
||||
_clint_lint()
|
||||
|
@ -117,6 +125,14 @@ _debug()
|
|||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
|
@ -125,14 +141,6 @@ _usage()
|
|||
}
|
||||
|
||||
|
||||
#warning
|
||||
_warning()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cO:P:" name; do
|
||||
|
@ -162,9 +170,15 @@ fi
|
|||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
_clint > "$target" || exit 2
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_clint > "$target" || ret=$?
|
||||
done
|
||||
exit $ret
|
||||
|
|
Loading…
Reference in New Issue
Block a user