Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. originDBDir="/run/media/antoine/Maxtor/Tandoori-builds/doneDBs"
  4.  
  5. appsFile="allApps.csv"
  6. outDir="output"
  7. inputDir="databases"
  8. githubKeyFile="./githubKey"
  9.  
  10. echo "Synchronizing databases"
  11. for file in $(ls $originDBDir); do
  12. db=$(basename $file)
  13. if [[ ! -d $inputDir/$db ]];then
  14. echo "Copying database $db"
  15. cp -r -n $originDBDir/$db $inputDir
  16. fi
  17. done
  18.  
  19. ##
  20. # Start the metrics calculation for the given app
  21. #
  22. # $1 - application name
  23. # $2 - application path on GitHub
  24. ##
  25. function startDevNote {
  26. appName=$1
  27. appPath=$2
  28. echo "##### Starting process for $appName ####"
  29. tmpOutput="/tmp/tandoori/$appName"
  30. mkdir -p $tmpOutput
  31. finalOutput="$outDir/$appName"
  32. echo "# Computing metrics for project $appName - $appPath"
  33. ./devNote.sh -d $inputDir/$appName -p $appPath -k "$(cat $githubKeyFile)" -o "$tmpOutput"
  34. echo "# Removing previous result and moving new"
  35. rm -rf $finalOutput
  36. mv $tmpOutput $finalOutput
  37. }
  38.  
  39.  
  40. if [[ -f $1 ]]; then
  41. # If we have a file as input argument (csv) we read it and do the given applications
  42. echo "Using input file $1"
  43. cat $1 | while IFS=, read name path; do
  44. if [[ -z $name && -z $path ]];then
  45. echo "Skipping empty line"
  46. else
  47. startDevNote $name $path
  48. fi
  49. done
  50. else
  51. # If no input is given we scan every available databases
  52. for db in $(ls $inputDir); do
  53. appName=$(basename $db)
  54. appPath=$(grep -- $appName $appsFile | cut -d, -f2)
  55. startDevNote $appName $appPath
  56. done
  57. fi
  58.  
  59. #./packResults.sh
  60. tarName="results-$(date +"%Y-%m-%d_%H-%M-%S")"
  61. echo "Creating tarball $tarName"
  62. tar caf "$tarName" $outDir/*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement