X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Flib%2Flinux%2Frpmfactory%2FCreateSrpm.java;h=04680df7b438e77bb0cc603d48d9d86b36f986fb;hb=9b2422e7198df6f34282a805058dd5f497417318;hp=1588bfa8fa93c2bf3e54d7557523ed284df96126;hpb=94f8c90b4eb50398388b6ee2ebb4e19c8abdee01;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/lib/linux/rpmfactory/CreateSrpm.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/lib/linux/rpmfactory/CreateSrpm.java index 1588bfa8f..04680df7b 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/lib/linux/rpmfactory/CreateSrpm.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/lib/linux/rpmfactory/CreateSrpm.java @@ -7,6 +7,7 @@ import java.io.OutputStream; 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; @@ -22,7 +23,7 @@ public class CreateSrpm implements Runnable { private File topdir; - /** Directory where to cache downloaded dsitributions. */ + /** Directory where to cache downloaded distributions. */ private File distributionCache; private Resource specFile; @@ -33,6 +34,8 @@ public class CreateSrpm implements Runnable { private File srpmFile; + private Executor executor; + public void run() { File sourcesDir = new File(topdir, "SOURCES"); sourcesDir.mkdirs(); @@ -58,12 +61,15 @@ public class CreateSrpm implements Runnable { 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 @@ -131,8 +137,8 @@ public class CreateSrpm implements Runnable { 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())) @@ -198,4 +204,8 @@ public class CreateSrpm implements Runnable { this.distributionCache = distributionCache; } + public void setExecutor(Executor executor) { + this.executor = executor; + } + }