10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-09 07:33:53 +01:00
quantum_package/scripts/check_dependencies.sh

64 lines
1.1 KiB
Bash
Raw Normal View History

2014-04-03 01:45:22 +02:00
#!/bin/bash
#
# usage:
# check_dependencies.sh MOs AOs Electrons
#
# Checks that the list of dependencies given in
# argument is consistent. If the dependencies
# are OK the exit code is 0, otherwise it is 1.
# If no argument is given, the dependencies are
# read in the Makefile.
# Thu Apr 3 01:44:23 CEST 2014
if [[ -z ${QPACKAGE_ROOT} ]]
then
print "The QPACKAGE_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file."
exit -1
fi
source ${QPACKAGE_ROOT}/scripts/qp_include.sh
2014-04-03 01:45:22 +02:00
if [[ -z $1 ]]
then
exit 0
fi
if [[ $1 == "-" ]]
then
COMMAND_LINE=$(cat NEEDED_MODULES)
2014-04-03 01:45:22 +02:00
else
COMMAND_LINE=$(unique_list $@)
fi
for d in $COMMAND_LINE
do
2014-04-03 01:50:22 +02:00
if [[ ! -d ${QPACKAGE_ROOT}/src/$d ]]
2014-04-03 01:45:22 +02:00
then
echo Error: Directory $d does not exist
exit 2
fi
done
DEPS_LONG=""
for i in $COMMAND_LINE
do
DEPS_LONG+=" $i "
2014-09-02 16:22:00 +02:00
DEPS_LONG+=$(cat "${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES")
2014-04-03 01:45:22 +02:00
done
DEPS=$(unique_list $DEPS_LONG)
if [[ ! "$COMMAND_LINE" == "$DEPS" ]]
then
2014-05-21 16:37:54 +02:00
DEPS=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${DEPS})
2014-04-03 01:45:22 +02:00
fi
2014-09-02 16:22:00 +02:00
echo "$DEPS"
2014-04-03 01:45:22 +02:00
if [[ "$COMMAND_LINE" == "$DEPS" ]]
then
exit 0
else
exit 1
fi