diff --git a/checks/get-diff.sh b/checks/get-diff.sh index 82a5ca0c..7b182027 100755 --- a/checks/get-diff.sh +++ b/checks/get-diff.sh @@ -1,21 +1,21 @@ #!/bin/bash -basepath=$1 +base_path=$1 analysis=$2 -resultfolder=$3 +result_dir=$3 # throw exception if args are not provided -if [ -z "$analysis" ] || [ -z "$basepath" ] || [ -z "$resultfolder" ]; then - echo "ERROR: analysis, basepath and resultfolder must be provided" +if [ -z "$analysis" ] || [ -z "$base_path" ] || [ -z "$result_dir" ]; then + echo "ERROR: analysis, base_path and result_dir must be provided" exit 1 fi # create the result folder if it does not exist -if [ ! -d "$resultfolder" ]; then - mkdir -p $resultfolder +if [ ! -d "$result_dir" ]; then + mkdir -p $result_dir fi -# go to the basepath -cd $basepath -base_diff=$resultfolder/base_diff.patch -commit_hash=$resultfolder/base_commit_hash.txt +# go to the base_path +cd $base_path +base_diff=$result_dir/base_diff.patch +commit_hash=$result_dir/base_commit_hash.txt touch $base_diff for next in $(git ls-files --others --exclude-standard); do git --no-pager diff --no-index /dev/null $next >>$base_diff @@ -23,12 +23,12 @@ done git rev-parse HEAD >$commit_hash # cd into the analysis directory -analysispath=$basepath/analysis_configurations/$analysis -if [ -d "$analysispath" ]; then - cd $analysispath - analysis_diff=$resultfolder/analysis_diff.patch - analysis_commit=$resultfolder/analysis_commit_hash.txt - analysis_name=$resultfolder/analysis_name.txt +analysis_path=$base_path/analysis_configurations/$analysis +if [ -d "$analysis_path" ]; then + cd $analysis_path + analysis_diff=$result_dir/analysis_diff.patch + analysis_commit=$result_dir/analysis_commit_hash.txt + analysis_name=$result_dir/analysis_name.txt touch $analysis_diff for next in $(git ls-files --others --exclude-standard); do git --no-pager diff --no-index /dev/null $next >>$analysis_diff diff --git a/checks/setup_from_tarball.sh b/checks/setup_from_tarball.sh index b82eb0d5..321d17d3 100755 --- a/checks/setup_from_tarball.sh +++ b/checks/setup_from_tarball.sh @@ -25,30 +25,31 @@ elif [ -f "$tarball" ]; then tarball=$(realpath temp) else echo "ERROR: tarball must be a file or a folder" + exit 1 fi # go to the checkout location cd $checkout_location echo "Using temporary tarball copy in $tarball" -# now read the commit hashes from the diff folder in the tarball +# read the commit hashes from the diff folder in the tarball base_commit=$(cat $tarball/diff/base_commit_hash.txt) analysis_commit=$(cat $tarball/diff/analysis_commit_hash.txt) analysis_name=$(cat $tarball/diff/analysis_name.txt) -# now checkout the base repository with the commit hash +# checkout the base repository with the commit hash git clone --recursive git@github.com:KIT-CMS/CROWN cd CROWN git checkout $base_commit -# now apply the base diff +# apply the base diff git apply $tarball/diff/base_diff.patch -# now setup the analysis with the init script +# setup the analysis with the init script bash init.sh $analysis_name -# now checkout the analysis repository with the commit hash +# checkout the analysis repository with the commit hash cd analysis_configurations/$analysis_name git checkout $analysis_commit -# now apply the analysis diff +# apply the analysis diff git apply $tarball/diff/analysis_diff.patch # cleanup the temporary tarball rm -rf $tarball echo "**************************************************************" echo "* Setup from tarball finished. You can now run the analysis *" -echo "**************************************************************" \ No newline at end of file +echo "**************************************************************"