mirror of
https://github.com/flutter/packages.git
synced 2025-06-29 22:33:11 +08:00
[fuchsia_ctl] Fix IPv6 URL formatting for amber_ctl (#46)
* [fuchsia_ctl] Fix IPv6 URL formatting for amber_ctl If the local address of the interface that's connected to the Fuchsia device has an IPv6 address the URL to the Amber config.json was formatted incorrectly. * [fuchsia_ctl] Discover local address over ssh. * [fuchsia_ctl] remove author from pubspec.yaml
This commit is contained in:
@ -172,7 +172,6 @@ Future<OperationResult> test(
|
||||
final List<String> farFiles = args['far'];
|
||||
final String target = args['target'];
|
||||
try {
|
||||
final String localIp = await devFinder.getLocalAddress(deviceName);
|
||||
final String targetIp = await devFinder.getTargetAddress(deviceName);
|
||||
stdout.writeln('Using ${repo.path} as repo to serve to $targetIp...');
|
||||
repo.createSync(recursive: true);
|
||||
@ -185,13 +184,23 @@ Future<OperationResult> test(
|
||||
|
||||
await server.serveRepo(repo.path, port: 0);
|
||||
|
||||
result = await ssh.runCommand(targetIp,
|
||||
identityFilePath: identityFile,
|
||||
command: <String>['echo \$SSH_CONNECTION']);
|
||||
if (!result.success) {
|
||||
stderr.writeln('failed to get local address, aborting.');
|
||||
stderr.writeln(result.error);
|
||||
return result;
|
||||
}
|
||||
final String localIp = result.info.split(' ')[0].replaceAll('%', '%25');
|
||||
|
||||
result = await ssh.runCommand(
|
||||
targetIp,
|
||||
identityFilePath: identityFile,
|
||||
command: <String>[
|
||||
'amberctl',
|
||||
'add_src',
|
||||
'-f', 'http://$localIp:${server.serverPort}/config.json', //
|
||||
'-f', 'http://[$localIp]:${server.serverPort}/config.json', //
|
||||
'-n', uuid,
|
||||
],
|
||||
);
|
||||
@ -245,6 +254,8 @@ Future<OperationResult> test(
|
||||
return testResult;
|
||||
} finally {
|
||||
repo.deleteSync(recursive: true);
|
||||
await server.close();
|
||||
if (server.serving) {
|
||||
await server.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,11 @@ class PackageServer {
|
||||
|
||||
int _serverPort;
|
||||
|
||||
/// Is the server up?
|
||||
bool get serving {
|
||||
return _pmServerProcess != null;
|
||||
}
|
||||
|
||||
/// Creates a new local repository and associated key material.
|
||||
///
|
||||
/// Corresponds to `pm newrepo`.
|
||||
@ -115,6 +120,7 @@ class PackageServer {
|
||||
}
|
||||
_pmServerProcess.kill();
|
||||
final int exitCode = await _pmServerProcess.exitCode;
|
||||
_pmServerProcess = null;
|
||||
if (exitCode == 0) {
|
||||
return OperationResult.success();
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ description: >
|
||||
A Dart package for paving, serving packages to, and running commands on a
|
||||
Fuchsia Device. This package is primarily intended for use in Flutter's
|
||||
continuous integration/testing infrastructure.
|
||||
author: Flutter Team <flutter-dev@googlegroups.com>
|
||||
homepage: https://github.com/flutter/packags/tree/master/packages/fuchsia_ctl
|
||||
version: 0.0.8
|
||||
|
||||
|
@ -95,7 +95,10 @@ void main() {
|
||||
processManager: processManager,
|
||||
);
|
||||
|
||||
expect(server.serving, false);
|
||||
|
||||
await server.serveRepo(repoPath, port: 0);
|
||||
expect(server.serving, true);
|
||||
|
||||
final List<String> capturedStartArgs =
|
||||
verify(processManager.start(captureAny))
|
||||
@ -115,6 +118,8 @@ void main() {
|
||||
|
||||
expect(result.success, true);
|
||||
expect(serverProcess.killed, true);
|
||||
|
||||
expect(server.serving, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user