[tycho] Introduce basic SCL support.

Roland Grunberg rgrunber at fedoraproject.org
Thu Jan 22 18:52:52 UTC 2015


commit 62839e138bf7932e318227306ba60488933f70e7
Author: Roland Grunberg <rgrunber at redhat.com>
Date:   Mon Jan 19 11:03:33 2015 -0500

    Introduce basic SCL support.
    
    - Minor changes for bootstrap build.
    - Suppress failed lookups on non-existing paths in scripts.
    - Explicitly depend on org.hamcrest.core where necessary.

 tycho-scripts.sh |   22 ++++++++++--
 tycho.spec       |   94 ++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 77 insertions(+), 39 deletions(-)
---
diff --git a/tycho-scripts.sh b/tycho-scripts.sh
index 86dd6e8..ff9120e 100755
--- a/tycho-scripts.sh
+++ b/tycho-scripts.sh
@@ -51,7 +51,12 @@ cp "${basedir}/pom.xml" "${loc}/${bName}-${version}.pom"
 
 function copyBundles () {
 
-osgiLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib*/eclipse' )
+# scls='scl1 scl2 scl3'
+baseLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib*/eclipse' )
+osgiLocations=(${baseLocations[@]} ${osgiLocations[@]} )
+for scl in ${scls} ; do
+  osgiLocations=( ${baseLocations[@]/#//opt/rh/${scl}/root} ${osgiLocations[@]} )
+done
 
 if [ ${eclipse_bootstrap} -eq 1 ]; then
 prefix="$(pwd)/bootstrap"
@@ -64,7 +69,7 @@ wantedBundles=`echo $1 | tr ',' ' '`
 destDir=$2
 
 for loc in ${osgiLocations[@]} ; do
-  for jar in `find ${loc} -name "*.jar"`; do
+  for jar in `find ${loc} -name "*.jar" 2>/dev/null`; do
     bsn=`readBSN ${jar}`
     versionline=`unzip -p ${jar} 'META-INF/MANIFEST.MF' | grep 'Bundle-Version:'`
     if [ -n "${bsn}" ]; then
@@ -82,12 +87,21 @@ done
 
 function symlinkBundles () {
 
-osgiLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib*/eclipse' )
+# Bootstrap Built Tycho provides some Eclipse bundles
+# Prevent non-bootstrap build's de-bundling from symlinking to them
+# SCL priority is from right to left.
+# scls='scl1 scl2 scl3'
+baseLocations=( '/usr/share/java/eclipse' '/usr/share/java' '/usr/lib/java' )
+osgiLocations=(${baseLocations[@]} ${osgiLocations[@]} )
+for scl in ${scls} ; do
+  osgiLocations=( ${baseLocations[@]/#//opt/rh/${scl}/root} ${osgiLocations[@]} )
+done
+
 
 wantedBundles=`echo $1 | tr ',' ' '`
 
 for loc in ${osgiLocations[@]} ; do
-  for jar in `find ${loc} -name "*.jar"`; do
+  for jar in `find ${loc} -name "*.jar" 2>/dev/null`; do
     bsn=`readBSN ${jar}`
     if [ -n "${bsn}" ]; then
       echo ${wantedBundles} | grep -q "${bsn}"
diff --git a/tycho.spec b/tycho.spec
index de3cb17..bf918bf 100644
--- a/tycho.spec
+++ b/tycho.spec
@@ -1,3 +1,5 @@
+%global pkg_name tycho
+%{?scl:%scl_package %{pkg_name}}
 # Bootstrap build
 # Tycho depends on itself, and Eclipse to build but in certain cases
 # these requirements may not be satisfiable.
@@ -21,9 +23,9 @@
 
 %define __requires_exclude osgi*
 
-Name:           tycho
+Name:           %{?scl_prefix}tycho
 Version:        0.22.0
-Release:        7%{?dist}
+Release:        8%{?dist}
 Summary:        Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
 
 Group:          Development/Libraries
@@ -36,9 +38,9 @@ Source0:        http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/snapshot/or
 # version 2.4.3 (impossible to have empty mojo created as aggregate). This
 # should be fixed upstream properly
 Source1:        EmptyMojo.java
-Source2:        %{name}-scripts.sh
-Source3:        %{name}-bootstrap.sh
-Source4:        %{name}-debundle.sh
+Source2:        %{pkg_name}-scripts.sh
+Source3:        %{pkg_name}-bootstrap.sh
+Source4:        %{pkg_name}-debundle.sh
 # Fedora Eclipse bundles (needed when Eclipse not present) to build Tycho
 %if %{eclipse_bootstrap}
 Source5:        eclipse-bootstrap.tar.xz
@@ -51,14 +53,14 @@ Source6:        fedoraproject-p2-%{fp_p2_sha}.tar.xz
 # artifacts. It is used in OSGi requires generation.
 Source7:        p2-install.sh
 
-Patch0:         %{name}-fix-build.patch
-Patch2:         %{name}-fix-surefire.patch
-Patch3:         %{name}-use-custom-resolver.patch
-Patch4:         %{name}-maven-delegation.patch
+Patch0:         %{pkg_name}-fix-build.patch
+Patch2:         %{pkg_name}-fix-surefire.patch
+Patch3:         %{pkg_name}-use-custom-resolver.patch
+Patch4:         %{pkg_name}-maven-delegation.patch
 # Additional changes needed just for bootstrap build
-Patch5:         %{name}-fix-bootstrap-build.patch
+Patch5:         %{pkg_name}-fix-bootstrap-build.patch
 # Patch director plugin to only assemble products for the current arch
-Patch6:         %{name}-running-env-only.patch
+Patch6:         %{pkg_name}-running-env-only.patch
 
 BuildArch:      noarch
 
@@ -72,6 +74,7 @@ BuildRequires:  maven-verifier
 BuildRequires:  objectweb-asm
 BuildRequires:  plexus-containers-component-metadata
 BuildRequires:  apache-commons-exec
+BuildRequires:  bcel
 BuildRequires:  decentxml
 BuildRequires:  easymock
 BuildRequires:  ecj
@@ -85,6 +88,7 @@ BuildRequires:  %{name}
 %endif
 %if %{eclipse_bootstrap}
 # Dependencies for Eclipse bundles we use
+BuildRequires:  eclipse-filesystem
 BuildRequires:  icu4j
 BuildRequires:  geronimo-annotation
 BuildRequires:  sac
@@ -148,12 +152,12 @@ no duplication of metadata between POM and OSGi metadata.
 
 
 %package javadoc
-Summary:        Javadocs for %{name}
+Summary:        Javadocs for %{pkg_name}
 Group:          Documentation
 Requires:       jpackage-utils
 
 %description javadoc
-This package contains the API documentation for %{name}.
+This package contains the API documentation for %{pkg_name}.
 
 %prep
 %setup -q -n org.eclipse.tycho-tycho-0.22.0
@@ -161,6 +165,7 @@ This package contains the API documentation for %{name}.
 # Prepare fedoraproject-p2
 tar -xf %{SOURCE6}
 
+%{?scl:scl enable %{scl} - << "EOF"}
 %pom_disable_module org.fedoraproject.p2.tests fedoraproject-p2
 
 %patch0 -p1
@@ -210,6 +215,14 @@ popd
 # we don't have org.apache.commons:commons-compress:jar:sources
 %pom_xpath_remove "pom:dependency[pom:classifier='sources' and pom:artifactId='commons-compress']" tycho-p2/tycho-p2-director-plugin
 
+# Previously, JUnit would re-export Hamcrest
+# Now modules using org.hamcrest.core must state the requirement explicitly
+for mod in tycho-bundles/org.eclipse.tycho.{p2.{maven.repository.tests,resolver.impl.test,tools.tests},test.utils,core.shared.tests}; do
+  sed -i 's/^Require-Bundle://
+          /org\.junit/ i Require-Bundle: org.hamcrest.core,' \
+          $mod/META-INF/MANIFEST.MF
+done
+
 
 # Bootstrap Build
 %if %{eclipse_bootstrap}
@@ -222,7 +235,7 @@ tar -xf %{SOURCE5}
 
 # Perform the 'minimal' (bootstrap) build of Tycho
 cp %{SOURCE2} %{SOURCE3} .
-./%{name}-bootstrap.sh %{eclipse_bootstrap}
+./%{pkg_name}-bootstrap.sh %{eclipse_bootstrap}
 
 %patch5 -p1 -R
 
@@ -265,8 +278,10 @@ sed '
 # Tests are skipped anyways, so remove some test dependencies
 %pom_xpath_remove "pom:dependency[pom:classifier='tests']" tycho-compiler-plugin
 %pom_xpath_remove "pom:dependency[pom:classifier='tests']" tycho-packaging-plugin
+%{?scl:EOF}
 
 %build
+%{?scl:scl enable %{scl} - << "EOF"}
 xmvn -o -Dtycho-version=%{version}-SNAPSHOT -Dmaven.test.skip=true \
 -Dmaven.repo.local=$(pwd)/.m2 -Dfedora.p2.repos=$(pwd)/bootstrap \
 -f fedoraproject-p2/pom.xml \
@@ -275,8 +290,10 @@ clean install org.apache.maven.plugins:maven-javadoc-plugin:aggregate
 xmvn -o -DtychoBootstrapVersion=%{version}-SNAPSHOT -Dmaven.test.skip=true \
 -Dmaven.repo.local=$(pwd)/.m2 -Dfedora.p2.repos=$(pwd)/bootstrap \
 clean install org.apache.maven.plugins:maven-javadoc-plugin:aggregate
+%{?scl:EOF}
 
 %install
+%{?scl:scl enable %{scl} - << "EOF"}
 
 cp %{SOURCE2} %{SOURCE4} .
 
@@ -285,16 +302,16 @@ install -dm 755 $RPM_BUILD_ROOT%{_mavenpomdir}
 
 # fedoraproject-p2 parent
 mod=fedoraproject-p2
-install -pm 644 $mod/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-$mod.pom
-%add_maven_depmap JPP.%{name}-$mod.pom
+install -pm 644 $mod/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$mod.pom
+%add_maven_depmap JPP.%{pkg_name}-$mod.pom
 
 # fedoraproject-p2
 for mod in fedoraproject-p2/{org.fedoraproject.p2,xmvn-p2-installer-plugin}; do
    echo $mod
    aid=`basename $mod`
-   install -pm 644 $mod/pom.xml  $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-$aid.pom
-   install -m 644 $mod/target/$aid-%{fp_p2_version}%{fp_p2_snap}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/$aid.jar
-   %add_maven_depmap JPP.%{name}-$aid.pom %{name}/$aid.jar -a "org.eclipse.tycho:$aid"
+   install -pm 644 $mod/pom.xml  $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$aid.pom
+   install -m 644 $mod/target/$aid-%{fp_p2_version}%{fp_p2_snap}.jar $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/$aid.jar
+   %add_maven_depmap JPP.%{pkg_name}-$aid.pom %{pkg_name}/$aid.jar -a "org.eclipse.tycho:$aid"
 done
 
 # pom and jar installation
@@ -307,9 +324,9 @@ for mod in target-platform-configuration tycho-compiler-{jdt,plugin} \
            tycho-surefire/{tycho-surefire-plugin,org.eclipse.tycho.surefire.{osgibooter,junit,junit4{,7}}}; do
    echo $mod
    aid=`basename $mod`
-   install -pm 644 $mod/pom.xml  $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-$aid.pom
-   install -m 644 $mod/target/$aid-%{version}%{snap}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/$aid.jar
-   %add_maven_depmap JPP.%{name}-$aid.pom %{name}/$aid.jar -a "org.eclipse.tycho:$aid"
+   install -pm 644 $mod/pom.xml  $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$aid.pom
+   install -m 644 $mod/target/$aid-%{version}%{snap}.jar $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/$aid.jar
+   %add_maven_depmap JPP.%{pkg_name}-$aid.pom %{pkg_name}/$aid.jar -a "org.eclipse.tycho:$aid"
 done
 
 # pom installation
@@ -317,35 +334,35 @@ for pommod in tycho-p2 tycho-bundles tycho-surefire \
               tycho-release sisu-equinox; do
    aid=`basename $pommod`
    install -pm 644 $pommod/pom.xml \
-               $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-$aid.pom
-   %add_maven_depmap JPP.%{name}-$aid.pom -a "org.eclipse.tycho:$aid"
+               $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$aid.pom
+   %add_maven_depmap JPP.%{pkg_name}-$aid.pom -a "org.eclipse.tycho:$aid"
 done
 
 # p2 runtime
 dir=.m2/org/eclipse/tycho/tycho-bundles-external/%{version}%{snap}
 %if ! %{eclipse_bootstrap}
-./%{name}-debundle.sh tycho-bundles/tycho-bundles-external/ $dir/tycho-bundles-external-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{name}/tycho-bundles-external-manifest.txt
+./%{pkg_name}-debundle.sh tycho-bundles/tycho-bundles-external/ $dir/tycho-bundles-external-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/tycho-bundles-external-manifest.txt
 %endif
-install -pm 644 $dir/tycho-bundles-external-%{version}*.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-tycho-bundles-external.pom
-install -m 644 $dir/tycho-bundles-external-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{name}/tycho-bundles-external.zip
-%add_maven_depmap JPP.%{name}-tycho-bundles-external.pom %{name}/tycho-bundles-external.zip -a "org.eclipse.tycho:tycho-bundles-external"
+install -pm 644 $dir/tycho-bundles-external-%{version}*.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-tycho-bundles-external.pom
+install -m 644 $dir/tycho-bundles-external-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/tycho-bundles-external.zip
+%add_maven_depmap JPP.%{pkg_name}-tycho-bundles-external.pom %{pkg_name}/tycho-bundles-external.zip -a "org.eclipse.tycho:tycho-bundles-external"
 %if ! %{eclipse_bootstrap}
-%add_maven_depmap org.eclipse.tycho:tycho-bundles-external:txt:manifest:%{version}%{snap} %{name}/tycho-bundles-external-manifest.txt
+%add_maven_depmap org.eclipse.tycho:tycho-bundles-external:txt:manifest:%{version}%{snap} %{pkg_name}/tycho-bundles-external-manifest.txt
 %endif
 
 # main
-install -pm 644 pom.xml  $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-main.pom
-%add_maven_depmap JPP.%{name}-main.pom
+install -pm 644 pom.xml  $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-main.pom
+%add_maven_depmap JPP.%{pkg_name}-main.pom
 
 # standalone p2 director
 %if ! %{eclipse_bootstrap}
-./%{name}-debundle.sh tycho-bundles/tycho-standalone-p2-director/ .m2/org/eclipse/tycho/tycho-standalone-p2-director/%{version}%{snap}/tycho-standalone-p2-director-%{version}*.zip
+./%{pkg_name}-debundle.sh tycho-bundles/tycho-standalone-p2-director/ .m2/org/eclipse/tycho/tycho-standalone-p2-director/%{version}%{snap}/tycho-standalone-p2-director-%{version}*.zip
 %endif
 pushd .m2/org/eclipse/tycho/tycho-standalone-p2-director/%{version}%{snap}/
-install -m 644 tycho-standalone-p2-director-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{name}/tycho-standalone-p2-director.zip
-install -pm 644 tycho-standalone-p2-director-%{version}*.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-tycho-standalone-p2-director.pom
+install -m 644 tycho-standalone-p2-director-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/tycho-standalone-p2-director.zip
+install -pm 644 tycho-standalone-p2-director-%{version}*.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-tycho-standalone-p2-director.pom
 popd
-%add_maven_depmap JPP.%{name}-tycho-standalone-p2-director.pom tycho/tycho-standalone-p2-director.zip -a "org.eclipse.tycho:tycho-standalone-p2-director"
+%add_maven_depmap JPP.%{pkg_name}-tycho-standalone-p2-director.pom tycho/tycho-standalone-p2-director.zip -a "org.eclipse.tycho:tycho-standalone-p2-director"
 
 # javadoc
 install -dm 755 $RPM_BUILD_ROOT%{_javadocdir}/tycho
@@ -398,6 +415,7 @@ ln -s %{_javadir}/eclipse/osgi.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
 %endif
 ln -s %{_javadir}/tycho/xmvn-p2-installer-plugin.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
 ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
+%{?scl:EOF}
 
 %files -f .mfiles
 %dir %{_javadir}/tycho
@@ -409,6 +427,12 @@ ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{_datadir}/xmvn/li
 %{_javadocdir}/tycho
 
 %changelog
+* Mon Jan 19 2015 Roland Grunberg <rgrunber at redhat.com> - 0.22.0-8
+- Introduce basic SCL support.
+- Minor changes for bootstrap build.
+- Suppress failed lookups on non-existing paths in scripts.
+- Explicitly depend on org.hamcrest.core where necessary.
+
 * Thu Dec 11 2014 Mat Booth <mat.booth at redhat.com> - 0.22.0-7
 - fedoraproject-p2: Fix for bundles containing underscores
 


More information about the scm-commits mailing list