summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRodrigo Fraxino Araujo2012-06-29 17:18:05 (EDT)
committer Otavio Pontes2012-06-29 21:38:18 (EDT)
commitf39e900a79ca0a5c833ec657f36053b7cf04ba90 (patch)
treee38bcc87dcaa84a3d2d65a4467e0c7f32c950040
parent2882e567c1cb2c595aaea52bad30b832f681ec10 (diff)
downloadorg.eclipse.linuxtools-f39e900a79ca0a5c833ec657f36053b7cf04ba90.zip
org.eclipse.linuxtools-f39e900a79ca0a5c833ec657f36053b7cf04ba90.tar.gz
org.eclipse.linuxtools-f39e900a79ca0a5c833ec657f36053b7cf04ba90.tar.bz2
Fix directories path for rpmbuild and flat layout.
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java47
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java54
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java46
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java1
4 files changed, 80 insertions, 68 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java
index f9ba7da..ce98177 100644
--- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java
+++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java
@@ -15,6 +15,7 @@ import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.rpm.core.IProjectConfiguration;
/**
@@ -35,20 +36,38 @@ public class FlatBuildConfiguration implements IProjectConfiguration {
public FlatBuildConfiguration(IProject project) {
this.project = project;
configDefines.add(DEFINE);
- configDefines
- .add("_sourcedir " + project.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_srcrpmdir " + project.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_builddir " + project.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_rpmdir " + project.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_specdir " + project.getLocation().toOSString()); //$NON-NLS-1$
+ if (project.getLocationURI()==null) {
+ configDefines
+ .add("_sourcedir " + project.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_srcrpmdir " + project.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_builddir " + project.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_rpmdir " + project.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_specdir " + project.getLocation().toOSString()); //$NON-NLS-1$
+ } else {
+ configDefines
+ .add("_sourcedir " + project.getLocationURI().getPath() + IPath.SEPARATOR); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_srcrpmdir " + project.getLocationURI().getPath() + IPath.SEPARATOR); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_builddir " + project.getLocationURI().getPath() + IPath.SEPARATOR); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_rpmdir " + project.getLocationURI().getPath() + IPath.SEPARATOR); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_specdir " + project.getLocationURI().getPath() + IPath.SEPARATOR); //$NON-NLS-1$
+
+ }
}
public IContainer getBuildFolder() {
diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java
index de5f914..49fec4a 100644
--- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java
+++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.linuxtools.rpm.core.IProjectConfiguration;
@@ -141,24 +142,43 @@ public class RPMBuildConfiguration implements IProjectConfiguration {
if(!specsFolder.exists()) {
specsFolder.create(false, true, null);
}
- }
- configDefines.add(DEFINE);
- configDefines
- .add("_sourcedir " + sourcesFolder.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_srcrpmdir " + srpmsFolder.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_builddir " + buildFolder.getLocation().toOSString()); //$NON-NLS-1$
- configDefines.add(DEFINE);
- configDefines
- .add("_rpmdir " + rpmsFolder.getLocation().toOSString()); //$NON-NLS-1$
+ }
configDefines.add(DEFINE);
- configDefines
- .add("_specdir " + specsFolder.getLocation().toOSString()); //$NON-NLS-1$
- }
-
+ if (project.getLocationURI()==null) {
+ configDefines
+ .add("_sourcedir " + sourcesFolder.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_srcrpmdir " + srpmsFolder.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_builddir " + buildFolder.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_rpmdir " + rpmsFolder.getLocation().toOSString()); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_specdir " + specsFolder.getLocation().toOSString()); //$NON-NLS-1$
+ } else {
+ String mainFolder = project.getLocationURI().getPath();
+ configDefines
+ .add("_sourcedir " + mainFolder + IPath.SEPARATOR + IRPMConstants.SOURCES_FOLDER); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_srcrpmdir " + mainFolder + IPath.SEPARATOR + IRPMConstants.SRPMS_FOLDER); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_builddir " + mainFolder + IPath.SEPARATOR + IRPMConstants.BUILD_FOLDER); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_rpmdir " + mainFolder + IPath.SEPARATOR + IRPMConstants.RPMS_FOLDER); //$NON-NLS-1$
+ configDefines.add(DEFINE);
+ configDefines
+ .add("_specdir " + mainFolder + IPath.SEPARATOR + IRPMConstants.SPECS_FOLDER); //$NON-NLS-1$
+
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.rpm.core.IProjectConfiguration#getBuildFolder()
*/
diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java
index c1c6d8b..8c2633f 100644
--- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java
+++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java
@@ -51,7 +51,7 @@ public class RPMBuild {
private String rpmBuildCmd;
- private String buildFolder;
+ private String mainFolder;
/**
* Constructs a new object.
@@ -62,35 +62,12 @@ public class RPMBuild {
public RPMBuild(IProjectConfiguration config) {
IEclipsePreferences node = DefaultScope.INSTANCE
.getNode(IRPMConstants.RPM_CORE_ID);
+ if (config.getBuildFolder().getLocation() == null)
+ mainFolder = config.getSourcesFolder().getLocationURI().toString();
rpmBuildCmd = node.get(IRPMConstants.RPMBUILD_CMD, ""); //$NON-NLS-1$
- if (config.getSourcesFolder().getLocation() == null) {
- buildFolder = config.getBuildFolder().getLocationURI().toString();
- String fullRemoteDirectory = config.getSourcesFolder()
- .getLocationURI().toString();
- String host = config.getSourcesFolder().getLocationURI().getHost();
- int startIndex = fullRemoteDirectory.indexOf(host) + host.length();
- String remoteDirectory = fullRemoteDirectory.substring(startIndex);
- String[] tmpMacroDefines = {
- // rpmBuildCmd,
- "-v", //$NON-NLS-1$
- DEFINE,
- "_sourcedir " + //$NON-NLS-1$
- remoteDirectory
- + "/" + IRPMConstants.SOURCES_FOLDER, //$NON-NLS-1$
- DEFINE, "_srcrpmdir " + //$NON-NLS-1$
- remoteDirectory + "/" + IRPMConstants.SRPMS_FOLDER, //$NON-NLS-1$
- DEFINE, "_builddir " + //$NON-NLS-1$
- remoteDirectory + "/" + IRPMConstants.BUILD_FOLDER, //$NON-NLS-1$
- DEFINE, "_rpmdir " + //$NON-NLS-1$
- remoteDirectory + "/" + IRPMConstants.RPMS_FOLDER, //$NON-NLS-1$
- DEFINE, "_specdir " + //$NON-NLS-1$
- remoteDirectory + "/" + IRPMConstants.SPECS_FOLDER, }; //$NON-NLS-1$
- macroDefines.addAll(Arrays.asList(tmpMacroDefines));
- } else {
- String[] tmpMacroDefines = { rpmBuildCmd, "-v" }; //$NON-NLS-1$
- macroDefines.addAll(Arrays.asList(tmpMacroDefines));
- macroDefines.addAll(config.getConfigDefines());
- }
+ String[] tmpMacroDefines = { rpmBuildCmd, "-v" }; //$NON-NLS-1$
+ macroDefines.addAll(Arrays.asList(tmpMacroDefines));
+ macroDefines.addAll(config.getConfigDefines());
}
/**
@@ -179,21 +156,16 @@ public class RPMBuild {
IRemoteCommandLauncher rmtCmdLauncher = null;
command.addAll(macroDefines);
command.add(buildParameter);
- String remoteSpec = ""; //$NON-NLS-1$
if (specFile.getLocation() == null) {
+ command.remove(0);
rmtProxyMgr = RemoteProxyManager.getInstance();
try {
- rmtCmdLauncher = rmtProxyMgr.getLauncher(new URI(buildFolder));
+ rmtCmdLauncher = rmtProxyMgr.getLauncher(new URI(mainFolder));
} catch (URISyntaxException e1) {
throw new CoreException(new Status(IStatus.ERROR,
IRPMConstants.RPM_CORE_ID, e1.getMessage(), e1));
-
}
- String host = specFile.getLocationURI().getHost();
- int startIndex = buildFolder.indexOf(host) + host.length();
- remoteSpec = specFile.getLocationURI().toString()
- .substring(startIndex);
- command.add(remoteSpec);
+ command.add(specFile.getLocationURI().getPath());
String empty[] = new String[0];
Process pProxy = rmtCmdLauncher.execute(
Path.fromOSString(rpmBuildCmd),
diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java
index a514fb3..9ba27ba 100644
--- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java
+++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java
@@ -88,6 +88,7 @@ public class RPMProjectCreator {
monitor.worked(10);
project.open(monitor);
+ RPMProject rpmProject = new RPMProject(project, layout);
if (projectPath.toString().indexOf(':') != -1) {
if (layout.equals(RPMProjectLayout.RPMBUILD)) {
createDirsRemote(monitor, project, parsedIPathString);