119 lines
3.6 KiB
Bash
Executable File
119 lines
3.6 KiB
Bash
Executable File
#! /bin/sh
|
|
set -e
|
|
|
|
sdk=$1'-sdk'
|
|
repo=$1
|
|
|
|
echo Building system local p2 repository... >&2
|
|
|
|
eclipse=$(rpm --eval '%{_libdir}')/eclipse
|
|
|
|
datadir=/usr/share/eclipse
|
|
javadir=/usr/share/java
|
|
jnidir=/usr/lib/java
|
|
|
|
launcher="/usr/lib*/eclipse/plugins/org.eclipse.equinox.launcher_*.jar"
|
|
if [ ! -e ${launcher} ]; then
|
|
launcher="$javadir/tycho/tycho-bundles-external.zip"
|
|
if [ -e ${launcher} ]; then
|
|
mkdir -p .tycho-runtime
|
|
unzip ${launcher} -d .tycho-runtime
|
|
launcher="$(pwd)/.tycho-runtime/eclipse/plugins/org.eclipse.equinox.launcher_*.jar"
|
|
else
|
|
launcher="$(pwd)/tycho-bundles/tycho-bundles-external/target/eclipse/plugins/org.eclipse.equinox.launcher_*.jar"
|
|
fi
|
|
fi
|
|
|
|
trap "rm -rf $sdk" 0
|
|
mkdir -p $sdk/plugins $sdk/features
|
|
pushd $sdk >/dev/null
|
|
|
|
(cd $eclipse;
|
|
ls -d plugins/* features/* 2>/dev/null) |
|
|
while read f; do
|
|
[ ! -e $f ] && ln -s $eclipse/$f $f
|
|
done
|
|
(cd $eclipse/dropins; ls -d * 2>/dev/null) |
|
|
while read f; do
|
|
if [ -e $eclipse/dropins/$f/eclipse ]; then
|
|
(cd $eclipse/dropins/$f/eclipse;
|
|
ls -d plugins/* features/* 2>/dev/null) |
|
|
while read g; do
|
|
[ ! -e $g ] && \
|
|
ln -s $eclipse/dropins/$f/eclipse/$g $g
|
|
done
|
|
else
|
|
(cd $eclipse/dropins/$f;
|
|
ls -d plugins/* features/* 2>/dev/null) |
|
|
while read g; do
|
|
[ ! -e $g ] && \
|
|
ln -s $eclipse/dropins/$f/$g $g
|
|
done
|
|
fi
|
|
done
|
|
(cd $datadir/dropins; ls -d * 2>/dev/null) |
|
|
while read f; do
|
|
if [ -e $datadir/dropins/$f/eclipse ]; then
|
|
(cd $datadir/dropins/$f/eclipse;
|
|
ls -d plugins/* features/* 2>/dev/null) |
|
|
while read g; do
|
|
[ ! -e $g ] && \
|
|
ln -s $datadir/dropins/$f/eclipse/$g $g
|
|
done
|
|
else
|
|
(cd $datadir/dropins/$f;
|
|
ls -d plugins/* features/* 2>/dev/null) |
|
|
while read g; do
|
|
[ ! -e $g ] && \
|
|
ln -s $datadir/dropins/$f/$g $g
|
|
done
|
|
fi
|
|
done
|
|
|
|
for p in $(ls -d $eclipse/dropins/jdt/plugins/* 2>/dev/null); do
|
|
plugin=$(basename $p)
|
|
[ ! -e plugins/$plugin ] && ln -s $eclipse/dropins/jdt/plugins/$plugin plugins/$plugin
|
|
done
|
|
for f in $(ls -d $eclipse/dropins/jdt/features/* 2>/dev/null); do
|
|
feature=$(basename $f)
|
|
[ ! -e features/$feature ] && ln -s $eclipse/dropins/jdt/features/$feature features/$feature
|
|
done
|
|
for p in $(ls -d $eclipse/dropins/sdk/plugins/* 2>/dev/null); do
|
|
plugin=$(basename $p)
|
|
[ ! -e plugins/$plugin ] && ln -s $eclipse/dropins/sdk/plugins/$plugin plugins/$plugin
|
|
done
|
|
for f in $(ls -d $eclipse/dropins/sdk/features/* 2>/dev/null); do
|
|
feature=$(basename $f)
|
|
[ ! -e features/$feature ] && ln -s $eclipse/dropins/sdk/features/$feature features/$feature
|
|
done
|
|
for f in $(ls -d $javadir/eclipse-license/eclipse/features/* 2>/dev/null); do
|
|
feature=$(basename $f)
|
|
[ ! -e features/$feature ] && ln -s $javadir/eclipse-license/eclipse/features/$feature features/$feature
|
|
done
|
|
|
|
# jars in %%{_javadir} may not be uniquely named
|
|
id=1
|
|
for p in $(find $javadir $jnidir -name "*.jar"); do
|
|
if unzip -p $p 'META-INF/MANIFEST.MF' | grep -q 'Bundle-SymbolicName'; then
|
|
plugin=${id}-$(basename $p)
|
|
[ ! -e plugins/$plugin ] && ln -s $p plugins/$plugin
|
|
id=$((${id} + 1))
|
|
fi
|
|
done
|
|
|
|
popd >/dev/null
|
|
|
|
(set -x
|
|
java -jar ${launcher} -nosplash -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
|
|
-metadataRepository file:$repo \
|
|
-artifactRepository file:$repo \
|
|
-source $sdk \
|
|
-compress -append -publishArtifacts)
|
|
|
|
# In debugging mode dump contents of local p2 repo
|
|
if [ x"$2" = x-X ]; then
|
|
echo === begin local p2 repo dump ===
|
|
find $repo -name \*.jar
|
|
echo === end local p2 repo dump ===
|
|
fi
|