Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(570)

Side by Side Diff: src/pkg/deps.bash

Issue 5332053: code review 5332053: html,log,math: renamings (Closed)
Patch Set: diff -r 9d2976cf80fc https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/Makefile ('k') | src/pkg/html/template/Makefile » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # Copyright 2009 The Go Authors. All rights reserved. 2 # Copyright 2009 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style 3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file. 4 # license that can be found in the LICENSE file.
5 5
6 eval $(gomake --no-print-directory -f ../Make.inc go-env) 6 eval $(gomake --no-print-directory -f ../Make.inc go-env)
7 7
8 OUT="Make.deps" 8 OUT="Make.deps"
9 TMP="Make.deps.tmp" 9 TMP="Make.deps.tmp"
10 10
11 if [ -f $OUT ] && ! [ -w $OUT ]; then 11 if [ -f $OUT ] && ! [ -w $OUT ]; then
12 echo "$0: $OUT is read-only; aborting." 1>&2 12 echo "$0: $OUT is read-only; aborting." 1>&2
13 exit 1 13 exit 1
14 fi 14 fi
15 15
16 # Get list of directories from Makefile 16 # Get list of directories from Makefile
17 dirs=$(gomake --no-print-directory echo-dirs) 17 dirs=$(gomake --no-print-directory echo-dirs)
18 dirpat=$(echo $dirs C | awk '{ 18 dirpat=$(echo $dirs C | awk '{
19 for(i=1;i<=NF;i++){· 19 for(i=1;i<=NF;i++){·
20 x=$i 20 x=$i
21 gsub("/", "\\/", x) 21 gsub("/", "\\/", x)
22 printf("/^(%s)$/\n", x) 22 printf("/^(%s)$/\n", x)
23 } 23 }
24 }') 24 }')
25 25
26 # Append old names of renamed packages. TODO: clean up after renaming. 26 # Append old names of renamed packages. TODO: clean up after renaming.
27 dirpat="$dirpat 27 dirpat="$dirpat
28 /^(asn1)$/ 28 /^(asn1)$/
29 /^(big)$/
30 /^(cmath)$/
29 /^(csv)$/ 31 /^(csv)$/
32 /^(exp\/template\/html)$/
30 /^(gob)$/ 33 /^(gob)$/
31 /^(json)$/ 34 /^(json)$/
35 /^(rand)$/
36 /^(syslog)$/
32 /^(xml)$/ 37 /^(xml)$/
33 " 38 "
34 39
35 for dir in $dirs; do ( 40 for dir in $dirs; do (
36 cd $dir >/dev/null || exit 1 41 cd $dir >/dev/null || exit 1
37 42
38 sources=$(sed -n 's/^[ ]*\([^ ]*\.go\)[ ]*\\*[ ]*$/\1/p' Makefi le) 43 sources=$(sed -n 's/^[ ]*\([^ ]*\.go\)[ ]*\\*[ ]*$/\1/p' Makefi le)
39 sources=$(echo $sources | sed 's/\$(GOOS)/'$GOOS'/g') 44 sources=$(echo $sources | sed 's/\$(GOOS)/'$GOOS'/g')
40 sources=$(echo $sources | sed 's/\$(GOARCH)/'$GOARCH'/g') 45 sources=$(echo $sources | sed 's/\$(GOARCH)/'$GOARCH'/g')
41 # /dev/null here means we get an empty dependency list if $sources is em pty 46 # /dev/null here means we get an empty dependency list if $sources is em pty
42 # instead of listing every file in the directory. 47 # instead of listing every file in the directory.
43 sources=$(ls $sources /dev/null 2> /dev/null) # remove .s, .c, etc. 48 sources=$(ls $sources /dev/null 2> /dev/null) # remove .s, .c, etc.
44 49
45 deps=$( 50 deps=$(
46 sed -n '/^import.*"/p; /^import[ \t]*(/,/^)/p' $sources /dev/nul l | 51 sed -n '/^import.*"/p; /^import[ \t]*(/,/^)/p' $sources /dev/nul l |
47 cut -d '"' -f2 | 52 cut -d '"' -f2 |
48 awk "$dirpat" | 53 awk "$dirpat" |
49 grep -v "^$dir\$" | 54 grep -v "^$dir\$" |
50 sed 's/$/.install/' | 55 sed 's/$/.install/' |
51 # TODO: rename the dependencies for renamed directories. TODO: clean up after renaming. 56 # TODO: rename the dependencies for renamed directories. TODO: clean up after renaming.
52 » » sed 's;^asn1.install$;encoding/asn1.install;' | 57 » » sed 's;^asn1.install$;encoding/asn1.install;
53 » » sed 's;^csv.install$;encoding/csv.install;' | 58 » » s;^big.install$;math/big.install;
54 » » sed 's;^gob.install$;encoding/gob.install;' | 59 » » s;^cmath.install$;math/cmplx.install;
55 » » sed 's;^json.install$;encoding/json.install;' | 60 » » s;^csv.install$;encoding/csv.install;
56 » » sed 's;^xml.install$;encoding/xml.install;' | 61 » » s;^exp/template/html.install$;html/template.install;
62 » » s;^gob.install$;encoding/gob.install;
63 » » s;^json.install$;encoding/json.install;
64 » » s;^syslog.install$;log/syslog.install;
65 » » s;^rand.install$;math/rand.install;
66 » » s;^xml.install$;encoding/xml.install;' |
57 # TODO: end of renamings. 67 # TODO: end of renamings.
58 sed 's;^C\.install;runtime/cgo.install;' | 68 sed 's;^C\.install;runtime/cgo.install;' |
59 sort -u 69 sort -u
60 ) 70 )
61 71
62 echo $dir.install: $deps 72 echo $dir.install: $deps
63 ) done > $TMP 73 ) done > $TMP
64 74
65 mv $TMP $OUT 75 mv $TMP $OUT
66 76
67 if (egrep -v '^(exp|old)/' $OUT | egrep -q " (exp|old)/"); then 77 if (egrep -v '^(exp|old)/' $OUT | egrep -q " (exp|old)/"); then
68 echo "$0: $OUT contains dependencies to exp or old packages" 78 echo "$0: $OUT contains dependencies to exp or old packages"
69 exit 1 79 exit 1
70 fi 80 fi
OLDNEW
« no previous file with comments | « src/pkg/Makefile ('k') | src/pkg/html/template/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b