Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315757

Summary: [publisher][regression] Cannot provide -contextMetadata to publisher application
Product: [Eclipse Project] Equinox Reporter: Tobias Oberlies <t-oberlies>
Component: p2Assignee: Ian Bull <irbull>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: dj.houghton, hmalphettes, igor, irbull, jan.von.loewenstein, matthias.gradl, pascal
Version: unspecifiedFlags: pascal: review+
Target Milestone: 3.6.1   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on:    
Bug Blocks: 323626    
Attachments:
Description Flags
delay initialization of context repositories
irbull: iplog+
Patch with test case none

Description Tobias Oberlies CLA 2010-06-04 08:23:36 EDT
Build Identifier: Target against Helios update site

When the org.eclipse.equinox.p2.publisher.AbstractPublisherApplication processes the command line parameter -contextMetadata it uses the member "agent". However this member is still null at that point in time. Consequently the context metadata repository of the PublisherInfo is set to null (meaning no context repository).
Effectively the parameter -contextMetadata is ignored.


Reproducible: Always

Steps to Reproduce:
The parameter "-contextMetadata" is interpreted here:
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.processMetadataRepositoryList(AbstractPublisherApplication.java:213)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.processParameter(AbstractPublisherApplication.java:183)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.processCommandLineArguments(AbstractPublisherApplication.java:149)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.run(AbstractPublisherApplication.java:270)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.start(AbstractPublisherApplication.java:323)

... but the member "agent" is only initialized afterwards:
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.setupAgent(AbstractPublisherApplication.java:252)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.run(AbstractPublisherApplication.java:292)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.run(AbstractPublisherApplication.java:271)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.start(AbstractPublisherApplication.java:323)
Comment 1 Jan Lohre CLA 2010-06-14 11:32:28 EDT
Created attachment 171839 [details]
delay initialization of context repositories

Hi,

with this patch the context repositories do not get initialized during parameter processing (with agent == null). Instead the already existing logic in initializeRepositories() will do the job.

Could we have the patch applied before the final release? I think the bug is rather severe and the patch is rather trivial.

Kind regards,
Jan
Comment 2 Ian Bull CLA 2010-06-14 15:23:42 EDT
We talked about this on the p2 call today and it seems a late for 3.6.0.  I've marked this 3.6.1 and I will it there (and in 3.7).  I've CC'd Pascal in case he feels differently (he wasn't on the call today).
Comment 3 Pascal Rapicault CLA 2010-06-14 15:58:35 EDT
I'll stick for 3.6.1 and get it in the build asap so work depending on this can actually proceed.
Comment 4 Ian Bull CLA 2010-08-24 15:51:56 EDT
Created attachment 177364 [details]
Patch with test case

I really like the patch, thanks! 

I first thought we should just init the agent earlier, but your patch demonstrates that we actually have two different code paths for setting the context repo. You're patch reduces this so that the ant tasks and the applications now use the same path. I like that.

My patch just adds two tests cases which makes it easier to see this problem.
Comment 5 Ian Bull CLA 2010-08-24 18:04:57 EDT
I've talked to pascal on IRC and he gave the go-ahead for this patch.  Pascal, do you want to give the review the +1.
Comment 6 Ian Bull CLA 2010-08-24 18:06:11 EDT
I've given Jan's patch the IPLog+, since it's the one used in the end (I just added the test case).
Comment 7 DJ Houghton CLA 2010-08-25 11:26:40 EDT
Ian, I thought I saw these changes released into the 3.6.1 when I sync'd up this morning. Can this bug be closed now? (just going through our 3.6.1 and trying to get resolution on them)
Comment 8 Ian Bull CLA 2010-08-25 11:32:33 EDT
This patch was released into 3.6.1.