Run reconciler after installation.

This commit is contained in:
Sami Wagiaalla 2011-09-23 10:56:22 -04:00
parent 124ed83b37
commit ed6ceab2aa
2 changed files with 92 additions and 6 deletions

57
eclipse-reconciler.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# This script runs the eclipse can do the following:
# - backup configuration files
# - restore configuration files from backup loation
# - run the eclipse reconciler
# - delete the backup files.
# A list of the files of directory that are to be backed up
config_files=("artifacts.xml" "eclipse.ini" "p2" "configuration")
if [ $# -ge 2 ]
then
echo "backing up configuration files"
for file in ${config_files[@]}
do
echo $file
cp -r $1/$file $2/$file
done
echo "Running eclipse reconciler"
pushd $1
./eclipse --launcher.suppressErrors -nosplash -consolelog -application org.eclipse.equinox.p2.reconciler.application ${@:3}
exit_value=$?
# Check exit value
if [ ! $exit_value -eq 0 ]
then
# Restore files
echo "Reconciler failed. Restoring files"
for file in ${config_files[@]}
do
echo $file
cp --remove-destination -Tr $2/$file $1/$file
done
fi
popd
#delete the backup files
for file in ${config_files[@]}
do
rm -rf $2/$file
done
exit $exit_value
fi
echo "Invalid options"
echo ""
echo "Usage:"
echo ""
echo " eclipse-reconciler <eclipse dir> <backup location> [reconciler parameters]"
echo " Backsup configuration files in the given location, run the reconciler"
echo " and restore the files if there is a problem at the end delete backup files."
echo " Any parameters given after the first two are passed directly to the reconciler"
exit 1;

View File

@ -22,6 +22,7 @@ Group: Text Editors/Integrated Development Environments (IDE)
URL: http://www.eclipse.org/
Source0: %{download_url}eclipse-build-db208c33d1a67591d17b02148ae7948fd178a80d.tar.xz
Source1: %{download_url}eclipse-3.7.0-src.tar.bz2
Source2: eclipse-reconciler.sh
BuildRequires: ant
BuildRequires: rsync
@ -208,6 +209,9 @@ for id in `ls configuration/org.eclipse.osgi/bundles`; do
done
popd
#install the reconciler script
cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/
# Symlinks to the SWT JNI shared libraries in %%{_libdir}/eclipse
pushd $RPM_BUILD_ROOT%{_libdir}/%{name}
for lib in $(find configuration -name libswt\*.so); do
@ -272,17 +276,35 @@ PDEBUILDVERSION=$(ls $RPM_BUILD_ROOT%{_libdir}/%{name}/dropins/sdk/plugins \
sed -i "s/@PDEBUILDVERSION@/$PDEBUILDVERSION/g" \
$RPM_BUILD_ROOT%{_libdir}/%{name}/buildscripts/pdebuild
%pre rcp
# Remove all the profiles that were created by the reconciler.
# this rpm will install a new profile and it will be reconciled
# by running the reconciler in %post platform
rm -rf %{_libdir}/%{name}/p2/org.eclipse.equinox.p2.engine/profileRegistry/PlatformProfile.profile/*
%post platform
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi
# We run the reconciler not to provision the platform but to reprovision
# all other plugins which may have already been installed in the system.
eclipse-reconciler.sh %{_libdir}/%{name} %{_tmppath} -clean > /dev/null
%postun platform
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi
# Cannot run the reconciler because it will have been removed at
# this point, and there is no need to.
%post jdt
eclipse-reconciler.sh %{_libdir}/%{name} %{_tmppath} > /dev/null
%postun jdt
eclipse-reconciler.sh %{_libdir}/%{name} %{_tmppath} > /dev/null
%pre jdt
# workaround for rpm bug, can be removed in F-20 Fixes the problem with efj being directory instead of launcher
@ -318,10 +340,10 @@ rm -rf %{_bindir}/efj/
%{_libdir}/%{name}/configuration/org.eclipse.osgi/.manager
%{_libdir}/%{name}/configuration/org.eclipse.osgi/.state*
%endif
%dir %{_libdir}/%{name}/configuration
%config %{_libdir}/%{name}/configuration/config.ini
%config %{_libdir}/%{name}/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
%dir %{_libdir}/%{name}/configuration/org.eclipse.equinox.simpleconfigurator
%verify(not md5 size mtime) %dir %{_libdir}/%{name}/configuration
%verify(not md5 size mtime) %{_libdir}/%{name}/configuration/config.ini
%verify(not md5 size mtime) %{_libdir}/%{name}/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
%verify(not md5 size mtime) %dir %{_libdir}/%{name}/configuration/org.eclipse.equinox.simpleconfigurator
%ifnarch ppc ppc64
%{_libdir}/%{name}/about.html
%endif
@ -365,13 +387,14 @@ rm -rf %{_bindir}/efj/
%attr(0755,root,root) %{_bindir}/%{name}
%{_libdir}/%{name}/.eclipseproduct
%config %{_libdir}/%{name}/eclipse.ini
%config %{_sysconfdir}/eclipse.ini
%verify(not md5 size mtime) %config %{_sysconfdir}/eclipse.ini
%ifnarch ppc ppc64
%{_libdir}/%{name}/about_files
%endif
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%{_datadir}/icons/*/*/apps/*
%{_bindir}/eclipse-reconciler.sh
%{_libdir}/%{name}/eclipse
%dir %{_libdir}/%{name}/dropins
%dir %{_datadir}/%{name}/dropins
@ -512,7 +535,7 @@ rm -rf %{_bindir}/efj/
%{_libdir}/%{name}/artifacts.xml
# FIXME: should we ship content.xml for the platform?
#%{_libdir}/%{name}/metadata
%{_libdir}/%{name}/p2
%verify(not md5 size mtime) %{_libdir}/%{name}/p2
%files jdt
%{_bindir}/efj
@ -523,6 +546,12 @@ rm -rf %{_bindir}/efj/
%{_libdir}/%{name}/dropins/sdk
%changelog
* Fri Sep 23 2011 Sami Wagiaalla <swagiaal@redhat.com> 1:3.7.0-4
- Add new script eclipse-reconciler.sh
- Run eclipse-reconciler.sh in the post and postun sections of jdt
and post seciton on platform.
- Remove all old profiles in %pre rcp.
* Wed Sep 21 2011 Alexander Kurtakov <akurtako@redhat.com> 1:3.7.0-4
- Remove _bindir/efj in pre - Fixes #738677.