lfe-deprecated / lfetool

DEPRECATED - See:
https://github.com/lfe-rebar3/
Other
61 stars 19 forks source link

Working with versioned deps can be a nightmare #135

Open oubiwann opened 9 years ago

oubiwann commented 9 years ago

This is a pretty big issue, and one that really needs to have some discussion on the mail list. However, I want to record it here so we don't lose track of it.

The versioning of LFE-based projects in their respective rebar.config files was solely focused on providing a development environment where updates in one project -- even breaking ones -- would not disturb developers of other projects.

The solution to that problem resulted in something that's fairly rigid, and having worked with Docker to create a custom app based on @rvirding's latest work in the develop branch, I had to essentially gut the rebar.config files for each of the deps and manually include them in the sample project.

There has got to be a better way.

I'll bring this up on the mail list ...

oubiwann commented 9 years ago

There is a good conversation in issue #111 that relates to this.

oubiwann commented 9 years ago

In issue #111, @rvirding made a request about addressing this issue, in particular asking if we could have options in lfetool that would allow users to override the default version-pinning (both in the generated projects, as well as in the deps of those generated projects).

It would be fairly easy to implement this if the following rebar issue was fixed:

However, it may be a while before that happens. We may have to work around rebar, as I said in my reply to Robert:

There are a couple of things that come to mind ... but I think we'd have to:

  • provide a way of indicating to lfetool that a project should not use the default, version-pinned rebar deps, and
  • get the deps to also ignore their own version-pinned deps

I'm not sure if this can be done within the confines of rebar's current feature set. We may have to implement this with bash, LFE, or Erlang.

oubiwann commented 9 years ago

Hrm, working on a rebar work-around for over-riding the default could be the first steps towards addressing this feature request:

lfetool could parse an lfe.config file that has a top-evel entry for deps like the rebar.config deps. If defined here, it could override rebar. For now, it would only support a minimal structure (nothing like the varieties of options that rebar allows in its deps. The simplest form of deps support in rebar (beside the empty list, of course) is just a list of project name atoms, e.g. [lfe, lutil, ltest, yaws].

Hrm, I guess we'd need to support [{lfe, "master"}, ...] so users could select which branch to use.

oubiwann commented 9 years ago

I'm working on a draft of this idea with the following:

oubiwann commented 9 years ago

So how this might work:

This will allow for the following scenarios:

So in the end, nothing really has to be changed for the end users and no crazy options need to be added to lfetool. Things will continue working as they have been.

But should a user want to override versions of deps, they just need to create anlfe.config file and keep using the updated make targets or use the lfetool download deps command.

oubiwann commented 9 years ago

Note to self: lfetool calls to rebar should remember Windows:

which rebar.cmd >/dev/null 2>&1 && rebar.cmd get-deps || rebar get-deps
oubiwann commented 9 years ago

Okay, I've got a very early implementation of the lfetool download deps command in place.

The command is documented here:

Testing Plan

I need to do a bunch of testing with it:

Notes for Testing

lfe.config

./lfe.config file for testing:

#(project (#(deps (#("rvirding/lfe" "develop")))))

Docker

Debian and Ubuntu Container Setup

Host:

$ docker run -t -i debian /bin/bash

Guest:

$ apt-get update && apt-get install -y \
    libpam0g-dev erlang git curl build-essential

CentOS Container Setup

Host:

$ docker run -t -i centos /bin/bash

Guest:

$ rpm -Uvh \
http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
$ yum -y groupinstall 'Development Tools' && \
  yum -y install wget erlang pam-devel

Setup for All Containers

rebar
$ curl -L -o /usr/local/bin/rebar \
    https://github.com/rebar/rebar/releases/download/2.5.1/rebar
$ chmod 755 /usr/local/bin/rebar
lfetool

The installation for lfetool on these Docker images:

$ curl -L -o ./lfetool \
    https://raw.github.com/lfe/lfetool/dev-v1/lfetool
$ bash ./lfetool install
$ lfetool -x

Testing for All Containers

$ lfetool new library lib-1
$ cd lib-1
$ make get-version; rm -rf deps/lfe
$ echo '#(project (#(deps (#("rvirding/lfe" "develop")))))' > lfe.config
$ make check; make get-version
$ cd ..
$ lfetool new yaws bootstrap web-1
$ cd web-1
$ make get-version; rm -rf deps/lfe
$ echo '#(project (#(deps (#("rvirding/lfe" "develop")))))' > lfe.config
$ make check; make get-version

Note that if you get a project creation failure (e.g., dependencies not found), try again:

$ rm -rf lib-1
$ lfetool new library lib-1

or

$ lfetool new library lib-2