You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/01/24 19:38:07 UTC

svn commit: r902618 - /geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java

Author: djencks
Date: Sun Jan 24 18:38:07 2010
New Revision: 902618

URL: http://svn.apache.org/viewvc?rev=902618&view=rev
Log:
fix unix permissions for bin scripts

Modified:
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java?rev=902618&r1=902617&r2=902618&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java Sun Jan 24 18:38:07 2010
@@ -88,17 +88,33 @@
             fileMode.setValue(Tar.TarLongFileMode.GNU);
             tar.setLongfile(fileMode);
             tar.setDestFile(dest);
-//            tar.setBasedir(source);
             TarFileSet rc = new TarFileSet();
             rc.setDir(source);
             rc.setPrefix(serverName);
             rc.setProject(project);
+            rc.setExcludes("bin/");
             tar.add(rc);
+
+            rc = new TarFileSet();
+            rc.setDir(source);
+            rc.setPrefix(serverName);
+            rc.setProject(project);
+            rc.setIncludes("bin/");
+            rc.setExcludes("bin/*.bat");
+            rc.setFileMode("755");
+            tar.add(rc);
+
+            rc = new TarFileSet();
+            rc.setDir(source);
+            rc.setPrefix(serverName);
+            rc.setProject(project);
+            rc.setIncludes("bin/*.bat");
+            tar.add(rc);
+
             archiver = tar;
         } else if ("zip".equals(artifact.getType())) {
             Zip zip = new Zip();
             zip.setDestFile(dest);
-//            zip.setBasedir(source);
             ZipFileSet fs = new ZipFileSet();
             fs.setDir(source);
             fs.setPrefix(serverName);
@@ -109,75 +125,6 @@
             throw new IllegalArgumentException("Unknown target type: " + artifact.getType());
         }
         archiver.setProject(project);
-//        archiver.set(true);
-//        archiver.set(dest);
-//        archiver.setIncludes("**");
-/* see if using plexus-archiver 1.0-alpha-7 same as maven lets us share code.  Following is for 1.0-alpha-9
-        DefaultFileSet all = new DefaultFileSet();
-        all.setDirectory(source);
-        archiver.addFileSet(all);
-*/
-/*
-        // add in all files and mark them with default file permissions
-        Map<File, Boolean> emptyDirs = new HashMap<File, Boolean>();
-        Map<String, File> all = IOUtil.listAllFileNames(source);
-        removeExcludes(source, all);
-        for (Map.Entry<String, File> entry : all.entrySet()) {
-            String destFileName = serverName + "/" + entry.getKey();
-            File sourceFile = entry.getValue();
-            if (sourceFile.isFile()) {
-                archiver.addFile(sourceFile, destFileName, UnixStat.DEFAULT_FILE_PERM);
-                // mark parent directories non-empty
-                for (File parentDir = sourceFile.getParentFile();
-                     parentDir != null && !parentDir.equals(source);
-                     parentDir = parentDir.getParentFile()) {
-                    emptyDirs.put(parentDir, Boolean.FALSE);
-                }
-
-            } else if (sourceFile.isDirectory()) {
-                Boolean isEmpty = emptyDirs.get(sourceFile);
-                if (isEmpty == null) {
-                    emptyDirs.put(sourceFile, Boolean.TRUE);
-                    // mark parent directories non-empty
-                    for (File parentDir = sourceFile.getParentFile();
-                         parentDir != null && !parentDir.equals(source);
-                         parentDir = parentDir.getParentFile()) {
-                        emptyDirs.put(parentDir, Boolean.FALSE);
-                    }
-                }
-            }
-        }
-
-        if (!all.isEmpty()) {
-            emptyDirs.put(source, Boolean.FALSE);
-        }
-
-        String sourceDirPath = source.getAbsolutePath();
-        for (Map.Entry<File, Boolean> entry : emptyDirs.entrySet()) {
-            if (entry.getValue().booleanValue()) {
-                String emptyDirPath = entry.getKey().getAbsolutePath();
-                String relativeDir = emptyDirPath.substring(sourceDirPath.length());
-                relativeDir = relativeDir.replace('\\', '/');
-                archiver.addDirectory(entry.getKey(), serverName + relativeDir);
-            }
-        }
-        emptyDirs.clear();
-
-        all.clear();
-
-        // add execute permissions to all non-batch files in the bin/ directory
-        File bin = new File(source, "bin");
-        if (bin.exists()) {
-            Map<String, File> includes = IOUtil.listAllFileNames(bin);
-            for (Map.Entry<String, File> entry : includes.entrySet()) {
-                String destFileName = serverName + "/bin/" + entry.getKey();
-                File sourceFile = entry.getValue();
-                if (!destFileName.endsWith(".bat") && sourceFile.isFile()) {
-                    archiver.addFile(sourceFile, destFileName, UnixStat.DEFAULT_DIR_PERM);
-                }
-            }
-        }
-*/
         archiver.execute();
         return dest;
     }