10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-05 10:55:59 +02:00

Cleaning scripts

This commit is contained in:
Anthony Scemama 2014-09-02 16:22:00 +02:00
parent 563a8bea4d
commit 9e34e22e62
5 changed files with 39 additions and 39 deletions

View File

@ -11,21 +11,21 @@ fi
function archive() function archive()
{ {
FILE=$1 FILE="$1"
MD5=$2 MD5="$2"
ARCHIVE=${QPACKAGE_ROOT}/data/cache/$MD5 ARCHIVE="${QPACKAGE_ROOT}/data/cache/$MD5"
if [[ -f $ARCHIVE ]] if [[ -f "$ARCHIVE" ]]
then then
if ! diff $FILE ${QPACKAGE_ROOT}/data/cache/$MD5 &> /dev/null if ! diff "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5" &> /dev/null
then then
echo "Something went wrong. The file" echo "Something went wrong. The file"
echo ${QPACKAGE_ROOT}/data/cache/$MD5 echo "${QPACKAGE_ROOT}/data/cache/$MD5"
echo "is different from $FILE" echo "is different from $FILE"
echo "Aborting" echo "Aborting"
return 1 return 1
fi fi
else else
cp $FILE ${QPACKAGE_ROOT}/data/cache/$MD5 cp "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5"
fi fi
} }
@ -41,7 +41,7 @@ then
fi fi
cd ${QPACKAGE_ROOT}/EZFIO/src cd "${QPACKAGE_ROOT}/EZFIO/src"
FILES=($(python << EOF | sort FILES=($(python << EOF | sort
from read_config import * from read_config import *
for group in groups: for group in groups:
@ -59,20 +59,20 @@ EOF
)) ))
cd $OLDPWD cd $OLDPWD
MD5_FILE=$(basename ${EZFIO_FILE} .ezfio).md5 MD5_FILE=$(basename "${EZFIO_FILE}" .ezfio).md5
rm -f ${MD5_FILE} rm -f -- "${MD5_FILE}"
for FILE in ${FILES[@]} for FILE in ${FILES[@]}
do do
FILE=${EZFIO_FILE}/${FILE} FILE="${EZFIO_FILE}/${FILE}"
MD5=$(md5sum ${FILE} 2>/dev/null | cut -d ' ' -f 1) MD5=$(md5sum "${FILE}" 2>/dev/null | cut -d ' ' -f 1)
if [[ ! -z $MD5 ]] if [[ ! -z $MD5 ]]
then then
if ! archive $FILE $MD5 if ! archive "$FILE" "$MD5"
then then
rm ${MD5_FILE} rm -- "${MD5_FILE}"
exit 1 exit 1
fi fi
echo $MD5 $FILE >> ${MD5_FILE} echo "$MD5" "$FILE" >> "${MD5_FILE}"
fi fi
done done

View File

@ -44,7 +44,7 @@ DEPS_LONG=""
for i in $COMMAND_LINE for i in $COMMAND_LINE
do do
DEPS_LONG+=" $i " DEPS_LONG+=" $i "
DEPS_LONG+=$(cat ${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES) DEPS_LONG+=$(cat "${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES")
done done
DEPS=$(unique_list $DEPS_LONG) DEPS=$(unique_list $DEPS_LONG)
@ -53,7 +53,7 @@ if [[ ! "$COMMAND_LINE" == "$DEPS" ]]
then then
DEPS=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${DEPS}) DEPS=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${DEPS})
fi fi
echo $DEPS echo "$DEPS"
if [[ "$COMMAND_LINE" == "$DEPS" ]] if [[ "$COMMAND_LINE" == "$DEPS" ]]
then then

View File

@ -6,9 +6,9 @@
# module directory. # module directory.
# Thu Apr 3 01:44:41 CEST 2014 # Thu Apr 3 01:44:41 CEST 2014
MODULE=$(basename $PWD) MODULE=$(basename "$PWD")
if [[ $MODULE == "src" ]] if [[ "$MODULE" == "src" ]]
then then
echo "Error: This script should not be run in the src directory." echo "Error: This script should not be run in the src directory."
exit 1 exit 1

View File

@ -8,17 +8,17 @@
SRC="" SRC=""
OBJ="" OBJ=""
DEPS=$(cat NEEDED_MODULES) DEPS="$(cat NEEDED_MODULES)"
for M in ${DEPS} for M in ${DEPS}
do do
# X is the list of external source files # 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} for f in ${X}
do do
SRC+=" ${M}/${f}" SRC+=" ${M}/${f}"
done 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} for f in ${X}
do do
OBJ+=" IRPF90_temp/${M}/${f/IRPF90_temp//}" OBJ+=" IRPF90_temp/${M}/${f/IRPF90_temp//}"

View File

@ -29,9 +29,9 @@ function debug()
function fail() function fail()
{ {
echo "Error: " $@ echo "Error: $@"
cd ${QPACKAGE_ROOT}/src cd "${QPACKAGE_ROOT}/src"
rm -rf ${MODULE} rm -rf -- "${MODULE}"
exit 1 exit 1
} }
@ -68,7 +68,7 @@ debug "Module does not already exist: OK"
# Set up dependencies # 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)" echo "Select which modules you are sure you will need: (press q to quit)"
NEEDED_MODULES="" NEEDED_MODULES=""
select M in ${ALL_MODULES} select M in ${ALL_MODULES}
@ -78,34 +78,34 @@ do
break break
fi fi
NEEDED_MODULES+=" $M" NEEDED_MODULES+=" $M"
echo $NEEDED_MODULES echo "$NEEDED_MODULES"
done done
# Create module directory and go into it # Create module directory and go into it
mkdir ${QPACKAGE_ROOT}/src/${MODULE} mkdir "${QPACKAGE_ROOT}/src/${MODULE}"
if [[ $? != 0 ]] if [[ $? != 0 ]]
then then
echo "Error: Unable to create module directory." echo "Error: Unable to create module directory."
exit 1 exit 1
fi fi
if [[ ! -d ${QPACKAGE_ROOT}/src/${MODULE} ]] if [[ ! -d "${QPACKAGE_ROOT}/src/${MODULE}" ]]
then then
echo "Something strange happened: the" echo "Something strange happened: the"
echo ${QPACKAGE_ROOT}/src/${MODULE} echo "${QPACKAGE_ROOT}/src/${MODULE}"
echo "directory was not created." echo "directory was not created."
exit 1 exit 1
fi fi
cd ${QPACKAGE_ROOT}/src/${MODULE} cd "${QPACKAGE_ROOT}/src/${MODULE}"
if [[ ${PWD} != ${QPACKAGE_ROOT}/src/${MODULE} ]] if [[ "${PWD}" != "${QPACKAGE_ROOT}/src/${MODULE}" ]]
then then
echo "Something strange happened: we should be in" echo "Something strange happened: we should be in"
echo ${QPACKAGE_ROOT}/src/${MODULE} echo "${QPACKAGE_ROOT}/src/${MODULE}"
echo "but we are in" echo "but we are in"
echo ${PWD} echo "${PWD}"
exit 1 exit 1
fi fi
@ -114,7 +114,7 @@ debug "Module directory is created."
# Create the Makefile # 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 ]] if [[ ! -f Makefile ]]
then then
fail "Makefile was not created" fail "Makefile was not created"
@ -122,7 +122,7 @@ fi
debug "Makefile created" debug "Makefile created"
# Create the NEEDED_MODULES file # 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 ]] if [[ ! -f NEEDED_MODULES ]]
then then
fail "NEEDED_MODULES was not created" fail "NEEDED_MODULES was not created"
@ -132,12 +132,12 @@ debug "NEEDED_MODULES created"
# Create rst templates # 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 # Update module list in main NEEDED_MODULES
ALL_MODULES+=" ${MODULE}" ALL_MODULES+=" ${MODULE}"
echo ${ALL_MODULES} > ${QPACKAGE_ROOT}/src/NEEDED_MODULES echo "${ALL_MODULES}" > "${QPACKAGE_ROOT}/src/NEEDED_MODULES"
debug "Updated NEEDED_MODULES" debug "Updated NEEDED_MODULES"
@ -149,7 +149,7 @@ then
fi fi
cd tests || fail "Unable to enter into tests directory" cd tests || fail "Unable to enter into tests directory"
${QPACKAGE_ROOT}/scripts/create_tests_Makefile.sh "${QPACKAGE_ROOT}/scripts/create_tests_Makefile.sh"
cd .. cd ..
if [[ ! -f tests/Makefile ]] if [[ ! -f tests/Makefile ]]
then then