scripts deplaces dans cvsroot/dev

This commit is contained in:
Olivier Sirol 1999-09-09 14:31:09 +00:00
parent b249ae4bec
commit db8991fcfe
4 changed files with 0 additions and 966 deletions

View File

@ -1,121 +0,0 @@
#!/bin/sh
# -*- Mode: shell-script -*-
#
# Script to update Alliance binaries
# toto.old <- toto <- toto.new
#
# Author : Olivier SIROL
# Date : Jul 1997
# $Id: alc_update_bin,v 1.1 1998/10/21 16:42:57 alliance Exp $
#
# Ex d'appel : "alc_update_binaries genscan"
# Sur HOUSE seulement : toto.old <- toto <- toto.new
# Copie dans le spool...
ALCTEAM="alliance-interested-users"
MAIL=/labo/gnu/bin/elm
NOD=`uname -n`
if [ ! $NOD = "trash" ] ; then
echo "Please, run this script from trash"
exit 1
fi
# le nom de l'exec a renomer
BIN_NAME=$1
ALC_HOUSE=/users/soft5/newlabo/
SPOOL_DIR=$ALC_HOUSE/alc_spool/
ALL_HOSTS="bechet opera morton"
ALL_MACHINE="Solaris SunOS Linux_elf"
fail() {
echo -e "\
\n\
\n\
@@@@@@@@@ @ @@@@@@ @@@@@@ \n\
@@ @ @ @@ @@ \n\
@@ @ @@@ @@ @@ \n\
@@ @@@ @@ @@ \n\
@@ @ @ @@ @@ @@ \n\
@@@@@@ @ @@ @@ @@ \n\
@@ @ @ @@ @@ @@ \n\
@@ @@@@@@@ @@ @@ \n\
@@ @ @@ @@ @@ @\n\
@@ @ @@ @@ @@ @ \n\
@@@@@@ @@@@ @@@@ @@@@@@ @@@@@@@@@@ "
exit 1
}
pass() {
echo -e "\
\n\
\n\
@@@@@@@ @ @@@@ @ @@@@ @ \n\
@@ @@ @ @ @@ @ @@ \n\
@@ @@ @@@ @@ @ @@ @ \n\
@@ @@ @@@ @@@ @@@ \n\
@@ @@ @ @@ @@@@ @@@@ \n\
@@@@@ @ @@ @@@@ @@@@ \n\
@@ @ @@ @@@ @@@ \n\
@@ @@@@@@@ @ @@ @ @@\n\
@@ @ @@ @@ @@ @@ @@\n\
@@ @ @@ @@@ @ @@@ @ \n\
@@@@@@ @@@@ @@@@ @ @@@@ @ @@@@ "
}
if [ $# -lt 1 ] ; then
echo "Usage : `basename $0` XXX"
echo "where XXX is the tool exec name"
echo "eg: `basename $0` tas"
exit 1
fi
# toto.old <- toto <- toto.new
for THIS_MACHINE in $ALL_MACHINE
do
echo Update on $THIS_MACHINE
OLD_NAME=$ALC_HOUSE/$THIS_MACHINE/bin/$BIN_NAME.old
CURRENT_NAME=$ALC_HOUSE/$THIS_MACHINE/bin/$BIN_NAME
NEW_NAME=$ALC_HOUSE/$THIS_MACHINE/bin/$BIN_NAME.new
TMP_NAME=$ALC_HOUSE/$THIS_MACHINE/bin/$BIN_NAME.tmp
# copie (en cas de disk full)
cp $NEW_NAME $TMP_NAME
if [ $? -ne 0 ] ; then
fail
fi
rm $OLD_NAME
mv $CURRENT_NAME $OLD_NAME
mv $NEW_NAME $CURRENT_NAME
mv $TMP_NAME $NEW_NAME
done
# update spool
#for THIS_HOST in $ALL_HOSTS
#do
# echo touch $SPOOL_DIR/$THIS_HOST/bin/$OLD_NAME
# echo touch $SPOOL_DIR/$THIS_HOST/bin/$CURRENT_NAME
# echo touch $SPOOL_DIR/$THIS_HOST/bin/$NEW_NAME
#done
pass
# il faut tout mailer a alc_team
#
# peut etre plus de :
# if [ $? -ne 0 ] ; then
# fail
# fi
$MAIL -s "ALC : $1.new passe en $1" $ALCTEAM < /dev/null

View File

@ -1,19 +0,0 @@
#!/bin/sh
DATE=`/asim/gnu/bin/date +"%Y.%m.%d_%H.%M.%S"`
LABO=/users/soft5/newlabo/alliance
for ARCHI in Linux_elf SunOS Solaris
do
for FILE in /users/outil1/alliance/alliance/archi/$ARCHI/bin/*
do
echo %%%%%% $FILE
cp -f $FILE /users/soft5/newlabo/alliance/archi/$ARCHI/bin/`basename $FILE`.$DATE
ln -f -s /users/soft5/newlabo/alliance/archi/$ARCHI/bin/`basename $FILE`.$DATE /users/soft5/newlabo/alliance/archi/$ARCHI/bin/`basename $FILE`
done
for TRUC in lib include
do
cp -f /users/outil1/alliance/alliance/archi/$ARCHI/$TRUC/* /users/soft5/newlabo/alliance/archi/$ARCHI/$TRUC
done
done

View File

@ -1,505 +0,0 @@
#!/bin/sh
# set -v
# set -x
#
# Installation script for the tools of the lab that plug on Alliance
#
# Author: Frédéric Pétrot (fred@pasta.fr.ea)
# for version 0
#
# $Id: instool,v 1.3 1999/02/01 14:47:54 alliance Exp $
#
SYS=`uname -a | awk '{print $1}'`
VER=`uname -a | awk '{print $3}' | awk -F. '{print $1}'`
NOD=`uname -n`
# depends vraiement de l'archi...est n'a ete teste que sur trash...
if [ ! $NOD = "trash" ] ; then
echo "Please, run this script from trash"
exit 1
fi
if [ $SYS = "SunOS" -a $VER = "5" ] ; then
MAIL=/labo/gnu/bin/elm
DF=/usr/ucb/df
DU=/usr/ucb/du
DATE=`/asim/gnu/bin/date +"%Y.%m.%d_%H.%M.%S"`
elif [ $SYS = "SunOS" -a $VER = "4" ] ; then
MAIL=/labo/gnu/bin/elm
DF=/usr/bin/df
DU=/usr/bin/du
DATE=`/asim/gnu/bin/date +"%Y.%m.%d_%H.%M.%S"`
elif [ $SYS = "Linux" ] ; then
MAIL=/usr/bin/elm
DF=/bin/df
DU=/bin/du
DATE=`/asim/gnu/bin/date +"%Y.%m.%d_%H.%M.%S"`
else
echo "`basename $0` is ran on an unknown system"
echo "use it at your own risks, ..."
MAIL=mail
DF=df
DU=du
fi
RSH=rsh
LOG=$HOME/`basename $0`.$$
BUG=$HOME/`basename $0`_bug.$$
TMP=$HOME/`basename $1`
ALCTEAM="alliance-programmers@asim.lip6.fr"
BUGTEAM="fred ludo czo"
# rep par defaut : alliance/archi/$MACHINE
# alliance/share/...
TARGET="SunOS Solaris Linux_elf"
LABO=/users/soft5/newlabo/alliance
CELL_EXTENSIONS="al ap vst vbe cp hns edi spi db dat IDX"
CELLS=$LABO/share/cells
ETC=$LABO/share/etc
MANS=$LABO/share/man
echo " @@@@@@ @@@@@@@@@@ @@@@"
echo " @@ @ @@ @ @@"
echo " @@ @ @@ @ @@"
echo " @@ @@@ @@@ @@@@@@ @@ @@@ @@@ @@"
echo " @@ @@@ @ @@ @ @@ @@ @@ @@ @@ @@"
echo " @@ @@ @@ @@@ @@ @@ @@ @@ @@ @@"
echo " @@ @@ @@ @@@@ @@ @@ @@ @@ @@ @@"
echo " @@ @@ @@ @@@@ @@ @@ @@ @@ @@ @@"
echo " @@ @@ @@ @ @@@ @@ @@ @@ @@ @@ @@"
echo " @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@"
echo " @@@@@@ @@@@ @@@@ @ @@@@@ @@@@@@ @@@ @@@ @@@@@@"
echo
echo " Alliance Tools Installation Script"
echo
echo " Alliance CAD System 3.2, instool beta0"
echo " Copyright (c) now, MASI, CAO-VLSI Team"
echo " E-mail support: cao-vlsi@lip6.fr"
echo
echo "News: "
echo " the installed binaries are now suffixed '.new'"
echo " the include are shared"
echo " the authorized cells extensions are $CELL_EXTENSIONS"
echo " a log of all installations is available in $HOME/log"
echo " a message MUST be given for each installation"
echo " the default shell is now sh"
if [ $# -lt 2 -o $# -gt 4 ] ; then
echo "Syntax: `basename $0` [-v] tool-home-directory message"
exit 1
fi
if [ $1 = "-v" ]; then
verbose=1
shift
else
verbose=0
fi
if [ -z $1 -o -z "${2:-''}" ] ; then
echo "Syntax: `basename $0` [-v] tool-home-directory message"
exit 1
fi
if [ $verbose -ne 0 ] ; then
echo "`basename $0` : Checking directories"
fi
if [ ! -d $1 ] ; then
echo "`basename $0` cannot install tool $1"
echo "Directory $1 doesn't exist!"
exit 2
fi
if [ ! -d $1/labo ] ; then
echo "`basename $0` cannot install tool $1"
echo "Directory $1/labo doesn't exist!"
exit 3
fi
for i in $TARGET ; do
if [ ! -d $1/labo/$i ] ; then
echo "`basename $0` cannot install tool $1"
echo "Directory $1/labo/$i doesn't exist!"
exit 4
fi
done
bin=0; lib=0; inc=0
for i in $TARGET ; do
if [ -d $1/labo/$i/bin ] ; then
bin=`expr $bin + 1`
fi
if [ -d $1/labo/$i/lib ] ; then
lib=`expr $lib + 1`
fi
if [ -d $1/labo/$i/include ] ; then
inc=`expr $inc + 1`
fi
done
if [ $bin -eq 0 ]; then
echo "No binaries to install, ..."
unset bin
elif [ ! $bin -eq 3 ]; then
echo "`basename $0` cannot install tool $1"
echo "Directory $1/labo/archi/bin doesn't exist on all architectures"
exit 5
fi
if [ $lib -eq 0 -a $inc -eq 0 ]; then
echo "No libraries to install, ..."
unset lib inc
elif [ ! \( $lib -eq 3 -a $inc -eq 3 \) ]; then
echo "`basename $0` cannot install tool $1"
echo "Directory $1/labo/archi/lib or/and $1/labo/archi/include "
echo "doesn't exist on all architectures"
exit 6
fi
if [ ${bin:-0} -eq 0 -a ${lib:-0} -eq 0 -a ${inc:-0} -eq 0 ] ; then
echo "`basename $0` cannot install tool $1"
echo "Nothing to be installed"
exit 0
fi
trap "rm -f $HOME/*.$$ $LOG; exit 0" 0 1 2 15
#trap "exit 12" 0 1 2 15
if [ $verbose -ne 0 ] ; then
echo "`basename $0` : Checking directories contents for consistency"
fi
b=0
if [ ! ${bin:-0} -eq 0 ]; then
for i in $TARGET ; do
ls -1 $1/labo/$i/bin > $HOME/$i.bin.$$ 2> /dev/null
if [ ! -s $HOME/$i.bin.$$ ] ; then
b=`expr $b + 1`
fi
done
if [ $b -eq 3 ] ; then
for i in $TARGET ; do
echo "Please remove $1/labo/$i/bin since it is empty"
done
unset bin
fi
fi
l=0
h=0
if [ ! ${lib:-0} -eq 0 ]; then
for i in $TARGET ; do
ls -1 $1/labo/$i/lib > $HOME/$i.lib.$$ 2> /dev/null
ls -1 $1/labo/$i/lib/*.a | awk -F/ '{print $NF}' > $HOME/$i.lib.a.$$ 2> /dev/null
diff $HOME/$i.lib.$$ $HOME/$i.lib.a.$$ > /dev/null 2>&1
if [ ! $? -eq 0 ] ; then
echo "`basename $0` cannot install tool $1"
echo "directory $1/labo/$i/lib contains files "
echo "that do not end with .a"
exit 7
fi
ls -1 $1/labo/$i/include > $HOME/$i.inc.$$ 2> /dev/null
ls -1 $1/labo/$i/include/*.h | awk -F/ '{print $NF}' > $HOME/$i.inc.h.$$ 2> /dev/null
diff $HOME/$i.inc.$$ $HOME/$i.inc.h.$$ > /dev/null 2>&1
if [ ! $? -eq 0 ] ; then
echo "`basename $0` cannot install tool $1"
echo "directory $1/labo/$i/include contains files "
echo "that do not end with .h"
exit 7
fi
if [ ! -s $HOME/$i.lib.$$ ] ; then
l=`expr $l + 1`
fi
if [ ! -s $HOME/$i.inc.$$ ] ; then
h=`expr $h + 1`
fi
if [ \( ! -s $HOME/$i.lib.$$ -a -s $HOME/$i.inc.$$ \) -o \
\( -s $HOME/$i.lib.$$ -a ! -s $HOME/$i.inc.$$ \) ] ; then
echo "`basename $0` cannot install tool $1"
echo "Libraries requires includes and vice-versa"
exit 7
fi
done
if [ $l -eq 3 ] ; then
echo "Please remove $1/labo/archi/lib since it is empty "
unset lib
fi
if [ $h -eq 3 ] ; then
echo "Please remove $1/labo/archi/include since it is empty "
unset inc
fi
fi
if [ ${bin:-0} -eq 0 -a ${lib:-0} -eq 0 -a ${inc:-0} -eq 0 ] ; then
echo "`basename $0` cannot install tool $1"
echo "Nothing to install"
exit 1
fi
DIR=`echo ${bin:+bin} ${lib:+lib} ${inc:+include}`
bins=0; libs=0; incs=0
for i in $TARGET ; do
for j in $TARGET ; do
if [ ! ${bin:-0} -eq 0 ]; then
diff $HOME/$j.bin.$$ $HOME/$i.bin.$$ > /dev/null 2>&1
bins=`expr $bins + $?`
fi
if [ ! ${lib:-0} -eq 0 ]; then
diff $HOME/$j.lib.$$ $HOME/$i.lib.$$ > /dev/null 2>&1
libs=`expr $libs + $?`
diff $HOME/$j.inc.$$ $HOME/$i.inc.$$ > /dev/null 2>&1
incs=`expr $incs + $?`
fi
done
done
if [ $bins -gt 0 -o $libs -gt 0 -o $incs -gt 0 ] ; then
echo "`basename $0` cannot install tool $1"
echo "all bin/lib/include directories do not contain the same files"
echo "for all target architectures"
exit 8
fi
echo "`basename $0`: Checking for space on disk :"
s=`$DU -s $1/labo/cells $1/labo/etc $1/labo/man \
2>/dev/null | tail -1 | cut -f 1`
for i in $TARGET; do
for j in $DIR; do
d=`$DU -s $1/labo/$i/$j | tail -1 | cut -f 1`
s=`expr $s + $d`
done
done
a=`$DF $LABO | sed -e 's/ */ /g' | tail -1 | cut -f 4`
if [ $verbose -ne 0 ] ; then
echo "Available disk space $a"
echo "Required disk space $s"
fi
if [ $s -gt $a ] ; then
echo "`basename $0`: cannot install tool $1"
echo "Not enough space on device for the installation"
echo "Ring me again in a few days, ..."
exit 23
fi
#
# echo "+---------------------------------------------------" >> $LOG
# echo $DATE >> $LOG
#
# if [ $verbose -ne 0 ] ; then
# echo "`basename $0` : Copying the directories contents"
# echo "May take a while, ..."
# echo "Cells [$CELL_EXTENSIONS]"
# fi
#
# c=0; nc=0
# if [ -d $1/labo/cells ] ; then
# cd $1/labo/cells
# for d in `\ls -d *`; do
# if [ ! -d $d ]; then continue; fi
# echo > $TMP.ext.$$
# for i in $CELL_EXTENSIONS; do
# ls -1 $1/labo/cells/$d/*.$i 2> /dev/null > $TMP.cell.$$
# if [ -s $TMP.cell.$$ ] ; then
# echo $i >> $TMP.ext.$$
# fi
# done
# if [ ! -s $TMP.ext.$$ ] ; then
# echo "Please remove the $1/labo/cells/$d directory as it"
# echo "contains no cells"
# else
# echo "+---------------------------------------------------" >> $LOG
# mkdir -p $CELLS/$d
# if [ -f $1/labo/cells/$d/CATAL ]; then
# cp $1/labo/cells/$d/CATAL $CELLS/$d
# fi
# echo "Cells:" >> $LOG
# for i in `cat $TMP.ext.$$` ; do
# cp $1/labo/cells/$d/*.$i $CELLS/$d >> $BUG 2>&1
# if [ $? -ne 0 ] ; then
# echo "`basename $0`: cp returned a non-zero exit status"
# echo "that sucks pretty much so I quit leaving things as is"
# exit 17
# fi
# ls -1 $1/labo/cells/$d | grep \.$i | fmt -70 >> $LOG
# done
# fi
# done
# else
# if [ $verbose -ne 0 ] ; then
# echo "none"
# fi
# fi
# cd
#
# if [ $verbose -ne 0 ] ; then
# echo "Etc"
# fi
#
# if [ -d $1/labo/etc ] ; then
# for i in $TARGET; do
# if [ -f $1/labo/etc/$i.mk ] ; then
# echo "`basename $0` cannot install tool $1"
# echo "You're not allowed to install '$i.mk' by yourself boy!"
# exit 9
# fi
# done
#
# if [ -f $1/labo/etc/libraries.mk ] ; then
# echo "`basename $0` cannot install tool $1"
# echo "You're not allowed to install 'libraries.mk' by yourself boy!"
# exit 9
# fi
# ls -1 $1/labo/etc/* > /dev/null 2> $TMP.etc.$$
# if [ ! -s $TMP.etc.$$ ] ; then
# cp $1/labo/etc/* $ETC >> $BUG 2>&1
# if [ $? -ne 0 ] ; then
# echo "`basename $0`: cp returned a non-zero exit status"
# echo "that sucks pretty much so I quit leaving things as is"
# exit 17
# fi
# echo "+---------------------------------------------------" >> $LOG
# echo "Etc :" >> $LOG
# ls -1 $1/labo/etc | fmt -70 >> $LOG
# else
# echo "Please remove the $1/labo/etc directory as it"
# echo "contains no files"
# fi
# else
# if [ $verbose -ne 0 ] ; then
# echo "none"
# fi
# fi
#
# if [ $verbose -ne 0 ] ; then
# echo "Manual pages"
# fi
#
# if [ -d $1/labo/man ] ; then
# echo "+---------------------------------------------------" >> $LOG
# echo "Manuals :" >> $LOG
# for i in 1 2 3 4 5 6 7 8 9 ; do
# if [ -d $1/labo/man/man$i ] ; then
# ls -1 $1/labo/man/man$i/*.$i > /dev/null 2> $TMP.man$i.$$
# if [ -s $TMP.man$i.$$ ] ; then
# echo "Please remove the $1/labo/man/man$i directory as it"
# echo "contains no files"
# else
# cp $1/labo/man/man$i/*.$i $MANS/man$i >> $BUG 2>&1
# if [ $? -ne 0 ] ; then
# echo "`basename $0`: cp returned a non-zero exit status"
# echo "that sucks pretty much so I quit leaving things as is"
# exit 17
# fi
# ls -1 $1/labo/man/man$i | grep \.$i | fmt -70 >> $LOG
# fi
# fi
# done
# for i in 1 2 3 4 5 6 7 8 9 ; do
# if [ -f $TMP.man$i.$$ ] ; then
# cat $TMP.man$i.$$ >> $TMP.man.$$
# fi
# if [ -f $TMP.man.$$ ] ; then
# if [ -s $TMP.man.$$ ] ; then
# echo "Please remove the $1/labo/man directory tree as it"
# echo "contains no files"
# fi
# fi
# done
# else
# if [ $verbose -ne 0 ] ; then
# echo "none"
# fi
# fi
#
if [ $verbose -ne 0 ] ; then
echo "The real stuff right now, ..."
fi
for i in $TARGET ; do
echo "+---------------------------------------------------" >> $LOG
echo "Target $i " >> $LOG
for j in $DIR ; do
echo "+---------------------" >> $LOG
echo "directory $j " >> $LOG
if [ $j = "bin" ] ; then
for k in $1/labo/$i/$j/*; do
cp $k $LABO/archi/$i/$j/`basename $k`.$DATE
if [ $? -ne 0 ] ; then
echo "`basename $0`: cp returned a non-zero exit status"
echo "that sucks pretty much so I quit leaving things as is"
exit 17
fi
rm -f $LABO/archi/$i/$j/`basename $k` > /dev/null 2>&1
ln -s $LABO/archi/$i/$j/`basename $k`.$DATE $LABO/archi/$i/$j/`basename $k`
if [ $? -ne 0 ] ; then
echo "`basename $0`: ln returned a non-zero exit status"
echo "that sucks pretty much so I quit leaving things as is"
exit 17
fi
done
elif [ $j = "lib" ] ; then
for k in $1/labo/$i/$j/*; do
cp $k $LABO/archi/$i/$j >> $BUG 2>&1
if [ $? -ne 0 ] ; then
echo "`basename $0`: cp returned a non-zero exit status"
echo "that sucks pretty much so I quit leaving things as is"
exit 17
fi
if [ $i = "SunOS" ] ; then
$RSH heavy ranlib $LABO/archi/$i/$j/`basename $k`
fi
done
else
cp $1/labo/$i/$j/* $LABO/archi/$i/$j >> $BUG 2>&1
if [ $? -ne 0 ] ; then
echo "`basename $0`: cp returned a non-zero exit status"
echo "that sucks pretty much so I quit leaving things as is"
exit 17
fi
fi
ls -1 $1/labo/$i/$j | fmt -70 >> $LOG
done
done
for i in $DIR; do
if [ $i = "lib" ] ; then
if [ -f $HOME/libraries.mk.* ] ; then
echo "`basename $0`: Sorry, somebody is updating libraries.mk"
echo "waiting until the update is done to finish"
fi
while [ -f $HOME/libraries.mk.$$ ]; do
sleep 2
echo "Still waiting, ..."
done
$HOME/bin/updatelibmk $LABO/archi/SunOS > $HOME/libraries.mk.$$
mv $ETC/libraries.mk $ETC/libraries.mk.$DATE
if [ $? -ne 0 ] ; then
echo "`basename $0`: mv returned a non-zero exit status"
echo "while copying libraries.mk to libraries.mk.$$"
echo "that sucks pretty much so I quit leaving things as is"
exit 17
fi
mv $HOME/libraries.mk.$$ $ETC/libraries.mk
if [ $? -ne 0 ] ; then
echo "`basename $0`: mv returned a non-zero exit status"
echo "while copying libraries.mk to libraries.mk.$$"
echo "that sucks pretty much so I quit leaving things as is"
exit 17
fi
fi
done
echo >> $LOG
if [ -s $BUG ] ; then
$MAIL -s "ALC : Problem while installing `basename $1`" $BUGTEAM < $BUG
fi
$MAIL -s "ALC : Install of `basename $1`" `basename $1` < $LOG
echo $* | $MAIL -s "ALC : Install of `basename $1`" $ALCTEAM
cat $LOG >> $HOME/log/`basename $1`.log
exit 0

View File

@ -1,321 +0,0 @@
#!/bin/sh
# -*- Mode: shell-script -*-
#
# Script to update Alliance XXX/etc/libraries.mk whith
# the newest libs found in XXX/lib/
# and the newest includes found in XXX/include/.
#
# Creates XXX/etc/libraries.mk.update and gives warnings to stderr
# then copy old libraries.mk to libraries.mk.`date`
# then copy new libraries.mk.update to libraries.mk
#
# Usage :
# Requires 1 arg : XXX which is the path to
# etc/libraries.mk, lib/ and include/
# Eg : update_libraries.mk.sh /users/soft5/labo_pc
#
# Author : Olivier SIROL
# Date : April 1997
# $Id: updatelibmk,v 1.2 1999/08/27 17:31:58 czo Exp $
# DO_UPDATE: 0 chk only, 1 write file, 2 print stdout
DO_UPDATE=2
if [ $# -ge 1 ] ; then
if [ $1 = "-u" ] ; then
DO_UPDATE=1
shift
fi
if [ $1 = "-c" ] ; then
DO_UPDATE=0
shift
fi
fi
if [ $# -lt 1 ] ; then
echo "Usage : `basename $0` [-c|-u] XXX"
echo "where XXX is the path to :"
echo " lib : XXX/lib/lib*.a"
echo " header : XXX/include/*.h"
echo " makefile : XXX/etc/libraries.mk"
echo "if -c is specified as first arg, only check (no files are written)"
echo "if -u is specified as first arg, write libraries.mk"
echo "whithout first arg, print to stdout"
exit 1
fi
if [ -d $1/lib ] && [ -d $1/include ] && [ -f $1/etc/libraries.mk ] ; then
ROOT_DIR=$1;
LIBMK=$1/etc/libraries.mk;
#if [ $DO_UPDATE -eq 1 ] ; then
# LIBMK_UPD=$LIBMK.update
# LIBMK_OLD=$LIBMK.`date +%Y_%m_%d`
#else
# if [ $DO_UPDATE -eq 2 ] ; then
# LIBMK_UPD=
# else
# LIBMK_UPD=> /dev/null
# fi
#fi
(cat $LIBMK) | gawk -v ROOT_DIR=$ROOT_DIR '
BEGIN {
# On cree un tableau contennant
# - le nom des librairies installees
# - le numero de version
# - un flag pour verifier par la suite quelles sont dans libraries.mk
#
FIRSTPASS=0;
OLD_PREFIX="";
OLD_NUMBER="0";
i=1;
MAFONC = "(cd "ROOT_DIR"/lib ; ls -1 lib*.a | sort)";
while (MAFONC | getline)
{
LIB_NAME=$0;
sub ( /.a$/ , "", LIB_NAME);
sub ( /^lib/ , "", LIB_NAME);
LIB_PREFIX=LIB_NAME;
LIB_NUMBER=LIB_NAME;
sub ( /[0-9]*$/ , "", LIB_PREFIX);
sub ( LIB_PREFIX , "", LIB_NUMBER);
if (OLD_PREFIX==LIB_PREFIX && FIRSTPASS)
{
if ((LIB_NUMBER+0) > (OLD_NUMBER+0))
OLD_NUMBER=LIB_NUMBER;
}
else
{
if (!FIRSTPASS)
FIRSTPASS=1;
else
{
HL[1,i]=OLD_PREFIX;
HL[2,i]=OLD_NUMBER;
HL[3,i]=0;
i++;
}
OLD_PREFIX=LIB_PREFIX;
OLD_NUMBER=LIB_NUMBER;
}
}
HL[1,i]=OLD_PREFIX;
HL[2,i]=OLD_NUMBER;
HL[3,i]=0;
MAX_HL=i;
close (MAFONC);
# On cree un autre tableau pour les headers
FIRSTPASS=0;
OLD_PREFIX="";
OLD_NUMBER="0";
i=1;
MAFONC = "(cd "ROOT_DIR"/include ; ls -1 *.h | sort)";
while (MAFONC | getline)
{
LIB_NAME=$0;
sub ( /.h$/ , "", LIB_NAME);
LIB_PREFIX=LIB_NAME;
LIB_NUMBER=LIB_NAME;
sub ( /[0-9]*$/ , "", LIB_PREFIX);
sub ( LIB_PREFIX , "", LIB_NUMBER);
if (OLD_PREFIX==LIB_PREFIX && FIRSTPASS)
{
if ((LIB_NUMBER+0) > (OLD_NUMBER+0))
OLD_NUMBER=LIB_NUMBER;
}
else
{
if (!FIRSTPASS)
FIRSTPASS=1;
else
{
HH[1,i]=OLD_PREFIX;
HH[2,i]=OLD_NUMBER;
HH[3,i]=0;
i++;
}
OLD_PREFIX=LIB_PREFIX;
OLD_NUMBER=LIB_NUMBER;
}
}
HH[1,i]=OLD_PREFIX;
HH[2,i]=OLD_NUMBER;
HH[3,i]=0;
MAX_HH=i;
close (MAFONC);
}
#
# process du libraries.mk
# on remplace les numeros inc/lib par les derniers numeros de version
# si inc/lib introuvable, on ne modifie pas la ligne
# Il doit y avoir une seul maro par ligne du type
# xxxx_L ou
# xxxx_LIB ou
# xxxx_H
#
# warnings sur stderr
#
# si commentaire, on laisse tomber sauf Last updated
/# Last updated on/ {
printf("# Last updated on %s\n", strftime("on %A %d %B %Y at %H:%M %Z"));
next;
}
/^[ \t]*#/ {
print;
next;
}
# si ALLIANCE ou TARGET on laisse tomber
/^[ \t]*ALLIANCE_/ {next}
/^[ \t]*TARGET_/ {next}
# si macro, ca nous interresse
/=/ {
MACRO = $0;
NAME = $0;
sub(/[ \t]*=.*$/, "", MACRO);
sub(/^.*=[ \t]*/, "", NAME);
LIB_NAME = NAME;
if ( MACRO ~ /_L/)
{
if (MACRO ~ /_LIB/)
{
sub ( /.a$/ , "", LIB_NAME);
sub ( /^lib/ , "", LIB_NAME);
}
else
sub ( /^-l/ , "", LIB_NAME);
LIB_PREFIX=LIB_NAME;
LIB_NUMBER=LIB_NAME;
sub ( /[0-9]*$/ , "", LIB_PREFIX);
sub ( LIB_PREFIX , "", LIB_NUMBER);
for (i=1; i<=MAX_HL; i++)
{
if (i==MAX_HL || HL[1,i]==LIB_PREFIX)
break;
}
if (HL[1,i]==LIB_PREFIX)
{
if (MACRO ~ /_LIB/)
{
if ((HL[2,i]+0) > (LIB_NUMBER+0))
printf ("## CHANGED : lib%s%s.a is older than existing, changed\n",
LIB_PREFIX, LIB_NUMBER) > "/dev/stderr";
if ((HL[2,i]+0) < (LIB_NUMBER+0))
printf ("## CHANGED : lib%s%s.a is newer than existing, changed\n",
LIB_PREFIX, LIB_NUMBER) > "/dev/stderr";
printf ("%-10s = lib%s%s.a\n", MACRO,LIB_PREFIX, HL[2,i]);
}
else
printf ("%-10s = -l%s%s\n", MACRO,LIB_PREFIX, HL[2,i]);
HL[3,i]=1;
}
else
{
printf ("%s\n", $0);
printf ("%%% Warning lib %s not found, left as is\n",
LIB_PREFIX) > "/dev/stderr";
}
}
else
if ( MACRO ~ /_H/)
{
sub ( /.h$/ , "", LIB_NAME);
LIB_PREFIX=LIB_NAME;
LIB_NUMBER=LIB_NAME;
sub ( /[0-9]*$/ , "", LIB_PREFIX);
sub ( LIB_PREFIX , "", LIB_NUMBER);
for (i=1; i<=MAX_HH; i++)
{
if (i==MAX_HH || HH[1,i]==LIB_PREFIX)
break;
}
if (HH[1,i]==LIB_PREFIX)
{
if ((HH[2,i]+0) > (LIB_NUMBER+0))
printf ("## CHANGED : %s%s.h is older than existing, changed\n",
LIB_PREFIX, LIB_NUMBER) > "/dev/stderr";
if ((HH[2,i]+0) < (LIB_NUMBER+0))
printf ("## CHANGED : %s%s.h is newer than existing, changed\n",
LIB_PREFIX, LIB_NUMBER) > "/dev/stderr";
printf ("%-10s = %s%s.h\n", MACRO,LIB_PREFIX, HH[2,i]);
HH[3,i]=1;
}
else
{
printf ("%s\n", $0);
printf ("%%% Warning header %s not found, left as is\n",
LIB_PREFIX) > "/dev/stderr";
}
}
else
{
printf ("%%% Warning : unrecognized line, left as is\n") > "/dev/stderr";
printf ("%s\n", $0);
}
next;
}
# sinon cest une ligne normale
{print;}
END {
for (i=1; i<=MAX_HL; i++)
if (HL[3,i]==0)
printf ("%%% WARNING no macro in libraries.mk for lib%s%s.a\n",
HL[1,i] , HL[2,i]) > "/dev/stderr";
for (i=1; i<=MAX_HH; i++)
if (HH[3,i]==0)
printf ("%%% WARNING no macro in libraries.mk for %s%s.h\n",
HH[1,i] , HH[2,i]) > "/dev/stderr";
}'
# $LIBMK_UPD
#if [ $DO_UPDATE -eq 1 ] ; then
# cp -f $LIBMK $LIBMK_OLD
# cp -f $LIBMK_UPD $LIBMK
# rm -f $LIBMK_UPD
# echo $LIBMK updated!
# exit 0
#fi
else
echo "`basename $0` : error, can't find file or dir"
echo "lib : $1/lib/lib*.a"
echo "header : $1/include/*.h"
echo "makefile : $1/etc/libraries.mk"
exit 1
fi