import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.exec.Executor;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
private File topdir;
- /** Directory where to cache downloaded dsitributions. */
+ /** Directory where to cache downloaded distributions. */
private File distributionCache;
private Resource specFile;
private File srpmFile;
+ private Executor executor;
+
public void run() {
File sourcesDir = new File(topdir, "SOURCES");
sourcesDir.mkdirs();
packageSrpm.arg("rpmbuild");
packageSrpm.arg("-bs").arg("--nodeps");
packageSrpm.arg("--rcfile=rpmrc");
+ packageSrpm.arg("--macros=" + RpmBuildEnvironment.defaultMacroFiles
+ + ":rpmmacros");
// buildSrpm.arg("-D", "_topdir " + topdir.getCanonicalPath() + "");
packageSrpm.arg("SPECS/" + specFile.getFilename());
packageSrpm.setExecDir(topdir.getCanonicalPath());
packageSrpm.setLogCommand(true);
// Execute
+ packageSrpm.setExecutor(executor);
String answer = packageSrpm.function();
// Extract generated SRPM path
if (!targetFile.exists() || overwriteSources)
copyResourceToFile(res, targetFile);
if (!targetDir.equals(sourcesDir)) {
- File fileInSourcesDir = new File(sourcesDir, targetFile
- .getName());
+ File fileInSourcesDir = new File(sourcesDir,
+ targetFile.getName());
if (!fileInSourcesDir.exists()
|| !(fileInSourcesDir.length() == targetFile
.length()))
this.distributionCache = distributionCache;
}
+ public void setExecutor(Executor executor) {
+ this.executor = executor;
+ }
+
}