Skip to content

Commit 938838c

Browse files
committed
Adapt buildPrep to use output stream.
1 parent 3a4c156 commit 938838c

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProject.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import java.io.File;
1414
import java.io.FileInputStream;
1515
import java.io.FileNotFoundException;
16-
import java.io.IOException;
17-
import java.io.InputStream;
1816
import java.io.OutputStream;
1917

2018
import org.eclipse.core.resources.IFile;
@@ -149,15 +147,9 @@ public void buildSourceRPM(OutputStream out) throws CoreException {
149147
IResource.DEPTH_INFINITE, null);
150148
}
151149

152-
public void buildPrep() throws CoreException {
150+
public void buildPrep(OutputStream out) throws CoreException {
153151
RPMBuild rpmbuild = new RPMBuild(getConfiguration());
154-
InputStream in = rpmbuild.buildPrep(getSpecFile());
155-
try {
156-
in.close();
157-
} catch (IOException e) {
158-
// TODO Do we really need the input stream here?
159-
e.printStackTrace();
160-
}
152+
rpmbuild.buildPrep(getSpecFile(), out);
161153
getConfiguration().getBuildFolder().refreshLocal(
162154
IResource.DEPTH_INFINITE, null);
163155
}

rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMBuild.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
package org.eclipse.linuxtools.rpm.core.utils;
1212

1313
import java.io.IOException;
14-
import java.io.InputStream;
1514
import java.io.OutputStream;
1615
import java.util.ArrayList;
1716
import java.util.Arrays;
@@ -69,18 +68,24 @@ public RPMBuild(RPMConfiguration config) {
6968
*
7069
* @param specFile
7170
* the spec file
72-
* @return The output of the `rpmbuild -bp` command.
7371
* @throws CoreException
7472
* if the operation fails
7573
*/
76-
public InputStream buildPrep(IFile specFile) throws CoreException {
74+
/**
75+
* Prepares the sources for a given spec file.
76+
*
77+
* @param specFile the spec file
78+
* @param outStream The stream to write the output to.
79+
* @throws CoreException If the operation fails.
80+
*/
81+
public void buildPrep(IFile specFile, OutputStream outStream) throws CoreException {
7782
List<String> command = new ArrayList<String>();
7883
command.addAll(Arrays.asList(macroDefines));
7984
command.add("-bp"); //$NON-NLS-1$
8085
command.add(specFile.getLocation().toString());
8186
try {
82-
return Utils.runCommandToInputStream(command
83-
.toArray(new String[command.size()]));
87+
Utils.runCommand(outStream,
88+
command.toArray(new String[command.size()]));
8489
} catch (IOException e) {
8590
throw new CoreException(new Status(IStatus.ERROR, RPMCorePlugin.ID,
8691
e.getMessage(), e));

0 commit comments

Comments
 (0)