mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-25 05:51:46 +02:00
Cleaning scripts
This commit is contained in:
parent
563a8bea4d
commit
9e34e22e62
@ -11,21 +11,21 @@ fi
|
||||
|
||||
function archive()
|
||||
{
|
||||
FILE=$1
|
||||
MD5=$2
|
||||
ARCHIVE=${QPACKAGE_ROOT}/data/cache/$MD5
|
||||
if [[ -f $ARCHIVE ]]
|
||||
FILE="$1"
|
||||
MD5="$2"
|
||||
ARCHIVE="${QPACKAGE_ROOT}/data/cache/$MD5"
|
||||
if [[ -f "$ARCHIVE" ]]
|
||||
then
|
||||
if ! diff $FILE ${QPACKAGE_ROOT}/data/cache/$MD5 &> /dev/null
|
||||
if ! diff "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5" &> /dev/null
|
||||
then
|
||||
echo "Something went wrong. The file"
|
||||
echo ${QPACKAGE_ROOT}/data/cache/$MD5
|
||||
echo "${QPACKAGE_ROOT}/data/cache/$MD5"
|
||||
echo "is different from $FILE"
|
||||
echo "Aborting"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
cp $FILE ${QPACKAGE_ROOT}/data/cache/$MD5
|
||||
cp "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ then
|
||||
fi
|
||||
|
||||
|
||||
cd ${QPACKAGE_ROOT}/EZFIO/src
|
||||
cd "${QPACKAGE_ROOT}/EZFIO/src"
|
||||
FILES=($(python << EOF | sort
|
||||
from read_config import *
|
||||
for group in groups:
|
||||
@ -59,20 +59,20 @@ EOF
|
||||
))
|
||||
cd $OLDPWD
|
||||
|
||||
MD5_FILE=$(basename ${EZFIO_FILE} .ezfio).md5
|
||||
rm -f ${MD5_FILE}
|
||||
MD5_FILE=$(basename "${EZFIO_FILE}" .ezfio).md5
|
||||
rm -f -- "${MD5_FILE}"
|
||||
for FILE in ${FILES[@]}
|
||||
do
|
||||
FILE=${EZFIO_FILE}/${FILE}
|
||||
MD5=$(md5sum ${FILE} 2>/dev/null | cut -d ' ' -f 1)
|
||||
FILE="${EZFIO_FILE}/${FILE}"
|
||||
MD5=$(md5sum "${FILE}" 2>/dev/null | cut -d ' ' -f 1)
|
||||
if [[ ! -z $MD5 ]]
|
||||
then
|
||||
if ! archive $FILE $MD5
|
||||
if ! archive "$FILE" "$MD5"
|
||||
then
|
||||
rm ${MD5_FILE}
|
||||
rm -- "${MD5_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
echo $MD5 $FILE >> ${MD5_FILE}
|
||||
echo "$MD5" "$FILE" >> "${MD5_FILE}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -44,7 +44,7 @@ DEPS_LONG=""
|
||||
for i in $COMMAND_LINE
|
||||
do
|
||||
DEPS_LONG+=" $i "
|
||||
DEPS_LONG+=$(cat ${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES)
|
||||
DEPS_LONG+=$(cat "${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES")
|
||||
done
|
||||
|
||||
DEPS=$(unique_list $DEPS_LONG)
|
||||
@ -53,7 +53,7 @@ if [[ ! "$COMMAND_LINE" == "$DEPS" ]]
|
||||
then
|
||||
DEPS=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${DEPS})
|
||||
fi
|
||||
echo $DEPS
|
||||
echo "$DEPS"
|
||||
|
||||
if [[ "$COMMAND_LINE" == "$DEPS" ]]
|
||||
then
|
||||
|
@ -6,9 +6,9 @@
|
||||
# module directory.
|
||||
# Thu Apr 3 01:44:41 CEST 2014
|
||||
|
||||
MODULE=$(basename $PWD)
|
||||
MODULE=$(basename "$PWD")
|
||||
|
||||
if [[ $MODULE == "src" ]]
|
||||
if [[ "$MODULE" == "src" ]]
|
||||
then
|
||||
echo "Error: This script should not be run in the src directory."
|
||||
exit 1
|
||||
|
@ -8,17 +8,17 @@
|
||||
|
||||
SRC=""
|
||||
OBJ=""
|
||||
DEPS=$(cat NEEDED_MODULES)
|
||||
DEPS="$(cat NEEDED_MODULES)"
|
||||
|
||||
for M in ${DEPS}
|
||||
do
|
||||
# X is the list of external source files
|
||||
X=$(grep 'SRC=' ${QPACKAGE_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2)
|
||||
X=$(grep 'SRC=' "${QPACKAGE_ROOT}/src/${M}/Makefile" 2>/dev/null |cut -d '=' -f 2)
|
||||
for f in ${X}
|
||||
do
|
||||
SRC+=" ${M}/${f}"
|
||||
done
|
||||
X=$(grep 'OBJ=' ${QPACKAGE_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2)
|
||||
X=$(grep 'OBJ=' "${QPACKAGE_ROOT}/src/${M}/Makefile" 2>/dev/null |cut -d '=' -f 2)
|
||||
for f in ${X}
|
||||
do
|
||||
OBJ+=" IRPF90_temp/${M}/${f/IRPF90_temp//}"
|
||||
|
@ -29,9 +29,9 @@ function debug()
|
||||
|
||||
function fail()
|
||||
{
|
||||
echo "Error: " $@
|
||||
cd ${QPACKAGE_ROOT}/src
|
||||
rm -rf ${MODULE}
|
||||
echo "Error: $@"
|
||||
cd "${QPACKAGE_ROOT}/src"
|
||||
rm -rf -- "${MODULE}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ debug "Module does not already exist: OK"
|
||||
|
||||
|
||||
# Set up dependencies
|
||||
ALL_MODULES=$(cat NEEDED_MODULES)
|
||||
ALL_MODULES="$(cat NEEDED_MODULES)"
|
||||
echo "Select which modules you are sure you will need: (press q to quit)"
|
||||
NEEDED_MODULES=""
|
||||
select M in ${ALL_MODULES}
|
||||
@ -78,34 +78,34 @@ do
|
||||
break
|
||||
fi
|
||||
NEEDED_MODULES+=" $M"
|
||||
echo $NEEDED_MODULES
|
||||
echo "$NEEDED_MODULES"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Create module directory and go into it
|
||||
mkdir ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
mkdir "${QPACKAGE_ROOT}/src/${MODULE}"
|
||||
if [[ $? != 0 ]]
|
||||
then
|
||||
echo "Error: Unable to create module directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d ${QPACKAGE_ROOT}/src/${MODULE} ]]
|
||||
if [[ ! -d "${QPACKAGE_ROOT}/src/${MODULE}" ]]
|
||||
then
|
||||
echo "Something strange happened: the"
|
||||
echo ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
echo "${QPACKAGE_ROOT}/src/${MODULE}"
|
||||
echo "directory was not created."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
if [[ ${PWD} != ${QPACKAGE_ROOT}/src/${MODULE} ]]
|
||||
cd "${QPACKAGE_ROOT}/src/${MODULE}"
|
||||
if [[ "${PWD}" != "${QPACKAGE_ROOT}/src/${MODULE}" ]]
|
||||
then
|
||||
echo "Something strange happened: we should be in"
|
||||
echo ${QPACKAGE_ROOT}/src/${MODULE}
|
||||
echo "${QPACKAGE_ROOT}/src/${MODULE}"
|
||||
echo "but we are in"
|
||||
echo ${PWD}
|
||||
echo "${PWD}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -114,7 +114,7 @@ debug "Module directory is created."
|
||||
|
||||
|
||||
# Create the Makefile
|
||||
${QPACKAGE_ROOT}/scripts/create_Makefile.sh || fail "Unable to create Makefile"
|
||||
"${QPACKAGE_ROOT}/scripts/create_Makefile.sh" || fail "Unable to create Makefile"
|
||||
if [[ ! -f Makefile ]]
|
||||
then
|
||||
fail "Makefile was not created"
|
||||
@ -122,7 +122,7 @@ fi
|
||||
debug "Makefile created"
|
||||
|
||||
# Create the NEEDED_MODULES file
|
||||
${QPACKAGE_ROOT}/scripts/create_Needed_modules.sh ${NEEDED_MODULES} || fail "Unable to create the NEEDED_MODULES file"
|
||||
"${QPACKAGE_ROOT}/scripts/create_Needed_modules.sh" ${NEEDED_MODULES} || fail "Unable to create the NEEDED_MODULES file"
|
||||
if [[ ! -f NEEDED_MODULES ]]
|
||||
then
|
||||
fail "NEEDED_MODULES was not created"
|
||||
@ -132,12 +132,12 @@ debug "NEEDED_MODULES created"
|
||||
|
||||
|
||||
# Create rst templates
|
||||
${QPACKAGE_ROOT}/scripts/create_rst_templates.sh || fail "Unable to create rst templates"
|
||||
"${QPACKAGE_ROOT}/scripts/create_rst_templates.sh" || fail "Unable to create rst templates"
|
||||
|
||||
|
||||
# Update module list in main NEEDED_MODULES
|
||||
ALL_MODULES+=" ${MODULE}"
|
||||
echo ${ALL_MODULES} > ${QPACKAGE_ROOT}/src/NEEDED_MODULES
|
||||
echo "${ALL_MODULES}" > "${QPACKAGE_ROOT}/src/NEEDED_MODULES"
|
||||
debug "Updated NEEDED_MODULES"
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ then
|
||||
fi
|
||||
|
||||
cd tests || fail "Unable to enter into tests directory"
|
||||
${QPACKAGE_ROOT}/scripts/create_tests_Makefile.sh
|
||||
"${QPACKAGE_ROOT}/scripts/create_tests_Makefile.sh"
|
||||
cd ..
|
||||
if [[ ! -f tests/Makefile ]]
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user