kysmith-csg opened a new pull request, #54:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/54

   This PR fixes OSGI manifest processing. As it is now, this tool creates 
invalid manifest headers. My changes fix two problems that I saw while trying 
to use this:
   
   1. [`Export-Package` is not allowed to have a version 
range.](https://docs.osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.exportpackage)
   The change by #42 was too broad and would create things like 
   ```
   Export-Package: jakarta.servlet;version="[5.0.0,7.0.0)"
   ```
   which is not valid in OSGI and results in the bundle not being installable. 
Now, it simply exports the single version:
   ```
   Export-Package: jakarta.servlet;version="5.0.0"
   ```
   
   I was a bit unsure what version to export though so I just went with the 
lowest.
   
   `Import-Package` is unchanged because you are allowed to have a version 
range there.
   
   2. Use `org.eclipse.osgi` as a dependency to process `Import-Package` and 
`Export-Package`. I have seen at least one case that a manifest had something 
like:
   ```
   Export-Package: some.package;uses:="javax.servlet";version="1.0.0"
   ```
   The regex pattern would see `javax.servlet` (after being transformed to 
`jakarta.servlet`) and change the version from `1.0.0` to `[5.0.0,7.0.0)`, even 
though that version is for `some.package`. 
   ```
   Export-Package: some.package;uses:="jakarta.servlet";version="[5.0.0,7.0.0)"
   ```
   
   This results in issues with other bundles who require `some.package` because 
they will be importing a version `1.0.0` which is no longer being exported.
   
   By using `org.eclipse.osgi` we can parse the manifest headers as OSGI would 
and do it properly. I think it's impossible for a regex to match these 
perfectly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to