mirror of
https://github.com/flutter/packages.git
synced 2025-06-30 23:03: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 List<String> farFiles = args['far'];
|
||||||
final String target = args['target'];
|
final String target = args['target'];
|
||||||
try {
|
try {
|
||||||
final String localIp = await devFinder.getLocalAddress(deviceName);
|
|
||||||
final String targetIp = await devFinder.getTargetAddress(deviceName);
|
final String targetIp = await devFinder.getTargetAddress(deviceName);
|
||||||
stdout.writeln('Using ${repo.path} as repo to serve to $targetIp...');
|
stdout.writeln('Using ${repo.path} as repo to serve to $targetIp...');
|
||||||
repo.createSync(recursive: true);
|
repo.createSync(recursive: true);
|
||||||
@ -185,13 +184,23 @@ Future<OperationResult> test(
|
|||||||
|
|
||||||
await server.serveRepo(repo.path, port: 0);
|
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(
|
result = await ssh.runCommand(
|
||||||
targetIp,
|
targetIp,
|
||||||
identityFilePath: identityFile,
|
identityFilePath: identityFile,
|
||||||
command: <String>[
|
command: <String>[
|
||||||
'amberctl',
|
'amberctl',
|
||||||
'add_src',
|
'add_src',
|
||||||
'-f', 'http://$localIp:${server.serverPort}/config.json', //
|
'-f', 'http://[$localIp]:${server.serverPort}/config.json', //
|
||||||
'-n', uuid,
|
'-n', uuid,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -245,6 +254,8 @@ Future<OperationResult> test(
|
|||||||
return testResult;
|
return testResult;
|
||||||
} finally {
|
} finally {
|
||||||
repo.deleteSync(recursive: true);
|
repo.deleteSync(recursive: true);
|
||||||
|
if (server.serving) {
|
||||||
await server.close();
|
await server.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,11 @@ class PackageServer {
|
|||||||
|
|
||||||
int _serverPort;
|
int _serverPort;
|
||||||
|
|
||||||
|
/// Is the server up?
|
||||||
|
bool get serving {
|
||||||
|
return _pmServerProcess != null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a new local repository and associated key material.
|
/// Creates a new local repository and associated key material.
|
||||||
///
|
///
|
||||||
/// Corresponds to `pm newrepo`.
|
/// Corresponds to `pm newrepo`.
|
||||||
@ -115,6 +120,7 @@ class PackageServer {
|
|||||||
}
|
}
|
||||||
_pmServerProcess.kill();
|
_pmServerProcess.kill();
|
||||||
final int exitCode = await _pmServerProcess.exitCode;
|
final int exitCode = await _pmServerProcess.exitCode;
|
||||||
|
_pmServerProcess = null;
|
||||||
if (exitCode == 0) {
|
if (exitCode == 0) {
|
||||||
return OperationResult.success();
|
return OperationResult.success();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ description: >
|
|||||||
A Dart package for paving, serving packages to, and running commands on a
|
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
|
Fuchsia Device. This package is primarily intended for use in Flutter's
|
||||||
continuous integration/testing infrastructure.
|
continuous integration/testing infrastructure.
|
||||||
author: Flutter Team <flutter-dev@googlegroups.com>
|
|
||||||
homepage: https://github.com/flutter/packags/tree/master/packages/fuchsia_ctl
|
homepage: https://github.com/flutter/packags/tree/master/packages/fuchsia_ctl
|
||||||
version: 0.0.8
|
version: 0.0.8
|
||||||
|
|
||||||
|
@ -95,7 +95,10 @@ void main() {
|
|||||||
processManager: processManager,
|
processManager: processManager,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(server.serving, false);
|
||||||
|
|
||||||
await server.serveRepo(repoPath, port: 0);
|
await server.serveRepo(repoPath, port: 0);
|
||||||
|
expect(server.serving, true);
|
||||||
|
|
||||||
final List<String> capturedStartArgs =
|
final List<String> capturedStartArgs =
|
||||||
verify(processManager.start(captureAny))
|
verify(processManager.start(captureAny))
|
||||||
@ -115,6 +118,8 @@ void main() {
|
|||||||
|
|
||||||
expect(result.success, true);
|
expect(result.success, true);
|
||||||
expect(serverProcess.killed, true);
|
expect(serverProcess.killed, true);
|
||||||
|
|
||||||
|
expect(server.serving, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user