Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 266047 - [publisher] BundleAction does not add ArtifactDescriptor entries for .pack.gz files
Summary: [publisher] BundleAction does not add ArtifactDescriptor entries for .pack.gz...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Andrew Niefer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-24 17:36 EST by Thomas Hallgren CLA
Modified: 2009-04-07 08:20 EDT (History)
2 users (show)

See Also:


Attachments
Patch to BundleActionTest that highlights the issue (part 1) (5.46 KB, patch)
2009-02-25 11:40 EST, Thomas Hallgren CLA
no flags Details | Diff
Patch to BundleActionTest that highlights the issue (part 2) (1.70 KB, application/octet-stream)
2009-02-25 11:41 EST, Thomas Hallgren CLA
no flags Details
New version of Patch to BundleActionTest (part 1) (5.16 KB, patch)
2009-02-25 11:50 EST, Thomas Hallgren CLA
no flags Details | Diff
Patch to make BundleAction recognize pack.gz siblings (2.65 KB, patch)
2009-02-25 11:55 EST, Thomas Hallgren CLA
no flags Details | Diff
Up to date patch to BundleActionTest (5.16 KB, patch)
2009-03-30 17:08 EDT, Thomas Hallgren CLA
aniefer: iplog+
Details | Diff
Up to date patch to fix the problem. (2.62 KB, patch)
2009-03-30 17:09 EDT, Thomas Hallgren CLA
aniefer: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hallgren CLA 2009-02-24 17:36:16 EST
I'm having problems with the BundleAction in the Publisher not recognizing the existence of ".pack.gz" files. I ran the debugger and ended up in the following code in BundlesAction.generateBundleIUs()  at line 721:

 // Publish according to the shape on disk
 File bundleLocation = new File(bd.getLocation());
 if (bundleLocation.isDirectory())
     publishArtifact(ad, new File(bd.getLocation()), new File(bd.getLocation()).listFiles(), info);
 else
     publishArtifact(ad, new File(bd.getLocation()), info);

The bundleLocation in my case is always the bundle jar so I end up in the second publishArtifact(). The code that adds the corresponding .pack.gz file however, is only present in the publishArtifact() that is called when bundleLocation is a directory. This never happens.

Looking at the deprecated Generated.generateBundleIUs(), I see similar code as the one above, but there it's followed by this (line 409):

 if (info.reuseExistingPack200Files() && !info.publishArtifacts()) {
     File packFile = new Path(bd.getLocation()).addFileExtension("pack.gz").toFile(); //$NON-NLS-1$
     if (packFile.exists()) {
         IArtifactDescriptor ad200 = MetadataGeneratorHelper.createPack200ArtifactDescriptor(key, packFile, ad.getProperty(IArtifactDescriptor.ARTIFACT_SIZE));
         publishArtifact(ad200, new File[] {packFile}, destination, true);
     }
 }
Comment 1 Thomas Hallgren CLA 2009-02-25 10:32:00 EST
I can provide a patch for this unless someone is already working on it (if so, please let me know ASAP).
Comment 2 Simon Kaegi CLA 2009-02-25 11:16:37 EST
Sure. Patch appreciated. I'm doing work in here right now so could take a look.
Comment 3 Thomas Hallgren CLA 2009-02-25 11:40:36 EST
Created attachment 126739 [details]
Patch to BundleActionTest that highlights the issue (part 1)

I divided this patch into two parts to make the code viewable. The second patch is a binary .pack.gz file that goes into testData. Both patches must be applied for the test to run.
Comment 4 Thomas Hallgren CLA 2009-02-25 11:41:48 EST
Created attachment 126740 [details]
Patch to BundleActionTest that highlights the issue (part 2)

Additional test data for the BundleActionTest
Comment 5 Thomas Hallgren CLA 2009-02-25 11:50:55 EST
Created attachment 126745 [details]
New version of Patch to BundleActionTest (part 1)

Just discovered a merge conflict in PublishActionTest. So here's a new version.
Comment 6 Thomas Hallgren CLA 2009-02-25 11:55:58 EST
Created attachment 126746 [details]
Patch to make BundleAction recognize pack.gz siblings

The code was there, but in the wrong place. This patch overrides the correct method (the one that is called when a jar file is encountered) and the code to create the .pack.gz descriptor was moved to that method.
Comment 7 Thomas Hallgren CLA 2009-03-20 18:06:35 EDT
Any chance this bugzilla can be attended to anytime soon? We use the publisher in our builds now and would really appreciate if it picked up the .pack.gz files and added them to the ArtifactRepository.
Comment 8 Pascal Rapicault CLA 2009-03-29 21:53:32 EDT
Sorry for having let that rot. Thomas could you please provide an updated version if this has not been fixed? Thx
Comment 9 Thomas Hallgren CLA 2009-03-30 02:34:54 EDT
(In reply to comment #8)
> Sorry for having let that rot. Thomas could you please provide an updated
> version if this has not been fixed? Thx
> 
As far as I can see, it has not been fixed and I'd be happy to provide a new patch. Right now I have another patch pending that concerns the same file in bug #269170. Perhaps you could apply that patch first? Otherwise it will render a new patch here stale.

I can of course provide a patch that contains both changes if you'd prefer that.

Comment 10 Pascal Rapicault CLA 2009-03-30 11:53:07 EDT
I have released patch for bug #269170.
I would appreciate if you could provide a patch.
Comment 11 Thomas Hallgren CLA 2009-03-30 17:08:10 EDT
Created attachment 130317 [details]
Up to date patch to BundleActionTest
Comment 12 Thomas Hallgren CLA 2009-03-30 17:09:06 EDT
Created attachment 130318 [details]
Up to date patch to fix the problem.
Comment 13 Thomas Hallgren CLA 2009-03-30 17:14:16 EDT
The binary patch containing the test data (a pack.gz file) didn't need an update.

1. Apply the binary patch + the BundleActionTest patch (I kept them separate to keep the latter readable).
2. Run the patched BundleActionTest. It should now fail since no pack.gz is generated.
3. Apply the fix patch.
4. Run the modified test again. This time it should succeed.
Comment 14 Andrew Niefer CLA 2009-04-06 17:32:42 EDT
released
Comment 15 Andrew Niefer CLA 2009-04-06 17:33:02 EDT
.