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

Feature Request: opm dist-install #39

Open
jvanasco opened this issue Nov 29, 2016 · 13 comments
Open

Feature Request: opm dist-install #39

jvanasco opened this issue Nov 29, 2016 · 13 comments

Comments

@jvanasco
Copy link
Contributor

jvanasco commented Nov 29, 2016

It would be nice if there were a way to install a dist file (as built by opm build)

  • It would be much easier for local testing by module authors, before uploading to server
  • It would allow for offline caching of dists, which is useful for testing and build scripts

It would also be nice if the output of opm build included the name of the distribution file that was just built.

i imagine the syntax could be something like:

 cd lua-resty-example
 opm build
 > found license: MIT license.
 > Package lua-resty-http-0.10 already installed.
 > a lua-resty-example-0.1
 > a lua-resty-example-0.1/dist.ini
 > a lua-resty-example-0.1/lib
 > a lua-resty-example-0.1/README.md
 > a lua-resty-example-0.1/lib/example
 > a lua-resty-example-0.1/lib/example/main.lua
 > Created distribution: lua-resty-example-0.1.tar.gz
 opm dist-install lua-resty-example-0.1.tar.gz
@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco Sounds good to me except that I don't like opm dist-install take any argument. Its usage should be similar to opm upload.

Pull requests welcome :)

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco After some thinking, it seems to me that it might be tricky to implement since it would require many more dependencies if we want to go through all the real processing details on the package server. "Slim clients" might no longer be possible after introducing this.

@jvanasco
Copy link
Contributor Author

@agentzh I don't think it should install any dependencies, just the declared package(s).

In one use case, I am porting something to opm. In order for me to test the distribution and make any necessary adjustments (based on how the opm client installs packages), I have to deploy the package to the opm repo then pull it back down. That means a non-functioning pre-release version can wind up distributed. If I were adjusting a deployed library, then I run the risk of people updating/installing a broken version of a once-working (and soon working again) library.

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco It would depend on util/opm-pkg-indexer.pl at least.

The following command should serve your purpose well already:

cd lua-resty-example-0.1 && opm server-build

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco BTW, it's not hard to set up your local opm server for testing. Everything is in the opm git repos.

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco Just remember to adjust your ~/.opmrc file to point to your local opm server during testing.

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco You'll also need to remember invoking util/opm-pkg-indexer.pl yourself after opm upload.

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

Another way to tackle this is to add support for "developer releases" by differentiating such releases via special version number suffixes like "_1" and "_2". By default, users cannot install such versions unless explicitly specify the version number in the opm get command line. Pull requests are welcome.

@jvanasco
Copy link
Contributor Author

I do think the easiest way is to just have a hook to install a given tarball into the site (or cwd or install-dir) using the existing infrastructure in the /bin/opm. I think I can pull this off (I haven't touched Perl in 10+ years)

The server-build is a great step for debugging (it raised some issues for me!), but it doesn't register in the local system.

hidden "developer versions" are great for a todo, but they wouldn't allow for offline development. that's kind of big for us -- we'd need to build/test locally, then hit the cloud.

running an OPM server might be an interim solution. i can see it as very useful for a full travis test. I'd really like to avoid that though, as it creates too many traps for people to fall into and use the wrong server.

let's see if i can pull anything off tonight!

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco Existing opm get hits the package server via HTTP or HTTPS. I don't want to add an artificial code path for opm dist-install which is not really realistic for your purposes anyway.

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco I just had another look. I now think dist-install has its own merit. The implementation should be simple, just wrap up the following operation sequence:

opm build
cd $dist-$version/
opm server-build
install $dist-$version.opm.tar.gz

The last step can reuse the code starting from the following line:

https://github.com/openresty/opm/blob/master/bin/opm#L1348

We do not need to re-invent anything here. Just some code refactoring in the opm script.

@agentzh
Copy link
Member

agentzh commented Nov 29, 2016

@jvanasco Pull requests are very welcome.

@jvanasco
Copy link
Contributor Author

I will have the first suggestion of a PR shortly.

The above functionality is working as build-install; I've also standardized some of the variable names so this package is easier to maintain.

I'm just cleaning up my work right now.

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

2 participants