Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 99419 Details for
Bug 229342
[shared] Updates to the base in a shared read-only install
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch in progress
229342.txt (text/plain), 18.34 KB, created by
Simon Kaegi
on 2008-05-09 00:09:55 EDT
(
hide
)
Description:
patch in progress
Filename:
MIME Type:
Creator:
Simon Kaegi
Created:
2008-05-09 00:09:55 EDT
Size:
18.34 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.engine >Index: src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java,v >retrieving revision 1.2 >diff -u -r1.2 ISurrogateProfileHandler.java >--- src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java 28 Apr 2008 21:47:59 -0000 1.2 >+++ src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java 9 May 2008 04:04:08 -0000 >@@ -13,4 +13,6 @@ > > public abstract Collector queryProfile(IProfile profile, Query query, Collector collector, IProgressMonitor monitor); > >+ public abstract boolean updateProfile(Profile selfProfile); >+ > } >\ No newline at end of file >Index: src/org/eclipse/equinox/internal/p2/engine/Messages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Messages.java,v >retrieving revision 1.8 >diff -u -r1.8 Messages.java >--- src/org/eclipse/equinox/internal/p2/engine/Messages.java 7 Apr 2008 22:11:50 -0000 1.8 >+++ src/org/eclipse/equinox/internal/p2/engine/Messages.java 9 May 2008 04:04:08 -0000 >@@ -55,6 +55,8 @@ > public static String TouchpointManager_Required_Touchpoint_Not_Found; > public static String TouchpointManager_Touchpoint_Type_Mismatch; > >+ public static String shared_profile_not_found; >+ > static { > // initialize resource bundles > NLS.initializeMessages(BUNDLE_NAME, Messages.class); >Index: src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java,v >retrieving revision 1.3 >diff -u -r1.3 SurrogateProfileHandler.java >--- src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java 2 May 2008 21:27:14 -0000 1.3 >+++ src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java 9 May 2008 04:04:08 -0000 >@@ -17,83 +17,99 @@ > import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; > import org.eclipse.equinox.internal.provisional.p2.engine.ISurrogateProfileHandler; > import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; >+import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery; > import org.eclipse.equinox.internal.provisional.p2.query.Collector; > import org.eclipse.equinox.internal.provisional.p2.query.Query; > import org.eclipse.osgi.service.datalocation.Location; >+import org.eclipse.osgi.util.NLS; > > public class SurrogateProfileHandler implements ISurrogateProfileHandler { > >- private static final String ORG_ECLIPSE_EQUINOX_P2_NATIVE = "org.eclipse.equinox.p2.native"; //$NON-NLS-1$ >- private static final String ORG_ECLIPSE_EQUINOX_P2_TYPE_ROOT = "org.eclipse.equinox.p2.type.root"; //$NON-NLS-1$ >+ private static final String NATIVE_TOUCHPOINT_TYPE = "org.eclipse.equinox.p2.native"; //$NON-NLS-1$ >+ private static final String PROP_TYPE_ROOT = "org.eclipse.equinox.p2.type.root"; //$NON-NLS-1$ > private static final String P2_ENGINE_DIR = "p2/" + EngineActivator.ID + "/"; //$NON-NLS-1$//$NON-NLS-2$ > private static final String OSGI_INSTALL_AREA = "osgi.install.area"; //$NON-NLS-1$ > private static final String ECLIPSE_INI_IGNORED = "eclipse.ini.ignored"; //$NON-NLS-1$ > private static final String IU_LOCKED = Integer.toString(IInstallableUnit.LOCK_UNINSTALL | IInstallableUnit.LOCK_UPDATE); >- >- /** >- * Profile property constant indicating the bundle pool cache location. >- */ >- public static final String PROP_SURROGATE = "org.eclipse.equinox.p2.surrogate"; //$NON-NLS-1$ >+ private static final String PROP_SURROGATE = "org.eclipse.equinox.p2.surrogate"; //$NON-NLS-1$ >+ private static final String PROP_SHARED_TIMESTAMP = "org.eclipse.equinox.p2.shared.timestamp"; //$NON-NLS-1$ >+ private static final String PROP_BASE = "org.eclipse.equinox.p2.base"; //$NON-NLS-1$ >+ private static final String PROP_RESOLVE = "org.eclipse.equinox.p2.resolve"; //$NON-NLS-1$ >+ private static final String OPTIONAL = "OPTIONAL"; //$NON-NLS-1$ >+ private static final String PROP_INCLUSION_RULES = "org.eclipse.equinox.p2.internal.inclusion.rules"; //$NON-NLS-1$ > > private SimpleProfileRegistry profileRegistry; > >- private synchronized SimpleProfileRegistry getProfileRegistry() { >- if (profileRegistry == null) { >- String installArea = EngineActivator.getContext().getProperty(OSGI_INSTALL_AREA); >- try { >- URL registryURL = new URL(installArea + P2_ENGINE_DIR + SimpleProfileRegistry.DEFAULT_STORAGE_DIR); >- File sharedRegistryDirectory = new File(registryURL.getPath()); >- profileRegistry = new SimpleProfileRegistry(sharedRegistryDirectory, null); >- } catch (MalformedURLException e) { >- //this is not possible because we know the above URL is valid >- } >- } >- return profileRegistry; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.equinox.internal.p2.engine.ISurrogateProfileHandler#createProfile(java.lang.String) >- */ >- public Profile createProfile(String id) { >- final IProfile sharedProfile = getProfileRegistry().getProfile(id); >- if (sharedProfile == null) >- return null; >- >+ private static void addSharedProfileBaseIUs(final IProfile sharedProfile, final Profile userProfile) { > Query rootIUQuery = new Query() { > public boolean isMatch(Object candidate) { > if (candidate instanceof IInstallableUnit) { > IInstallableUnit iu = (IInstallableUnit) candidate; >- if (Boolean.valueOf(sharedProfile.getInstallableUnitProperty(iu, ORG_ECLIPSE_EQUINOX_P2_TYPE_ROOT)).booleanValue()) >+ if (Boolean.valueOf(sharedProfile.getInstallableUnitProperty(iu, PROP_TYPE_ROOT)).booleanValue()) > return true; >- if (iu.getTouchpointType().getId().equals(ORG_ECLIPSE_EQUINOX_P2_NATIVE)) >+ if (iu.getTouchpointType().getId().equals(NATIVE_TOUCHPOINT_TYPE)) > return true; > } > return false; > } > }; >- > Collector rootIUs = sharedProfile.query(rootIUQuery, new Collector(), null); >- >- Profile userProfile = new Profile(id, null, sharedProfile.getProperties()); >- userProfile.setSurrogateProfileHandler(this); > for (Iterator iterator = rootIUs.iterator(); iterator.hasNext();) { > IInstallableUnit iu = (IInstallableUnit) iterator.next(); > userProfile.addInstallableUnit(iu); > userProfile.addInstallableUnitProperties(iu, sharedProfile.getInstallableUnitProperties(iu)); > userProfile.setInstallableUnitProperty(iu, IInstallableUnit.PROP_PROFILE_LOCKED_IU, IU_LOCKED); >+ userProfile.setInstallableUnitProperty(iu, PROP_BASE, Boolean.TRUE.toString()); > } >+ } > >- //update properties >- userProfile.setProperty(PROP_SURROGATE, Boolean.TRUE.toString()); >+ private static void removeUserProfileBaseIUs(final Profile userProfile) { >+ Query rootIUQuery = new Query() { >+ public boolean isMatch(Object candidate) { >+ if (candidate instanceof IInstallableUnit) { >+ IInstallableUnit iu = (IInstallableUnit) candidate; >+ if (Boolean.valueOf(userProfile.getInstallableUnitProperty(iu, PROP_BASE)).booleanValue()) >+ return true; >+ } >+ return false; >+ } >+ }; >+ Collector rootIUs = userProfile.query(rootIUQuery, new Collector(), null); >+ for (Iterator iterator = rootIUs.iterator(); iterator.hasNext();) { >+ IInstallableUnit iu = (IInstallableUnit) iterator.next(); >+ userProfile.removeInstallableUnit(iu); >+ } >+ } >+ >+ private static void markRootsOptional(final Profile userProfile) { >+ Query rootIUQuery = new Query() { >+ public boolean isMatch(Object candidate) { >+ if (candidate instanceof IInstallableUnit) { >+ IInstallableUnit iu = (IInstallableUnit) candidate; >+ if (Boolean.valueOf(userProfile.getInstallableUnitProperty(iu, PROP_TYPE_ROOT)).booleanValue()) >+ return true; >+ } >+ return false; >+ } >+ }; >+ Collector rootIUs = userProfile.query(rootIUQuery, new Collector(), null); >+ for (Iterator iterator = rootIUs.iterator(); iterator.hasNext();) { >+ IInstallableUnit iu = (IInstallableUnit) iterator.next(); >+ userProfile.setInstallableUnitProperty(iu, PROP_INCLUSION_RULES, OPTIONAL); >+ } >+ } >+ >+ private static void updateProperties(final IProfile sharedProfile, Profile userProfile) { >+ userProfile.setProperty(PROP_SHARED_TIMESTAMP, Long.toString(sharedProfile.getTimestamp())); > Location installLocation = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName(), Location.INSTALL_FILTER); > File installFolder = new File(installLocation.getURL().getPath()); > >- if (Boolean.valueOf(userProfile.getProperty(IProfile.PROP_ROAMING)).booleanValue()) { >+ if (Boolean.valueOf(sharedProfile.getProperty(IProfile.PROP_ROAMING)).booleanValue()) { > userProfile.setProperty(IProfile.PROP_INSTALL_FOLDER, installFolder.getAbsolutePath()); > userProfile.setProperty(IProfile.PROP_SHARED_CACHE, installFolder.getAbsolutePath()); > userProfile.setProperty(IProfile.PROP_ROAMING, Boolean.FALSE.toString()); > } else { >- String cache = userProfile.getProperty(IProfile.PROP_CACHE); >+ String cache = sharedProfile.getProperty(IProfile.PROP_CACHE); > if (cache != null) > userProfile.setProperty(IProfile.PROP_SHARED_CACHE, cache); > } >@@ -106,6 +122,35 @@ > > File launcherConfigFile = new File(configurationFolder, ECLIPSE_INI_IGNORED); > userProfile.setProperty(IProfile.PROP_LAUNCHER_CONFIGURATION, launcherConfigFile.getAbsolutePath()); >+ } >+ >+ private synchronized SimpleProfileRegistry getProfileRegistry() { >+ if (profileRegistry == null) { >+ String installArea = EngineActivator.getContext().getProperty(OSGI_INSTALL_AREA); >+ try { >+ URL registryURL = new URL(installArea + P2_ENGINE_DIR + SimpleProfileRegistry.DEFAULT_STORAGE_DIR); >+ File sharedRegistryDirectory = new File(registryURL.getPath()); >+ profileRegistry = new SimpleProfileRegistry(sharedRegistryDirectory, null); >+ } catch (MalformedURLException e) { >+ //this is not possible because we know the above URL is valid >+ } >+ } >+ return profileRegistry; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.equinox.internal.p2.engine.ISurrogateProfileHandler#createProfile(java.lang.String) >+ */ >+ public Profile createProfile(String id) { >+ final IProfile sharedProfile = getProfileRegistry().getProfile(id); >+ if (sharedProfile == null) >+ return null; >+ >+ Profile userProfile = new Profile(id, null, sharedProfile.getProperties()); >+ userProfile.setProperty(PROP_SURROGATE, Boolean.TRUE.toString()); >+ userProfile.setSurrogateProfileHandler(this); >+ updateProperties(sharedProfile, userProfile); >+ addSharedProfileBaseIUs(sharedProfile, userProfile); > return userProfile; > } > >@@ -126,4 +171,25 @@ > > return profile.query(query, collector, monitor); > } >+ >+ public boolean updateProfile(Profile userProfile) { >+ final IProfile sharedProfile = getProfileRegistry().getProfile(userProfile.getProfileId()); >+ if (sharedProfile == null) >+ throw new IllegalStateException(NLS.bind(Messages.shared_profile_not_found, userProfile.getProfileId())); >+ >+ String sharedTimeStamp = Long.toString(sharedProfile.getTimestamp()); >+ String userSharedTimeStamp = userProfile.getProperty(PROP_SHARED_TIMESTAMP); >+ >+ if (userSharedTimeStamp != null && userSharedTimeStamp.equals(sharedTimeStamp)) >+ return false; >+ >+ updateProperties(sharedProfile, userProfile); >+ removeUserProfileBaseIUs(userProfile); >+ if (!userProfile.query(InstallableUnitQuery.ANY, new Collector(), null).isEmpty()) { >+ userProfile.setProperty(PROP_RESOLVE, Boolean.TRUE.toString()); >+ markRootsOptional(userProfile); >+ } >+ addSharedProfileBaseIUs(sharedProfile, userProfile); >+ return true; >+ } > } >Index: src/org/eclipse/equinox/internal/p2/engine/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/messages.properties,v >retrieving revision 1.10 >diff -u -r1.10 messages.properties >--- src/org/eclipse/equinox/internal/p2/engine/messages.properties 7 May 2008 18:33:50 -0000 1.10 >+++ src/org/eclipse/equinox/internal/p2/engine/messages.properties 9 May 2008 04:04:08 -0000 >@@ -42,3 +42,4 @@ > profile_not_registered=Profile {0} not registered. > reg_dir_not_available=Registry Directory not available. > thread_not_owner=Thread not lock owner. >+shared_profile_not_found=Shared profile {0} not found. >Index: src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java,v >retrieving revision 1.29 >diff -u -r1.29 SimpleProfileRegistry.java >--- src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java 7 May 2008 18:33:50 -0000 1.29 >+++ src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java 9 May 2008 04:04:08 -0000 >@@ -128,15 +128,26 @@ > * If the current profile for self is marked as a roaming profile, we need > * to update its install and bundle pool locations. > */ >- private void updateRoamingProfile(Map profileMap) { >+ private void updateSelfProfile(Map profileMap) { > if (profileMap == null) > return; > Profile selfProfile = (Profile) profileMap.get(self); > if (selfProfile == null) > return; >+ >+ boolean changed = false; > //only update if self is a roaming profile >- if (!Boolean.valueOf(selfProfile.getProperty(IProfile.PROP_ROAMING)).booleanValue()) >- return; >+ if (Boolean.valueOf(selfProfile.getProperty(IProfile.PROP_ROAMING)).booleanValue()) >+ changed = updateRoamingProfile(selfProfile); >+ >+ if (surrogateProfileHandler != null && surrogateProfileHandler.isSurrogate(selfProfile)) >+ changed = changed || surrogateProfileHandler.updateProfile(selfProfile); >+ >+ if (changed) >+ saveProfile(selfProfile); >+ } >+ >+ private boolean updateRoamingProfile(Profile selfProfile) { > Location installLocation = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName(), Location.INSTALL_FILTER); > File location = new File(installLocation.getURL().getPath()); > boolean changed = false; >@@ -148,8 +159,7 @@ > selfProfile.setProperty(IProfile.PROP_CACHE, location.getAbsolutePath()); > changed = true; > } >- if (changed) >- saveProfile(selfProfile); >+ return changed; > } > > public synchronized String toString() { >@@ -216,7 +226,7 @@ > if (!hasBeenRestored) { > //update roaming profile on first load > hasBeenRestored = true; >- updateRoamingProfile(result); >+ updateSelfProfile(result); > } > return result; > } >#P org.eclipse.equinox.simpleconfigurator >Index: src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java,v >retrieving revision 1.4 >diff -u -r1.4 SimpleConfiguratorImpl.java >--- src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java 8 Apr 2008 20:57:29 -0000 1.4 >+++ src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java 9 May 2008 04:04:09 -0000 >@@ -78,15 +78,18 @@ > //if it is an relative file URL, then resolve it against the configuration area > URL[] configURL = EquinoxUtils.getConfigAreaURL(context); > if (configURL != null) { >- File target = new File(configURL[0].getFile(), url.getFile()); >- if (target.exists()) >- return target.toURL(); >- else if (configURL.length > 1) { >- target = new File(configURL[1].getFile(), url.getFile()); >- if (target.exists()) >- return target.toURL(); >- } >- return null; >+ File userConfig = new File(configURL[0].getFile(), url.getFile()); >+ if (configURL.length == 1) >+ return userConfig.exists() ? userConfig.toURL() : null; >+ >+ File sharedConfig = new File(configURL[1].getFile(), url.getFile()); >+ if (!userConfig.exists()) >+ return sharedConfig.exists() ? sharedConfig.toURL() : null; >+ >+ if (!sharedConfig.exists()) >+ return userConfig.toURL(); >+ >+ return (sharedConfig.lastModified() > userConfig.lastModified()) ? sharedConfig.toURL() : userConfig.toURL(); > } > } catch (MalformedURLException e) { > return null; >@@ -130,9 +133,7 @@ > > public void applyConfiguration() throws IOException { > synchronized (configurationLock) { >- if (configurationURL == null) >- configurationURL = getConfigurationURL(); >- >+ configurationURL = getConfigurationURL(); > applyConfiguration(configurationURL); > } > } >#P org.eclipse.equinox.p2.reconciler.dropins >Index: src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java,v >retrieving revision 1.21 >diff -u -r1.21 ProfileSynchronizer.java >--- src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java 8 May 2008 15:53:51 -0000 1.21 >+++ src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java 9 May 2008 04:04:09 -0000 >@@ -256,6 +256,11 @@ > > public ProfileChangeRequest createProfileChangeRequest(ProvisioningContext context) { > ProfileChangeRequest request = new ProfileChangeRequest(profile); >+ >+ boolean resolve = Boolean.valueOf(profile.getProperty("org.eclipse.equinox.p2.resolve")).booleanValue(); >+ if (resolve) >+ request.removeProfileProperty("org.eclipse.equinox.p2.resolve"); >+ > List toAdd = new ArrayList(); > List toRemove = new ArrayList(); > >@@ -298,7 +303,7 @@ > toRemove.add(iu); > } > >- if (toAdd.isEmpty() && toRemove.isEmpty()) >+ if (toAdd.isEmpty() && toRemove.isEmpty() && !resolve) > return null; > > context.setExtraIUs(toAdd);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229342
: 99419 |
99456
|
99457