Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2017-05-03 19:41:23 -0400
committerJeff Johnston2017-05-03 19:48:08 -0400
commitfa0bc20d34fa0a02059bb1a32de91294e8788957 (patch)
tree1eeb5d5a184eb27b6ff7b98f466d252b66d4708c
parentbbeda1f5a641a845fea52a77ce25ffe62d1e33d5 (diff)
downloadorg.eclipse.linuxtools-containerBuild.tar.gz
org.eclipse.linuxtools-containerBuild.tar.xz
org.eclipse.linuxtools-containerBuild.zip
More changes to support CDT Build in ContainercontainerBuild
- close LogStream when Log job completes - make changes to ContainerCommandProcess - add keepContainer support - make changes to ContainerLauncher - add optimization in CopyVolumesFromJob so we don't copy sub-directories of directories we have already copied - save the image id to compare in case the user has reloaded a different version and assume we have to copy everything if it has changed Change-Id: I28016cbd1673a2c2d87e1dc5894d53293d94432b
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java5
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java31
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java7
3 files changed, 24 insertions, 19 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index 4d6febe229..345373b71b 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -604,6 +604,7 @@ public class DockerConnection
@Override
public void execute() throws InterruptedException, IOException {
+ LogStream stream = null;
try {
// Add timestamps to log based on user preference
IEclipsePreferences preferences = InstanceScope.INSTANCE
@@ -612,7 +613,6 @@ public class DockerConnection
boolean timestamps = preferences.getBoolean(
"logTimestamp", true); //$NON-NLS-1$
- LogStream stream = null;
if (timestamps)
stream = copyClient.logs(id, LogsParam.follow(),
@@ -626,7 +626,6 @@ public class DockerConnection
int delayTime = 100;
do {
- outputStream.write("Sleeping".getBytes());
Thread.sleep(delayTime);
// Second time in loop and following, pause a second to
// allow other threads to do meaningful work
@@ -657,6 +656,8 @@ public class DockerConnection
} finally {
follow = false;
copyClient.close(); // we are done with copyClient..dispose
+ if (stream != null)
+ stream.close();
if (outputStream != null)
outputStream.close();
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java
index ae970495b6..192ff97085 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java
@@ -196,7 +196,10 @@ public class ContainerLauncher {
try {
IDockerImage dockerImage = ((DockerConnection) connection)
.getImageByTag(image);
- IPath imageFilePath = target.append(".IMAGE_ID");
+ // if there is a .image_id file, check the image id to ensure
+ // the user hasn't loaded a new version which may have
+ // different header files installed.
+ IPath imageFilePath = target.append(".image_id"); //$NON-NLS-1$
File imageFile = imageFilePath.toFile();
boolean needImageIdFile = !imageFile.exists();
if (!needImageIdFile) {
@@ -240,9 +243,16 @@ public class ContainerLauncher {
monitor.worked(1);
continue;
}
- if (dirList.contains(volume)) {
- monitor.worked(1);
- continue;
+ // if we have already copied the directory either directly
+ // or as part of a parent directory copy, then skip to next
+ // volume.
+ for (String path : dirList) {
+ if (volume.equals(path)
+ || (volume.startsWith(path) && volume.charAt(
+ path.length()) == File.separatorChar)) {
+ monitor.worked(1);
+ continue;
+ }
}
try {
monitor.setTaskName(Messages.getFormattedString(
@@ -300,18 +310,7 @@ public class ContainerLauncher {
}
k.close();
} catch (final DockerException e) {
- // Display.getDefault()
- // .syncExec(() -> MessageDialog.openError(
- // PlatformUI.getWorkbench()
- // .getActiveWorkbenchWindow()
- // .getShell(),
- // Messages.getFormattedString(
- // ERROR_COPYING_VOLUME,
- // new String[] { volume, target
- // .toPortableString() }),
- // e.getCause() != null
- // ? e.getCause().getMessage()
- // : e.getMessage()));
+ // ignore
}
}
} catch (InterruptedException e) {
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
index 7c5e06a8fa..f3e018f353 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
@@ -54,7 +54,9 @@ public class ContainerCommandProcess extends Process {
try {
try {
// TODO: see if there is a better way of draining the
- // container output before closing the streams
+ // container output before closing the streams. Note
+ // that trying to join the attachLog thread does not
+ // work.
Thread.sleep(1000);
} catch (InterruptedException e1) {
// ignore
@@ -106,6 +108,9 @@ public class ContainerCommandProcess extends Process {
IDockerContainerExit exit = connection
.waitForContainer(containerId);
connection.stopLoggingThread(containerId);
+ if (!keepContainer) {
+ connection.removeContainer(containerId);
+ }
return exit.statusCode();
} catch (DockerException e) {
return -1;

Back to the top