maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r660818 - in /maven/wagon/trunk: wagon-provider-api/src/main/java/org/apache/maven/wagon/ wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/ wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven...
Date Wed, 28 May 2008 05:45:48 GMT
Author: brett
Date: Tue May 27 22:45:48 2008
New Revision: 660818

URL: http://svn.apache.org/viewvc?rev=660818&view=rev
Log:
[WAGON-171] don't set any default permissions - use the remote umask if nothing is set
add the ability to override the permissions on the repository via wagon configuration

Modified:
    maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh-ganymed/src/main/java/org/apache/maven/wagon/providers/ssh/ganymed/ScpWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java

Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java?rev=660818&r1=660817&r2=660818&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
(original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
Tue May 27 22:45:48 2008
@@ -32,6 +32,7 @@
 import org.apache.maven.wagon.proxy.ProxyInfoProvider;
 import org.apache.maven.wagon.proxy.ProxyUtils;
 import org.apache.maven.wagon.repository.Repository;
+import org.apache.maven.wagon.repository.RepositoryPermissions;
 import org.apache.maven.wagon.resource.Resource;
 import org.codehaus.plexus.util.IOUtil;
 
@@ -68,8 +69,10 @@
     protected boolean interactive = true;
     
     private int connectionTimeout = 60000;
-
+    
     private ProxyInfoProvider proxyInfoProvider;
+    
+    private RepositoryPermissions permissionsOverride;
 
     // ----------------------------------------------------------------------
     // Accessors
@@ -168,6 +171,11 @@
             throw new IllegalStateException( "The repository specified cannot be null." );
         }
 
+        if ( permissionsOverride != null )
+        {
+            repository.setPermissions( permissionsOverride );
+        }
+        
         this.repository = repository;
 
         if ( authenticationInfo == null )
@@ -834,4 +842,14 @@
         }
         return null;
     }
+
+    public RepositoryPermissions getPermissionsOverride()
+    {
+        return permissionsOverride;
+    }
+
+    public void setPermissionsOverride( RepositoryPermissions permissionsOverride )
+    {
+        this.permissionsOverride = permissionsOverride;
+    }
 }

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java?rev=660818&r1=660817&r2=660818&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractSshWagon.java
Tue May 27 22:45:48 2008
@@ -68,7 +68,7 @@
 
     protected String getOctalMode( RepositoryPermissions permissions )
     {
-        String mode = "0644";
+        String mode = null;
         if ( permissions != null && permissions.getFileMode() != null )
         {
             if ( permissions.getFileMode().matches( "[0-9]{3,4}" ) )

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java?rev=660818&r1=660817&r2=660818&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
Tue May 27 22:45:48 2008
@@ -362,12 +362,11 @@
                                 true );
             }
 
-            String fileMode = "644";
             if ( permissions != null && permissions.getFileMode() != null )
             {
-                fileMode = permissions.getFileMode();
+                executeCommand( "chmod -f " + permissions.getFileMode() + " " + basedir +
"/" + resourceName + "\n",
+                                true );
             }
-            executeCommand( "chmod -f " + fileMode + " " + basedir + "/" + resourceName +
"\n", true );
         }
         catch ( CommandExecutionException e )
         {

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-ganymed/src/main/java/org/apache/maven/wagon/providers/ssh/ganymed/ScpWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-ganymed/src/main/java/org/apache/maven/wagon/providers/ssh/ganymed/ScpWagon.java?rev=660818&r1=660817&r2=660818&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-ganymed/src/main/java/org/apache/maven/wagon/providers/ssh/ganymed/ScpWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-ganymed/src/main/java/org/apache/maven/wagon/providers/ssh/ganymed/ScpWagon.java
Tue May 27 22:45:48 2008
@@ -110,8 +110,16 @@
         try
         {
             int index = path.lastIndexOf( '/' );
-            client.put( source.getAbsolutePath(), path.substring( index + 1 ), path.substring(
0, index ),
-                        getOctalMode( permissions ) );
+            String octalMode = getOctalMode( permissions );
+            if ( octalMode != null )
+            {
+                client.put( source.getAbsolutePath(), path.substring( index + 1 ), path.substring(
0, index ),
+                            octalMode );
+            }
+            else
+            {
+                client.put( source.getAbsolutePath(), path.substring( index + 1 ), path.substring(
0, index ) );
+            }
         }
         catch ( IOException e )
         {

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java?rev=660818&r1=660817&r2=660818&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java
Tue May 27 22:45:48 2008
@@ -134,7 +134,12 @@
         try
         {
             // exec 'scp -p -t rfile' remotely
-            String command = "scp -p -t \"" + path + "\"";
+            String command = "scp";
+            if ( octalMode != null )
+            {
+                command += " -p";
+            }
+            command += " -t \"" + path + "\"";
 
             fireTransferDebug( "Executing command: " + command );
 
@@ -154,7 +159,8 @@
             // send "C0644 filesize filename", where filename should not include '/'
             long filesize = source.length();
 
-            command = "C" + octalMode + " " + filesize + " ";
+            String mode = octalMode == null ? "0644" : octalMode;
+            command = "C" + mode + " " + filesize + " ";
 
             if ( resourceName.lastIndexOf( PATH_SEPARATOR ) > 0 )
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message