directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r376694 - in /directory/sandbox/akarasulu/rc1/daemon/plugin/src: main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java test/java/
Date Fri, 10 Feb 2006 14:07:36 GMT
Author: akarasulu
Date: Fri Feb 10 06:07:34 2006
New Revision: 376694

URL: http://svn.apache.org/viewcvs?rev=376694&view=rev
Log:
fixing small issue with apacheds-tools shell script in RPM

Modified:
    directory/sandbox/akarasulu/rc1/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
    directory/sandbox/akarasulu/rc1/daemon/plugin/src/test/java/   (props changed)

Modified: directory/sandbox/akarasulu/rc1/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java?rev=376694&r1=376693&r2=376694&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
(original)
+++ directory/sandbox/akarasulu/rc1/daemon/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
Fri Feb 10 06:07:34 2006
@@ -18,6 +18,7 @@
 
 
 import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -131,18 +132,30 @@
          * @todo clean me up
          * @see http://issues.apache.org/jira/browse/DIREVE-333 
          */
-        File toolsSource = new File( this.mymojo.getSourceDirectory(), "apacheds-tools.sh"
);
+        String version = target.getApplication().getVersion().replace( '-', '_' );
         File toolsTarget = new File( target.getLayout().getBinDirectory(), "apacheds-tools.sh"
);
+        StringBuffer buf = new StringBuffer();
+        buf.append( "#!/bin/sh\n\n" );
+        buf.append( "$JAVA_HOME/bin/java -jar " );
+        buf.append( "/usr/local/apacheds-" );
+        buf.append( version );
+        buf.append( "/bin/apacheds-tools.jar $@\n" );
+        FileWriter writer = null;
         try
         {
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, toolsSource, toolsTarget,
true );
+            writer = new FileWriter( toolsTarget );
+            writer.write( buf.toString() );
+            writer.flush();
         }
-        catch ( IOException e )
+        catch ( IOException e1 )
         {
-            mymojo.getLog().error(
-                "Failed to copy apacheds-tools.sh file " + toolsSource + " into position
" + toolsTarget, e );
+            throw new MojoFailureException( "Failed to write out apacheds-tools.sh" );
         }
-
+        finally
+        {
+            try { writer.close(); } catch( Exception e ){ e.printStackTrace(); };
+        }
+        
         try
         {
             MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass()
@@ -201,8 +214,6 @@
         String[] cmd = new String[]
             { rpmBuilder.getAbsolutePath(), "-ba", rpmConfigurationFile.getAbsolutePath()
};
         MojoHelperUtils.exec( cmd, target.getLayout().getBaseDirectory().getParentFile(),
target.isDoSudo() );
-
-        String version = target.getApplication().getVersion().replace( '-', '_' );
         String rpmName = target.getApplication().getName() + "-" + version + "-0.i386.rpm";
         File srcFile = new File( "/usr/src/redhat/RPMS/i386", rpmName );
         File dstFile = null;

Propchange: directory/sandbox/akarasulu/rc1/daemon/plugin/src/test/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 10 06:07:34 2006
@@ -0,0 +1 @@
+META-INF



Mime
View raw message