Debundle tycho-bundles-external and tycho-standalone-p2-director.
- Resolves: rhbz#789272
This commit is contained in:
parent
b31d03ca43
commit
793ac795c5
@ -1,147 +1,6 @@
|
||||
#! /bin/bash
|
||||
|
||||
function minibuild () {
|
||||
|
||||
basedir=$1
|
||||
|
||||
src=`cat "${basedir}/build.properties" | grep 'source..' | cut -d'=' -f2 | tr ' ' '\0'`
|
||||
output=`cat "${basedir}/build.properties" | grep 'output..' | cut -d'=' -f2 | tr ' ' '\0'`
|
||||
bName=`cat "${basedir}/META-INF/MANIFEST.MF" | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`
|
||||
artifactId=`cat "${basedir}/pom.xml" | sed '/<parent>/,/<\/parent>/ d' | grep "<artifactId>" | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/'`
|
||||
version=`cat "${basedir}/pom.xml" | grep "<version>" | sed 's/.*<version>\(.*\)<\/version>.*/\1/'`
|
||||
|
||||
# External (System) dependencies
|
||||
if [ $# -eq 3 ]; then
|
||||
mkdir -p "${basedir}/target/externalDeps"
|
||||
copyBundles $3 "${basedir}/target/externalDeps"
|
||||
else
|
||||
mkdir -p "${basedir}/target"
|
||||
fi
|
||||
|
||||
mkdir -p "${basedir}/${output}"
|
||||
|
||||
# Compile
|
||||
cp=
|
||||
if [ $# -gt 1 ]; then
|
||||
cp='-classpath '$2':'"${basedir}"'/target/externalDeps/*'
|
||||
fi
|
||||
|
||||
javac -d "${basedir}/${output}" \
|
||||
$(for file in `find "${basedir}/${src}" -name "*.java"`; \
|
||||
do echo -n "${file} "; \
|
||||
done;) \
|
||||
${cp}
|
||||
|
||||
# Package
|
||||
pushd ${basedir}
|
||||
pushd ${output}
|
||||
classfiles=`for file in $(find . -name "*.class"); do echo -n ' -C '${output} ${file} ; done;`
|
||||
popd
|
||||
jar -cfmv "target/${bName}-${version}.jar" 'META-INF/MANIFEST.MF' 'OSGI-INF' 'plugin.xml' 'about.html' 'plugin.properties' ${classfiles}
|
||||
popd
|
||||
|
||||
# Install
|
||||
loc=".m2/org/eclipse/tycho/${artifactId}/${version}"
|
||||
mkdir -p ${loc}
|
||||
cp "${basedir}/target/${bName}-${version}.jar" ${loc}
|
||||
cp "${basedir}/pom.xml" "${loc}/${bName}-${version}.pom"
|
||||
|
||||
}
|
||||
|
||||
|
||||
function copyBundles () {
|
||||
|
||||
osgiLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib*/eclipse' )
|
||||
|
||||
if [ ${eclipse_bootstrap} -eq 1 ]; then
|
||||
prefix="$(pwd)/bootstrap"
|
||||
osgiLocations=( ${osgiLocations[@]/#/${prefix}} )
|
||||
osgiLocations+=( ${osgiLocations[@]/${prefix}/} )
|
||||
fi
|
||||
|
||||
wantedBundles=`echo $1 | tr ',' ' '`
|
||||
destDir=$2
|
||||
|
||||
for loc in ${osgiLocations[@]} $(pwd)/bootstrap/extras ; do
|
||||
for jar in `find ${loc} -name "*.jar"`; do
|
||||
bsn=`readBSN ${jar}`
|
||||
versionline=`unzip -p ${jar} 'META-INF/MANIFEST.MF' | grep 'Bundle-Version:'`
|
||||
if [ -n "${bsn}" ]; then
|
||||
vers=`echo "${versionline}" | sed 's/Bundle-Version: \([a-zA-Z0-9_.-]*\).*/\1/'`
|
||||
echo ${wantedBundles} | grep -q "${bsn}"
|
||||
if [ $? -eq 0 ]; then
|
||||
cp ${jar} "${destDir}/${bsn}_${vers}.jar"
|
||||
wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"`
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
function removeFromList () {
|
||||
arr=( ${1} )
|
||||
for (( i=0; i < ${#arr[@]}; i++ )); do
|
||||
if [ "${arr[${i}]}" = "$2" ]; then
|
||||
arr[${i}]=
|
||||
fi
|
||||
done
|
||||
echo ${arr[@]}
|
||||
}
|
||||
|
||||
function isolateProject () {
|
||||
|
||||
sed -i '/<parent>/,/<\/parent>/ d' "$1/pom.xml"
|
||||
sed -i "/<modelVersion>/ a <groupId>org.eclipse.tycho<\/groupId><version>${v}<\/version>" "$1/pom.xml"
|
||||
|
||||
sed -i "/<artifactId>org.eclipse.osgi<\/artifactId>/ a <version>${osgiV}</version>" "$1/pom.xml"
|
||||
sed -i "/<artifactId>org.eclipse.osgi.compatibility.state<\/artifactId>/ a <version>${osgiV}</version>" "$1/pom.xml"
|
||||
}
|
||||
|
||||
function unifyProject () {
|
||||
|
||||
aid=$(basename $(dirname $1))
|
||||
if [ "${aid}" = '.' ]; then
|
||||
aid='tycho'
|
||||
fi
|
||||
sed -i "/<groupId>org.eclipse.tycho<\/groupId><version>${v}<\/version>/ d" "$1/pom.xml"
|
||||
sed -i "/<modelVersion>/ a <parent>\n<groupId>org.eclipse.tycho<\/groupId>\n<artifactId>${aid}<\/artifactId>\n<version>${preV}<\/version>\n<\/parent>" "$1/pom.xml"
|
||||
|
||||
sed -i "/<version>${osgiV}<\/version>/ d" "$1/pom.xml"
|
||||
|
||||
}
|
||||
|
||||
function readBSN () {
|
||||
|
||||
bsn=
|
||||
manEntryPat="^[a-zA-Z-]*:"
|
||||
foundBSNLine=0
|
||||
|
||||
while read line; do
|
||||
if [ ${foundBSNLine} -eq 1 ]; then
|
||||
echo ${line} | grep -qE ${manEntryPat}
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
else
|
||||
bsn=${bsn}"`echo ${line} | sed 's/\([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ${line} | grep -q "Bundle-SymbolicName:"
|
||||
if [ $? -eq 0 ]; then
|
||||
bsn=`echo ${line} | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`
|
||||
echo ${line} | grep "Bundle-SymbolicName:" | grep -q ";"
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
foundBSNLine=1
|
||||
fi
|
||||
done < <(unzip -p $1 'META-INF/MANIFEST.MF')
|
||||
|
||||
echo ${bsn}
|
||||
|
||||
}
|
||||
|
||||
. $(pwd)/tycho-scripts.sh
|
||||
|
||||
eclipse_bootstrap=$1
|
||||
preV='0.21.0'
|
||||
|
22
tycho-debundle.sh
Executable file
22
tycho-debundle.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
|
||||
. $(pwd)/tycho-scripts.sh
|
||||
|
||||
projLoc=$1
|
||||
zipLoc=$2
|
||||
|
||||
zipDir=`dirname ${zipLoc}`
|
||||
zipFile=`basename ${zipLoc}`
|
||||
tmpDir=${zipDir}/tmp
|
||||
|
||||
mkdir -p ${tmpDir}
|
||||
unzip -d ${tmpDir} ${zipLoc}
|
||||
wantedBundles=`sed 's/ fragment=\"true\"//' ${projLoc}/*.product | sed -n 's/.*<plugin id=\"\(.*\)\"\/>.*/\1/ p'`
|
||||
pushd ${tmpDir}
|
||||
pluginsDir=`find . -type d -name plugins`
|
||||
pushd ${pluginsDir} && rm -rf *
|
||||
symlinkBundles "${wantedBundles}"
|
||||
popd
|
||||
zip -ry ${zipFile} *
|
||||
popd
|
||||
mv ${tmpDir}/${zipFile} ${zipLoc}
|
165
tycho-scripts.sh
Executable file
165
tycho-scripts.sh
Executable file
@ -0,0 +1,165 @@
|
||||
#! /bin/bash
|
||||
|
||||
function minibuild () {
|
||||
|
||||
basedir=$1
|
||||
|
||||
src=`cat "${basedir}/build.properties" | grep 'source..' | cut -d'=' -f2 | tr ' ' '\0'`
|
||||
output=`cat "${basedir}/build.properties" | grep 'output..' | cut -d'=' -f2 | tr ' ' '\0'`
|
||||
bName=`cat "${basedir}/META-INF/MANIFEST.MF" | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`
|
||||
artifactId=`cat "${basedir}/pom.xml" | sed '/<parent>/,/<\/parent>/ d' | grep "<artifactId>" | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/'`
|
||||
version=`cat "${basedir}/pom.xml" | grep "<version>" | sed 's/.*<version>\(.*\)<\/version>.*/\1/'`
|
||||
|
||||
# External (System) dependencies
|
||||
if [ $# -eq 3 ]; then
|
||||
mkdir -p "${basedir}/target/externalDeps"
|
||||
copyBundles $3 "${basedir}/target/externalDeps"
|
||||
else
|
||||
mkdir -p "${basedir}/target"
|
||||
fi
|
||||
|
||||
mkdir -p "${basedir}/${output}"
|
||||
|
||||
# Compile
|
||||
cp=
|
||||
if [ $# -gt 1 ]; then
|
||||
cp='-classpath '$2':'"${basedir}"'/target/externalDeps/*'
|
||||
fi
|
||||
|
||||
javac -d "${basedir}/${output}" \
|
||||
$(for file in `find "${basedir}/${src}" -name "*.java"`; \
|
||||
do echo -n "${file} "; \
|
||||
done;) \
|
||||
${cp}
|
||||
|
||||
# Package
|
||||
pushd ${basedir}
|
||||
pushd ${output}
|
||||
classfiles=`for file in $(find . -name "*.class"); do echo -n ' -C '${output} ${file} ; done;`
|
||||
popd
|
||||
jar -cfmv "target/${bName}-${version}.jar" 'META-INF/MANIFEST.MF' 'OSGI-INF' 'plugin.xml' 'about.html' 'plugin.properties' ${classfiles}
|
||||
popd
|
||||
|
||||
# Install
|
||||
loc=".m2/org/eclipse/tycho/${artifactId}/${version}"
|
||||
mkdir -p ${loc}
|
||||
cp "${basedir}/target/${bName}-${version}.jar" ${loc}
|
||||
cp "${basedir}/pom.xml" "${loc}/${bName}-${version}.pom"
|
||||
|
||||
}
|
||||
|
||||
|
||||
function copyBundles () {
|
||||
|
||||
osgiLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib*/eclipse' )
|
||||
|
||||
if [ ${eclipse_bootstrap} -eq 1 ]; then
|
||||
prefix="$(pwd)/bootstrap"
|
||||
osgiLocations=( ${osgiLocations[@]/#/${prefix}} )
|
||||
osgiLocations+=( ${osgiLocations[@]/${prefix}/} )
|
||||
fi
|
||||
|
||||
wantedBundles=`echo $1 | tr ',' ' '`
|
||||
destDir=$2
|
||||
|
||||
for loc in ${osgiLocations[@]} ; do
|
||||
for jar in `find ${loc} -name "*.jar"`; do
|
||||
bsn=`readBSN ${jar}`
|
||||
versionline=`unzip -p ${jar} 'META-INF/MANIFEST.MF' | grep 'Bundle-Version:'`
|
||||
if [ -n "${bsn}" ]; then
|
||||
vers=`echo "${versionline}" | sed 's/Bundle-Version: \([a-zA-Z0-9_.-]*\).*/\1/'`
|
||||
echo ${wantedBundles} | grep -q "${bsn}"
|
||||
if [ $? -eq 0 ]; then
|
||||
cp ${jar} "${destDir}/${bsn}_${vers}.jar"
|
||||
wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"`
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
function symlinkBundles () {
|
||||
|
||||
osgiLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib*/eclipse' )
|
||||
|
||||
wantedBundles=`echo $1 | tr ',' ' '`
|
||||
|
||||
for loc in ${osgiLocations[@]} ; do
|
||||
for jar in `find ${loc} -name "*.jar"`; do
|
||||
bsn=`readBSN ${jar}`
|
||||
versionline=`unzip -p ${jar} 'META-INF/MANIFEST.MF' | grep 'Bundle-Version:'`
|
||||
if [ -n "${bsn}" ]; then
|
||||
vers=`echo "${versionline}" | sed 's/Bundle-Version: \([a-zA-Z0-9_.-]*\).*/\1/'`
|
||||
echo ${wantedBundles} | grep -q "${bsn}"
|
||||
if [ $? -eq 0 ]; then
|
||||
ln -s ${jar} "${bsn}_${vers}.jar"
|
||||
wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"`
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function removeFromList () {
|
||||
arr=( ${1} )
|
||||
for (( i=0; i < ${#arr[@]}; i++ )); do
|
||||
if [ "${arr[${i}]}" = "$2" ]; then
|
||||
arr[${i}]=
|
||||
fi
|
||||
done
|
||||
echo ${arr[@]}
|
||||
}
|
||||
|
||||
function isolateProject () {
|
||||
|
||||
sed -i '/<parent>/,/<\/parent>/ d' "$1/pom.xml"
|
||||
sed -i "/<modelVersion>/ a <groupId>org.eclipse.tycho<\/groupId><version>${v}<\/version>" "$1/pom.xml"
|
||||
|
||||
sed -i "/<artifactId>org.eclipse.osgi<\/artifactId>/ a <version>${osgiV}</version>" "$1/pom.xml"
|
||||
sed -i "/<artifactId>org.eclipse.osgi.compatibility.state<\/artifactId>/ a <version>${osgiV}</version>" "$1/pom.xml"
|
||||
}
|
||||
|
||||
function unifyProject () {
|
||||
|
||||
aid=$(basename $(dirname $1))
|
||||
if [ "${aid}" = '.' ]; then
|
||||
aid='tycho'
|
||||
fi
|
||||
sed -i "/<groupId>org.eclipse.tycho<\/groupId><version>${v}<\/version>/ d" "$1/pom.xml"
|
||||
sed -i "/<modelVersion>/ a <parent>\n<groupId>org.eclipse.tycho<\/groupId>\n<artifactId>${aid}<\/artifactId>\n<version>${preV}<\/version>\n<\/parent>" "$1/pom.xml"
|
||||
|
||||
sed -i "/<version>${osgiV}<\/version>/ d" "$1/pom.xml"
|
||||
|
||||
}
|
||||
|
||||
function readBSN () {
|
||||
|
||||
bsn=
|
||||
manEntryPat="^[a-zA-Z-]*:"
|
||||
foundBSNLine=0
|
||||
|
||||
while read line; do
|
||||
if [ ${foundBSNLine} -eq 1 ]; then
|
||||
echo ${line} | grep -qE ${manEntryPat}
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
else
|
||||
bsn=${bsn}"`echo ${line} | sed 's/\([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ${line} | grep -q "Bundle-SymbolicName:"
|
||||
if [ $? -eq 0 ]; then
|
||||
bsn=`echo ${line} | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`
|
||||
echo ${line} | grep "Bundle-SymbolicName:" | grep -q ";"
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
foundBSNLine=1
|
||||
fi
|
||||
done < <(unzip -p $1 'META-INF/MANIFEST.MF')
|
||||
|
||||
echo ${bsn}
|
||||
|
||||
}
|
21
tycho.spec
21
tycho.spec
@ -23,7 +23,7 @@
|
||||
|
||||
Name: tycho
|
||||
Version: 0.21.0
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
|
||||
|
||||
Group: Development/Libraries
|
||||
@ -36,10 +36,12 @@ Source0: http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/snapshot/ty
|
||||
# version 2.4.3 (impossible to have empty mojo created as aggregate). This
|
||||
# should be fixed upstream properly
|
||||
Source1: EmptyMojo.java
|
||||
Source2: %{name}-bootstrap.sh
|
||||
Source2: %{name}-scripts.sh
|
||||
Source3: %{name}-bootstrap.sh
|
||||
Source4: %{name}-debundle.sh
|
||||
# Fedora Eclipse bundles (needed when Eclipse not present) to build Tycho
|
||||
%if %{eclipse_bootstrap}
|
||||
Source4: eclipse-bootstrap.tar.xz
|
||||
Source5: eclipse-bootstrap.tar.xz
|
||||
%endif
|
||||
# Eclipse Plugin Project supporting filesystem as p2 repository
|
||||
# https://github.com/rgrunber/fedoraproject-p2
|
||||
@ -211,7 +213,7 @@ sed -i '/^<unit id=.*$/d' tycho-bundles/tycho-bundles-target/tycho-bundles-targe
|
||||
|
||||
# Bootstrap Build
|
||||
%if %{eclipse_bootstrap}
|
||||
tar -xf %{SOURCE4}
|
||||
tar -xf %{SOURCE5}
|
||||
%endif
|
||||
|
||||
%if %{tycho_bootstrap}
|
||||
@ -219,7 +221,8 @@ tar -xf %{SOURCE4}
|
||||
%patch5 -p1
|
||||
|
||||
# Perform the 'minimal' (bootstrap) build of Tycho
|
||||
%{SOURCE2} %{eclipse_bootstrap}
|
||||
cp %{SOURCE2} %{SOURCE3} .
|
||||
./%{name}-bootstrap.sh %{eclipse_bootstrap}
|
||||
|
||||
%patch5 -p1 -R
|
||||
|
||||
@ -275,6 +278,8 @@ clean install org.apache.maven.plugins:maven-javadoc-plugin:aggregate
|
||||
|
||||
%install
|
||||
|
||||
cp %{SOURCE2} %{SOURCE4} .
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_javadir}/%{name}
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
|
||||
|
||||
@ -318,6 +323,7 @@ done
|
||||
|
||||
# p2 runtime
|
||||
dir=.m2/org/eclipse/tycho/tycho-bundles-external/%{version}%{snap}
|
||||
./%{name}-debundle.sh tycho-bundles/tycho-bundles-external/ $dir/tycho-bundles-external-%{version}*.zip
|
||||
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"
|
||||
@ -327,6 +333,7 @@ install -pm 644 pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-main.pom
|
||||
%add_maven_depmap JPP.%{name}-main.pom
|
||||
|
||||
# standalone p2 director
|
||||
./%{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
|
||||
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
|
||||
@ -379,6 +386,10 @@ install -m 644 $osgiStateJarPath $RPM_BUILD_ROOT%{_javadir}/%{name}/osgi.compati
|
||||
%{_javadocdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Fri Sep 05 2014 Roland Grunberg <rgrunber@redhat.com> - 0.21.0-7
|
||||
- Debundle tycho-bundles-external and tycho-standalone-p2-director.
|
||||
- Resolves: rhbz#789272
|
||||
|
||||
* Thu Sep 04 2014 Roland Grunberg <rgrunber@redhat.com> - 0.21.0-6
|
||||
- Use fedoraproject-p2 to do OSGi bundle discovery.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user