Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tycho-p2-director:director: Fix handling of destination on macOS #3549

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

sratz
Copy link
Contributor

@sratz sratz commented Mar 6, 2024

No description provided.

Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we probably have a new testcase instead of adjusting the existing one? Both "variants" should work in my opinion.

Copy link

github-actions bot commented Mar 6, 2024

Test Results

  591 files    591 suites   4h 31m 50s ⏱️
  413 tests   406 ✅  7 💤 0 ❌
1 239 runs  1 217 ✅ 22 💤 0 ❌

Results for commit ffd4114.

♻️ This comment has been updated with latest results.

@sratz sratz force-pushed the director-destination branch from 9cb87f7 to 40dd605 Compare March 7, 2024 15:26
@sratz sratz changed the title Improve integration test to show issue #3548 tycho-p2-director:director: Fix handling of destination on macOS Mar 7, 2024
@sratz sratz force-pushed the director-destination branch from 40dd605 to 361fd98 Compare March 7, 2024 17:03
Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, this looks good in general just some small remarks.

@laeubi laeubi added the backport-to-tycho-4.0.x Can be added to a PR to trigger an automatic backport of the change label Mar 8, 2024
@laeubi
Copy link
Member

laeubi commented Mar 18, 2024

@sratz I plan to do a bugfix release maybe end of month, do you think we can include this one here?

@sratz
Copy link
Contributor Author

sratz commented Mar 22, 2024

@sratz I plan to do a bugfix release maybe end of month, do you think we can include this one here?

Yes, I think that should be possible, I am currently looking for a solution to this issue again.

@sratz sratz force-pushed the director-destination branch from 361fd98 to 5f363fa Compare March 25, 2024 21:34
@sratz
Copy link
Contributor Author

sratz commented Mar 25, 2024

I thought about this some more and changed the pull request again to what you initially proposed in the issue.

The processing of work in tycho-surefire-plugin and destination in tycho-p2-director-plugin is now consistent and the same rules apply.

I think the benefits of applying this in some standard scenario (e.g. https://github.com/eclipse-tycho/tycho/blob/d23230d9ea1c03e64184f3c69bfe69499e815ef8/tycho-its/projects/surefire.p2InstalledRuntime/extProductTestDirector/pom.xml) outweigh the fact that tycho-p2-director-plugin:director is not a drop-in-replacement for the legacy eclipse -application org.eclipse.equinox.p2.director -destination <destination> ....

I tried to document these peculiarities of path name handling in the mojo parameter descriptions.

@sratz sratz force-pushed the director-destination branch from 5f363fa to 95b912e Compare March 25, 2024 22:03
laeubi
laeubi previously approved these changes Mar 26, 2024
Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine and tests are green, @sratz if you are happy with that let me know and I'll put this on the merge train!

@sratz
Copy link
Contributor Author

sratz commented Mar 26, 2024

Looks fine and tests are green, @sratz if you are happy with that let me know and I'll put this on the merge train!

I have one more question:

I am trying to understand the intention behind the installAllEnvironments option:

Was the idea to run the director N times and install IUs for all platforms into the same product/installation?

Has this ever worked?

The way I see it, the environment options (os/ws/arch) end up in the director call inside the IProfile, but only if that profile does not exist, yet:

private IProfile initializeProfile() throws CoreException {
IProfile profile = getProfile();
if (profile == null) {
if (destination == null)
missingArgument("destination"); //$NON-NLS-1$
if (flavor == null)
flavor = System.getProperty("eclipse.p2.configurationFlavor", FLAVOR_DEFAULT); //$NON-NLS-1$
Map<String, String> props = new HashMap<>();
props.put(IProfile.PROP_INSTALL_FOLDER, destination.toString());
if (bundlePool == null)
props.put(IProfile.PROP_CACHE,
sharedLocation == null ? destination.getAbsolutePath() : sharedLocation.getAbsolutePath());
else
props.put(IProfile.PROP_CACHE, bundlePool.getAbsolutePath());
if (roamingProfile)
props.put(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
String env = getEnvironmentProperty();
if (env != null)
props.put(IProfile.PROP_ENVIRONMENTS, env);

So AFAIK installAllEnvironments is a no-op, and just runs the (same) director multiple times.

I am asking here, because if we could remove that option, it would simplify the handling of the target env even more inside ProvisionedInstallationBuilder

From what I can tell installAllEnvironments is not used in production anywhere.

@laeubi
Copy link
Member

laeubi commented Mar 26, 2024

Was the idea to run the director N times and install IUs for all platforms into the same product/installation?
Has this ever worked?

Yes but I think it was actually in the end not that useful.

So AFAIK installAllEnvironments is a no-op, and just runs the (same) director multiple times.

the difference is if you have native fragments, you can install all of them while this si not possible with one classic call.

I am asking here, because if we could remove that option, it would simplify the handling of the target env even more inside ProvisionedInstallationBuilder

Yes I think we can remove that option.

@sratz
Copy link
Contributor Author

sratz commented Mar 26, 2024

the difference is if you have native fragments, you can install all of them while this si not possible with one classic call.

When I follow the information flow of os/ws/arch, I don't see how that would've ever worked in practice:

  • org.eclipse.tycho.surefire.provisioning.ProvisionedInstallationBuilder.executeDirector(TargetEnvironment)
  • org.eclipse.tycho.p2.tools.director.shared.DirectorRuntime.Command.setEnvironment(TargetEnvironment)
  • Director arguments -p2.os / -p2.ws / -p2.arch

And then inside

private IProfile initializeProfile() throws CoreException {
IProfile profile = getProfile();
if (profile == null) {
if (destination == null)
missingArgument("destination"); //$NON-NLS-1$
if (flavor == null)
flavor = System.getProperty("eclipse.p2.configurationFlavor", FLAVOR_DEFAULT); //$NON-NLS-1$
Map<String, String> props = new HashMap<>();
props.put(IProfile.PROP_INSTALL_FOLDER, destination.toString());
if (bundlePool == null)
props.put(IProfile.PROP_CACHE,
sharedLocation == null ? destination.getAbsolutePath() : sharedLocation.getAbsolutePath());
else
props.put(IProfile.PROP_CACHE, bundlePool.getAbsolutePath());
if (roamingProfile)
props.put(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
String env = getEnvironmentProperty();
if (env != null)
props.put(IProfile.PROP_ENVIRONMENTS, env);
the only place where this information is used again is when creating a new profile, when it does not does not yet exist.

So, the first org.eclipse.tycho.surefire.provisioning.ProvisionedInstallationBuilder.install(TargetEnvironment) makes use of the environment, when creating the IProfile, but all the subsequent calls don't and they essentially just repeat the first invocation.

Yes I think we can remove that option.

Ok, then I'll do that in a separate pull-request to clean things up.

I think we can then merge this one.

@laeubi
Copy link
Member

laeubi commented Mar 26, 2024

So, the first org.eclipse.tycho.surefire.provisioning.ProvisionedInstallationBuilder.install(TargetEnvironment) makes use of the environment, when creating the IProfile, but all the subsequent calls don't and they essentially just repeat the first invocation.

Yes the "key" was a new profile each time so they end up installed in the folder but as said in the end this was not really something useful at all...

Ok, then I'll do that in a separate pull-request to clean things up.

Whatever you think fits best if it make things easier you can also do it in this PR.

@sratz
Copy link
Contributor Author

sratz commented Mar 26, 2024

Whatever you think fits best if it make things easier you can also do it in this PR.

Then I'll do it here. Also keeps the discussions together in one issue/PR.

* In DirectorMojo, the adjustment of 'destination' must consider the
  actual target environment (p2os/p2ws/p2arch parameters) that is to be
  installed and only fall back to the running environment if no explicit
  target environment is given.

* Document in the tycho-p2-director:director JavaDoc / mojo parameter
  description that this intentionally deviates from the behavior of the
  stand-alone director application invocation:
      eclipse -application org.eclipse.equinox.p2.director
              -destination <destination> ...

* In DirectorMojo, add a consistency check that p2os/p2ws/p2arch must
  all be specified mutually.

* The helper methods in DirectorRuntime are extended, to properly handle
  all three possible scenarios:

  1)     /path/without/app/bundle/layout
     --> /path/without/app/bundle/layout/Eclipse.app/Contents/Eclipse

  2)     /path/to/real.app/Contents/Eclipse
     --> /path/to/real.app/Contents/Eclipse

  3)     /path/to/real.app
     --> /path/to/real.app/Contents/Eclipse

  This allows us to remove redundant code in
  ProvisionedInstallationBuilder.

* This also removes the <installAllPlatforms> option again which was
  introduced in eclipse-tycho#3091 (606a087).
  This is not used in production and was not having the desired effect.

  This simplifies the handling in AbstractEclipseTestMojo /
  ProvisionedInstallationBuilder even more.

Fixes eclipse-tycho#3548.
Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!

@laeubi laeubi merged commit b35d8e0 into eclipse-tycho:main Mar 26, 2024
11 checks passed
@eclipse-tycho-bot
Copy link

💚 All backports created successfully

Status Branch Result
tycho-4.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@sratz sratz deleted the director-destination branch March 28, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-tycho-4.0.x Can be added to a PR to trigger an automatic backport of the change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants