Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 49033 invoked from network); 3 Apr 2008 22:50:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 22:50:14 -0000 Received: (qmail 92186 invoked by uid 500); 3 Apr 2008 22:50:13 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 92171 invoked by uid 500); 3 Apr 2008 22:50:13 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 92162 invoked by uid 99); 3 Apr 2008 22:50:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 15:50:13 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 22:49:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A26D11A983A; Thu, 3 Apr 2008 15:49:51 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r644541 - in /ant/ivy/core/trunk: CHANGES.txt doc/resolver/ssh.html src/java/org/apache/ivy/plugins/repository/ssh/Scp.java src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java Date: Thu, 03 Apr 2008 22:49:50 -0000 To: notifications@ant.apache.org From: maartenc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080403224951.A26D11A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: maartenc Date: Thu Apr 3 15:49:49 2008 New Revision: 644541 URL: http://svn.apache.org/viewvc?rev=644541&view=rev Log: IMPROVEMENT: make it possible to specify permissions of published files for the SSH resolver (IVY-764) + removal of some unused code Modified: ant/ivy/core/trunk/CHANGES.txt ant/ivy/core/trunk/doc/resolver/ssh.html ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=644541&r1=644540&r2=644541&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Thu Apr 3 15:49:49 2008 @@ -69,6 +69,7 @@ - NEW: Add a new resolve mode (optionally per module) to utilize dynamic constraint rule metadata (IVY-740) - NEW: Add transitive dependency version and branch override mechanism (IVY-784) +- IMPROVEMENT: make it possible to specify permissions of published files for the SSH resolver (IVY-764) - IMPROVEMENT: Load Ivy version number into some Ant property (IVY-790) - IMPROVEMENT: Make Ivy standalone runnable with no required dependencies (IVY-757) - IMPROVEMENT: add branch attribute in ivy:install task (IVY-727) Modified: ant/ivy/core/trunk/doc/resolver/ssh.html URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/resolver/ssh.html?rev=644541&r1=644540&r2=644541&view=diff ============================================================================== --- ant/ivy/core/trunk/doc/resolver/ssh.html (original) +++ ant/ivy/core/trunk/doc/resolver/ssh.html Thu Apr 3 15:49:49 2008 @@ -56,6 +56,8 @@ No, defaults to host given on the patterns, fail if none is set portThe port to connect to No, defaults to 22 + publishModeA four digit string (e.g., 0644, see "man chmod", "man open") specifying the permissions of the published files. (since 2.0) +No, defaults to 0600

Child elements

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java?rev=644541&r1=644540&r2=644541&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java Thu Apr 3 15:49:49 2008 @@ -276,41 +276,6 @@ fileInfo.setLastModified(modtime); } - private void sendBytes(Channel channel, byte[] data, String fileName, String mode) - throws IOException, RemoteScpException { - OutputStream os = channel.getOutputStream(); - InputStream is = new BufferedInputStream( - channel.getInputStream(), SEND_BYTES_BUFFER_LENGTH); - - try { - if (channel.isConnected()) { - channel.start(); - } else { - channel.connect(); - } - } catch (JSchException e1) { - throw (IOException) new IOException("Channel connection problems").initCause(e1); - } - - readResponse(is); - - String cline = "C" + mode + " " + data.length + " " + fileName + "\n"; - - os.write(cline.getBytes()); - os.flush(); - - readResponse(is); - - os.write(data, 0, data.length); - os.write(0); - os.flush(); - - readResponse(is); - - os.write("E\n".getBytes()); - os.flush(); - } - private void sendFile(Channel channel, String localFile, String remoteName, String mode) throws IOException, RemoteScpException { byte[] buffer = new byte[BUFFER_SIZE]; @@ -480,101 +445,6 @@ os.flush(); } return fileInfo; - } - - /** - * Copy a local file to a remote directory, uses mode 0600 when creating the file on the remote - * side. - * - * @param localFile - * Path and name of local file. - * @param remoteTargetDirectory - * Remote target directory where the file has to end up (optional) - * @param remoteName - * target filename to use - * @throws IOException - * in case of network problems - * @throws RemoteScpException - * in case of problems on the target system (connection ok) - */ - public void put(String localFile, String remoteTargetDirectory, String remoteName) - throws IOException, RemoteScpException { - put(localFile, remoteTargetDirectory, remoteName, "0600"); - } - - /** - * Create a remote file and copy the contents of the passed byte array into it. Uses mode 0600 - * for creating the remote file. - * - * @param data - * the data to be copied into the remote file. - * @param remoteFileName - * The name of the file which will be created in the remote target directory. - * @param remoteTargetDirectory - * Remote target directory where the file has to end up (optional) - * @throws IOException - * in case of network problems - * @throws RemoteScpException - * in case of problems on the target system (connection ok) - */ - - public void put(byte[] data, String remoteFileName, String remoteTargetDirectory) - throws IOException, RemoteScpException { - put(data, remoteFileName, remoteTargetDirectory, "0600"); - } - - /** - * Create a remote file and copy the contents of the passed byte array into it. The method use - * the specified mode when creating the file on the remote side. - * - * @param data - * the data to be copied into the remote file. - * @param remoteFileName - * The name of the file which will be created in the remote target directory. - * @param remoteTargetDirectory - * Remote target directory where the file has to end up (optional) - * @param mode - * a four digit string (e.g., 0644, see "man chmod", "man open") - * @throws IOException - * in case of network problems - * @throws RemoteScpException - * in case of problems on the target system (connection ok) - */ - public void put(byte[] data, String remoteFileName, String remoteTargetDirectory, String mode) - throws IOException, RemoteScpException { - ChannelExec channel = null; - - if ((remoteFileName == null) || (mode == null)) { - throw new IllegalArgumentException("Null argument."); - } - - if (mode.length() != MODE_LENGTH) { - throw new IllegalArgumentException("Invalid mode."); - } - - for (int i = 0; i < mode.length(); i++) { - if (!Character.isDigit(mode.charAt(i))) { - throw new IllegalArgumentException("Invalid mode."); - } - } - - String cmd = "scp -t "; - if (remoteTargetDirectory != null && remoteTargetDirectory.length() > 0) { - cmd = cmd + "-d " + remoteTargetDirectory; - } - - try { - channel = getExecChannel(); - channel.setCommand(cmd); - sendBytes(channel, data, remoteFileName, mode); - // channel.disconnect(); - } catch (JSchException e) { - if (channel != null) { - channel.disconnect(); - } - throw (IOException) new IOException("Error during SCP transfer." + e.getMessage()) - .initCause(e); - } } /** Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java?rev=644541&r1=644540&r2=644541&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java Thu Apr 3 15:49:49 2008 @@ -54,6 +54,8 @@ private String existCommand = "ls"; private String createDirCommand = "mkdir"; + + private String publishMode = "0600"; /** * create a new resource with lazy initializing @@ -259,7 +261,7 @@ makePath(path, session); } Scp myCopy = new Scp(session); - myCopy.put(source.getCanonicalPath(), path, name); + myCopy.put(source.getCanonicalPath(), path, name, publishMode); } catch (IOException e) { if (session != null) { releaseSession(session, destination); @@ -421,6 +423,14 @@ */ public void setFileSeparator(char fileSeparator) { this.fileSeparator = fileSeparator; + } + + /** + * A four digit string (e.g., 0644, see "man chmod", "man open") specifying the permissions + * of the published files. + */ + public void setPublishMode(String mode) { + this.publishMode = mode; } /**