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

Rename dev versions #334

Closed
wants to merge 4 commits into from
Closed

Rename dev versions #334

wants to merge 4 commits into from

Conversation

rubys
Copy link
Contributor

@rubys rubys commented Mar 25, 2013

Address the bulk of what I originally set out to do. See comments on rubys@879e1c5

rubys added 4 commits March 23, 2013 19:27
if RUBY_BUILD_CACHE_PATH is set, create and maintain a local bare git
repository in this location.  The name of the git repository is based
on the git URL, so it will be shared between branches.
* Decrease likelihood of cache collisions
* Avoid file:// urls (and therefore the need to escape)
@sferik
Copy link
Contributor

sferik commented Mar 31, 2013

@sstephenson @jeremy Any reason not to merge this? It looks good to me.

@jeremy
Copy link
Member

jeremy commented Apr 2, 2013

Feels like the multipass change could be seen through to a cleaner conclusion. Sourcing the build definition twice with a special PASS flag is some indication that the build functions should be broken into smaller parts so the git builds can explicitly fetch then make while the other tarball builds can use a bundled fetch+make.

@rubys
Copy link
Contributor Author

rubys commented Apr 2, 2013

I must confess that I don't understand the requirement for a bundled fetch+make. In fact, as an end user, I would argue the opposite: fetch failures are often intermittent and restartable, whereas make failures are less so. I actually find it appealing to have ruby-build first fetch everything it might need before it invests the effort in building, but that might just be me. In any case, a follow-on effort could take this to the logical conclusion, and make sure that all of the built in fetch operations are restartable -- either though the expediency of doing the fetch first to a temporary location and then to move it, or by employing restartable operations.

Looking at the specifics of the current build definitions as they exist in my pull request, splitting the install_git into smaller steps would involve repeating the branch name twice, a suboptimal outcome.

I would suggest that the ideal solution would involve treating the build definitions as declarative instead of imperative, and thereby be more a specification of what is desired and less of a prescription as to how to do it. Given the limitations of shell scripts, the current design of build definitions does a wonderful job of giving the appearance of being declarative.

That being said, the current implementation is decidedly imperative, which means that any change has the possibility of breaking existing user provided build definitions. If such definitions use the provided primitives like install_git, they will continue to work, but if they provide their own primitives or embedded logic, they might need to be modified.

@sstephenson
Copy link
Contributor

Hey Sam. I'm sorry I haven't given this the attention it deserves. You've given me a lot to think about. I promise to have an answer soon.

@sstephenson
Copy link
Contributor

Double-sourcing the definition is a smell. Here's what I think we should do:

  1. Add a new command-line flag to ruby-build to enable "dynamic prefixes" (name TBD); rbenv-install enables this flag by default.
  2. Memoize fetch_git so it only runs once per ruby-build invocation.
  3. Allow definitions to define a function that computes a "dynamic prefix." The function takes the basename of $PREFIX_PATH and returns a transformed basename. For dev definitions, this will mean calling fetch_git to find the revision, then replacing -dev with that revision.

hdgarrood pushed a commit to hdgarrood/ruby-build that referenced this pull request May 14, 2013
This is another method for fixing issues like rbenv#334 (where the downloaded
file is tar.bz2 but we're invoking `tar xzvf`).

Instead of relying on tar to do the compression format detection (as I
have in the other PR), this commit adds an extra optional argument to
install_package for specifying the filename extension. If omitted,
'tar.gz' is assumed. Currently only .tar.gz and .tar.bz2 are supported,
but it would be easy to add more -- see the new `extract` function.

I prefer this solution because it will work with GNU tar before version
1.15. I'm not sure if bsdtar implementations do the compression format
detection that newer GNU ones do, and if they have, how long they've
been doing so...

I also prefer it because downloaded tarballs are now given the correct
file extension (assuming the file definition is correct). So if
topaz-dev is downloaded but fails to install, manually debugging is
slightly less confusing.
@mislav
Copy link
Member

mislav commented Oct 23, 2013

What does this patch do? I'd like to avoid pulling it, if it's not terribly necessary. It adds some complex code.

@rubys
Copy link
Contributor Author

rubys commented Oct 23, 2013

I'll describe the root problem to be solved: if I build the HEAD/master version of Ruby 2.1.0 given day, and then repeat that a week or a month later, the results should be two versions of ruby, with distinct names.

Another way to describe this: ruby-2.1.0-dev is an inappropriate name for a rbenv version, it isn't precise in that two different machines could have two different versions of ruby by that name.

@mislav
Copy link
Member

mislav commented Sep 10, 2014

Hey @rubys, thanks for your work on this, but I'm dropping it.

  1. The code added is a bit scary, especially because our current code for fetching and building ruby is already getting a bit unwieldy and hard to grok for a first-timer.

  2. The outcome of a rbenv install or ruby-build operation should be predictable; i.e. you should know what directory/version name you're ending up with. After this change, installing a version to /path/to/2.1.0-dev would result in an actual directory named /path/to/2.1.0-{SHA}, which you can't predict and you must ls the parent directory after the operation to see what you ended up with. Moreover, if you accumulate multiple directories named in the /path/to/2.1.0-{SHA} format, you can't tell which one is the newest anyway.

  3. This should ideally get handled in user scripts that wrap ruby-build, e.g.:

    $ ruby-build 2.1.0-dev `rbenv root`/versions/ruby-2.1.0-dev-`date "+%Y.%m.%d"`
    

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

Successfully merging this pull request may close these issues.

5 participants