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

tebako-packer doesn't support the new ./exe binary directory #215

Closed
bradgessler opened this issue Dec 5, 2024 · 4 comments
Closed

tebako-packer doesn't support the new ./exe binary directory #215

bradgessler opened this issue Dec 5, 2024 · 4 comments

Comments

@bradgessler
Copy link
Contributor

bradgessler commented Dec 5, 2024

Took me a while to figure this out, but the packaging scenarios at https://github.com/tamatebako/blob/a1d21fb64f8df2b849f7d1696f2f1c86ff0a80af/README.adoc#L1002-L1021 won't work gems created via bundler gem.

By default, bundler gem blah creates an ./exe directory, which is defined in the gemspec via spec.bindir = "exe". This changed from a few years ago when binaries were stored in ./bin, but this path has since been reserved for developers binary stubs, for bundler, and the exe folder is reserved for the binaries that are to be distributed.

I think the best approach might be for Tebake to find the gemspec, load it, ask for the bindir, and use that path.

I haven't tracked down in the code where this is happening, but I'm guessing the bin path is hard coded.

For now my work around is to throw the ./exe/blah file into ./bin/blah and get it running.

@bradgessler bradgessler changed the title Gem packer doesn't support the new ./exe directory tebako-packer doesn't support the new ./exe binary directory Dec 5, 2024
@bradgessler
Copy link
Contributor Author

Another proposal: it might make sense to pass the path into the —entry-point argument. For example —entry-point=exe/blah instead of —entry-point=blah with the implicit bin prefix.

I don't understand the project well enough to know if there's a reason entry-point doesn't have a folder in front of it, but I'd guess there's a reason.

@ronaldtse
Copy link
Contributor

Thank you @bradgessler for the feedback (and the recent PR #213 )!

I think the best approach might be for Tebake to find the gemspec, load it, ask for the bindir, and use that path.

As you realize the entrypoint is currently defined using the --entry-point argument, and any implicit prefixes for legacy compatibility is probably moot at this point since Tebako does not need to be compatible with ruby-packer (that was the original motivation).

I believe it is time we take a clean look at how to make entrypoint definitions (we have previously discussed a Tebafile):

  • gem: check gemspec for executables (but we can only have one..., so the user still needs to choose)
  • command line exe: specify directly without adding any prefix

@maxirmx
Copy link
Member

maxirmx commented Dec 7, 2024

Hi, @bradgessler

You are three times right :)

  • bin is hardcoded
  • tebako shall parse gemspec (and also Gemfile.lock) and do not make silly assumptions
  • we shall remove implict prefixes from --entry-point argument

if you are interested in details you can look at maxirmx-separate-runtime branch. Somewhere between scenario_manager.rb and deploy_helper.rb

Main branch has the same logic implemented in CMake script that would be very hard to change.

@maxirmx
Copy link
Member

maxirmx commented Jan 12, 2025

After revisiting this issue I do not see any errors or unsupported features
Tebako 100% depends on gemspec and gem install command

There is no ./exe binary directory in specification.
gemspec can define bindir and executables within bindir

Specification explicitly says "You don’t specify the full path (as in bin/rake); all application-style files are expected to be found in bindir", tebako follows this convention and expects the entry-point executable to be found in bindir as defined in gemspec

There is also bindir option of gem install command

-n, --bindir DIR - Directory where executables will be placed when the gem is installed

Tebako sets this option to a path within memfs like \__tebako_memfs__\bin which is actually gem install default (the folder where Ruby executable resides). In any case the specification does not say that gem install bindir option can be set or restricted by a gem in any way.

So I believe that tebako relies follows specifications. I have added some tests for different bindir settings in gemspec and included this information to tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants