Guys,

 This is the patch for local repo support. I am pushing out a new
version in the morning (all the work is done! woot). You will need to
delete the _build directory in your projects to use this new version
however.

Thanks,
 Eric

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlware-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlware-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

From db532c9940083cf71b67266ae5479392a024cb42 Mon Sep 17 00:00:00 2001
From: Eric Merritt <[EMAIL PROTECTED]>
Date: Sat, 6 Dec 2008 21:53:14 -0600
Subject: [sinan PATCH] Use local erlware repository

---
 bin/sinan                                |    2 +-
 bin/sinserv                              |    4 +-
 server/sinan/ebin/sinan.app              |    5 +-
 server/sinan/src/sin_app.erl             |    1 -
 server/sinan/src/sin_depends.erl         |  134 ++++++++++++----
 server/sinan/src/sin_depends_check.erl   |  253 ------------------------------
 server/sinan/src/sin_dist_builder.erl    |    7 +-
 server/sinan/src/sin_edoc.erl            |   13 +--
 server/sinan/src/sin_erl_builder.erl     |   85 ++++-------
 server/sinan/src/sin_release_builder.erl |   10 +-
 server/sinan/src/sin_repo_fetcher.erl    |  143 -----------------
 server/sinan/src/sin_test.erl            |    2 +-
 support/build.py                         |   61 +-------
 support/run                              |    2 +-
 14 files changed, 155 insertions(+), 567 deletions(-)
 delete mode 100644 server/sinan/src/sin_depends_check.erl
 delete mode 100644 server/sinan/src/sin_repo_fetcher.erl

diff --git a/bin/sinan b/bin/sinan
index cfb6915..0354357 100755
--- a/bin/sinan
+++ b/bin/sinan
@@ -3,7 +3,7 @@
 
 #### Fill in values for these variables ####
 REL_NAME=sinan
-REL_VSN=0.11.0.0
+REL_VSN=0.12.0.0
 ###########################################
 
 PROG=$0
diff --git a/bin/sinserv b/bin/sinserv
index 3da5538..a6e3796 100755
--- a/bin/sinserv
+++ b/bin/sinserv
@@ -9,7 +9,7 @@ mkdir -p $CONFIGDIR
 
 #### Fill in values for these variables ####
 REL_NAME=sinan
-REL_VSN=0.11.0.0
+REL_VSN=0.12.0.0
 ERTS_VSN=5.6.3
 INVOCATION_SUFFIX=""
 ###########################################
@@ -23,7 +23,7 @@ if [ ! -f $CONFIGFILE ]; then
 
 echo " [{kernel, [{error_logger, {file, \"$LOGDIR/kernel.log\"}}]}, \
 {sasl,[{sasl_error_logger, {file, \"$LOGDIR/sasl.log\"}}]},
-{sinan, [{prefix, \"$PREFIX\"}]}]." > $CONFIGFILE
+{sinan, [{prefix, \"$PREFIX\"}, {erts_version, \"$ERTS_=VSN\"}]}]." > $CONFIGFILE
 
 
 fi
diff --git a/server/sinan/ebin/sinan.app b/server/sinan/ebin/sinan.app
index c94da95..e5c13e1 100644
--- a/server/sinan/ebin/sinan.app
+++ b/server/sinan/ebin/sinan.app
@@ -2,20 +2,20 @@
 
 {application, sinan,
  [{description, "Build system for erlang"},
-  {vsn, "0.10.0.14"},
+  {vsn, "0.11.0.0"},
   {modules, [sinan,
              sin_edoc,
              sin_shell,
              sin_config_registry,
              sin_config_sup,
              sin_build_config,
-             sin_repo_fetcher,
              sin_wip,
              sin_utils,
              sin_clean,
              sin_depends,
              sin_sig,
              sin_gen,
+	     sin_resolver,
              sin_skel,
              sin_config_parser,
              sin_group_leader,
@@ -32,7 +32,6 @@
              sin_app,
              sin_sup,
              sin_help,
-             sin_depends_check,
              sin_version]},
   {registered, [sin_sup]},
   {versioned_dependencies, [{ibrowse, "1.2.4.1", gte},
diff --git a/server/sinan/src/sin_app.erl b/server/sinan/src/sin_app.erl
index f2adcaa..90e6136 100644
--- a/server/sinan/src/sin_app.erl
+++ b/server/sinan/src/sin_app.erl
@@ -100,7 +100,6 @@ register_tasks() ->
     sin_help:start(),
     sin_version:start(),
     sin_depends:start(),
-    sin_depends_check:start(),
     sin_test:start(),
     sin_release_builder:start(),
     sin_dist_builder:start().
diff --git a/server/sinan/src/sin_depends.erl b/server/sinan/src/sin_depends.erl
index ccca6f9..19dd0e5 100644
--- a/server/sinan/src/sin_depends.erl
+++ b/server/sinan/src/sin_depends.erl
@@ -81,46 +81,114 @@ do_task(BuildRef) ->
 %% @end
 %%--------------------------------------------------------------------
 depends(BuildRef) ->
-    ProjectApps = gather_project_apps(BuildRef),
+    BuildDir = sin_build_config:get_value(BuildRef, "build.dir"),
+    AppBDir = filename:join([BuildDir, "apps"]),
+    ProjectApps = gather_project_apps(BuildRef, AppBDir),
     sin_build_config:store(BuildRef, "project.apps", ProjectApps),
-    Repos = sin_build_config:get_value(BuildRef, "repositories"),
-    case catch ewr_depends:
-               check_project_dependencies(Repos,
-                                          ProjectApps,
-                                          get_supplimental(BuildRef)) of
-               {dependency_resolution_error, Reason} ->
-                 ?ETA_RAISE_D(dependency_issue, Reason);
-               dependency_resolution_error ->
-                 ?ETA_RAISE(dependency_issue);
-               {error, Reason} ->
-                 ?ETA_RAISE_D(dependency_issue, Reason);
-               {'EXIT', Reason} ->
-                 ?ETA_RAISE_DA(dependency_issue,
-                               "'EXIT': ~p~n", [Reason]);
-               AllDeps ->
-                 sin_build_config:store(BuildRef, "project.deps", AllDeps),
-                 sin_repo_fetcher:fetch(?TASK, BuildRef, ProjectApps, AllDeps),
-                 save_deps(BuildRef, AllDeps),
-                 update_sigs(BuildRef)
-
-         end.
+    Prefix = get_application_env(prefix),
+    ErtsVersion = get_application_env(erts_version),
+    AllDeps = check_project_dependencies(Prefix,
+					 ErtsVersion,
+					 ProjectApps,
+					 get_supplimental(BuildRef,
+							  Prefix,
+							  ErtsVersion)),
+    sin_build_config:store(BuildRef, "project.deps", AllDeps),
+    sin_build_config:store(BuildRef, "project.repoapps", AllDeps),
+    save_deps(BuildRef, AllDeps),
+    update_sigs(BuildRef).
 
 %%====================================================================
 %% Internal functions
 %%====================================================================
 %%--------------------------------------------------------------------
 %% @doc
+%%  Get an enviroment variable, throw error if unavailable.
+%% @spec (Key) -> Value
+%% @end
+%%--------------------------------------------------------------------
+get_application_env(Key) ->
+    case application:get_env(sinan, Key) of
+	{ok, Value} ->
+	    Value;
+	_ ->
+	     ?ETA_RAISE_DA(variables_not_set,
+			   "Key ~w not set, must be set as application"
+			   " environment variable ", [Key])
+    end.
+
+%%--------------------------------------------------------------------
+%% @doc
+%%  Parse the app description into a format consumable by the
+%%  deps engine.
+%% @spec preformat_version_data(AppInfo, Acc) -> {Deps, Pkg, Vsns}
+%% @end
+%%--------------------------------------------------------------------
+check_project_dependencies(Prefix,
+			   ErtsVersion,
+			   [{_, _, Deps, _} | ProjectApps], Acc) ->
+    Acc2 = resolve_project_dependencies(Prefix, ErtsVersion, Deps,
+				       Acc),
+    check_project_dependencies(Prefix,
+			       ErtsVersion,
+			       ProjectApps,
+			       Acc2);
+check_project_dependencies(_,
+			   _,
+			   [],
+			   Acc) ->
+    Acc.
+
+resolve_project_dependencies(Prefix,
+			      ErtsVersion,
+			      [Dep | Deps], Acc) ->
+     case already_resolved(Dep, Acc) of
+	 false ->
+	     [Version | _] = sin_resolver:package_versions(Prefix,
+							   ErtsVersion,
+							   Dep),
+	     NDeps = sin_resolver:package_dependencies(Prefix,
+						       ErtsVersion,
+						       Dep,
+						       Version),
+	     Location = sin_resolver:find_package_location(Prefix,
+							   ErtsVersion,
+							   Dep,
+							   Version),
+	     resolve_project_dependencies(Prefix, ErtsVersion, Deps ++ NDeps,
+					  [{Dep, Version, NDeps, Location} |
+					   Acc]);
+	 true ->
+	     resolve_project_dependencies(Prefix, ErtsVersion, Deps,
+					 Acc)
+    end;
+resolve_project_dependencies(_, _, [], Acc) ->
+    Acc.
+
+
+already_resolved(Dep, [{Dep, _, _, _} | _]) ->
+    true;
+already_resolved(Dep, [_ | Rest]) ->
+    already_resolved(Dep,  Rest);
+already_resolved(_, []) ->
+    false.
+
+%%--------------------------------------------------------------------
+%% @doc
 %%  Add the latest version of eunit to the dependency list.
 %% @spec (BuildRef) -> SupplimentalInformation
 %% @end
 %% @private
 %%--------------------------------------------------------------------
-get_supplimental(BuildRef) ->
+get_supplimental(BuildRef, Prefix, ErtsVersion) ->
     case sin_build_config:get_value(BuildRef, "eunit") of
         "disable" ->
             [];
         _ ->
-            [{eunit, []}]
+	    resolve_project_dependencies(Prefix,
+					 ErtsVersion,
+					 [eunit], [])
+
     end.
 
 
@@ -177,11 +245,12 @@ save_repo_apps(BuildRef, BuildDir) ->
 %% @end
 %% @private
 %%-------------------------------------------------------------------
-gather_project_apps(BuildRef) ->
+gather_project_apps(BuildRef, AppBDir) ->
     gather_project_apps(BuildRef,
+			AppBDir,
                         sin_build_config:get_value(BuildRef, "project.applist"), []).
 
-gather_project_apps(BuildRef, [AppName | T], Acc) ->
+gather_project_apps(BuildRef, AppBDir, [AppName | T], Acc) ->
     Vsn = sin_build_config:get_value(BuildRef, "apps." ++ AppName ++ ".vsn"),
     Name = sin_build_config:get_value(BuildRef,
                                       "apps." ++ AppName ++ ".name"),
@@ -192,15 +261,16 @@ gather_project_apps(BuildRef, [AppName | T], Acc) ->
                                            "apps." ++ AppName ++
                                             ".included_applications"),
 
-    VersionedDeps = sin_build_config:get_value(BuildRef,
-                                          "apps." ++ AppName ++
-                                           ".versioned_dependencies"),
-    NDeps = {merge(OpenDeps, IncludedDeps), VersionedDeps},
+    NDeps = merge(OpenDeps, IncludedDeps),
+
+    BuildTarget = lists:flatten([atom_to_list(Name), "-", Vsn]),
+    AppPath = filename:join([AppBDir, BuildTarget]),
 
     sin_build_config:store(BuildRef, "apps." ++ AppName ++ ".deps", NDeps),
 
-    gather_project_apps(BuildRef, T, [{Name, Vsn, NDeps} | Acc]);
-gather_project_apps(_BuildRef, [], Acc) ->
+    gather_project_apps(BuildRef, AppBDir, T,
+			[{Name, Vsn, NDeps, AppPath} | Acc]);
+gather_project_apps(_, _, [], Acc) ->
     Acc.
 
 
diff --git a/server/sinan/src/sin_depends_check.erl b/server/sinan/src/sin_depends_check.erl
deleted file mode 100644
index c72d9fb..0000000
--- a/server/sinan/src/sin_depends_check.erl
+++ /dev/null
@@ -1,253 +0,0 @@
-%% -*- mode: Erlang; fill-column: 132; comment-column: 118; -*-
-%%%-------------------------------------------------------------------
-%%% Copyright (c) 2006, 2007 Erlware
-%%%
-%%% Permission is hereby granted, free of charge, to any
-%%% person obtaining a copy of this software and associated
-%%% documentation files (the "Software"), to deal in the
-%%% Software without restriction, including without limitation
-%%% the rights to use, copy, modify, merge, publish, distribute,
-%%% sublicense, and/or sell copies of the Software, and to permit
-%%% persons to whom the Software is furnished to do so, subject to
-%%% the following conditions:
-%%%
-%%% The above copyright notice and this permission notice shall
-%%% be included in all copies or substantial portions of the Software.
-%%%
-%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-%%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-%%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-%%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-%%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-%%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-%%% OTHER DEALINGS IN THE SOFTWARE.
-%%%---------------------------------------------------------------------------
-%%% @author Eric Merritt
-%%% @doc
-%%%  Checks that dependencies are acceptable. If dependencies have been
-%%%  generated. If they have not it asks the user if he wants to run them.
-%%%  If the answer is affermative then he runs depends. If not he errors out.
-%%% @end
-%%% @copyright (C) 2007, Erlware
-%%%---------------------------------------------------------------------------
--module(sin_depends_check).
-
--behaviour(eta_gen_task).
-
--include("etask.hrl").
-
-%% API
--export([start/0, do_task/1, check_depends/1]).
-
--define(TASK, check_depends).
--define(DEPS, []).
-
-%%====================================================================
-%% API
-%%====================================================================
-%%--------------------------------------------------------------------
-%% @doc
-%% Starts the server
-%% @spec start() -> ok
-%% @end
-%%--------------------------------------------------------------------
-start() ->
-    Desc = "Checks that dependencies have been run.  "
-        "If dependencies have not been run attempts to "
-        "run depends task",
-    TaskDesc = #task{name = ?TASK,
-                     task_impl = ?MODULE,
-                     deps = ?DEPS,
-                     desc = Desc,
-                     callable = true,
-                     opts = []},
-    eta_task:register_task(TaskDesc).
-
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  dO the task defined in this module.
-%% @spec (BuildRef) -> ok
-%% @end
-%%--------------------------------------------------------------------
-do_task(BuildRef) ->
-    check_depends(BuildRef).
-
-
-%%====================================================================
-%%% Internal functions
-%%====================================================================
-%%--------------------------------------------------------------------
-%% @doc
-%%  Run the check_depends task.
-%%
-%% @spec (BuildRef) -> ok
-%% @end
-%%--------------------------------------------------------------------
-check_depends(BuildRef) ->
-    eta_event:task_start(BuildRef, ?TASK),
-    ProjectApps = gather_project_apps(BuildRef),
-    sin_build_config:store(BuildRef, "project.apps", ProjectApps),
-    case needs_verify(BuildRef) of
-        true ->
-            interactive_check(BuildRef);
-        false ->
-            load_deps(BuildRef),
-            ok
-    end,
-    eta_event:task_stop(BuildRef, ?TASK).
-
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  Do an interactive check to ask if dependency information should be checked.
-%% @spec (BuildRef) -> ok
-%% @end
-%%--------------------------------------------------------------------
-interactive_check(BuildRef) ->
-    case sin_build_config:get_value(BuildRef, "task.depends.no_remote") of
-        "True" ->
-            load_deps(BuildRef);
-        "true" ->
-            load_deps(BuildRef);
-        "t" ->
-            load_deps(BuildRef);
-        "T" ->
-            load_deps(BuildRef);
-        _ ->
-            sin_depends:depends(BuildRef)
-    end.
-
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  Load dependency information from the file system and store it
-%%  where needed.
-%% @spec (BuildRef) -> ok
-%% @end
-%%--------------------------------------------------------------------
-load_deps(BuildRef) ->
-    BuildDir = sin_build_config:get_value(BuildRef, "build.dir"),
-    Depsf = filename:join([BuildDir, "info", "deps"]),
-    case file:consult(Depsf) of
-        {ok, [AllDeps]} ->
-            sin_build_config:store(BuildRef, "project.deps", AllDeps);
-        {ok, _Else} ->
-            eta_event:task_fault(BuildRef, {"Dependency information exists but seems to "
-                                            "be in a strange format (~s)", [Depsf]}),
-            throw(unable_to_read_deps_info);
-        {error, _} ->
-            eta_event:task_fault(BuildRef,
-                                 {"Unable to read stored dependency information "
-                                  "from file ~s", [Depsf]}),
-            throw(unable_to_read_deps_info)
-    end,
-    load_repo_apps(BuildRef, BuildDir).
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  Load the repo apps info from the file system.
-%% @spec (BuildRef, BuildDir) -> ok
-%% @end
-%%--------------------------------------------------------------------
-load_repo_apps(BuildRef, BuildDir) ->
-    Repsf = filename:join([BuildDir, "info", "repoapps"]),
-    case file:consult(Repsf) of
-        {ok, [Reps]} ->
-            sin_build_config:store(BuildRef, "project.repoapps", Reps);
-        {ok, _Else} ->
-            eta_event:task_fault(BuildRef, ?TASK, {"The repo application list exists but seems to "
-                                                  "be in a strange format (~s)", [Repsf]}),
-            throw(unable_to_read_deps_info);
-        {error, _} ->
-            ewl_event:task_fault(BuildRef, ?TASK, {"Unable to read stored repo application information "
-                                                   "from file ~s", [Repsf]}),
-            throw(unable_to_read_deps_info)
-    end.
-
-
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  Check to see if we need to do a dependency verification.
-%% @spec (BuildRef) -> true | false
-%% @end
-%% @private
-%%--------------------------------------------------------------------
-needs_verify(BuildRef) ->
-    BuildConfig = sin_build_config:get_value(BuildRef, "build.config"),
-    BuildDir = sin_build_config:get_value(BuildRef, "build.dir"),
-    case sin_sig:changed("dep", BuildDir, BuildConfig) of
-        true ->
-            sin_sig:update("dep", BuildDir, BuildConfig),
-            true;
-        false ->
-            verify_app_list(BuildRef, BuildDir,
-                            sin_build_config:get_value(BuildRef, "project.applist"))
-    end.
-
-%%--------------------------------------------------------------------
-%% @doc
-%%   Verify that the *.app files are unchanged.
-%% @spec (BuildRef, BuildDir, AppList) -> true | false
-%% @end
-%% @private
-%%--------------------------------------------------------------------
-verify_app_list(BuildRef, BuildDir, [H | T]) ->
-    App = sin_build_config:get_value(BuildRef, "apps." ++ H ++ ".dotapp"),
-    case sin_sig:changed("dep", BuildDir, App) of
-        true ->
-            true;
-        false ->
-            verify_app_list(BuildRef, BuildDir, T)
-    end;
-verify_app_list(_BuildRef, _BuildDir, []) ->
-    false.
-
-%%-------------------------------------------------------------------
-%% @doc
-%%   Roll through the list of project apps and gather the app
-%%   name and version number.
-%% @spec (BuildRef) -> ListOfAppVsn
-%% @end
-%% @private
-%%-------------------------------------------------------------------
-gather_project_apps(BuildRef) ->
-    gather_project_apps(BuildRef,
-                        sin_build_config:get_value(BuildRef, "project.applist"), []).
-
-gather_project_apps(BuildRef, [AppName | T], Acc) ->
-    Vsn = sin_build_config:get_value(BuildRef, "apps." ++ AppName ++ ".vsn"),
-    Name = sin_build_config:get_value(BuildRef,
-                                      "apps." ++ AppName ++ ".name"),
-    OpenDeps = sin_build_config:get_value(BuildRef,
-                                       "apps." ++ AppName ++
-                                        ".applications"),
-    IncludedDeps = sin_build_config:get_value(BuildRef,
-                                           "apps." ++ AppName ++
-                                            ".included_applications"),
-
-    VersionedDeps = sin_build_config:get_value(BuildRef,
-                                          "apps." ++ AppName ++
-                                           ".versioned_dependencies"),
-    NDeps = {merge(OpenDeps, IncludedDeps), VersionedDeps},
-
-    sin_build_config:store(BuildRef, "apps." ++ AppName ++ ".deps", NDeps),
-
-    gather_project_apps(BuildRef, T, [{Name, Vsn, NDeps} | Acc]);
-gather_project_apps(_BuildRef, [], Acc) ->
-    Acc.
-
-
-%%--------------------------------------------------------------------
-%% @doc
-%%   Merge the two types of deps removing duplicates.
-%% @spec (OpenDeps, IncludedDeps) -> MergedList
-%% @end
-%%--------------------------------------------------------------------
-merge(OpenDeps, undefined) ->
-    OpenDeps;
-merge(OpenDeps, IncludedDeps) ->
-    lists:umerge(lists:sort(OpenDeps), lists:sort(IncludedDeps)).
-
diff --git a/server/sinan/src/sin_dist_builder.erl b/server/sinan/src/sin_dist_builder.erl
index e6dc632..5b97bf8 100644
--- a/server/sinan/src/sin_dist_builder.erl
+++ b/server/sinan/src/sin_dist_builder.erl
@@ -189,13 +189,10 @@ copy_additional_dirs(BuildRef, TopLevel, ProjectDir) ->
 %% @spec (LibDir, AppDir, DirList, Acc) -> TarablePairs
 %% @end
 %%--------------------------------------------------------------------
-gather_dirs(LibDir, RepoDir, [{AppName, Vsn, _} | T], Acc) ->
-    gather_dirs(LibDir, RepoDir, [{AppName, Vsn} | T], Acc);
-gather_dirs(LibDir, RepoDir, [{AppName, Vsn} | T], Acc) ->
+gather_dirs(LibDir, RepoDir, [{AppName, Vsn, _, Path} | T], Acc) ->
     DirName = lists:flatten([atom_to_list(AppName), "-", Vsn]),
-    Name = filename:join([RepoDir, DirName]),
     NewName = filename:join([LibDir, DirName]),
-    gather_dirs(LibDir, RepoDir, T, [{Name, NewName} | Acc]);
+    gather_dirs(LibDir, RepoDir, T, [{Path, NewName} | Acc]);
 gather_dirs(_, _, [], Acc) ->
     Acc.
 
diff --git a/server/sinan/src/sin_edoc.erl b/server/sinan/src/sin_edoc.erl
index a673a50..35c6eae 100644
--- a/server/sinan/src/sin_edoc.erl
+++ b/server/sinan/src/sin_edoc.erl
@@ -100,20 +100,13 @@ doc(BuildRef) ->
 %% @spec (BuildRef, AppList) -> ok
 %% @end
 %%--------------------------------------------------------------------
-run_docs(BuildRef, [{AppName, _, _} | T]) ->
-    LAppName = atom_to_list(AppName),
-    AppDir = sin_build_config:get_value(BuildRef, "apps." ++
-                                        LAppName ++
-                                        ".basedir"),
-    AppBuildDir = sin_build_config:get_value(BuildRef, "apps." ++
-                                             LAppName ++
-                                             ".builddir"),
-    DocDir = filename:join([AppBuildDir, "docs"]),
+run_docs(BuildRef, [{AppName, _, _, Path} | T]) ->
+    DocDir = filename:join([Path, "docs"]),
     filelib:ensure_dir(filename:join([DocDir, "tmp"])),
 
     try
     edoc:application(AppName,
-                     AppDir,
+                     Path,
                      [{dir, DocDir}]) catch
                                _:Error ->
                                    Error
diff --git a/server/sinan/src/sin_erl_builder.erl b/server/sinan/src/sin_erl_builder.erl
index 4725361..5b39215 100644
--- a/server/sinan/src/sin_erl_builder.erl
+++ b/server/sinan/src/sin_erl_builder.erl
@@ -47,11 +47,10 @@
                apps_build_dir,
                sig_dir,
                app_list,
-               deps,
-               repo}).
+               deps}).
 
 -define(TASK, build).
--define(DEPS, [check_depends]).
+-define(DEPS, [depends]).
 
 
 
@@ -114,7 +113,7 @@ build(BuildRef) ->
 %%--------------------------------------------------------------------
 reorder_apps_according_to_deps(AllApps) ->
     ReOrdered = lists:foldr(
-		  fun ({App, _, {Deps, _}}, Acc) ->
+		  fun ({App, _, Deps, _}, Acc) ->
 			  case map_deps(App, Deps, AllApps) of
 			      [] ->
 				  [{'NONE', to_list(App)} | Acc];
@@ -177,14 +176,12 @@ build_apps(BuildRef, Apps, Args) ->
     BuildDir = sin_build_config:get_value(BuildRef, "build.dir"),
     AppBDir = filename:join([BuildDir, "apps"]),
     SigDir = filename:join([BuildDir, "sigs"]),
-    Repo = sin_build_config:get_value(BuildRef, "project.repository"),
     build_apps(BuildRef, #env{project_dir=ProjectDir,
                               build_dir=BuildDir,
                               apps_build_dir=AppBDir,
                               sig_dir=SigDir,
                               app_list=AppList,
-                              deps=Deps,
-                              repo=Repo},
+                              deps=Deps},
                Apps, Args).
 
 
@@ -272,20 +269,9 @@ setup_code_path(BuildRef, Env, AppName) ->
                          "App ~s is not in the list of project apps. "
                          "This shouldn't happen!!",
                          [AppName]);
-        {_, _, {Deps, _}} ->
-            case sin_build_config:get_value(BuildRef, "eunit") of
-                "disabled" ->
-                    extract_info_from_deps(BuildRef, Deps, Env#env.app_list,
-                                           Env#env.repo,
-                                           Env#env.apps_build_dir,
-                                           Env#env.deps, [], []);
-                _ ->
-                    extract_info_from_deps(BuildRef, [eunit | Deps],
-                                           Env#env.app_list, Env#env.repo,
-                                           Env#env.apps_build_dir,
-                                           Env#env.deps, [], [])
-                end
-    end.
+        {_, _, Deps, _} ->
+	    extract_info_from_deps(BuildRef, Deps, Env#env.deps, [], [], [])
+	end.
 
 %%--------------------------------------------------------------------
 %% @doc
@@ -295,41 +281,30 @@ setup_code_path(BuildRef, Env, AppName) ->
 %% @end
 %% @private
 %%--------------------------------------------------------------------
-extract_info_from_deps(BuildRef, [App | T], AppList, Repo,
-                       AppBDir, Deps, Acc, IAcc) ->
-    BuildTarget = lists:flatten([atom_to_list(App), "-", get_vsn(App, Deps)]),
-    case lists:keymember(App, 1, AppList) of
-        true ->
-            Ebin = filename:join([AppBDir, BuildTarget, "ebin"]),
-            Include = {i, filename:join([AppBDir, BuildTarget, "include"])};
-        false ->
-            Ebin = filename:join([Repo, BuildTarget, "ebin"]),
-            Include = {i, filename:join([Repo, BuildTarget, "include"])}
-    end,
-    code:add_patha(Ebin),
-    extract_info_from_deps(BuildRef, T, AppList, Repo, AppBDir, Deps, [Ebin | Acc],
-                           [Include | IAcc]);
-extract_info_from_deps(_, [], _AppList, _Repo, _AppBDir, _Deps, Acc, IAcc) ->
-    {Acc, IAcc}.
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  Get the version for the app.
-%% @spec (AppName, DepList) -> Vsn
-%% @end
-%% @private
-%%--------------------------------------------------------------------
-
-get_vsn(App, DepList) ->
-    case lists:keysearch(App, 1, DepList) of
-	{value,{App, Vsn}} ->
-	    Vsn;
+extract_info_from_deps(BuildRef, [AppName | T], AppList, Marked, Acc, IAcc) ->
+    case lists:member(AppName, Marked) of
 	false ->
-	    ?ETA_RAISE_DA(miss_app,
-			  "Unable to get the version for ~w. This "
-			  "shouldn't happen!",
-			  [App])
-    end.
+	    case get_app_from_list(AppName, AppList) of
+		not_in_list ->
+		    ?ETA_RAISE_DA(app_name_not_in_list,
+				  "App ~s is not in the list of project apps. "
+				  "This shouldn't happen!!",
+				  [AppName]);
+		{_, _, Deps, Path} ->
+		    Ebin = filename:join([Path, "ebin"]),
+		    Include = {i, filename:join([Path, "include"])},
+		    code:add_patha(Ebin),
+		    extract_info_from_deps(BuildRef, T, AppList ++ Deps,
+					   Marked,
+					   [Ebin | Acc],
+					   [Include | IAcc])
+	    end;
+	true ->
+	    extract_info_from_deps(BuildRef, T, AppList, Marked, Acc,
+				   IAcc)
+    end;
+extract_info_from_deps(_, [], _, _, Acc, IAcc) ->
+    {Acc, IAcc}.
 
 %%--------------------------------------------------------------------
 %% @doc
diff --git a/server/sinan/src/sin_release_builder.erl b/server/sinan/src/sin_release_builder.erl
index de17075..042ff71 100644
--- a/server/sinan/src/sin_release_builder.erl
+++ b/server/sinan/src/sin_release_builder.erl
@@ -160,7 +160,7 @@ project_name(BuildRef) ->
 %% @end
 %% @private
 %%--------------------------------------------------------------------
-process_deps(BuildRef, [{App, Vsn} | T], Acc) ->
+process_deps(BuildRef, [{App, Vsn, _, _} | T], Acc) ->
     NewApp = stringify(App),
     case {sin_build_config:get_value(BuildRef,
                                      "project.release." ++ NewApp ++ ".type"),
@@ -327,16 +327,14 @@ get_code_paths(BuildRef) ->
     ProjApps = sin_build_config:get_value(BuildRef, "project.apps"),
     ProjPaths = lists:merge(
                   lists:map(
-                    fun({App, _, _}) ->
+                    fun({App, _, _, _}) ->
                             sin_build_config:get_value(BuildRef,
                                             "apps." ++ atom_to_list(App) ++
                                               ".code_paths")
                     end, ProjApps)),
-    RepoDir = sin_build_config:get_value(BuildRef, "project.repository"),
     RepoPaths = lists:map(
-                  fun ({App, Vsn}) ->
-                          Dir = lists:flatten([atom_to_list(App), "-", Vsn]),
-                          filename:join([RepoDir, Dir, "ebin"])
+                  fun ({App, Vsn, _, Path}) ->
+                          filename:join([Path, "ebin"])
                   end, sin_build_config:get_value(BuildRef, "project.repoapps")),
     lists:merge([ProjPaths, RepoPaths]).
 
diff --git a/server/sinan/src/sin_repo_fetcher.erl b/server/sinan/src/sin_repo_fetcher.erl
deleted file mode 100644
index ff56281..0000000
--- a/server/sinan/src/sin_repo_fetcher.erl
+++ /dev/null
@@ -1,143 +0,0 @@
-%% -*- mode: Erlang; fill-column: 132; comment-column: 118; -*-
-%%%-------------------------------------------------------------------
-%%% Copyright (c) 2006, 2007 Erlware
-%%%
-%%% Permission is hereby granted, free of charge, to any
-%%% person obtaining a copy of this software and associated
-%%% documentation files (the "Software"), to deal in the
-%%% Software without restriction, including without limitation
-%%% the rights to use, copy, modify, merge, publish, distribute,
-%%% sublicense, and/or sell copies of the Software, and to permit
-%%% persons to whom the Software is furnished to do so, subject to
-%%% the following conditions:
-%%%
-%%% The above copyright notice and this permission notice shall
-%%% be included in all copies or substantial portions of the Software.
-%%%
-%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-%%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-%%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-%%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-%%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-%%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-%%% OTHER DEALINGS IN THE SOFTWARE.
-%%%---------------------------------------------------------------------------
-%%% @author Eric Merritt
-%%% @doc
-%%%   Gets the list of fetchables from the environment and loads them
-%%%   into the local repository.
-%%% @end
-%%% @copyright (C) 2007, Erlware
-%%%---------------------------------------------------------------------------
--module(sin_repo_fetcher).
-
-%% API
--export([fetch/4]).
-
-%%====================================================================
-%% API
-%%====================================================================
-
-%%-------------------------------------------------------------------
-%% @doc
-%%  Given the metadata about the project goes through and pulls
-%%  down the required libraries from the specified repo.
-%% @spec (Task, BuildRef, ProjectApps, ProjectDeps) -> ok
-%% @end
-%%-------------------------------------------------------------------
-fetch(Task, BuildRef, ProjectApps, ProjectDeps) ->
-    Repo = ensure_repo(Task, BuildRef),
-    fetch_deps(Task, BuildRef, Repo, ProjectApps, ProjectDeps).
-
-%%====================================================================
-%% Internal functions
-%%====================================================================
-
-%%-------------------------------------------------------------------
-%% @doc
-%%  Make sure a repo location is specified.
-%% @spec (Task, BuildRef) -> ok
-%% @end
-%% @private
-%%-------------------------------------------------------------------
-ensure_repo(Task, BuildRef) ->
-    case sin_build_config:get_value(BuildRef, "project.repository") of
-        undefined ->
-            eta_event:task_fault(BuildRef, Task,
-                                 "I need a local repository specified in the "
-                                 "build config!"),
-            throw(no_local_repo_specified);
-        Repo ->
-            filelib:ensure_dir(filename:join([Repo, "tmp"])),
-            Repo
-    end.
-
-%%-------------------------------------------------------------------
-%% @doc
-%%  Fetch down and individual required app from the http repository.
-%% @spec (Task, BuildRef, LocalRepo, ProjectApp, ProjectDeps) -> void()
-%% @end
-%% @private
-%%-------------------------------------------------------------------
-fetch_deps(Task, BuildRef, LocalRepo, ProjectApps, ProjectDeps) ->
-    Repos = sin_build_config:get_value(BuildRef, "repositories"),
-    fetch_dep(Task, BuildRef, Repos, LocalRepo, ProjectApps, ProjectDeps, []).
-
-
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  Fetch the individual deps from the system, returning a list of apps
-%%  that are non-project but required.
-%% @spec (Task, BuildRef, RemoteRepos, LocalRepo, ProjectApps, ProjectDeps, Acc) ->
-%%   RepoDeps
-%% @end
-%% @private
-%%--------------------------------------------------------------------
-fetch_dep(Task, BuildRef, RemoteRepos, LocalRepo,
-          ProjectApps, [App = {AppName, Vsn} | T], Acc) ->
-    case is_project_app(AppName, ProjectApps) of
-        true ->
-            fetch_dep(Task, BuildRef, RemoteRepos,
-                      LocalRepo, ProjectApps, T, Acc);
-        false ->
-            eta_event:task_event(BuildRef, Task, info,
-                                 {"Pulling ~w-~s from repository if non-local",
-                                  [AppName, Vsn]}),
-            case ewr_fetch:fetch_binary_package(RemoteRepos, AppName,
-                                                Vsn, LocalRepo) of
-                {error, {_Type, Reason}} ->
-                    eta_event:task_event(BuildRef, Task, info,
-                                         {"Unable to fetch ~w version (~w) "
-                                          "from repo due to ~s",
-                                          [AppName, Vsn, Reason]}),
-                    throw(unable_to_fetch_from_repo);
-                {error, Reason} ->
-                   eta_event:task_event(BuildRef, Task, info,
-                                        {"Unable to fetch ~w version (~w) "
-                                         "from repo due to ~s",
-                                         [AppName, Vsn, Reason]}),
-                    throw(unable_to_fetch_from_repo);
-                _ ->
-                    fetch_dep(Task, BuildRef, RemoteRepos,
-                              LocalRepo, ProjectApps, T, [App | Acc])
-            end
-    end;
-fetch_dep(_Task, BuildRef, _RemoteRepos, _LocalRepo, _ProjectApps, [], Acc) ->
-    sin_build_config:store(BuildRef, "project.repoapps", Acc),
-    ok.
-
-%%--------------------------------------------------------------------
-%% @doc
-%%  check to see if AppName is a project app.
-%% @spec (AppName, AppList) -> true | false
-%% @end
-%% @private
-%%--------------------------------------------------------------------
-is_project_app(AppName, [{AppName, _, _} | _T]) ->
-    true;
-is_project_app(App, [_H | T]) ->
-    is_project_app(App, T);
-is_project_app(_App, []) ->
-    false.
diff --git a/server/sinan/src/sin_test.erl b/server/sinan/src/sin_test.erl
index e531cc9..8b29c94 100644
--- a/server/sinan/src/sin_test.erl
+++ b/server/sinan/src/sin_test.erl
@@ -90,7 +90,7 @@ test(BuildRef) ->
                                  "'enabled' or remove it.");
         _ ->
             GL = sin_group_leader:capture_start(BuildRef, ?TASK),
-            Apps = lists:map(fun({App, _Vsn, _Deps}) ->
+            Apps = lists:map(fun({App, _Vsn, _Deps, _}) ->
                                      atom_to_list(App)
                              end, sin_build_config:get_value(BuildRef,
                                                   "project.apps")),
diff --git a/support/build.py b/support/build.py
index 60b2f99..c1b18cd 100755
--- a/support/build.py
+++ b/support/build.py
@@ -5,63 +5,16 @@
 import sys
 import os
 import commands
+import support
 from optparse import OptionParser
 
-class BuildError(Exception):
-    def __init__(self, value):
-        self.value = value
-    def __str__(self):
-        return repr(self.value)
-
-ERTS_VERSION = "5.6.3"
-
-BUILD_PATH = "_build/development/apps/%s/ebin"
-
-ERLWARE_PATH = "/usr/local/erlware"
-
-ERLC = "erlc +debug_info "
-
-LOCAL_APPS = [("etask", "0.5.0"),
-              ("sinan", "0.10.0.14"),
-              ("sinan_web_api", "0.1.0.4")]
-
-ERLWARE_APPS = ["fconf-0.3.0.0",
-                "ktuo-0.4.0.1",
-                "crary-0.2.3",
-                "eunit-2.0",
-                "cryptographic-0.2.1",
-                "ewlib-0.8.2.0",
-                "ewrepo-0.18.6.0",
-                "gas-6.1.1",
-                "kernel-2.12.3",
-                "ibrowse-1.4",
-                "uri-0.2.0"]
-
-
-def generate_local_path(app):
-    ebin = "_build/development/apps/%s-%s/ebin" % (app[0], app[1])
-    include = "_build/development/apps/%s-%s/include" % (app[0], app[1])
-
-    if not os.path.isdir(ebin):
-        raise BuildError(ebin + " is not a directory")
-
-    return " -pa %s -I %s " % (ebin, include)
-
-def generate_erlware_path(path):
-    ebin = "%s/packages/%s/lib/%s/ebin" % (ERLWARE_PATH, ERTS_VERSION, path)
-    include = "%s/packages/%s/lib/%s/include" % (ERLWARE_PATH, ERTS_VERSION, path)
-
-    if not os.path.isdir(ebin):
-        raise BuildError(ebin + " is not a directory")
-
-
-    return " -pa %s -I %s " % (ebin, include)
-
 def compile_app(app):
     ebin = "_build/development/apps/%s-%s/ebin" % (app[0], app[1])
     compile_command = ("erlc +debug_info %s %s -o %s/ ./server/%s/src/*.erl" %
-                       (' '.join(map(generate_local_path, LOCAL_APPS)),
-                        ' '.join(map(generate_erlware_path, ERLWARE_APPS)),
+                       (' '.join(map(support.generate_local_path,
+                                     support.LOCAL_APPS)),
+                        ' '.join(map(support.generate_erlware_path,
+                                     support.ERLWARE_APPS)),
                         ebin,
                         app[0]))
 
@@ -72,7 +25,7 @@ def compile_app(app):
 
 
 def compile_apps():
-    for app in LOCAL_APPS:
+    for app in support.LOCAL_APPS:
         compile_app(app)
 
 def main():
@@ -85,7 +38,7 @@ def main():
 
     (options, args) = parser.parse_args()
 
-    ERLWARE_PATH = options.erlware
+    support.ERLWARE_PATH = options.erlware
 
     compile_apps()
 
diff --git a/support/run b/support/run
index d1af340..1806f49 100755
--- a/support/run
+++ b/support/run
@@ -14,4 +14,4 @@ erl -pa /usr/local/erlware/application_packages/5.6.3/lib/sgte-0.7.1/ebin \
  ../uri/_build/development/apps/uri-0.1.0/ebin -pa \
  ../erlware/_build/development/apps/gas-5.1.0/ebin -pa\
  /usr/local/erlware/application_packages/5.6.3/lib/gtime-0.9.4/ebin\
-  -run sinan_web_api start
+
-- 
1.5.6.4

Reply via email to