From 6dd16b871a04fe29d1805b110371b0a229876159 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Thu, 10 Jan 2019 11:59:37 +0000 Subject: Wrapper script to allow groups working in the build directory On large projects, its often necessary to share the build directory between the various users of the pipeline. To simplify the process a `for-group' script is now added to the pipeline which is just a wrapper over the `./configure' and `.local/bin/make' commands to make sure that the group owner of the outputs and the permission flags are set properly. --- README-pipeline.md | 18 ++++++++++++++ for-group | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100755 for-group diff --git a/README-pipeline.md b/README-pipeline.md index 48f6c7b..f98a7ee 100644 --- a/README-pipeline.md +++ b/README-pipeline.md @@ -382,6 +382,16 @@ your research, set it as prerequisites to other rules and remove it from the list of prerequisites for TeX macro file. In fact, this is how a project is designed to grow in this framework. +When working within a group, more than one person may want to work with the +pipeline outputs (in the build directory). For example each person is +developing part of the higher-level steps of the pipeline in their own Git +branch of the pipeline, but using the same build directory. Therefore, the +lower-level parts of the built outputs, can be shared between them. In such +scenarios, this pipeline comes with a `for-group` script (in the top +directory) which is just a simple wrapper to run the configure and building +steps. You can specify a group name within this file. Therefore, when you +use it (fully described in the comments at the start of the file), it will +ensure that all group members have write access to the created files. @@ -581,6 +591,14 @@ advanced in later stages of your work. with. Also check and update this file one last time when you are ready to publish your work (and its reproduction pipeline). + - **`for-group`**: If you will be working on this pipeline with + colleagues, and the build steps involve many files, or are slow, you + need to share the build directory. This script is designed for such + scenarios. So open this file and give the name of the Unix name of + your group to the `thisgroup` variable. You can see the list of groups + you are a member of with the `groups` command. You can ask your system + administrator to define a group with specific members if necessary. + - **Your first commit**: You have already made some small and basic changes in the steps above and you are in the `master` branch. So, you can officially make your first commit in your project's history. But diff --git a/for-group b/for-group new file mode 100755 index 0000000..653c8d9 --- /dev/null +++ b/for-group @@ -0,0 +1,69 @@ +#! /bin/sh +# +# Running examples: +# +# $ ./for-group configure +# $ ./for-group 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 +# build directory. +# +# When the configuration (normally done with `./configure') and build +# (normally done with `.local/bin/make') steps are done with this 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). +# 2) The permission flags give write access to the group members. +# +# Original author: +# Mohammad Akhlaghi +# Contributing author(s): +# Copyright (C) 2019, Mohammad Akhlaghi. +# +# 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 +# . + + + + + +# Desired group +thisgroup=ourgroup + + + + + +# Script settings +# --------------- +# Stop the script if there are any errors. +set -e + + + + + +# Set and run the respective command. +if [ "x$1" = x ]; then + echo "$0: an argument is necessary ('configure' or 'make')" + exit 1 +elif [ "x$1" = xconfigure ]; then script="./configure" +elif [ "x$1" = xmake ]; then script=".local/bin/make $2" +else + echo "$0: argument must be 'configure' or 'make'" + exit 1 +fi +echo; echo $script; echo +sg $thisgroup "umask g+w && $script" -- cgit v1.2.1