diff --git a/scripts/check_added_files.sh b/scripts/check_added_files.sh index de05dc226ce90d7cd159019f42f5dd4798bcc47a..f09a532579494cb6e204c8b2ec19b86199670b63 100755 --- a/scripts/check_added_files.sh +++ b/scripts/check_added_files.sh @@ -1,43 +1,6 @@ #!/bin/bash source scripts/whitelist.sh -# Function to check if a file is in the whitelist of files -# that are allowed to be added in a commit -checkWhiteList() { - if [ -f $1 ] ; then - if [[ !($1 == */*/mc.*.py) && - !($1 == */*/log.generate.short) && - !($1 == */*/MadGraphControl/*.py) && - !($1 == */*/PowhegControl/*.py) && - !($1 == */*/Herwig7_i/*.py) && - !($1 == */*/Pythia8_i/*.py) && - !($1 == */*/Sherpa_i/*.py) ]] ; then - return 1 #false - else - return 0 #true - fi - elif [ -d $1 ] ; then - if [[ !($1 == */*/MadGraphControl) && - !($1 == */*/PowhegControl) && - !($1 == */*/Herwig7_i) && - !($1 == */*/Pythia8_i) && - !($1 == */*/Sherpa_i) ]] ; then - return 1 #false - else - return 0 #true - fi - elif [ -L $1 ] ; then - if [[ !($1 == */*/mc_*TeV.*.GRID.tar.gz) ]] ; then - return 1 #false - else - return 0 #true - fi - else - echo "Unknown file/filetype: $1" - return 1 - fi -} - # Make sure that if a command fails the script will continue set +e @@ -47,7 +10,7 @@ echo "Find files that have been added in last commit..." # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -files=($(git diff-tree --no-commit-id --name-only -r HEAD --diff-filter=A)) +files=($(git diff-tree --no-commit-id --name-only -r origin/master..HEAD --diff-filter=A)) if (( ${#files[@]} == 0 )) ; then echo "No files added" diff --git a/scripts/check_grid_file_atlcvmfs.sh b/scripts/check_grid_file_atlcvmfs.sh index b00e3d3e5d62ea8c3d15b69cfeefa9acf4c5b6a8..be7cc4d48bfdafd96f286ca519ddf40ba5f82e77 100755 --- a/scripts/check_grid_file_atlcvmfs.sh +++ b/scripts/check_grid_file_atlcvmfs.sh @@ -8,7 +8,7 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -changed=($(git diff-tree --name-only -r HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +changed=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_grid_file_size.sh b/scripts/check_grid_file_size.sh index 2bec1ffd43d97c6a365b55071f4f614bfaebf2ba..5551261deb6970f274fda2ba7691ad0fa79ffbc5 100755 --- a/scripts/check_grid_file_size.sh +++ b/scripts/check_grid_file_size.sh @@ -8,7 +8,7 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -changed=($(git diff-tree --name-only -r HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +changed=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_jo_consistency_main.py b/scripts/check_jo_consistency_main.py index d18160d5a6831789bd4a9bebc61205b20e2bcccd..37b870a6b2452837786f7590a6b250cbc9df96e9 100755 --- a/scripts/check_jo_consistency_main.py +++ b/scripts/check_jo_consistency_main.py @@ -5,7 +5,7 @@ from check_jo_consistency import * def main(): print("\n===> Checking jobOption consistency...\n") # Get job options - command="git diff-tree --name-only -r HEAD --diff-filter=AMDCRTUXB | grep -E \"mc.*.py\"" + command="git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMDCRTUXB | grep -E \"mc.*.py\"" # Filter list of strings obtained from git diff-tree command to remove empty strings (no file modified) files=list(filter(None,os.popen(command).read().strip().split("\n"))) if files: diff --git a/scripts/check_logParser.sh b/scripts/check_logParser.sh index eea08bd0f7dc1eafe390c2f968762678c69b6f59..bc716ccd738a308dad26f3d15c2e519818cde25b 100755 --- a/scripts/check_logParser.sh +++ b/scripts/check_logParser.sh @@ -8,7 +8,7 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -dirs=($(git diff-tree --name-only -r HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +dirs=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" diff --git a/scripts/check_modified_files.sh b/scripts/check_modified_files.sh index b239d9b94f331225a9f937d6fb06172dc90f4fb1..9e375ccb62a90f0e685babfae1eab61e51b3e5bd 100755 --- a/scripts/check_modified_files.sh +++ b/scripts/check_modified_files.sh @@ -10,13 +10,13 @@ pass=true # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -nchanged=$(git diff --name-status origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=MDCRTUXB | wc -l) +nchanged=$(git diff --name-status origin/master..HEAD --diff-filter=MDCRTUXB | wc -l) if [ $nchanged -eq 0 ] ; then echo "OK: No file modified." else echo "ERROR: Your commit has modified or deleted pre-existing files: " - git diff --name-status origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=MDCRTUXB + git diff --name-status origin/master..HEAD --diff-filter=MDCRTUXB echo "This is not allowed!" pass=false fi @@ -24,7 +24,7 @@ fi # Find number of files that have been added in directories that # already existed (this would also modify the physics output) echo -e "\nWill now check whether files have been added in pre-existing DSID directories" -added=($(git diff --name-only origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=A)) +added=($(git diff --name-only origin/master..HEAD --diff-filter=A)) if [[ "${#added[@]}" > 0 ]] ; then # We also need to get a list of DSID directories present in the previous commit # First find the hash of the previous commit diff --git a/scripts/check_unique_physicsShort.sh b/scripts/check_unique_physicsShort.sh index 70e9d0879858e2af8e647012f12a839c667fb5c4..709ba437af9ba743c609bb64fc970f6937198e7a 100755 --- a/scripts/check_unique_physicsShort.sh +++ b/scripts/check_unique_physicsShort.sh @@ -5,8 +5,8 @@ set +e unique=true -# Get the files modified in the last commit -modified=($(git diff-tree --name-only -r HEAD --diff-filter=A | grep -E "mc.*py")) +# Get the files modified in the last commit wrt origin/master +modified=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=A | grep -E "mc.*py")) if [[ "${#modified[@]}" > 0 ]] ; then echo "jO files modified in the latest commit: ${#modified[@]}" diff --git a/scripts/commit_new_dsid.sh b/scripts/commit_new_dsid.sh index c3615da3f55ab32004e2ebe1bee13aa90035923f..9afa0fa5f7a1ab922657275416965e3c46cd0a99 100755 --- a/scripts/commit_new_dsid.sh +++ b/scripts/commit_new_dsid.sh @@ -250,12 +250,10 @@ if $git ; then printError "ERROR: nothing added to the commit. Please check error messages above." else git commit -q -m "Adding new DSID ${newDSID[0]} $commitMessage" - echo "" - printInfo "You have prepared branch $(git rev-parse --abbrev-ref HEAD)." + printInfo -f "\nYou have prepared branch $(git rev-parse --abbrev-ref HEAD)." printInfo "This contains the following changes:" git diff --stat master HEAD - echo "" - printInfo "If this looks good, you should now run 'git push' to upload." + printInfo "\nIf this looks good, you should now run 'git push' to upload." fi fi diff --git a/scripts/run_athena.sh b/scripts/run_athena.sh index 49fb90a4d4c25b72b2fa4be4459e707df5a9c611..c34330dc3ca102f9b509d84cad63caec0964165f 100755 --- a/scripts/run_athena.sh +++ b/scripts/run_athena.sh @@ -8,7 +8,7 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -dirs=($(git diff-tree --name-only -r HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +dirs=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit"