| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 set -e | 6 set -e |
| 7 | 7 |
| 8 http_port=8080 | 8 http_port=8080 |
| 9 ssh_port=29418 | 9 ssh_port=29418 |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 # ... | 70 # ... |
| 71 # } | 71 # } |
| 72 # | 72 # |
| 73 # ...and prints the name and md5sum of the corresponding *.war file. | 73 # ...and prints the name and md5sum of the corresponding *.war file. |
| 74 | 74 |
| 75 import json | 75 import json |
| 76 import re | 76 import re |
| 77 import sys | 77 import sys |
| 78 | 78 |
| 79 requested_version = sys.argv[1] if len(sys.argv) > 1 else None | 79 requested_version = sys.argv[1] if len(sys.argv) > 1 else None |
| 80 gerrit_re = re.compile('gerrit(?:-full)?-([0-9.]+)(-rc[0-9]+)?[.]war') | 80 # Disable using -rc versions. This is a temporary hack to avoid |
| 81 # picking up version 2.9-rc0, which requires java 7. These lines |
| 82 # should be un-commented after this bug is fixed: |
| 83 # https://code.google.com/p/chromium/issues/detail?id=346369 |
| 84 #gerrit_re = re.compile('gerrit(?:-full)?-([0-9.]+)(-rc[0-9]+)?[.]war') |
| 85 gerrit_re = re.compile('gerrit(?:-full)?-([0-9.]+)[.]war') |
| 81 j = json.load(sys.stdin) | 86 j = json.load(sys.stdin) |
| 82 items = [(x, gerrit_re.match(x['name'])) for x in j['items']] | 87 items = [(x, gerrit_re.match(x['name'])) for x in j['items']] |
| 83 items = [(x, m.group(1), m.group(2)) for x, m in items if m] | 88 #items = [(x, m.group(1), m.group(2)) for x, m in items if m] |
| 89 items = [(x, m.group(1), '') for x, m in items if m] |
| 84 def _cmp(a, b): | 90 def _cmp(a, b): |
| 85 an = a[1].split('.') | 91 an = a[1].split('.') |
| 86 bn = b[1].split('.') | 92 bn = b[1].split('.') |
| 87 while len(an) < len(bn): | 93 while len(an) < len(bn): |
| 88 an.append('0') | 94 an.append('0') |
| 89 while len(bn) < len(an): | 95 while len(bn) < len(an): |
| 90 bn.append('0') | 96 bn.append('0') |
| 91 # Disable using -rc versions. This is a temporary hack to avoid | 97 an.append(a[2][3:] if a[2] else '1000') |
| 92 # picking up version 2.9-rc0, which requires java 7. These lines | 98 bn.append(b[2][3:] if b[2] else '1000') |
| 93 # should be un-commented after this bug is fixed: | |
| 94 # https://code.google.com/p/chromium/issues/detail?id=346369 | |
| 95 # an.append(a[2][3:] if a[2] else '1000') | |
| 96 # bn.append(b[2][3:] if b[2] else '1000') | |
| 97 for i in range(len(an)): | 99 for i in range(len(an)): |
| 98 if an[i] != bn[i]: | 100 if an[i] != bn[i]: |
| 99 return -1 if int(an[i]) > int(bn[i]) else 1 | 101 return -1 if int(an[i]) > int(bn[i]) else 1 |
| 100 return 0 | 102 return 0 |
| 101 | 103 |
| 102 if requested_version: | 104 if requested_version: |
| 103 for info, version in items: | 105 for info, version in items: |
| 104 if version == requested_version: | 106 if version == requested_version: |
| 105 print '"%s" "%s"' % (info['name'], info['md5Hash']) | 107 print '"%s" "%s"' % (info['name'], info['md5Hash']) |
| 106 sys.exit(0) | 108 sys.exit(0) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 To use SSH API: | 205 To use SSH API: |
| 204 ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit | 206 ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit |
| 205 | 207 |
| 206 To enable 'git push' without a password prompt: | 208 To enable 'git push' without a password prompt: |
| 207 git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' | 209 git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' |
| 208 | 210 |
| 209 To stop the server: | 211 To stop the server: |
| 210 ${rundir}/bin/gerrit.sh stop | 212 ${rundir}/bin/gerrit.sh stop |
| 211 | 213 |
| 212 EOF | 214 EOF |
| OLD | NEW |