diff options
author | Doug Schaefer | 2015-10-26 15:56:44 +0000 |
---|---|---|
committer | Doug Schaefer | 2015-10-26 15:56:44 +0000 |
commit | 4d22181892b506d4fe2e8f2884f3e128bc674e66 (patch) | |
tree | 0ce63e310034a8d52c993a4fbd0fd915829e568f | |
parent | 9e2f937a06d0bd85e43e2473dfc3acb2acccd73f (diff) | |
download | org.eclipse.cdt-4d22181892b506d4fe2e8f2884f3e128bc674e66.tar.gz org.eclipse.cdt-4d22181892b506d4fe2e8f2884f3e128bc674e66.tar.xz org.eclipse.cdt-4d22181892b506d4fe2e8f2884f3e128bc674e66.zip |
Bug 480603 - Support Intel's crazy tarballs and such.
Includes +'s in file names. Also fixed up how we unpack the links
inside tarballs.
Change-Id: I09a7e6a4a6f1c2db91f3f429f313eaff67fc84db
3 files changed, 21 insertions, 20 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoManager.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoManager.java index e0cab06db4d..10089e3df14 100644 --- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoManager.java +++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoManager.java @@ -327,18 +327,32 @@ public class ArduinoManager { continue; } - Path entryPath = installPath.resolve(entry.getName()); + // Magic file for git tarballs + Path path = Paths.get(entry.getName()); + if (path.endsWith("pax_global_header")) { //$NON-NLS-1$ + continue; + } + + // Strip the first directory of the path + Path entryPath = installPath.resolve(path.subpath(1, path.getNameCount())); + Files.createDirectories(entryPath.getParent()); if (entry instanceof TarArchiveEntry) { TarArchiveEntry tarEntry = (TarArchiveEntry) entry; if (tarEntry.isLink()) { - Path linkPath = installPath.resolve(tarEntry.getLinkName()); + Path linkPath = Paths.get(tarEntry.getLinkName()); + linkPath = installPath.resolve(linkPath.subpath(1, linkPath.getNameCount())); + Files.deleteIfExists(entryPath); Files.createSymbolicLink(entryPath, entryPath.getParent().relativize(linkPath)); + } else if (tarEntry.isSymbolicLink()) { + Path linkPath = Paths.get(tarEntry.getLinkName()); + Files.deleteIfExists(entryPath); + Files.createSymbolicLink(entryPath, linkPath); } else { Files.copy(archiveIn, entryPath, StandardCopyOption.REPLACE_EXISTING); } - if (!isWin) { + if (!isWin && !tarEntry.isSymbolicLink()) { int mode = tarEntry.getMode(); Files.setPosixFilePermissions(entryPath, toPerms(mode)); } @@ -352,22 +366,6 @@ public class ArduinoManager { } } - // Special hack for Intel - remove the pax_global_header file - File paxFile = new File(installPath.toFile(), "pax_global_header"); //$NON-NLS-1$ - if (paxFile.exists()) { - paxFile.delete(); - } - - // Fix up directory - File[] children = installPath.toFile().listFiles(); - if (children.length == 1 && children[0].isDirectory()) { - // make that directory the install path - Path childPath = children[0].toPath(); - Path tmpPath = installPath.getParent().resolve("_t"); //$NON-NLS-1$ - Files.move(childPath, tmpPath); - Files.delete(installPath); - Files.move(tmpPath, installPath); - } return Status.OK_STATUS; } catch (IOException | CompressorException | ArchiveException e) { error = e; diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoTool.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoTool.java index 1d029f6f330..cd3714c7f75 100644 --- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoTool.java +++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/board/ArduinoTool.java @@ -76,6 +76,8 @@ public class ArduinoTool { public Properties getToolProperties() { Properties properties = new Properties(); properties.put("runtime.tools." + name + ".path", ArduinoBuildConfiguration.pathString(getInstallPath())); // $NON-NLS-1$ //$NON-NLS-1$//$NON-NLS-2$ + properties.put("runtime.tools." + name + '-' + version + ".path", //$NON-NLS-1$//$NON-NLS-2$ + ArduinoBuildConfiguration.pathString(getInstallPath())); // $NON-NLS-1$ return properties; } diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java index b7340f1383b..83f63441e4a 100644 --- a/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java +++ b/toolchains/arduino/org.eclipse.cdt.arduino.core/src/org/eclipse/cdt/arduino/core/internal/build/ArduinoBuildConfiguration.java @@ -244,6 +244,7 @@ public class ArduinoBuildConfiguration { properties = new Properties(); properties.put("runtime.platform.path", platform.getInstallPath().toString()); //$NON-NLS-1$ properties.put("runtime.ide.version", "10607"); //$NON-NLS-1$ //$NON-NLS-2$ + properties.put("software", "ARDUINO"); //$NON-NLS-1$ //$NON-NLS-2$ properties.put("build.arch", platform.getArchitecture().toUpperCase()); //$NON-NLS-1$ properties.put("build.path", config.getName()); //$NON-NLS-1$ properties.put("build.variant.path", //$NON-NLS-1$ @@ -369,7 +370,7 @@ public class ArduinoBuildConfiguration { properties.put("includes", includes); //$NON-NLS-1$ Path platformPath = platform.getInstallPath(); - buildModel.put("platform_path", pathString(platformPath)); //$NON-NLS-1$ + buildModel.put("platform_path", pathString(platformPath).replace("+", "\\+")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ buildModel.put("platform_srcs", //$NON-NLS-1$ platform.getSources(properties.getProperty("build.core"), properties.getProperty("build.variant"))); //$NON-NLS-1$ //$NON-NLS-2$ |