OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Updates all SHA1s in Goopfile to point to current refs/heads/master. | 6 """Updates all SHA1s in Goopfile to point to current refs/heads/master. |
7 | 7 |
8 Horribly slow, but simple. | 8 Horribly slow, but simple. |
9 | 9 |
10 Supposed to be followed by './env.py goop update' and manual examination of | 10 Supposed to be followed by './env.py goop update' and manual examination of |
11 all new wonderful packages we now depend on (to setup mirrors for them, etc). | 11 all new wonderful packages we now depend on (to setup mirrors for them, etc). |
12 See README.md. | 12 See README.md. |
13 """ | 13 """ |
14 | 14 |
15 import os | 15 import os |
16 import re | 16 import re |
17 import subprocess | 17 import subprocess |
18 import sys | 18 import sys |
19 import urllib2 | 19 import urllib2 |
20 | 20 |
21 | 21 |
22 GO_DIR = os.path.dirname(os.path.abspath(__file__)) | 22 GO_DIR = os.path.dirname(os.path.abspath(__file__)) |
23 | 23 |
24 | 24 |
25 # Packages that should be checked out via some non-standard ref. Notable | 25 # Packages that should be checked out via some non-standard ref. Notable |
26 # examples are packages distributed via gopkg.in hackery. | 26 # examples are packages distributed via gopkg.in hackery. |
27 EXCEPTIONS = { | 27 EXCEPTIONS = { |
28 'github.com/luci/gkvlite': 'refs/heads/32bitKeys', | |
Vadim Sh.
2015/09/28 22:27:48
oh, it's no longer exceptions, Robbie fixed refs/h
tandrii(chromium)
2015/09/29 10:17:28
Oh, great.
| |
29 'gopkg.in/fsnotify.v0': 'refs/heads/v0', | 28 'gopkg.in/fsnotify.v0': 'refs/heads/v0', |
30 'gopkg.in/tomb.v1': 'refs/heads/v1', | 29 'gopkg.in/tomb.v1': 'refs/heads/v1', |
31 'gopkg.in/yaml.v2': 'refs/heads/v2', | 30 'gopkg.in/yaml.v2': 'refs/heads/v2', |
32 } | 31 } |
33 | 32 |
34 | 33 |
35 def parse_goop_line(line): | 34 def parse_goop_line(line): |
36 """Line of Goop file -> (package name, ref, mirror repo or None).""" | 35 """Line of Goop file -> (package name, ref, mirror repo or None).""" |
37 chunks = [c.strip() for c in line.split()] | 36 chunks = [c.strip() for c in line.split()] |
38 mirror = None | 37 mirror = None |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 new_goop = '\n'.join(filtered) + '\n' | 102 new_goop = '\n'.join(filtered) + '\n' |
104 if new_goop.strip() == goop.strip(): | 103 if new_goop.strip() == goop.strip(): |
105 print 'No changes.' | 104 print 'No changes.' |
106 return 0 | 105 return 0 |
107 with open(os.path.join(GO_DIR, 'Goopfile'), 'wt') as f: | 106 with open(os.path.join(GO_DIR, 'Goopfile'), 'wt') as f: |
108 f.write(new_goop) | 107 f.write(new_goop) |
109 return 0 | 108 return 0 |
110 | 109 |
111 | 110 |
112 if __name__ == '__main__': | 111 if __name__ == '__main__': |
113 main() | 112 sys.exit(main()) |
OLD | NEW |