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

Bug 313997

Summary: [publisher] ExecutablesDescriptor fails to rename a launcher for macos
Product: [Eclipse Project] Equinox Reporter: Hugues Malphettes <hmalphettes>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bsd, bugs.eclipse.org, christian.georgi, eric.jain, hmalphettes, irbull, jamesblackburn+eclipse, jeffmcaffer, mail, steffen.pingel, t-oberlies
Version: 3.6   
Target Milestone: 3.7   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 331974    
Attachments:
Description Flags
Suggested patch
none
new patch no camel case attempts
none
Testcase
none
New patch none

Description Hugues Malphettes CLA 2010-05-21 19:35:00 EDT
When invoking the PublishProduct application outside of the PDEBuilder, I see the following stack trace:
Generating metadata for ..
java.io.FileNotFoundException: /tmp/p2.brandingIron3758427379227508132/Eclipse.app/Contents/MacOS/eclipse.ini (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at org.eclipse.equinox.internal.p2.core.helpers.FileUtils.zipFile(FileUtils.java:357)
        at org.eclipse.equinox.internal.p2.core.helpers.FileUtils.zip(FileUtils.java:286)
        at org.eclipse.equinox.internal.p2.core.helpers.FileUtils.zip(FileUtils.java:251)
        at org.eclipse.equinox.p2.publisher.AbstractPublisherAction.publishArtifact(AbstractPublisherAction.java:469)
        at org.eclipse.equinox.p2.publisher.eclipse.EquinoxExecutableAction.publishExecutableIU(EquinoxExecutableAction.java:129)
This was reported here:
http://www.eclipse.org/newsportal/article.php?id=6608&group=eclipse.technology.equinox#6608

It looks like the org.eclipse.equinox.internal.p2.publisher.eclipse#ExecutablesDescriptor does not work for macoxs when the executable is created from the equinox executable feature.

In that case the launcher is called "launcher" (hardcoded line 63 of ExecutablesDescriptor) and it is not related to the ini file (named "eclipse.ini").
The method updateExecutableName assumes that the ini file is derived from the launcher name.

Also we probably need to code to update the Info.plist's CFBundleExecutable key to the name of the executable when it is not 'eclipse'

Let me know if I missed something. I can contribute a patch if that helps.
Comment 1 Hugues Malphettes CLA 2010-05-21 19:58:29 EDT
(In reply to comment #0)
> Also we probably need to code to update the Info.plist's CFBundleExecutable key
> to the name of the executable when it is not 'eclipse'
I take that back: BrandingIron is already taking care of Info.plist.

I have done a really cheap patch that hardcodes this special case and the rest of the renaming of the executable for macosx is working fine.
Comment 2 Hugues Malphettes CLA 2010-05-24 12:46:14 EDT
Created attachment 169700 [details]
Suggested patch

This patch deals with the macosx executable extracted from the equinox launcher feature without changing to much code.
Comment 3 Hugues Malphettes CLA 2010-05-26 17:59:43 EDT
Created attachment 170116 [details]
new patch no camel case attempts
Comment 4 Hugues Malphettes CLA 2010-05-26 18:33:08 EDT
Created attachment 170121 [details]
Testcase

Import this project in the workspace of a PDE.
It contains a launch configuration that runs the ProductPublisher for a product file with a single plugin. The configuration will run out of the box: no need to edit the pathes in the p2 parameters.
It also contains a trimmed down delta-pack with only the cocoa files.
On 3.6M7 it crashes with the exception reported in the bug and inside the published repository folder the binary folder contains a 0 byte long file for the cocoa executable.

With the patch applied to director it behaves as expected.
Comment 5 Hugues Malphettes CLA 2010-05-30 11:08:18 EDT
Created attachment 170475 [details]
New patch

The previous patch was not working when the launcher name was 'eclipse' or 'launcher'.
This patch supports all launcher names.
It does respect the best practice for macosx where the ".app" folder starts with an upper case letter which is also the practice that BrandingIron follows.

I have tested this patch with a tycho build and was able to generate a product archive for macosx with director.
Comment 6 Hugues Malphettes CLA 2010-06-07 20:28:17 EDT
To complete the macosx launcher support with Publisher, the last thing that was missing for me was the symbolic link at the root of the installation.
Here is the bug with a patch for that: bug 316028
Comment 7 Hugues Malphettes CLA 2010-11-12 10:53:41 EST
The maven tycho community is now working on this area and they are facing those bugs with the BrandingIron in p2:
https://issues.sonatype.org/browse/TYCHO-520

Ian, what is the future of the p2-publisher's BrandingIron?
Do you recommend that we look into using the PDEBuild version instead?

For jetty we forked Tycho and I built tycho with a patched version of the p2-publisher. we are looking forward to be able to use the version of tycho that is maintained by the community and this bug is standing on our way.

Thanks for your attention!
Comment 8 Jeff McAffer CLA 2010-12-02 19:48:55 EST
*** Bug 331721 has been marked as a duplicate of this bug. ***
Comment 9 Brian de Alwis CLA 2010-12-03 09:28:30 EST
Huh, I didn't find this bug before submitting bug 331721; my search only turned up bug 325301 against Buckminster.

To repeat Jeff's comment on bug 331721:
> I believe this is a dupe of bug 313997.  We should look at the patch here and
> patch there, the one in Buckminster and what they have done in Tycho to see if
> unification is possible.

Buckminster has also forked the p2 publisher's code and fixed the .ini issue as well as handling icons too.  I ported their patch to the current p2 publisher as attachment 184413 [details] (attached to bug 331721).
Comment 10 Ian Bull CLA 2011-05-29 23:47:51 EDT
Hi everyone,

It's not clear if this is still a problem with all the publisher work that was done recently. I will look at this for 3.7.1
Comment 11 Tobias Oberlies CLA 2011-07-19 09:39:04 EDT
I have seen this working: when specifying a launcher name, e.g. "myrcp", the launcher in the installed product is in "myrcp.app/Contents/MacOS/myrcp". In fact, this is a workaround for bug 352457.

AFAIK, the only missing feature for Mac products is the symlink to the launcher from the installation root, but there is a separate bug for this: bug 316028. I believe the issue described in this bug has been resolved in 3.7.
Comment 12 Tobias Oberlies CLA 2011-07-19 10:06:59 EDT
This issue has been resolved through other changes which are part of the 3.7 release.