[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Questions about Queries

Hi Thomas,

I (for now) have a product in my repo. I want to query for updates that have a specific version (i.e upgrade to 1.6.3 only if the server version is 1.6.3, update 1.6.2 if a newer qualifier has been published.)

So I give the query the range, not the IU.

2010/5/16 Thomas Hallgren <thomas@xxxxxxx>
Hi Thomas,
When you say "iu that has the same version range", do you mean other IU's with a version that matches the specified range? Only requirements have ranges.

Thomas Hallgren

On 05/16/2010 12:20 PM, Thomas Kratz wrote:
HI all again,

it looks like my trouble with the prestartupdate has been a timing problem. one needs to start the p2.engine and give the service time to be registered. maybe you could fix that in the example.

But now I have the next questions. I have a client-server scenario where client and server must match. so the client asks the server for his version at startup and then looks for updates.

I try that by providing a Policy that goes like this: (Is a little bit ugly as Ive reads that I have to register the Policy early, but the server version can be queried only after login time). I guess I could use the default policy and onle set the query, but for now this should be my first hops with this.

public class VersionPolicy extends Policy {

private String serverVersion;

public void setServerVersion(String serverVersion) {
this.serverVersion = serverVersion;

public IQuery<IInstallableUnit> getVisibleAvailableIUQuery() {
if (serverVersion == null) {
throw new IllegalStateException("Policy not initialized yet");
String[] version = serverVersion.split("\\.");
int major = Integer.parseInt(version[0]);
int minor = Integer.parseInt(version[1]);
int micro = Integer.parseInt(version[2]);

IQuery<IInstallableUnit> query = QueryUtil.createIUQuery("de.eiswind.mango.client.core.mango", new VersionRange(Version.createOSGi(major,
minor, micro), true, Version.createOSGi(major, minor, micro + 1), false));
return query;


I register the policy as shown in the cloud example in my core Activator.

I guessed the IU form the director output:

 [p2.director] Installing de.eiswind.mango.client.core.mango

Is this already my mistake ?

when I upload a new build with a new qualifier the UpdateOperation still says

!ENTRY de.eiswind.mango.client.core 1 0 2010-05-16 12:01:54.641
!MESSAGE Checking for updates

!ENTRY de.eiswind.mango.client.core 1 0 2010-05-16 12:01:55.438
!MESSAGE Done.10000

!ENTRY org.eclipse.equinox.p2.operations 1 10000 2010-05-16 12:01:55.439
!MESSAGE No updates were found.

And if I get this to work the next question would be how I could query for "any" iu (i.e. other features installed by the user) that has the same versionrange.

Any hints would be really appreciated.


_______________________________________________ p2-dev mailing list p2-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/p2-dev

p2-dev mailing list