[xbean] Implement equinox and spring conditionals

Mikolaj Izdebski mizdebsk at fedoraproject.org
Wed Oct 10 12:10:17 UTC 2012


commit 1f03e8b29f3c2f63907dbfbd241353a32f78e31c
Author: Mikolaj Izdebski <mizdebsk at redhat.com>
Date:   Wed Oct 10 14:08:15 2012 +0200

    Implement equinox and spring conditionals

 xbean.spec |   63 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 32 insertions(+), 31 deletions(-)
---
diff --git a/xbean.spec b/xbean.spec
index 7cd378a..575d6fb 100644
--- a/xbean.spec
+++ b/xbean.spec
@@ -1,8 +1,15 @@
+# Conditionals to help breaking eclipse <-> xbean dependency cycle
+# when bootstrapping for new architectures
+%if 0%{?fedora}
+#%%bcond_without equinox
+#%%bcond_without spring
+%endif
+
 Name:           xbean
 Version:        3.11.1
 BuildArch:      noarch
 
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Java plugin based web server
 
 Group:          Development/Libraries
@@ -35,8 +42,12 @@ BuildRequires:  maven-resources-plugin
 BuildRequires:  maven-surefire-plugin
 BuildRequires:  maven-site-plugin
 BuildRequires:  maven-shade-plugin
-%if !0%{?rhel:1}
+%if %{with equinox}
 BuildRequires:  eclipse-rcp
+%else
+BuildRequires:  felix-framework
+%endif
+%if %{with spring}
 BuildRequires:  maven-archiver
 BuildRequires:  maven-plugin-plugin
 BuildRequires:  maven-project
@@ -46,8 +57,6 @@ BuildRequires:  springframework
 BuildRequires:  springframework-beans
 BuildRequires:  springframework-context
 BuildRequires:  springframework-web
-%else
-BuildRequires:  felix-framework
 %endif
 
 Requires:       java
@@ -55,7 +64,7 @@ Requires:       jpackage-utils
 Requires:       apache-commons-logging
 Requires:       objectweb-asm
 Requires:       slf4j
-%if !0%{?rhel:1}
+%if %{with equinox}
 Requires:       eclipse-rcp
 %else
 Requires:       felix-framework
@@ -70,7 +79,7 @@ support for running with no IoC system, JMX without JMX code,
 lifecycle and class loader management, and a rock solid Spring
 integration.
 
-%if !0%{?rhel:1}
+%if %{with spring}
 %package        spring
 Summary:        Schema-driven namespace handler for spring contexts
 Requires:       %{name} = %{version}-%{release}
@@ -124,27 +133,21 @@ rm src/site/site.xml
 %pom_disable_module xbean-telnet
 
 # Prevent modules depending on springframework from building.
-if [ %{?rhel} ]; then
+%if %{without spring}
    %pom_remove_dep org.springframework:
    %pom_disable_module xbean-spring
    %pom_disable_module maven-xbean-plugin
-fi
-
-%pom_add_plugin :maven-compiler-plugin . "
-    <configuration>
-      <source>1.5</source>
-      <target>1.5</target>
-    </configuration>"
+%endif
 
-# Force use of Equinox
+# Replace generic OSGi dependencies with either Equinox or Felix
 %pom_remove_dep :org.osgi.core xbean-bundleutils
 %pom_remove_dep org.eclipse:osgi xbean-bundleutils
-%pom_xpath_inject "pom:project/pom:dependencies" "
-    <dependency>
-      <groupId>org.eclipse.osgi</groupId>
-      <artifactId>org.eclipse.osgi</artifactId>
-      <version>any</version>
-    </dependency>" xbean-bundleutils
+%if %{with equinox}
+  %pom_add_dep org.eclipse.osgi:org.eclipse.osgi xbean-bundleutils
+%else
+  rm -rf xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/
+  %pom_add_dep org.apache.felix:org.apache.felix.framework xbean-bundleutils
+%endif
 
 
 # Fix dependency on xbean-asm-shaded to original objectweb-asm
@@ -154,16 +157,11 @@ sed -i 's/org.apache.xbean.asm/org.objectweb.asm/' \
 # Fix ant groupId
 find -name pom.xml -exec sed -i "s|<groupId>ant</groupId>|<groupId>org.apache.ant</groupId>|" {} \;
 
-# Do not build equinox specific part for rhel.
-if [ %{?rhel} ]; then
-   rm -rf xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/
-   sed -i "s|<groupId>org.eclipse.osgi|<groupId>org.apache.felix|g" xbean-bundleutils/pom.xml
-   sed -i "s|<artifactId>org.eclipse.osgi|<artifactId>org.apache.felix.framework|g" xbean-bundleutils/pom.xml
-fi
-
 
 %build
 mvn-rpmbuild -e \
+        -Dmaven.compiler.source=1.5 \
+        -Dmaven.compiler.target=1.5 \
         -Dmaven.local.depmap.file="%{SOURCE1}" \
         -Dmaven.test.skip=true \
         install javadoc:aggregate
@@ -185,7 +183,7 @@ for sub in bundleutils classpath finder naming reflect; do
     %add_maven_depmap JPP.%{name}-%{name}-${sub}.pom %{name}/%{name}-${sub}.jar
 done
 
-if [ %{?fedora} ]; then
+%if %{with spring}
    # xbean-spring
    install -m 644 %{name}-spring/target/%{name}-spring-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/%{name}-spring.jar
    install -pm 644 %{name}-spring/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP.%{name}-%{name}-spring.pom
@@ -194,7 +192,7 @@ if [ %{?fedora} ]; then
    install -m 644 maven-%{name}-plugin/target/maven-%{name}-plugin-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/maven-%{name}-plugin.jar
    install -pm 644 maven-%{name}-plugin/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP.%{name}-maven-%{name}-plugin.pom
    %add_maven_depmap JPP.%{name}-maven-%{name}-plugin.pom %{name}/maven-%{name}-plugin.jar -f maven-plugin
-fi
+%endif
 
 # javadocs
 cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
@@ -216,7 +214,7 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
 %{_mavenpomdir}/JPP.%{name}-%{name}-reflect.pom
 %{_mavendepmapfragdir}/%{name}
 
-%if !0%{?rhel:1}
+%if %{with spring}
 %files spring
 %doc LICENSE NOTICE
 %{_javadir}/%{name}/%{name}-spring.jar
@@ -235,6 +233,9 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
 %{_javadocdir}/%{name}
 
 %changelog
+* Wed Oct 10 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 3.11.1-6
+- Implement equinox and spring conditionals
+
 * Mon Sep  3 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 3.11.1-5
 - Fix eclipse requires
 


More information about the scm-commits mailing list