private void process(final File file) { assert file != null; if (file.isFile()) { if (Functions.isMustangOrAbove()) { if (!file.setExecutable(true, false)) { log.error("Failed to chmod: {}", file); } } else { try { GNUCLibrary.LIBC.chmod(file.getAbsolutePath(), mode); } catch (LinkageError e) { // if JNA is unavailable, fall back PosixAPI.get().chmod(file.getAbsolutePath(), mode); } } } else { File[] children = file.listFiles(); if (children != null) { for (File child : children) { process(child); } } } } }
@IgnoreJRERequirement private void process(File f) { if (f.isFile()) { if(Functions.isMustangOrAbove()) f.setExecutable(true, false); else { try { GNUCLibrary.LIBC.chmod(f.getAbsolutePath(),0755); } catch (LinkageError e) { // if JNA is unavailable, fall back. // we still prefer to try JNA first as PosixAPI supports even smaller platforms. PosixAPI.get().chmod(f.getAbsolutePath(),0755); } } } else { File[] kids = f.listFiles(); if (kids != null) { for (File kid : kids) { process(kid); } } } } }
@IgnoreJRERequirement private void process(File f) { if (f.isFile()) { if(Functions.isMustangOrAbove()) f.setExecutable(true, false); else { try { GNUCLibrary.LIBC.chmod(f.getAbsolutePath(),0755); } catch (LinkageError e) { // if JNA is unavailable, fall back. // we still prefer to try JNA first as PosixAPI supports even smaller platforms. PosixAPI.get().chmod(f.getAbsolutePath(),0755); } } } else { File[] kids = f.listFiles(); if (kids != null) { for (File kid : kids) { process(kid); } } } } }
/** * Run chmod via libc if we can, otherwise fall back to Ant. */ private static void _chmod(File f, int mask) throws IOException { if (Functions.isWindows()) return; // noop try { if(LIBC.chmod(f.getAbsolutePath(),mask)!=0) { throw new IOException("Failed to chmod "+f+" : "+LIBC.strerror(Native.getLastError())); } } catch(NoClassDefFoundError e) { // cf. https://groups.google.com/group/hudson-dev/browse_thread/thread/6d16c3e8ea0dbc9?hl=fr _chmodAnt(f, mask); } catch(UnsatisfiedLinkError e2) { // HUDSON-8155: use Ant's chmod task on non-GNU C systems _chmodAnt(f, mask); } }
/** * Run chmod via libc if we can, otherwise fall back to Ant. */ private static void _chmod(File f, int mask) throws IOException { if (Functions.isWindows()) return; // noop try { if(LIBC.chmod(f.getAbsolutePath(),mask)!=0) { throw new IOException("Failed to chmod "+f+" : "+LIBC.strerror(Native.getLastError())); } } catch(NoClassDefFoundError e) { // cf. https://groups.google.com/group/hudson-dev/browse_thread/thread/6d16c3e8ea0dbc9?hl=fr _chmodAnt(f, mask); } catch(UnsatisfiedLinkError e2) { // HUDSON-8155: use Ant's chmod task on non-GNU C systems _chmodAnt(f, mask); } }
/** * 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; }
GNUCLibrary.LIBC.chmod(new File(mvnHome,mavenVersion+"/bin/mvn").getPath(),0755);
GNUCLibrary.LIBC.chmod(new File(mvnHome,mavenVersion+"/bin/mvn").getPath(),0755);
if(mode!=0 && !Functions.isWindows()) // be defensive try { LIBC.chmod(f.getPath(), mode); } catch (NoClassDefFoundError ncdfe) {