From 20b6273a65ab4d99ad760fd715ca935494d4fc2e Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Sun, 28 Mar 2021 12:55:03 +0100 Subject: Configuration: corrected check of group name When built in 'group' mode, the write permissions of all created files will be activated for a certain group of users in the host operating system. The user specifies the name of the group with the '--group' option at configure time. At the very start, the './project' script checks to see if the given group name actually exists or not (to avoid hard-to-debug errors popping up later). Until now, the checking 'sg' command (that was used to build the project with group-writable permissions) would always fail due to the excessive number of redirections. Therefore, it would always print the error message and abort. With this commit, the output of 'sg' is no longer re-directed (which also helps users in debuggin). If the group does actually exist, it will just print a small statement saying so, and if it fails, the error message is printed. This fixed the problem, allowing maneage to be built in group-mode. I also noticed that the variable name keeping the group name ('reproducible_paper_group_name') used the old name for the project (which was "Reproducible paper template"! So it has been changed/corrected to 'maneage_group_name'. --- project | 6 +++--- reproduce/analysis/make/top-make.mk | 4 ++-- reproduce/analysis/make/top-prepare.mk | 2 +- reproduce/software/shell/configure.sh | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/project b/project index 1e3aeb4..53452ff 100755 --- a/project +++ b/project @@ -326,14 +326,14 @@ fi if ! [ x$group = x ]; then # Check if group is usable. - if ! sg "$group" "echo test &> /dev/null" &> /dev/null; then + if ! sg "$group" "echo Group \'$group\' exists"; then echo "$scriptname: '$group' is not a usable group name on this system."; echo "(TIP: you can use the 'groups' command to see your groups)" exit 1 fi # Set the group option for running Make. - gopt="reproducible_paper_group_name=$group" + gopt="maneage_group_name=$group" fi @@ -441,10 +441,10 @@ case $operation in export build_dir=$build_dir export input_dir=$input_dir export scriptname=$scriptname + export maneage_group_name=$group export software_dir=$software_dir export existing_conf=$existing_conf export all_highlevel=$all_highlevel - export reproducible_paper_group_name=$group # Run the configuration script if [ x"$group" = x ]; then diff --git a/reproduce/analysis/make/top-make.mk b/reproduce/analysis/make/top-make.mk index 026220e..596cc0d 100644 --- a/reproduce/analysis/make/top-make.mk +++ b/reproduce/analysis/make/top-make.mk @@ -51,7 +51,7 @@ include reproduce/software/config/LOCAL.conf # Controlling this requires two variables that are available at this stage: # # - `GROUP-NAME': from `LOCAL.conf' (which was built by `./project configure'). -# - `reproducible_paper_group_name': value to the `--group' option. +# - `maneage_group_name': value to the `--group' option. # # The analysis is only done when both have the same group name. Note that # when the project isn't being built for a group, both variables will be an @@ -64,7 +64,7 @@ include reproduce/software/config/LOCAL.conf # If you are just interested in the processing and don't want to build the # PDF, you can skip the creation of the final PDF by giving a value of # `yes' to `pdf-build-final' in `reproduce/analysis/config/pdf-build.conf'. -ifeq (x$(reproducible_paper_group_name),x$(GROUP-NAME)) +ifeq (x$(maneage_group_name),x$(GROUP-NAME)) all: paper.pdf else all: diff --git a/reproduce/analysis/make/top-prepare.mk b/reproduce/analysis/make/top-prepare.mk index f81ac07..fb5700e 100644 --- a/reproduce/analysis/make/top-prepare.mk +++ b/reproduce/analysis/make/top-prepare.mk @@ -35,7 +35,7 @@ include reproduce/software/config/LOCAL.conf # ------------------------------- # # See `top-make.mk' for complete explanation. -ifeq (x$(reproducible_paper_group_name),x$(GROUP-NAME)) +ifeq (x$(maneage_group_name),x$(GROUP-NAME)) all: $(BDIR)/software/preparation-done.mk @echo "Project preparation is complete."; else diff --git a/reproduce/software/shell/configure.sh b/reproduce/software/shell/configure.sh index fe46cef..e15a8e9 100755 --- a/reproduce/software/shell/configure.sh +++ b/reproduce/software/shell/configure.sh @@ -771,7 +771,7 @@ fi # exists and we don't want to re-write it). if [ $rewritepconfig = no ]; then oldgroupname=$(awk '/GROUP-NAME/ {print $3; exit 0}' $pconf) - if [ "x$oldgroupname" = "x$reproducible_paper_group_name" ]; then + if [ "x$oldgroupname" = "x$maneage_group_name" ]; then just_a_place_holder_to_avoid_not_equal_test=1; else echo "-----------------------------" @@ -1089,7 +1089,7 @@ if [ $rewritepconfig = yes ]; then -e's|@ddir[@]|'"$ddir"'|' \ -e's|@sys_cpath[@]|'"$sys_cpath"'|' \ -e's|@downloader[@]|'"$downloader"'|' \ - -e's|@groupname[@]|'"$reproducible_paper_group_name"'|' \ + -e's|@groupname[@]|'"$maneage_group_name"'|' \ $pconf.in >> $pconf else # Read the values from existing configuration file. Note that the build @@ -1248,7 +1248,7 @@ if ! [ -d "$mtexdir" ]; then mkdir "$mtexdir"; fi # TeX build directory. If built in a group scenario, the TeX build # directory must be separate for each member (so they can work on their # relevant parts of the paper without conflicting with each other). -if [ "x$reproducible_paper_group_name" = x ]; then +if [ "x$maneage_group_name" = x ]; then texbdir="$texdir"/build else user=$(whoami) @@ -1758,10 +1758,10 @@ echo `.local/bin/date` > $finaltarget # # The configuration is now complete, we can inform the user on the next # step(s) to take. -if [ x$reproducible_paper_group_name = x ]; then +if [ x$maneage_group_name = x ]; then buildcommand="./project make -j8" else - buildcommand="./project make --group=$reproducible_paper_group_name -j8" + buildcommand="./project make --group=$maneage_group_name -j8" fi cat <