aboutsummaryrefslogtreecommitdiff
path: root/for-group
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-07-28 02:32:20 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-07-28 02:53:34 +0100
commit6ef4cc854d1df46b719de5d66b45537b0aa11f92 (patch)
treea4b9680ef483167e41089a4a8b911cca70c11164 /for-group
parent8847155563e25aa70663413f6a8dc9657ca79993 (diff)
Single wrapper instead of old ./configure, Makefile and ./for-group
Until now, to work on a project, it was necessary to `./configure' it and build the software. Then we had to run `.local/bin/make' to run the project and do the analysis every time. If the project was a shared project between many users on a large server, it was necessary to call the `./for-group' script. This way of managing the project had a major problem: since the user directly called the lower-level `./configure' or `.local/bin/make' it was not possible to provide high-level control (for example limiting the environment variables). This was especially noticed recently with a bug that was related to environment variables (bug #56682). With this commit, this problem is solved using a single script called `project' in the top directory. To configure and build the project, users can now run these commands: $ ./project configure $ ./project make To work on the project with other users in a group these commands can be used: $ ./project configure --group=GROUPNAME $ ./project make --group=GROUPNAME The old options to both configure and make the project are still valid. Run `./project --help' to see a list. For example: $ ./project configure -e --host-cc $ ./project make -j8 The old `configure' script has been moved to `reproduce/software/bash/configure.sh' and is called by the new `./project' script. The `./project' script now just manages the options, then passes control to the `configure.sh' script. For the "make" step, it also reads the options, then calls Make. So in the lower-level nothing has changed. Only the `./project' script is now the single/direct user interface of the project. On a parallel note: as part of bug #56682, we also found out that on some macOS systems, the `DYLD_LIBRARY_PATH' environment variable has to be set to blank. This is no problem because RPATH is automatically set in macOS and the executables and libraries contain the absolute address of the libraries they should link with. But having `DYLD_LIBRARY_PATH' can conflict with some low-level system libraries and cause very hard to debug linking errors (like that reported in the bug report). This fixes bug #56682.
Diffstat (limited to 'for-group')
-rwxr-xr-xfor-group114
1 files changed, 0 insertions, 114 deletions
diff --git a/for-group b/for-group
deleted file mode 100755
index e5c55f9..0000000
--- a/for-group
+++ /dev/null
@@ -1,114 +0,0 @@
-#! /bin/bash
-#
-# Running examples:
-#
-# $ ./for-group group_name configure [OPTIONS]
-# $ ./for-group group_name make [OPTIONS]
-#
-# This is a wrapper for the configure and Make steps designed for a group
-# of users (sharing the same group name) working on the project in the same
-# build directory.
-#
-# When the configuration (normally done with `./configure') and build
-# (normally done with `.local/bin/make') steps are done with this script,
-# all the files that are created within the project will have these
-# properties:
-#
-# 1) Group owner will be the group specified in the command-line.
-# 2) The permission flags give write access to the group members.
-#
-# Copyright (C) 2019, Mohammad Akhlaghi <mohammad@akhlaghi.org>
-#
-# This script is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This script is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# A copy of the GNU General Public License is available at
-# <http://www.gnu.org/licenses/>.
-
-
-
-
-
-# Script settings
-# ---------------
-# Stop the script if there are any errors.
-set -e
-
-
-
-
-
-# See if any argument are given at all.
-if [ "x$1" = x ]; then
- 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
-fi
-
-
-
-
-
-# Prepare any other argument to pass onto the `./configure' or `make'
-# commands. `$@' is the list of command-line tokens given to the this
-# (`./for-group') script. Therefore, the first token in it is the group
-# name and the second is the script name. As a result, we want anything
-# after the third token.
-options=$(echo "$@" | awk '{for(i=3;i<=NF;++i) printf("%s ", $i)}')
-
-
-
-
-
-# Make sure the given group is usable.
-if sg "$1" "echo test &> /dev/null" &> /dev/null; then
- if [ "x$2" = xconfigure ]; then script="./configure"
- elif [ "x$2" = xmake ]; then script=".local/bin/make"
- else
- echo "$0: a third argument is necessary."
- echo "It specifies the action: either 'configure' or 'make'"
- exit 1
- fi
-else
- echo "$0: '$1' is not a usable group name on this system.";
- echo "TIP: you can use the 'groups' command to see your groups."
- exit 1
-fi
-
-
-
-
-
-# Define the group, and set the permission so the user and group both have
-# read and write permissions. Then run the respective script.
-#
-# 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).
-export reproducible_paper_group_name="$1"
-sg "$1" "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && $script $options"
-
-
-
-
-
-# Group writing permissions for dependencies directory
-#
-# The common build process sets the writing permissions of the installed
-# programs/libraries to `755'. So group members can't write over a
-# file. This creates problems when another group member wants to update the
-# software for example. We thus need to manually add the group writing flag
-# to all installed software files.
-if [ "x$2" = xconfigure ]; then
- echo "Enabling group writing permission on all installed software..."
- .local/bin/chmod -R g+w .local/;
-fi