OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library pub.command_runner; | 5 library pub.command_runner; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void printUsage() { | 153 void printUsage() { |
154 log.message(usage); | 154 log.message(usage); |
155 } | 155 } |
156 | 156 |
157 /// Print a warning if we're running from the Dart SDK repo and pub isn't | 157 /// Print a warning if we're running from the Dart SDK repo and pub isn't |
158 /// up-to-date. | 158 /// up-to-date. |
159 /// | 159 /// |
160 /// This is otherwise hard to tell, and can produce confusing behavior issues. | 160 /// This is otherwise hard to tell, and can produce confusing behavior issues. |
161 void _checkDepsSynced() { | 161 void _checkDepsSynced() { |
162 if (!runningFromDartRepo) return; | 162 if (!runningFromDartRepo) return; |
| 163 if (!git.isInstalled) return; |
163 | 164 |
164 var deps = readTextFile(p.join(dartRepoRoot, 'DEPS')); | 165 var deps = readTextFile(p.join(dartRepoRoot, 'DEPS')); |
165 var pubRevRegExp = new RegExp( | 166 var pubRevRegExp = new RegExp( |
166 r'^ +"pub_rev": +"@([^"]+)"', multiLine: true); | 167 r'^ +"pub_rev": +"@([^"]+)"', multiLine: true); |
167 var match = pubRevRegExp.firstMatch(deps); | 168 var match = pubRevRegExp.firstMatch(deps); |
168 if (match == null) return; | 169 if (match == null) return; |
169 var depsRev = match[1]; | 170 var depsRev = match[1]; |
170 | 171 |
171 var actualRev = git.runSync(["rev-parse", "HEAD"], workingDir: pubRoot) | 172 var actualRev; |
172 .single; | 173 try { |
| 174 actualRev = git.runSync(["rev-parse", "HEAD"], workingDir: pubRoot) |
| 175 .single; |
| 176 } on git.GitException catch (_) { |
| 177 // When building for Debian, pub isn't checked out via git. |
| 178 return; |
| 179 } |
173 | 180 |
174 if (depsRev == actualRev) return; | 181 if (depsRev == actualRev) return; |
175 log.warning( | 182 log.warning( |
176 "${log.yellow('Warning:')} the revision of pub in DEPS is " | 183 "${log.yellow('Warning:')} the revision of pub in DEPS is " |
177 "${log.bold(depsRev)},\n" | 184 "${log.bold(depsRev)},\n" |
178 "but ${log.bold(actualRev)} is checked out in " | 185 "but ${log.bold(actualRev)} is checked out in " |
179 "${p.relative(pubRoot)}.\n\n"); | 186 "${p.relative(pubRoot)}.\n\n"); |
180 } | 187 } |
181 | 188 |
182 /// Returns the appropriate exit code for [exception], falling back on 1 if no | 189 /// Returns the appropriate exit code for [exception], falling back on 1 if no |
(...skipping 21 matching lines...) Expand all Loading... |
204 Future _validatePlatform() async { | 211 Future _validatePlatform() async { |
205 if (Platform.operatingSystem != 'windows') return; | 212 if (Platform.operatingSystem != 'windows') return; |
206 | 213 |
207 var result = await runProcess('ver', []); | 214 var result = await runProcess('ver', []); |
208 if (result.stdout.join('\n').contains('XP')) { | 215 if (result.stdout.join('\n').contains('XP')) { |
209 log.error('Sorry, but pub is not supported on Windows XP.'); | 216 log.error('Sorry, but pub is not supported on Windows XP.'); |
210 await flushThenExit(exit_codes.USAGE); | 217 await flushThenExit(exit_codes.USAGE); |
211 } | 218 } |
212 } | 219 } |
213 } | 220 } |
OLD | NEW |