Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2011-09-22 04:16:24 -0400
committerAlexander Kurtakov2011-09-22 04:16:24 -0400
commit681e7142825a1cc53899f45d0aabcf7857bc386b (patch)
tree92f6d7dd5acd5bbcc67a3c5f579c8318ea5b39bd /rpmstubby
parent511c6f4ab85e9783421d902b57d31700c6643513 (diff)
downloadorg.eclipse.linuxtools-681e7142825a1cc53899f45d0aabcf7857bc386b.tar.gz
org.eclipse.linuxtools-681e7142825a1cc53899f45d0aabcf7857bc386b.tar.xz
org.eclipse.linuxtools-681e7142825a1cc53899f45d0aabcf7857bc386b.zip
Adapt to latest Fedora packaging achievements.
Use add_maven_depmap - quite simpler. Use the mvn(groupId:artifactId) virtual provides for BR/R - should be autogenerated.
Diffstat (limited to 'rpmstubby')
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java16
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java41
2 files changed, 19 insertions, 38 deletions
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java
index 38c218e0e5..71b712b7ca 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java
@@ -13,6 +13,7 @@ package org.eclipse.linuxtools.internal.rpmstubby;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -101,11 +102,11 @@ public class StubbyPomGenerator {
}
private void generateRequires(StringBuilder buffer) {
- for (String dependency: model.getDependencies()) {
- buffer.append("BuildRequires: "+dependency+"\n");
+ for (Map.Entry<String,String> entry : model.getDependencies().entrySet()) {
+ buffer.append("BuildRequires: mvn("+entry.getKey()+":"+entry.getValue()+")\n");
}
- for (String dependency: model.getDependencies()) {
- buffer.append("Requires: "+dependency+"\n");
+ for (Map.Entry<String,String> entry : model.getDependencies().entrySet()) {
+ buffer.append("Requires: mvn("+entry.getKey()+":"+entry.getValue()+")\n");
}
}
@@ -130,11 +131,8 @@ public class StubbyPomGenerator {
buffer.append("# jars\n");
buffer.append("install -d -m 0755 %{buildroot}%{_javadir}\n");
buffer
- .append("install -m 644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}\n\n");
+ .append("install -m 644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar\n\n");
- buffer.append("%add_to_maven_depmap " + model.getGroupId() + " "
- + model.getArtifactId() + " %{version} JPP "
- + model.getArtifactId() + "\n\n");
buffer.append("# poms\n");
buffer
@@ -143,6 +141,8 @@ public class StubbyPomGenerator {
buffer
.append(" %{buildroot}%{_mavenpomdir}/JPP.%{name}.pom\n\n");
+ buffer.append("%add_maven_depmap JPP.%{name}.pom %{name}.jar\n\n");
+
buffer.append("# javadoc\n");
buffer
.append("install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}\n");
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java
index 6f98b9e5c3..9a3ec59aea 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.rpmstubby.model;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
@@ -55,29 +55,6 @@ public class PomModel {
}
/**
- * Returns the artifact id xpath:/project/artifactId .
- *
- * @return The artifact id.
- */
- public String getArtifactId() {
- return xpathEval("/project/artifactId");
- }
-
- /**
- * Returns the group id (xpath:/project/groupId) or the groupId of the
- * parent (xpath:/project/parent/groupId) if groupId is not present.
- *
- * @return The group id.
- */
- public String getGroupId() {
- String groupId = xpathEval("/project/groupId");
- if (groupId.equals("")) {
- groupId = xpathEval("/project/parent/groupId");
- }
- return groupId;
- }
-
- /**
* Returns the summary (xpath:/project/name). Maven project name is verbose
* and it corresponds to the RPM specfile Summary tag.
*
@@ -130,7 +107,6 @@ public class PomModel {
* @return The project description.
*/
public String getDescription() {
- getDependencies();
return xpathEval("/project/description");
}
@@ -138,12 +114,17 @@ public class PomModel {
* Returns the dependencies.
* @return All the dependencies.
*/
- public List<String> getDependencies() {
- List<String> dependencies = new ArrayList<String>();
- NodeList nodes = xpathEvalNodes("/project/dependencies/dependency/artifactId");
+ public Map<String, String> getDependencies() {
+ Map<String, String> dependencies = new HashMap<String, String>();
+ NodeList nodes = xpathEvalNodes("/project/dependencies/dependency");
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
- dependencies.add(node.getTextContent());
+ try {
+ dependencies.put(xpath.evaluate("groupId", node), xpath.evaluate("artifactId", node));
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
return dependencies;
}

Back to the top