Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypuuter committed Mar 17, 2023
1 parent 76e5416 commit b46f615
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
32 changes: 16 additions & 16 deletions checks/get-diff.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#!/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
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
Expand Down
15 changes: 8 additions & 7 deletions checks/setup_from_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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 "**************************************************************"
echo "**************************************************************"

0 comments on commit b46f615

Please sign in to comment.