Bug 181210 - [patch][osgi] Should warn if an R3 bundle uses R4 syntax
Summary: [patch][osgi] Should warn if an R3 bundle uses R4 syntax
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M2   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, contributed
: 181182 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-05 10:33 EDT by Thomas Watson CLA
Modified: 2011-08-11 11:22 EDT (History)
6 users (show)

See Also:


Attachments
mylyn/context/zip (662 bytes, application/octet-stream)
2007-11-19 12:23 EST, Chris Aniszczyk CLA
no flags Details
Quick-fix to add Bundle-ManifestVersion (11.14 KB, patch)
2011-07-14 12:56 EDT, Ben Cox CLA
curtis.windatt.public: iplog+
Details | Diff
mylyn/context/zip (63.57 KB, application/octet-stream)
2011-07-14 12:56 EDT, Ben Cox CLA
no flags Details
Updated patch (11.24 KB, patch)
2011-08-11 11:21 EDT, Curtis Windatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2007-04-05 10:33:19 EDT
See bug 181179.  If a bundle manifest does not have Bundle-ManifestVersion: 2 then PDE should provide a warning if the bundle manifest contains headers only defined by the OSGi R4 specification.  For example, the following headers should produce warnings if Bundle-ManifestVersion: 2 is not specified:

Bundle-SymbolicName
Require-Bundle
Fragment-Host
Bundle-Localization
Bundle-ActivationPolicy
Comment 1 Chris Aniszczyk CLA 2007-04-05 10:46:38 EDT
*** Bug 181182 has been marked as a duplicate of this bug. ***
Comment 2 Chris Aniszczyk CLA 2007-11-19 12:22:55 EST
Adding context to help bugday people.
Comment 3 Chris Aniszczyk CLA 2007-11-19 12:23:05 EST
Created attachment 83260 [details]
mylyn/context/zip
Comment 4 Ben Cox CLA 2011-06-30 11:46:55 EDT
I'll give this one a go - assuming I did the correct sort of thing on Bug 350756. :)
Comment 5 Ben Cox CLA 2011-07-01 09:00:22 EDT
I've just been working on this, and have it warning if any of the headers from the description are found without "Bundle-ManifestVersion: 2".

I also coded up a couple of quickfixes, but wanted some feedback about them. I have:

Quickfix 1) removes the offending header.
Quickfix 2) adds the "Bundle-ManifestVersion: 2" header.

I'm fairly happy with Quickfix 1, but I'm not sure about Quickfix 2, or at least how to word it without implying that simply adding "Bundle-ManifestVersion: 2" will perform a full conversion to an R4-compliant bundle (when in reality, you still need to do things like add the Bundle-SymbolicName). Is it a good idea?
Comment 6 Curtis Windatt CLA 2011-07-07 16:19:10 EDT
(In reply to comment #5)
> I'm fairly happy with Quickfix 1, but I'm not sure about Quickfix 2, or at
> least how to word it without implying that simply adding
> "Bundle-ManifestVersion: 2" will perform a full conversion to an R4-compliant
> bundle (when in reality, you still need to do things like add the
> Bundle-SymbolicName). Is it a good idea?

What are the consequences of taking a typical V1 manifest and changing the version?  Will PDE warn the user that a symbolic name should be added?  If we do tell the user what should be fixed, it is reasonable to offer the version change.

Alternatively, the quick fix could do a manifest conversion.  It would have to open some sort of dialog (similar to the older rename dialog) and would need to have some smarts to respect existing headers.
Comment 7 Ben Cox CLA 2011-07-13 08:46:16 EDT
(In reply to comment #6)

At the moment, it looks like it will always protest with an error if Bundle-SymbolicName is missing, even for bundles without "Bundle-ManifestVersion: 2" (i.e., all R3 bundles).

I'm not aware of the history - presumably PDE does not support the development of R3 bundles? I certainly can't find a switch anywhere to enable it. In which case, I think the primary use case here would be importing an R3 bundle and migrating it to R4. Does that sound sensible? Potential solutions being a quick-fix that duplicates the Bundle-Name as Bundle-SymbolicName, or a dialog that asks for more explicit instruction.

I'm aware that this is probably only a very small edge case scenario these days, when most bundles are already R4, but just thought I'd try my hand at something fairly small to start with!
Comment 8 Curtis Windatt CLA 2011-07-13 14:33:14 EDT
(In reply to comment #7)
> (In reply to comment #6)
> I'm not aware of the history - presumably PDE does not support the development
> of R3 bundles? I certainly can't find a switch anywhere to enable it. In which
> case, I think the primary use case here would be importing an R3 bundle and
> migrating it to R4. Does that sound sensible? Potential solutions being a
> quick-fix that duplicates the Bundle-Name as Bundle-SymbolicName, or a dialog
> that asks for more explicit instruction.

It sounds like the best approach is for the quick fix to offer to convert your file.  While PDE does not offer any options to create a R3 manifest, we generally try not to prevent a developer from working with such a file.
Comment 9 Ben Cox CLA 2011-07-14 12:56:00 EDT
Created attachment 199685 [details]
Quick-fix to add Bundle-ManifestVersion

That seems fair enough, so I've put together a patch that gives a quick-fix to add the "Bundle-ManifestVersion: 2" header if R4 headers are found in a pre-R4 manifest. Let me know what you think of it.
Comment 10 Ben Cox CLA 2011-07-14 12:56:03 EDT
Created attachment 199686 [details]
mylyn/context/zip
Comment 11 Curtis Windatt CLA 2011-08-11 11:21:06 EDT
Created attachment 201327 [details]
Updated patch

Fixes copyrights, simplifies the resolution, improves the wording of the problem and fixes.
Comment 12 Curtis Windatt CLA 2011-08-11 11:22:33 EDT
Thanks for your work Ben!

Fixed in HEAD.