|
|
Re: P2 "Headless Updating on Startup" not working [message #129033 is a reply to message #128834] |
Mon, 13 April 2009 23:57 |
Susan F. McCourt Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Andre Hanika wrote:
> Hi All
> After some more debugging the P2Util class
> ( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.equinox /p2/examples/org.eclipse.equinox.p2.examples.rcp.prestartupd ate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P 2Util.java?root=RT_Project&view=markup)
> I saw that the ArrayList replacementIUs is just filled with IUs, but
> then never used again.
> Is this a Bug that iusWithUpdates is used in the remove and the add method?
> changeRequest.removeInstallableUnits(...iusWithUpdates...);
> changeRequest.addInstallableUnits(...iusWithUpdates...);
Yes, thanks for pointing that out. I've updated the example. I
remember fixing that once before, but apparently did not commit it. ;-(
>
> Changed to:
> changeRequest.removeInstallableUnits(...iusWithUpdates...);
> changeRequest.addInstallableUnits(...replacementIUs...);
>
> After I changed that, the new version of my RCPMail plugin was loaded
> after a manually restart. But now the checkForUpdates method returns
> with an error:
>
>
> Status ERROR: org.eclipse.equinox.p2.engine code=4 An error occurred
> while collecting items to be installed null children=
> [Status ERROR: org.eclipse.equinox.p2.engine code=0 session context
> was:(profile=profile, phase=, operand=, action=). null Status ERROR:
> org.eclipse.equinox.p2.artifact.repository code=0 Problems downloading
> artifact:
> osgi.bundle,org.eclipse.equinox.p2.exemplarysetup,1.0.0.2009 04081327.
> null children=[Status OK: org.eclipse.equinox.p2.repository code=0 OK
> null Status OK: org.eclipse.core.runtime code=0 OK null Status ERROR:
> org.eclipse.equinox.p2.artifact.repository code=0 Error while processing
> stream. MD5 hash is not as expected. Expected:
> 2e5e5405cf57113a1f292083fb194e12 and found
> b8af3ce9230b5d3f744129214510720a. null Status OK:
> org.eclipse.core.runtime code=0 OK null Status OK:
> org.eclipse.core.runtime code=0 OK null]]
>
> Thanks for any help,
> Andre
I'm not sure about this one. It's looking for a specific underlying p2
bundle that you built.
First of all - I am assuming that you updated the p2.inf file when you
built the app to point to the repository that you generated with export.
You'll want to make sure that both the artifact and metadata repo for
the build repo are included (type 0 and type 1).
addRepository(type:0,location:<your location>
addRepository(type:1,location:<your location>
The default repo in the p2.inf is a sample repo that is likely out of
date. If you've done that, then it sounds like a problem in the repo
that was built, and I'm not sure about that one.
|
|
|
|
|
Re: P2 "Headless Updating on Startup" not working [message #536719 is a reply to message #128821] |
Sun, 30 May 2010 09:39 |
Vincenzo Caselli Messages: 51 Registered: July 2009 |
Member |
|
|
Hi Susan,
I checked out the latest (May 30, 2010)
org.eclipse.equinox.p2.examples.rcp.prestartupdate
so, according to bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=282333
I should have the fixed version.
Then, in order to try the headless update, I do the following:
- change the p2.inf content making it point to a local repository (e.g. file:///E:/Temp/RCPMail/repository)
- export the procuct into directory E:/Temp/RCPMail (so that repository corresponds to that of p2.inf)
- move the E:/Temp/RCPMail/eclipse product to another folder (let's call it the "deploy" folder)
- run prestartupdate.exe from the deploy folder: I receive the popup message "No updates available", that's ok
- change something in the sources (e.g. a menu item label)
- increase the version of both plugin.xml and prestartupdate.product (e.g. to "1.0.1.qualifier")
- re-export the product
- re-run the deployed product, what I obtain is:
* not receiving any popup (which indicates that the update is being correctly recognized I suppose)
* the product does not restart as expected, so no modification is shown
* the new plugin 1.0.1 is not present into
<deploy>\eclipse\plugins (the plugin was not retrieved)
* the .log shows the following
!SESSION 2010-05-30 11:19:04.111 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=it_IT
Command-line arguments: -os win32 -ws win32 -arch x86
!ENTRY org.eclipse.equinox.p2.engine 4 4 2010-05-30 11:19:07.746
!MESSAGE An error occurred while collecting items to be installed
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2010-05-30 11:19:07.746
!MESSAGE session context was:(profile=profile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
!SUBENTRY 1 org.eclipse.equinox.p2.repository 4 1002 2010-05-30 11:19:07.746
!MESSAGE Unable to read repository at file:/E:/Temp/RCPMail/repository/plugins/org.eclipse.equinox.p2.examples.rcp.prestartupdate_1.0.1.201005301117.jar.
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.SWT.error(SWT.java:3969)
at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:359)
at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1540)
at org.eclipse.swt.graphics.GC.<init>(GC.java:166)
at org.eclipse.swt.graphics.GC.<init>(GC.java:132)
at org.eclipse.jface.dialogs.Dialog.shortenText(Dialog.java:349)
at org.eclipse.jface.dialogs.ProgressMonitorDialog$ProgressMonitor.subTask(ProgressMonitorDialog.java:234)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:156)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:174)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
at org.eclipse.equinox.internal.p2.repository.FileReader.handleTransferEvent(FileReader.java:180)
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.fireTransferReceiveDataEvent(AbstractRetrieveFileTransfer.java:376)
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.handleReceivedData(AbstractRetrieveFileTransfer.java:276)
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer$1.performFileTransfer(AbstractRetrieveFileTransfer.java:161)
at org.eclipse.ecf.filetransfer.FileTransferJob.run(FileTransferJob.java:74)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!SUBENTRY 1 org.eclipse.equinox.p2.repository 4 1002 2010-05-30 11:19:07.746
!MESSAGE Unable to read repository at file:/E:/Temp/RCPMail/repository/binary/org.eclipse.equinox.p2.examples.rcp.prestartupdate.product_root.win32.win32.x86_1.0.1.201005301117.
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.SWT.error(SWT.java:3969)
at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:359)
at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1540)
at org.eclipse.swt.graphics.GC.<init>(GC.java:166)
at org.eclipse.swt.graphics.GC.<init>(GC.java:132)
at org.eclipse.jface.dialogs.Dialog.shortenText(Dialog.java:349)
at org.eclipse.jface.dialogs.ProgressMonitorDialog$ProgressMonitor.subTask(ProgressMonitorDialog.java:234)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:156)
at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:174)
at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
at org.eclipse.equinox.internal.p2.repository.FileReader.handleTransferEvent(FileReader.java:180)
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.fireTransferReceiveDataEvent(AbstractRetrieveFileTransfer.java:376)
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.handleReceivedData(AbstractRetrieveFileTransfer.java:276)
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer$1.performFileTransfer(AbstractRetrieveFileTransfer.java:161)
at org.eclipse.ecf.filetransfer.FileTransferJob.run(FileTransferJob.java:74)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
what I do wrong?
Consider that in my various trials I also modified P2Util in this way, from this (line 49)
(I tried to make the operation non-modal, please consider mine just as a trial)
IStatus status = operation.resolveModal(sub.newChild(100));
to
//IStatus status = operation.resolveModal(sub.newChild(100));
ProvisioningJob job = operation.getResolveJob(monitor);
IStatus status = job.run(sub.newChild(100));
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
return status;
}
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
// if (status.getSeverity() != IStatus.ERROR) {
// // More complex status handling might include showing the user what updates
// // are available if there are multiples, differentiating patches vs. updates, etc.
// // In this example, we simply update as suggested by the operation.
// ProvisioningJob job = operation.getProvisioningJob(null);
// status = job.runModal(sub.newChild(100));
// if (status.getSeverity() == IStatus.CANCEL)
// throw new OperationCanceledException();
// }
this way I get no Invalid thread access exception and the product restarts in case the repository contains a new version. However the restarted product does not have the modification and the plugin folder does not contain the new plugin.
Seems like the new plugin is recognized, but fails to retrieve it.
Any suggestions?
|
|
|
|
Re: P2 "Headless Updating on Startup" not working [message #537318 is a reply to message #128821] |
Tue, 01 June 2010 23:27 |
Vincenzo Caselli Messages: 51 Registered: July 2009 |
Member |
|
|
Hi all,
I managed the example to work!
I modified the code in ApplicationWorkbenchWindowAdvisor.postWindowOpen() in the following way:
- executed the ProgressMonitorDialog in the UI thread
before
try {
new ProgressMonitorDialog(null).run(true, true, runnable);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
}
after
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
new ProgressMonitorDialog(null).run(true, true, runnable);
} catch (Throwable x) {
LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"Throwable 2: "+x));
}
}
});
- same for restarting
before
PlatformUI.getWorkbench().restart();
after
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
PlatformUI.getWorkbench().restart();
} catch (Throwable x) {
LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"Throwable 1: "+x));
}
}
});
it just works!
Bye
Vincenzo Caselli
RCP Vision
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05542 seconds