ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r397303 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
Date Wed, 26 Apr 2006 21:20:27 GMT
Author: jkf
Date: Wed Apr 26 14:20:25 2006
New Revision: 397303

URL: http://svn.apache.org/viewcvs?rev=397303&view=rev
Log:
Fixed bug reported by Wolfgang Brodowski.
Bug report 39345.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=397303&r1=397302&r2=397303&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Apr 26 14:20:25 2006
@@ -85,6 +85,7 @@
 
 Fixed bugs:
 -----------
+* <rpm> now also correctly searches the first element of the path. Bug report 39345.
 
 * ant.bat now handles classpath set to "". Bug report 38914. 
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java?rev=397303&r1=397302&r2=397303&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java Wed Apr 26 14:20:25
2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2001-2005 The Apache Software Foundation
+ * Copyright  2001-20056 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -43,6 +43,11 @@
  */
 public class Rpm extends Task {
 
+    private static final String PATH1 = "PATH=";
+    private static final String PATH2 = "Path=";
+    private static final String PATH3 = "path=";
+    private static final int PATH_LEN = PATH1.length();
+
     /**
      * the spec file
      */
@@ -300,6 +305,8 @@
      * the absolute path to it - falls back to <code>rpm</code>
      * otherwise.
      *
+     * @return the command used to build RPM's
+     *
      * @since 1.6
      */
     protected String guessRpmBuildCommand() {
@@ -307,8 +314,8 @@
         String path = null;
         for (Enumeration e = env.elements(); e.hasMoreElements();) {
             String var = (String) e.nextElement();
-            if (var.startsWith("PATH=") || var.startsWith("Path=")) {
-                path = var.substring(6 /* "PATH=".length() + 1 */);
+            if (var.startsWith(PATH1) || var.startsWith(PATH2) || var.startsWith(PATH3))
{
+                path = var.substring(PATH_LEN);
                 break;
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message