Skip to content
Browse files

Add AGNER_PACKAGE_NAME and AGNER_PACKAGE_VERSION environment variable…

…s for build & install commands
  • Loading branch information...
1 parent 376e447 commit 85fe0c8ec354e41f901f831c9a1275e4c951f516 @yrashk yrashk committed Feb 7, 2011
Showing with 10 additions and 2 deletions.
  1. +2 −0 CONTRIBUTING.md
  2. +8 −2 src/agner_fetch.erl
View
2 CONTRIBUTING.md
@@ -60,6 +60,8 @@ Here's the current list of environmentvariables that will be available to build
* AGNER -- Absolute path to the agner script file
* AGNER_PREFIX -- Root agner's directory (defaults to `/usr/local/agner`)
* AGNER_PACKAGE_REPO -- Path to checked out .agner repo
+* AGNER_PACKAGE_NAME -- Name of the package
+* AGNER_PACKAGE_VERSION -- Version of the package
* AGNER_INSTALL_PREFIX -- A place where install procedure should consider putting installable files to. Right now it equates to
`AGNER_PREFIX/agner/packages/<package_name>-<package_version>`
View
10 src/agner_fetch.erl
@@ -432,7 +432,10 @@ rebar(#opts_rec{ spec = {spec, Spec}, directory = Directory }) ->
ignore
end.
-build_command(#opts_rec{ spec = {spec, Spec}, directory = Directory, quiet = Quiet } = Opts) ->
+build_command(#opts_rec{ spec = {spec, Spec}, directory = Directory, quiet = Quiet, package = Package, version = Version } = Opts) ->
+ os:putenv("AGNER_PACKAGE_NAME", Package),
+ os:putenv("AGNER_PACKAGE_VERSION", Version),
+
case proplists:get_value(build_command, Spec) of
undefined ->
case proplists:get_value(rebar_compatible, Spec, false) of
@@ -473,7 +476,10 @@ add_path(#opts_rec{ addpath = false }) ->
ignore.
-install_command(#opts_rec{ spec = {spec, Spec}, directory = Directory, quiet = Quiet } = Opts) ->
+install_command(#opts_rec{ spec = {spec, Spec}, directory = Directory, quiet = Quiet, package = Package, version = Version } = Opts) ->
+ os:putenv("AGNER_PACKAGE_NAME", Package),
+ os:putenv("AGNER_PACKAGE_VERSION", Version),
+
filelib:ensure_dir(filename:join([os:getenv("AGNER_PREFIX"),"packages"]) ++ "/"),
InstallPrefix = set_install_prefix(Opts),
os:cmd("rm -rf " ++ InstallPrefix),

0 comments on commit 85fe0c8

Please sign in to comment.
Something went wrong with that request. Please try again.