diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-02-01 18:30:02 +0000 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-02-01 18:38:44 +0000 |
commit | f41be41e376dfd521881ad2e6137360e549777de (patch) | |
tree | f01dfde240cf065ea161b073ac6663a4941a2ed4 /for-group | |
parent | d65b1ccd97fab64062804ace0e0ec5914e1029c1 (diff) |
Group name is now part of the local configuration
Until now, the group name to build the project actually went into the Git
source of the project! This doesn't allow exact reproducibility on
different machines (where the group name may be different).
With this commit, the `for-group' script has been modified to accept the
group name as its first argument and pass that onto `configure' and
Make. This is much better now, because not only the existance of a group
installation is checked, but also the name of the group. It also made
things simpler (in particular in `LOCAL.mk.in').
Diffstat (limited to 'for-group')
-rwxr-xr-x | for-group | 45 |
1 files changed, 28 insertions, 17 deletions
@@ -1,9 +1,9 @@ -#! /bin/sh +#! /bin/bash # # Running examples: # -# $ ./for-group configure -# $ ./for-group make [-jN] +# $ ./for-group group_name configure +# $ ./for-group group_name make [-jN] # # This is a wrapper for the configure and Make steps designed for a group # of users (sharing the same group name) using this pipeline on the same @@ -13,7 +13,7 @@ # (normally done with `.local/bin/make') steps are done with this script, # all the files that are created within the pipeline have these properties: # -# 1) Group owner will be a special group (value of `thisgroup' below). +# 1) Group owner will be the group specified in the command-line. # 2) The permission flags give write access to the group members. # # Original author: @@ -39,13 +39,6 @@ -# Desired group -thisgroup=YOUR-GROUP - - - - - # Script settings # --------------- # Stop the script if there are any errors. @@ -55,14 +48,32 @@ set -e -# Set and run the respective command. +# See if any argument are given at all. if [ "x$1" = x ]; then - echo "$0: an argument is necessary ('configure' or 'make')" + echo "$0: At least two arguments are necessary:" + echo + echo " To configure: $ ./for-group group_name configure" + echo " To build: $ ./for-group group_name make" exit 1 -elif [ "x$1" = xconfigure ]; then script="./configure" -elif [ "x$1" = xmake ]; then script=".local/bin/make $2" +fi + +# Make sure the given group is usable. +testfile=".reproducible-pipeline-group-test" +echo "Just for a test" > $testfile +if chgrp $1 $testfile; then + rm $testfile + if [ "x$2" = xconfigure ]; then script="./configure" + elif [ "x$2" = xmake ]; then script=".local/bin/make $2" + else + echo "$0: a third argument is necessary." + echo "It specifies the action: 'configure' or 'make'" + exit 1 + fi else - echo "$0: argument must be 'configure' or 'make'" + rm $testfile + echo + echo "$0: '$1' is not a usable group name!"; + echo "TIP: you can use the 'groups' command to see your groups." exit 1 fi @@ -76,4 +87,4 @@ fi # We are also exporting a special variable so `./configure' and Make can # prepare for sanity checks and avoid re-doing the whole analysis with a # typo (not using this script properly after configuration). -sg $thisgroup "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && export reproducible_paper_for_group=yes && $script" +sg $1 "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && export reproducible_paper_group_name=$1 && $script" |