1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 16:15:25 +02:00

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
This commit is contained in:
Doug Schaefer 2015-10-26 11:56:44 -04:00
parent 9e2f937a06
commit 4d22181892
3 changed files with 21 additions and 20 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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$