diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh index 673ae527..2c0b6a13 100755 --- a/.circleci/build-verilator.sh +++ b/.circleci/build-verilator.sh @@ -12,7 +12,7 @@ source $SCRIPT_DIR/defaults.sh # call clean on exit trap clean EXIT -run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh +run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh $CI_DIR if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then # set stricthostkeychecking to no (must happen before rsync) diff --git a/.circleci/clean-old-files.sh b/.circleci/clean-old-files.sh index 0fe4f429..96fcf8d7 100755 --- a/.circleci/clean-old-files.sh +++ b/.circleci/clean-old-files.sh @@ -1,10 +1,7 @@ #!/bin/bash # clean directories that are older than 30 days - -# get shared variables -SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" -source $SCRIPT_DIR/defaults.sh +# argument is used as the directory to look in age () { local AGE_SEC @@ -21,10 +18,12 @@ age () { echo $(expr $DIFF_SEC / $SEC_PER_DAY) } -for d in $CI_DIR/*/ ; do +for d in $1/*/ ; do DIR_AGE="$(age $d)" if [ $DIR_AGE -ge 30 ]; then echo "Deleting $d since is it $DIR_AGE old" rm -rf $d + else + echo "Keep $d since it is $DIR_AGE old" fi done diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index c4d7eb6f..accf4ff9 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -9,7 +9,7 @@ run () { } run_script () { - ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 + ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2" } clean () {