source: trunk/IPs/systemC/processor/Morpheo/Script/version.sh @ 88

Last change on this file since 88 was 88, checked in by rosiere, 15 years ago

Almost complete design
with Test and test platform

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/bash
2
3#-----------------------------------------------------------
4# $Id$
5#-----------------------------------------------------------
6
7file_sed_src="${MORPHEO_TOPLEVEL}/IPs/systemC/processor/Morpheo/Behavioural/include/Version.h.sed";
8file_sed_dest="${MORPHEO_TOPLEVEL}/IPs/systemC/processor/Morpheo/Behavioural/include/Version.h";
9file_sed_script="/tmp/file_sed_script";
10
11#-----[ usage ]---------------------------------------------
12function usage ()
13{
14    echo "Usage           : ${0} action";
15    echo "Arguments       : ";
16    echo " * action";     
17    echo "   * add        : add all file unpresent in project and set proprity";
18    echo "   * commit     : update revision number and commit";
19    echo "   * status     : print only locally modified items";
20    echo "   * status_new : print only locally new      items";
21    echo "   * help       : print this message";
22    echo "Note            :";
23    echo " * Morpheo's environnement must be positionned.";
24    exit;
25}
26
27#-----[ main ]----------------------------------------------
28function main ()
29{
30    # Test operand
31    if test ${#} -ne 1; then
32        usage ${*};
33    fi;
34
35    if test -z ${MORPHEO_TOPLEVEL}; then
36        usage ${*};
37    fi;
38
39    export LC_ALL=C;
40    export EDITOR="emacs";
41
42    pwd=${PWD};
43   
44    case ${1} in
45        "commit")
46            cd ${MORPHEO_TOPLEVEL};
47   
48            # +1 because is the next revision
49            revision=$(($(export LC_ALL=C; svnversion  | tr -d [:alpha:] | cut -d : -f 2) + 1));
50            date_day=$(date +%d);
51            date_month=$(date +%m);
52            date_year=$(date +%Y);
53           
54            echo "s/\"@REVISION\"/\"${revision}\"/"     >  ${file_sed_script};
55            echo "s/\"@DATE_DAY\"/\"${date_day}\"/"     >> ${file_sed_script};
56            echo "s/\"@DATE_MONTH\"/\"${date_month}\"/" >> ${file_sed_script};
57            echo "s/\"@DATE_YEAR\"/\"${date_year}\"/"   >> ${file_sed_script};
58
59            cat ${file_sed_src} |sed -f ${file_sed_script} &> ${file_sed_dest};
60
61            rm ${file_sed_script};
62           
63            svn commit;
64
65            cd ${pwd};
66            ;;
67
68        "add")
69            cd ${MORPHEO_TOPLEVEL};
70
71            for i in $(svn status | grep '?'); do
72                if test -e ${i}; then
73                    svn add ${i};
74                    svn propset svn:keywords "Id" ${i} -R
75                fi;
76            done;
77
78            cd ${pwd};
79            ;;
80
81        "status")
82            cd ${MORPHEO_TOPLEVEL};
83
84            svn status;
85
86            cd ${pwd};
87            ;;
88
89        "status_new")
90            cd ${MORPHEO_TOPLEVEL};
91
92            svn status | grep '?';
93
94            cd ${pwd};
95            ;;
96           
97        "help")
98            usage ${*};
99            ;;
100        *)
101            usage ${*};
102    esac
103}
104
105#-----[ Body ]----------------------------------------------
106main ${*}
Note: See TracBrowser for help on using the repository browser.