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

Bug 258820

Summary: Bundle remains packed with upack=true set in feature.xml
Product: z_Archived Reporter: Markus Kuppe <bugs.eclipse.org>
Component: BuckminsterAssignee: buckminster.core-inbox <buckminster.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: cernst, thomas
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
example
none
patch p1
none
mylyn/context/zip
none
patch p2
none
mylyn/context/zip
none
patch p3
thomas: iplog+
mylyn/context/zip none

Description Markus Kuppe CLA 2008-12-15 09:52:10 EST
1) Empty workspace but org.eclipse.ecf.foo
2) "Perform local resolution" is checked
3) Import > "Materialize from MSPEC,...." with org.eclipse.ecf.foo.mspec
4) Destination type: "targetPlatform" Location: e.g. /tmp/foo
5) org.junit isn't unpacked

Setting to major as this blocks me from using BM currently.
Comment 1 Markus Kuppe CLA 2008-12-15 09:54:25 EST
Created attachment 120471 [details]
example
Comment 2 Markus Kuppe CLA 2008-12-15 10:08:45 EST
What's worth to mention is, that

a) Bundles set to be unpacked in e.g. "org.eclipse.help" end up unpacked
b) Explicitly checking unpack in the "Component query" wizard page doesn't help 
Comment 3 Markus Kuppe CLA 2009-01-15 02:44:04 EST
The problems seems to be that my unpack defining feature is local/source. BM apparently (correctly) materializes the feature into a temporary location (without the feature itself though). Then it continues resolving the dependencies but looses the unpack in nested/child resolutions.

BM should either:

a. pass the unpack bit from the outer (feature) resolution to the inner (bundle) resolution to set it in org.eclipse.buckminster.core.cspec.AbstractResolutionBuilder.createResolution(IComponentReader, CSpecBuilder, OPMLBuilder).

b. org.eclipse.buckminster.pde.cspecgen.bundle.CSpecFromBinary scans the temp location and sets the unpack bit on the bundle (requires an extra field which essentially duplicates the unpack bit from the feature to the bundle). The CSpecFromBinary could either check the temp if the bundle is extracted or use the feature.xml of the parent feature (requires the feature to be copied to the temp location).
Comment 4 Markus Kuppe CLA 2009-01-16 06:49:08 EST
Created attachment 122791 [details]
patch p1

This patch changes EclipseImportBase to keep the "unpack" bit. EclipseImportReader* and CSpecBuilder offer unpack getters/setters to allow CSpecFromBinary to access this information.
Comment 5 Markus Kuppe CLA 2009-01-16 06:49:16 EST
Created attachment 122792 [details]
mylyn/context/zip
Comment 6 Thomas Hallgren CLA 2009-01-16 06:55:15 EST
Anyway you can modify this patch so that it does not alter the CSpecBuilder? I'm not much in favor of having a pack/unpack attribute in the cspec (nor in it's builder).
Comment 7 Markus Kuppe CLA 2009-01-16 07:02:21 EST
(In reply to comment #6)
> Anyway you can modify this patch so that it does not alter the CSpecBuilder?
> I'm not much in favor of having a pack/unpack attribute in the cspec (nor in
> it's builder).

I don't really see how to get unpack from org.eclipse.buckminster.pde.internal.EclipseImportReader to org.eclipse.buckminster.core.cspec.AbstractResolutionBuilder.createResolution(IComponentReader, CSpecBuilder, OPMLBuilder) without changing CSpecBuilder, unless:

a) org.eclipse.buckminster.core.reader.ICatalogReader offers isUnpack()

b) org.eclipse.buckminster.pde.cspecgen.PDEBuilder overwrites createResolution(IComponentReader, CSpecBuilder, OPMLBuilder). The derived impl could cast to EclipseImportReader. But it would need to clone the impl from org.eclipse.buckminster.core.cspec.AbstractResolutionBuilder.createResolution(IComponentReader, CSpecBuilder, OPMLBuilder)
Comment 8 Markus Kuppe CLA 2009-01-16 07:19:56 EST
Created attachment 122794 [details]
patch p2

This one doesn't change CSpec* but overwrites BundleBuilder#createResolution(...)
Comment 9 Markus Kuppe CLA 2009-01-16 07:20:01 EST
Created attachment 122795 [details]
mylyn/context/zip
Comment 10 Thomas Hallgren CLA 2009-01-16 07:29:43 EST
I would suggest option #B in combination with two things.

1. You add an extra parameter 'isUnpack' to the current
AbstractResolutionBuilder.createResolution() method and assign that value to
the ResolutionBuilder. 

2. You add an additional AbstractResolutionBuilder.createResolution() that
preserves the current signature by just doing:

protected Resolution createResolution(IComponentReader reader, CSpecBuilder
cspecBuilder, OPMLBuilder opmlBuilder) throws CoreException
{
  return createResolution(reader, cspecBuilder, opmlBuilder, false);
}

3. You override the added method in the PDEBuilder så that it, instead of
passing false, passes the value extracted from the reader.

This way you will not have to clone the implementation and you will not cause
any changes in the API (other then adding, but that's non intrusive).
Comment 11 Markus Kuppe CLA 2009-01-16 07:50:59 EST
Created attachment 122799 [details]
patch p3

Done as you wish ;-)
Comment 12 Markus Kuppe CLA 2009-01-16 07:51:03 EST
Created attachment 122800 [details]
mylyn/context/zip
Comment 13 Thomas Hallgren CLA 2009-01-16 08:21:29 EST
Patch applied, thanks.
Comment 14 Markus Kuppe CLA 2009-01-20 03:18:14 EST
With 3.5 a new "Eclipse-BundleShape" bundle header has been defined [1]. It's tracked in bug #157562. It defines whether a bundle remains a jar or has to be extracted during installation.

IMO this patch needs to be revised to also check for "Eclipse-BundleShape" and not just "unpack". But maybe the transition to p2 addresses this problem already.

[1] http://eclipsesource.com/blogs/2009/01/20/tip-eclipse-bundleshape/
Comment 15 Thomas Hallgren CLA 2009-03-25 11:19:59 EDT
Fix also avaiable in Ganymede 3.4.2 release