private void unzip(File dir, InputStream in) throws IOException { File tmpFile = File.createTempFile("tmpzip", null); // uses java.io.tmpdir try { // TODO why does this not simply use ZipInputStream? IOUtils.copy(in, tmpFile); unzip(dir,tmpFile); } finally { tmpFile.delete(); } }
public void restoreTo(AbstractBuild<?,?> owner, FilePath dst, TaskListener listener) throws IOException, InterruptedException { File zip = new File(owner.getRootDir(),"workspace.zip"); if (zip.exists()) {// we used to keep it in zip new FilePath(zip).unzip(dst); } else {// but since 1.456 we do tgz File tgz = new File(owner.getRootDir(),"workspace.tgz"); new FilePath(tgz).untar(dst, TarCompression.GZIP); } } }
private void unzip(File dir, InputStream in) throws IOException { File tmpFile = File.createTempFile("tmpzip", null); // uses java.io.tmpdir try { // TODO why does this not simply use ZipInputStream? IOUtils.copy(in, tmpFile); unzip(dir,tmpFile); } finally { tmpFile.delete(); } }
public void restoreTo(AbstractBuild<?,?> owner, FilePath dst, TaskListener listener) throws IOException, InterruptedException { File wss = new File(owner.getRootDir(),"workspace.zip"); new FilePath(wss).unzip(dst); } }
public void restoreTo(AbstractBuild<?,?> owner, FilePath dst, TaskListener listener) throws IOException, InterruptedException { File wss = new File(owner.getRootDir(),"workspace.zip"); new FilePath(wss).unzip(dst); } }
public void restoreTo(AbstractBuild<?, ?> owner, FilePath dst, TaskListener listener) throws IOException, InterruptedException { File wss = new File(owner.getRootDir(), "workspace.zip"); new FilePath(wss).unzip(dst); } }
public void restoreTo(AbstractBuild<?,?> owner, FilePath dst, TaskListener listener) throws IOException, InterruptedException { File wss = new File(owner.getRootDir(),"workspace.zip"); new FilePath(wss).unzip(dst); } }
public void restoreTo(AbstractBuild<?,?> owner, FilePath dst, TaskListener listener) throws IOException, InterruptedException { File zip = new File(owner.getRootDir(),"workspace.zip"); if (zip.exists()) {// we used to keep it in zip new FilePath(zip).unzip(dst); } else {// but since 1.456 we do tgz File tgz = new File(owner.getRootDir(),"workspace.tgz"); new FilePath(tgz).untar(dst, TarCompression.GZIP); } } }
public File allocate() throws Exception { File target = NEW.allocate(); if(source.getProtocol().equals("file")) { File src = new File(source.toURI()); if(src.isDirectory()) new FilePath(src).copyRecursiveTo("**/*",new FilePath(target)); else if(src.getName().endsWith(".zip")) new FilePath(src).unzip(new FilePath(target)); } else { File tmp = File.createTempFile("hudson","zip"); try { FileUtils.copyURLToFile(source,tmp); new FilePath(tmp).unzip(new FilePath(target)); } finally { tmp.delete(); } } return target; } }
public File allocate() throws Exception { File target = NEW.allocate(); if (source.getProtocol().equals("file")) { File src = new File(source.toURI()); if (src.isDirectory()) { new FilePath(src).copyRecursiveTo("**/*", new FilePath(target)); } else if (src.getName().endsWith(".zip")) { new FilePath(src).unzip(new FilePath(target)); } } else { File tmp = File.createTempFile("hudson", "zip"); try { FileUtils.copyURLToFile(source, tmp); new FilePath(tmp).unzip(new FilePath(target)); } finally { tmp.delete(); } } return target; } }
public File allocate() throws Exception { File target = NEW.allocate(); if(source.getProtocol().equals("file")) { File src = new File(source.toURI()); if(src.isDirectory()) new FilePath(src).copyRecursiveTo("**/*",new FilePath(target)); else if(src.getName().endsWith(".zip")) new FilePath(src).unzip(new FilePath(target)); } else { File tmp = File.createTempFile("hudson","zip"); try { FileUtils.copyURLToFile(source,tmp); new FilePath(tmp).unzip(new FilePath(target)); } finally { tmp.delete(); } } return target; } }
public File allocate() throws Exception { File target = NEW.allocate(); if(source.getProtocol().equals("file")) { File src = new File(source.toURI()); if(src.isDirectory()) new FilePath(src).copyRecursiveTo("**/*",new FilePath(target)); else if(src.getName().endsWith(".zip")) new FilePath(src).unzip(new FilePath(target)); } else { File tmp = File.createTempFile("hudson","zip"); try { FileUtils.copyURLToFile(source,tmp); new FilePath(tmp).unzip(new FilePath(target)); } finally { tmp.delete(); } } return target; } }
public File allocate() throws Exception { File target = NEW.allocate(); if(source.getProtocol().equals("file")) { File src = new File(source.toURI()); if(src.isDirectory()) new FilePath(src).copyRecursiveTo("**/*",new FilePath(target)); else if(src.getName().endsWith(".zip")) new FilePath(src).unzip(new FilePath(target)); } else { File tmp = File.createTempFile("hudson","zip"); try { FileUtils.copyURLToFile(source,tmp); new FilePath(tmp).unzip(new FilePath(target)); } finally { tmp.delete(); } } return target; } }
public File allocate() throws Exception { File target = NEW.allocate(); if(source.getProtocol().equals("file")) { File src = new File(source.toURI()); if(src.isDirectory()) new FilePath(src).copyRecursiveTo("**/*",new FilePath(target)); else if(src.getName().endsWith(".zip")) new FilePath(src).unzip(new FilePath(target)); } else { File tmp = File.createTempFile("hudson","zip"); try { FileUtils.copyURLToFile(source,tmp); new FilePath(tmp).unzip(new FilePath(target)); } finally { tmp.delete(); } } return target; } }
/** * Extracts Ant and configures it. */ protected Ant.AntInstallation configureDefaultAnt() throws Exception { Ant.AntInstallation antInstallation; if (System.getenv("ANT_HOME") != null) { antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES); } else { LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); File antHome = createTmpDir(); ant.unzip(new FilePath(antHome)); // TODO: switch to tar that preserves file permissions more easily if(!Functions.isWindows()) GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755); antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); } hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); return antInstallation; }
/** * Extracts Ant and configures it. */ protected Ant.AntInstallation configureDefaultAnt() throws Exception { Ant.AntInstallation antInstallation; if (System.getenv("ANT_HOME") != null) { antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES); } else { LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); File antHome = createTmpDir(); ant.unzip(new FilePath(antHome)); // TODO: switch to tar that preserves file permissions more easily if(!Functions.isWindows()) GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755); antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); } hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); return antInstallation; }
/** * Extracts Ant and configures it. */ protected Ant.AntInstallation configureDefaultAnt() throws Exception { Ant.AntInstallation antInstallation; if (System.getenv("ANT_HOME") != null) { antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES); } else { LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " + "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation."); FilePath ant = hudson.getRootPath().createTempFile("ant", "zip"); ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); File antHome = createTmpDir(); ant.unzip(new FilePath(antHome)); // TODO: switch to tar that preserves file permissions more easily if (!Functions.isWindows()) { Util.chmod(new File(antHome, "apache-ant-1.8.1/bin/ant"), 0755); } antInstallation = new AntInstallation("default", new File(antHome, "apache-ant-1.8.1").getAbsolutePath(), NO_PROPERTIES); } hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); return antInstallation; }
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); File mvnHome = new File(buildDirectory);//createTmpDir(); mvn.unzip(new FilePath(mvnHome));
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); File mvnHome = new File(buildDirectory);//createTmpDir(); mvn.unzip(new FilePath(mvnHome));
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); File mvnHome = new File(buildDirectory);//createTmpDir(); mvn.unzip(new FilePath(mvnHome));