Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 227217 - update site build should create p2 metadata
Summary: update site build should create p2 metadata
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 227383
Blocks:
  Show dependency tree
 
Reported: 2008-04-15 16:18 EDT by Darin Wright CLA
Modified: 2008-04-24 09:33 EDT (History)
1 user (show)

See Also:


Attachments
Simple fix (2.14 KB, patch)
2008-04-17 13:12 EDT, Curtis Windatt CLA
no flags Details | Diff
Fix (2.80 KB, patch)
2008-04-23 12:12 EDT, Curtis Windatt CLA
no flags Details | Diff
mylyn/context/zip (658 bytes, application/octet-stream)
2008-04-24 09:33 EDT, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2008-04-15 16:18:17 EDT
When we build an update site we should generate p2 metadata. This would avoid having to "auto-generate" the metadata at install time (i.e. like p2 does for old update sites).

Start with set of properties we have in feature export.
Comment 1 Curtis Windatt CLA 2008-04-15 17:23:31 EDT
Tried a couple of things, but keep running into the following generic error.  If I specify a sub directory in the update project and set publish artifacts to true, I get the artifacts, content.xml and artifacts.xml all generating, but the error still occurs.

Problems during export
  C:\Workspace Target\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:208: The following error occurred while executing this line:
C:\Workspace Target\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:218: An error occurred when calling generator.
  The following error occurred while executing this line:
C:\Workspace Target\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:218: An error occurred when calling generator.
  C:\Workspace Target\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:208: The following error occurred while executing this line:
C:\Workspace Target\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:218: An error occurred when calling generator.
  The following error occurred while executing this line:
C:\Workspace Target\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:218: An error occurred when calling generator.


Comment 2 Curtis Windatt CLA 2008-04-15 17:52:15 EDT
Did some debugging and figured it out. I was getting an NPE in the p2 generator.  I'm not really sure how I got it into this state, but the generator was trying to add jdt debug to the IUs (even though I was building the CVS feature) and no file existed for the bundle.

For reference the NPE occurs at
org.eclipse.equinox.internal.p2.core.helpers.FileUtils.zip(FileUtils.java:169), org.eclipse.equinox.internal.p2.core.helpers.FileUtils.zip(FileUtils.java:163), org.eclipse.equinox.internal.provisional.p2.metadata.generator.Generator.publishArtifact(Generator.java:1143), org.eclipse.equinox.internal.provisional.p2.metadata.generator.Generator.generateBundleIUs(Generator.java:361), org.eclipse.equinox.internal.provisional.p2.metadata.generator.Generator.generate(Generator.java:305), 
...

Comment 3 Curtis Windatt CLA 2008-04-16 11:46:58 EDT
Dealt with the NPE by cleaning out my target workspace.  I am now able to generate a p2 repo and install from it.

However, I tried to specify the artifact and metadata repositories as the base of the project (so the site.xml, content.xml and artifact.xml are all at the root) and got another generic error from the generator.  Debugging showed that the error is because the repository is not modifiable.  This works when creating a new directory as doing so will create a new repository.  However, when specifying the project, an UpdateSiteArtifactRepository is returned.  That class does not override isModifiable() and the super class always returns false.  If the repository is unmodifiable, an error is thrown.

To me, it makes more sense to have the repo be at the root of the project and reuse the plugins/features folders generated by the update site build.  I believe that this is a bug in the design of the UpdateSiteArtifactRepository class, as I see no reason why the repo couldn't be modified.
Comment 4 Curtis Windatt CLA 2008-04-17 13:12:17 EDT
Created attachment 96471 [details]
Simple fix

Adds in p2 metadata generation to update site building.

Two problems:

1) Can't have the p2 repo at the root of the project.  Depends on bug 227383.
2) If you rebuild the site with different features, they are appended, so you can have stale data in the repo.
Comment 5 Curtis Windatt CLA 2008-04-22 11:35:13 EDT
The second problem, appending to the metadata repo, is more complex than I originally thought.  If we leave appending on, as features get removed from site.xml, they may not be removed from the repo.  However, if we turn off appending and the repo gets deleted each time we build, we might be deleting valid features.  For example, if the site.xml defines features A, B and C, and we only select A and hit build, if the repo gets deleted before building, only A would be in the repo while A, B and C are all available in site.xml.

I'm not sure what to do about this.  Perhaps we can call the generator script for all features in site.xml.  Because we wouldn't be generating artifacts, it should be quick.
Comment 6 Curtis Windatt CLA 2008-04-23 12:12:26 EDT
Created attachment 97254 [details]
Fix

With Bug 227283 fixed, I can now put the metadata the the root.  Because we don't have to create duplicate artifacts, it's quite fast to run.

I think the solution to the appending problem is to leave things as they are.  Currently, if you build a site.xml, remove one or more features and build again, you'll end up with all the artifacts from the builds.  Building a site does not delete existing artifacts.  So it makes enough sense to not delete them from the artifact.xml and content.xml.  It is also very easy to delete the two files before building to generate them from scratch.
Comment 7 Chris Aniszczyk CLA 2008-04-24 05:18:30 EDT
Curtis, are you happy with this patch for M7?

It looks straightforward and mimicks the existing behavior. I'm happy with it.
Comment 8 Curtis Windatt CLA 2008-04-24 09:20:37 EDT
Yes, I'm happy with it.  Hopefully people who are actually making live update sites will be happy with it :)
Comment 9 Chris Aniszczyk CLA 2008-04-24 09:33:17 EDT
done.

> 20080424

I will do further testing on the plane, so far, it doens't look like people targetting other versions are affected.
Comment 10 Chris Aniszczyk CLA 2008-04-24 09:33:20 EDT
Created attachment 97455 [details]
mylyn/context/zip