diff options
author | David Symonds <dsymonds@golang.org> | 2009-05-23 19:39:25 -0700 |
---|---|---|
committer | David Symonds <dsymonds@golang.org> | 2009-05-23 19:39:25 -0700 |
commit | 0c277f198ced8088fca5000f612e5e2a18bc357a (patch) | |
tree | c3daba435589ad61403842327feaa6aa57489d9c | |
parent | 6e0667febec8b666f3d9feef74a9e0d7003dd944 (diff) | |
download | golang-0c277f198ced8088fca5000f612e5e2a18bc357a.tar.gz |
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
-rw-r--r-- | src/lib/Makefile | 2 | ||||
-rwxr-xr-x | src/lib/deps.bash | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Makefile b/src/lib/Makefile index 653900236..8aa70cd47 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -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. diff --git a/src/lib/deps.bash b/src/lib/deps.bash index d6796c940..db05f2a1d 100755 --- a/src/lib/deps.bash +++ b/src/lib/deps.bash @@ -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 |