If Make.deps is not writable (e.g. in Perforce client and not opened for editing), bail out immediately.

R=rsc,r
APPROVED=r
DELTA=7  (5 added, 1 deleted, 1 changed)
OCL=29319
CL=29319
This commit is contained in:
David Symonds 2009-05-23 19:39:25 -07:00
parent 798b19bf77
commit bef1a6439d
2 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@
# After editing the DIRS= list or adding imports to any Go files
# in any of those directories, run:
#
# p4 edit Make.deps; ./deps.bash
# ./deps.bash
#
# to rebuild the dependency information in Make.deps.

View File

@ -6,6 +6,11 @@
OUT="Make.deps"
TMP="Make.deps.tmp"
if [ -f $OUT ] && ! [ -w $OUT ]; then
echo "$0: $OUT is read-only; aborting." 1>&2
exit 1
fi
# Get list of directories from Makefile
dirs=$(sed '1,/^DIRS=/d; /^$/,$d; s/\\//g' Makefile)
dirpat=$(echo $dirs | sed 's/ /|/g; s/.*/^(&)$/')
@ -28,5 +33,4 @@ for dir in $dirs; do (
echo $dir.install: $deps
) done > $TMP
p4 open $OUT
mv $TMP $OUT