From 42d3cef11bd9a84d11eb48a4ff9686d2e0ce5436 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 18 Jan 2019 20:36:11 +0000 Subject: Sanity check to run the Make with proper group permissions If the `./for-group' script is not used properly, it can lead to the whole pipeline being re-run. Therefore it is important to do a sanity check immediately at the start of Make's processing and inform the user if there is a problem. With this commit, `./for-group' exports the `reproducible_paper_for_group' variable which is used by both the initial `./configure' script, and later in each call to Make. The `./configure' script will use it to write a value in `reproduce/config/pipeline/LOCAL.mk' and Make will use it to compare with the value in `reproduce/config/pipeline/LOCAL.mk'. If there is an inconsistency, Make will not even attempt to build anything and will just print a message and abort. --- configure | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'configure') diff --git a/configure b/configure index c2ab5e7..df87435 100755 --- a/configure +++ b/configure @@ -162,6 +162,34 @@ fi +# Make sure the group permissions satisfy the previous configuration (if it +# exists and we don't want to re-write it). +if [ $rewritepconfig = no ]; then + oldforgroup=$(awk '/FOR-GROUP/ && c==0 {c=1; print $3}' $pconf) + if [ "x$oldforgroup" = xyes ]; then + if [ "x$reproducible_paper_for_group" = x ]; then + echo "-----------------------------" + echo "!!!!!!!! ERROR !!!!!!!!" + echo "-----------------------------" + echo "Previous pipeline was configured for groups." + echo "Either enable re-write, or use './for-group'." + exit 1 + fi + else + if [ "x$reproducible_paper_for_group" = xyes ]; then + echo "-----------------------------" + echo "!!!!!!!! ERROR !!!!!!!!" + echo "-----------------------------" + echo "Previous pipeline was not configured for groups." + echo "Either enable re-write, or don't use './for-group'." + exit 1 + fi + fi +fi + + + + # Identify the downloader tool # ---------------------------- @@ -376,11 +404,23 @@ fi # Write the parameters into the local configuration file. if [ $rewritepconfig = yes ]; then + + # Make the pipeline configuration's initial comments. create_file_with_notice $pconf + + # Fix the group settings. + if [ "x$reproducible_paper_for_group" = xyes ]; then + for_group=yes + else + for_group=no + fi + + # Write the values. sed -e's|@bdir[@]|'"$bdir"'|' \ -e's|@indir[@]|'"$indir"'|' \ -e's|@ddir[@]|'"$ddir"'|' \ -e's|@downloader[@]|'"$downloader"'|' \ + -e's|@forgroup[@]|'"$for_group"'|' \ $pconf.in >> $pconf else # Read the values from existing configuration file. -- cgit v1.2.1