#! /bin/bash #******************************************************************************* # E.S.O. - ALMA project # # "@(#) $Id: acsMakeCopySources,v 1.2 2010/09/20 14:25:08 mzampare Exp $" # # who when what # -------- -------- ---------------------------------------------- #******************************************************************************* # ALMA - Atacama Large Millimeter Array # Copyright (c) ESO - European Southern Observatory, 2014 # (in the framework of the ALMA collaboration). # All rights reserved. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #******************************************************************************* #************************************************************************ # NAME # acsMakeCopySources - copy the module source files into integration area. # # SYNOPSIS # # acsMakeCopySources # # # DESCRIPTION # Utility used by acsMakefile to copy the module source files into # integration area, when INTROOT/INTLIST is defined. # It is not intended to be used as a standalone command. # # According to the current parent directory, files are copied into: # # # /src ---> INTROOT/Sources//src # /test ---> INTROOT/Sources//test # /include ---> INTROOT/Sources//include # # / where is one or more of ws, lcu, ace, dsp # # /ws/src ---> INTROOT/Sources//ws/src # /lcu/src ---> INTROOT/Sources//lcu/src # /ace/src ---> INTROOT/Sources//ace/src # /dsp/src ---> INTROOT/Sources//dsp/src # # /ws/test ---> INTROOT/Sources//ws/test # /lcu/test ---> INTROOT/Sources//lcu/test # /ace/test ---> INTROOT/Sources//ace/test # /dsp/test ---> INTROOT/Sources//dsp/test # # /ws/include ---> INTROOT/Sources//ws/include # /lcu/include ---> INTROOT/Sources//lcu/include # /ace/include ---> INTROOT/Sources//ace/include # /dsp/include ---> INTROOT/Sources//dsp/include # # # The reason why to copy sorce file into integration area is to have # the exact files that have been used for generating the software # that has been installed. This for debugging purposes. # # FILES # $ACSROOT/include/acsMakefile # # ENVIRONMENT # # INTROOT current integration area root directory # # RETURN VALUES # # SEE ALSO # acsMakefile, Makefile, (GNU) make # # GNU make - Edition 0.41, for make Version 3.64 Beta, April 93 # # BUGS # #---------------------------------------------------------------------- # Select the first dir of INTLIST TMP_INTLIST=`echo $INTLIST | awk -F: '{print $1}'` if [ "X$INTROOT" = "X" ] then if [ "X$TMP_INTLIST" = "X" ] then # Integration area is not specified --> nothing to do exit 0 else if [ ! -d $TMP_INTLIST ] then echo "" echo " ERROR: acsMakeCopySources: INTLIST defined as >> $TMP_INTLIST << is not a directory" echo "" exit 1 fi fi else if [ ! -d $INTROOT ] then echo "" echo " ERROR: acsMakeCopySources: INTROOT defined as >> $INTROOT << is not a directory" echo "" exit 1 fi fi # WHERE_TO_COPY initialization WHERE_TO_COPY="" if [ "X$INTROOT" != "X" ] then WHERE_TO_COPY=$INTROOT fi if [ "X$INTROOT" = "X" ] && [ "X$INTLIST" != "X" ] then WHERE_TO_COPY=`echo $INTLIST | awk 'BEGIN {FS=":"} {print $1}'` fi # # get current directory. It should have this form: .....//src) PWD=`pwd` # # where am I? SUB_DIR=`basename $PWD` # # check if this is a standard ACS structure. if [ $SUB_DIR != "src" -a $SUB_DIR != "test" ] then echo "" echo " ERROR: acsMakeCopySources: " echo " ACS standard Makefile can be either src/ or in test/ " echo " Where are you now?" echo "" exit 1 fi # # find module name. There are two cases: # - normal modules: the module name is the parent directory # - multiplatform modules: the module is structured as more than one # submodules. Each submodule has the normal module # directory tree but fixed names are used: # /ws for the ws part # /lcu for the LCU part # /ace for the ACE part # /dsp for the DSP part PARENT_DIR=`dirname $PWD` MODULE_NAME=`basename $PARENT_DIR` if [ "$MODULE_NAME" = "lcu" -o "$MODULE_NAME" = "ws" -o "$MODULE_NAME" = "ace" -o "$MODULE_NAME" = "dsp" ] then GRANDPARENT_DIR=`dirname $PARENT_DIR` MODULE_NAME="`basename $GRANDPARENT_DIR`" PLATFORM_NAME="`basename $PARENT_DIR`" fi # # If Sources directory does not exists, create it (compatibility with # existing INTROOT structures) for dir in Sources $MODULE_NAME $PLATFORM_NAME do WHERE_TO_COPY=$WHERE_TO_COPY/$dir if [ ! -d $WHERE_TO_COPY ] then if mkdir $WHERE_TO_COPY then continue else echo "" echo " ERROR: acsMakeCopySources: cannot access/create $WHERE_TO_COPY" echo "" exit 1 fi fi done echo "" echo " Copying current files " for dir in $SUB_DIR include do echo " from: $PARENT_DIR/$dir" # # because some modules may not follow the standard directory # structure, let's check that the directory exists if [ -d $PARENT_DIR/$dir ] then # if any, remove files currently stored in the integration area if [ -d $WHERE_TO_COPY/$dir ] then rm -rf $WHERE_TO_COPY/$dir fi mkdir $WHERE_TO_COPY/$dir echo " to: $WHERE_TO_COPY/$dir" # # copy current files into integration area cp -r $PARENT_DIR/$dir $WHERE_TO_COPY # set the files group writable (so they can be overwritten # by another team member during integration activity) chmod -R 777 $WHERE_TO_COPY/$dir else echo " . . . does not exists. Skipped" echo " (probably this module is not standard)" fi done echo " . . . done " echo "" # # ___oOo___