source: rtems/c/update-tools/update.in @ 11cfb6f7

4.104.114.84.95
Last change on this file since 11cfb6f7 was 11cfb6f7, checked in by Joel Sherrill <joel.sherrill@…>, on 10/14/98 at 20:19:30

Patch from Ralf Corsepius <corsepiu@…>:

  1. Rtems contains some perl scripts that use hard-coded paths to /usr/bin/perl or /usr/local/bin/perl I have already fixed these problems by adding some checks to configure.in. While doing this, I also cleaned up some more autoconf related problems for generating shell scripts. This patch might seem a bit scary to you, but I am quite confident it won't break something (I've been testing it for almost a week now, however it might introduce typos for a limited number configurations I don't have access to - But it shouldn't be a problem for you to test them :-).

I expect to get this finished tonight, hence you will very likely
have the patch when you get up tomorrow.

Changes:

  • Check for PERL and disable all PERL scripts if perl wasn't found.
  • Generate all KSHELL-scripts with autoconf instead of make-script
  • Automatic dependency handling for autoconf generated KSHELL or PERL scripts (make/rtems.cfg)

Notes:

  • this patch contains new files and deletes some other files.
  • The patch is relative to rtems-4.0.0-beta4 with my previous rtems-rc-981014-1.diff patch applied.

Testing:

I tested it with sh-rtems and posix under linux. Now all targets
which are touched by this patch and which are not used while building
for sh-rtems and posix still need to be tested. AFAIS, only the
sparc/erc32 BSP should be affected by this criterion. And if you
like to, you should also consider testing it on a Cygwin32 and a
Solaris host for one arbitrary BSP.

  • Property mode set to 100644
File size: 4.2 KB
Line 
1#!@KSH@ -p
2#
3# $Id$
4#
5# Either bash or ksh will be ok for this; requires 'test -ot'
6#  (-p above just says to not parse $ENV file; makes it faster for
7#   those of us who set $ENV)
8#
9# Update RTEMS applications for the API changes from 3.1.0 to 3.2.0
10#
11# NOTE
12#
13#   This is potentially a very dangerous program.
14
15# progname=`basename $0`
16progname=${0##*/}        # fast basename hack for ksh, bash
17
18USAGE=\
19"
20usage: $progname [ -vs ] [ -b base_directory ] [-p file] [-f] [files...]
21        -v          -- verbose
22        -p          -- file with replacement instructions
23        -s          -- skip prompt for backup verification
24        -f          -- do files at end of line
25
26base_directory is the root directory of the source code to update.  It
27defaults to the current directory.
28
29This program updates C, H, and .inl files.
30"
31
32fatal() {
33    if [ "$1" ]
34    then
35        echo    >&2
36        echo $* >&2
37        echo    >&2
38    fi
39    echo "$USAGE" 1>&2
40    exit 1
41}
42
43#
44#  KLUDGE to figure out at runtime how to echo a line without a
45#  newline.
46#
47count=`echo "\\c" | wc -c`
48if [ ${count} -ne 0 ] ; then
49  EARG="-n"
50  EOL=""
51else
52  EARG=""
53  EOL="\\c"
54fi
55
56#
57#  Function to make sure they do a backup
58#
59
60WARNING=\
61"
62
63*******************************************************************************
64*******************************************************************************
65*******************************************************************************
66****                                                                       ****
67****        WARNING!!!          WARNING!!!           WARNING!!!            ****
68****                                                                       ****
69****   ALL SOURCE CODE SHOULD BE BACKED UP BEFORE RUNNING THIS PROGRAM!!   ****
70****                                                                       ****
71****        WARNING!!!          WARNING!!!           WARNING!!!            ****
72****                                                                       ****
73*******************************************************************************
74*******************************************************************************
75*******************************************************************************
76
77"
78
79verify_backup()
80{
81  echo "$WARNING"
82  continue="yes"
83  while [ $continue = "yes" ]
84  do
85echo ${EARG} "Do you wish to update the source tree at this time [y|n]? " ${EOL}
86    read answer
87    case $answer in
88      [yY]*)
89        continue="no"
90        ;;
91      [nN]*)
92        echo
93        echo "Exitting at user request"
94        echo
95        exit 0
96        ;;
97    esac
98  done
99}
100
101#
102#  Default tools to use...
103#
104#  NOTE: The GNU versions of both of these are faster.
105#
106find_prog=find
107xargs_prog=xargs
108
109#
110# process the options
111#
112
113verbose=""
114suffix=""
115mode=""
116base_directory=.
117do_files="no"
118do_prompt="yes"
119replacement_file="${RTEMS_ROOT}/update-tools/310_to_320_list"
120
121while getopts sfp:b:v OPT
122do
123    case "$OPT" in
124        v)
125          verbose="yes";;
126        s)
127          do_prompt="no";;
128        b)
129          base_directory=${OPTARG};;
130        p)
131          replacement_file=${OPTARG};;
132        f)
133          do_files="yes";;
134        *)
135          fatal
136    esac
137done
138
139let $((shiftcount = $OPTIND - 1))
140shift $shiftcount
141
142args=$*
143
144#
145#  Make sure they have done a backup
146#
147
148if [ ${do_prompt} = "yes" ]
149then
150  verify_backup
151fi
152
153#
154# Validate the base directory
155#
156
157if [ ! -d $base_directory ]
158then
159    fatal "${base_directory} does not exist"
160fi
161
162#
163# Validate the replacement file
164#
165
166if [ ! -r $replacement_file ]
167then
168    fatal "${replacement_file} does not exist or is not readable"
169fi
170
171
172#
173#  Verify enough of the RTEMS environment variables are set
174#
175
176if [ ! -d "${RTEMS_ROOT}" ]
177then
178    fatal "RTEMS_ROOT environment variable is not initialized"
179fi
180
181#
182# Update the files
183#
184
185generate_list()
186{
187  if [ ${do_files} = "yes" ]
188  then
189    for i in $args
190    do
191      echo $i
192    done
193  else
194    ${find_prog} ${base_directory} \(  -name "*.[ch]" -o -name "*.inl" \) -print
195  fi
196}
197
198generate_list | ${xargs_prog} |
199  while read line
200  do
201    ${RTEMS_ROOT}/update-tools/word-replace -p ${replacement_file} ${line}
202    if [ $? -ne 0 ]
203    then
204      exit 1
205    fi
206    for file in ${line}
207    do
208      mv ${file}.fixed ${file}
209    done
210  done
211
212exit 0
213
214# Local Variables: ***
215# mode:ksh ***
216# End: ***
Note: See TracBrowser for help on using the repository browser.