For additional information see 'faxien help search' wherein I have provided
an example of how to use this.  This is a major rev of faxien because I have
changed the semantics of the
search command in a non backwards compatible way.

Cheers,
Martin

--~--~---------~--~----~------------~-------~--~----~
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 92ecf7e5781868a02a94eb33475e748ee34a526c Mon Sep 17 00:00:00 2001
From: Martin Logan <[email protected]>
Date: Fri, 16 Jan 2009 22:04:50 -0600
Subject: [faxien PATCH] added erts vsn specification in search.
 Semantically changed search.

---
 _build.cfg                 |    2 +-
 bin/epkg                   |    2 +-
 bin/faxien                 |    2 +-
 lib/epkg/ebin/epkg.app     |    2 +-
 lib/faxien/ebin/faxien.app |    2 +-
 lib/faxien/src/faxien.erl  |   50 +++++++++++++++++++++++++++----------------
 6 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/_build.cfg b/_build.cfg
index 9a942f3..35cfd9e 100644
--- a/_build.cfg
+++ b/_build.cfg
@@ -1,6 +1,6 @@
 project : {
    name : faxien
-   vsn  : "0.39.0.6"
+   vsn  : "0.40.0.0"
 },
 
 repositories : ["http://repo.erlware.org/pub";],
diff --git a/bin/epkg b/bin/epkg
index 28c8ea2..0b109f3 100644
--- a/bin/epkg
+++ b/bin/epkg
@@ -7,7 +7,7 @@ PREFIX=$(dirname $PROG_DIR)
 
 #### Fill in values for these variables ####
 REL_NAME=faxien
-REL_VSN=0.39.0.6
+REL_VSN=0.40.0.0
 ERTS_VSN=5.6.3
 INVOCATION_SUFFIX="-s epkg cmdln_apply epkg $@ -noshell -prefix $PREFIX"
 ###########################################
diff --git a/bin/faxien b/bin/faxien
index 1469b7d..e2f2812 100644
--- a/bin/faxien
+++ b/bin/faxien
@@ -7,7 +7,7 @@ PREFIX=$(dirname $PROG_DIR)
 
 #### Fill in values for these variables ####
 REL_NAME=faxien
-REL_VSN=0.39.0.6
+REL_VSN=0.40.0.0
 ERTS_VSN=5.6.3
 INVOCATION_SUFFIX="-s faxien cmdln_apply faxien $@ -noshell -prefix $PREFIX"
 ###########################################
diff --git a/lib/epkg/ebin/epkg.app b/lib/epkg/ebin/epkg.app
index 60eaa1a..8eead14 100755
--- a/lib/epkg/ebin/epkg.app
+++ b/lib/epkg/ebin/epkg.app
@@ -5,7 +5,7 @@
   {description, "Manages local erlang/OTP packages. Faxien depends on this for local operations."},
 
   % The version of the applicaton
-  {vsn, "0.13.0.0"},
+  {vsn, "0.13.0.1"},
 
   % All modules used by the application.
   {modules,
diff --git a/lib/faxien/ebin/faxien.app b/lib/faxien/ebin/faxien.app
index 45e5d51..aa4c011 100644
--- a/lib/faxien/ebin/faxien.app
+++ b/lib/faxien/ebin/faxien.app
@@ -5,7 +5,7 @@
   {description, "The erlang package management tool."},
 
   % The version of the applicaton
-  {vsn, "0.39.0.6"},
+  {vsn, "0.40.0.0"},
 
   % All modules used by the application. 
   {modules,
diff --git a/lib/faxien/src/faxien.erl b/lib/faxien/src/faxien.erl
index 60a6188..90ecdc9 100644
--- a/lib/faxien/src/faxien.erl
+++ b/lib/faxien/src/faxien.erl
@@ -56,6 +56,7 @@
 -export([
 	 cmdln_apply/1,
 	 
+	 search/5,
 	 search/4,
 	 search/2,
 	 search/1,
@@ -869,7 +870,7 @@ help(Command) when is_list(Command) ->
 %%--------------------------------------------------------------------
 %% @doc 
 %%  Returns a list of packages.
-%% @spec search(Repos, Side, SearchType, SearchString) -> string()
+%% @spec search(Repos, TargetErtsVsns, Side, SearchType, SearchString) -> string()
 %%  where
 %%   Repos = list()
 %%   Side = lib | releases | both
@@ -877,41 +878,47 @@ help(Command) when is_list(Command) ->
 %%   SearchString = string() | atom()
 %% @end
 %%--------------------------------------------------------------------
-search([H|_] = Repo, Side, SearchType, SearchString) when is_integer(H) -> 
-    search([Repo], Side, SearchType, SearchString);
-search(Repos, Side, SearchType, SearchString) when is_atom(SearchString) -> 
-    search(Repos, Side, SearchType, atom_to_list(SearchString));
-search(Repos, Side, SearchType, SearchString) -> 
+search([H|_] = Repo, TargetErtsVsns, Side, SearchType, SearchString) when is_integer(H) -> 
+    search([Repo], TargetErtsVsns, Side, SearchType, SearchString);
+search(Repos, [H|_] = TargetErtsVsn, Side, SearchType, SearchString) when is_integer(H) -> 
+    case translate_version(erlang, erts, TargetErtsVsn) of
+	{ok, TranslatedVsn} -> search(Repos, [TranslatedVsn], Side, SearchType, SearchString);
+	error               -> search(Repos, [TargetErtsVsn], Side, SearchType, SearchString)
+    end;
+search(Repos, TargetErtsVsns, Side, SearchType, SearchString) when is_atom(SearchString) -> 
+    search(Repos, TargetErtsVsns, Side, SearchType, atom_to_list(SearchString));
+search(Repos, TargetErtsVsns, Side, SearchType, SearchString) -> 
     proceed_only_on_valid_repos(Repos),
-    {ok, LowErtsVsn}       = gas:get_env(epkg, low_erts_vsn, ewr_util:erts_version()),
-    {ok, HighErtsVsn}      = gas:get_env(epkg, high_erts_vsn, ewr_util:erts_version()),
-    {ok, PreferredErtsVsn} = gas:get_env(epkg, preferred_erts_vsn, HighErtsVsn),
-    TargetErtsVsns      = epkg_util:all_erts_vsns(LowErtsVsn, HighErtsVsn, PreferredErtsVsn),
-    ?INFO_MSG("Searching the following erts vsns ~p~n", [TargetErtsVsns]),
+    ?INFO_MSG("Searching for ~p the following erts vsns ~p on the following repos ~p~n", [SearchString,TargetErtsVsns,Repos]),
     fax_manage:search(Repos, Side, SearchType, SearchString, TargetErtsVsns).
 
+%% @spec search(TargetErtsVsn, Side, SearchType, SearchString) -> string()
+%% @equiv search(Repos, TargetErtsVsn, both, SearchType, SearchString) 
+search(TargetErtsVsns, Side, SearchType, SearchString) -> 
+    {ok, Repos} = gas:get_env(faxien, repos_to_fetch_from, [?ERLWARE_URL]),
+    search(Repos, TargetErtsVsns, Side, SearchType, SearchString).
+
 %% @spec search(SearchType, SearchString) -> string()
-%% @equiv search(Repos, both, SearchType, SearchString) 
+%% @equiv search(Repos, ConfigTargetErtsVsns, both, SearchType, SearchString) 
 search(SearchType, SearchString) -> 
-    {ok, Repos} = gas:get_env(faxien, repos_to_fetch_from, [?ERLWARE_URL]),
-    search(Repos, both, SearchType, SearchString).
+    search(target_erts_vsns_from_config(), both, SearchType, SearchString).
 
 %% @spec search(SearchString) -> string()
 %% @equiv search(Repos, both, normal, SearchString) 
 search(SearchString) -> 
-    {ok, Repos} = gas:get_env(faxien, repos_to_fetch_from, [?ERLWARE_URL]),
-    search(Repos, both, normal, SearchString).
+    search(target_erts_vsns_from_config(), both, normal, SearchString).
     
 %% @spec search() -> string()
 %% @equiv search(Repos, both, regexp, ".*") 
 search() -> 
-    {ok, Repos} = gas:get_env(faxien, repos_to_fetch_from, [?ERLWARE_URL]),
-    search(Repos, both, normal, "").
+    search(target_erts_vsns_from_config(), both, normal, "").
 
 %% @private
 search_help() ->
     ["\nHelp for search\n",
-     "Usage: search [[space separated repos] [both|lib|releases] [normal|regexp] search_string]: lists the contents of a repository in various ways.\n",
+     "Usage: search [[space separated repos] [TargetErtsOrErlangVsn] [both|lib|releases] [normal|regexp] search_string]: lists the contents of a repository in various ways.\n",
+     "Example: search R12B-3 lib regexp std.* - this example will list all libraries (lib) that match the regexp std.*" ,
+     "                                          and are from R12B-3 verison of Erlang.",
      "Example: search lib regexp std.* - this example will list all libraries (lib) that match the regexp std.*" ,
      "Example: search regexp std.* - this example will list all libraries and releases that match the regexp std.*" ,
      "Example: search yaw - this example will list all libraries and releases that contain the string 'yaw'" ,
@@ -1355,3 +1362,8 @@ proceed_only_on_valid_repos(Repos) when is_list(Repos) ->
     lists:foreach(fun(Repo) -> proceed_only_on_valid_repos(Repo) end, Repos).
 
 	    
+target_erts_vsns_from_config() ->
+    {ok, LowErtsVsn}       = gas:get_env(epkg, low_erts_vsn, ewr_util:erts_version()),
+    {ok, HighErtsVsn}      = gas:get_env(epkg, high_erts_vsn, ewr_util:erts_version()),
+    {ok, PreferredErtsVsn} = gas:get_env(epkg, preferred_erts_vsn, HighErtsVsn),
+    epkg_util:all_erts_vsns(LowErtsVsn, HighErtsVsn, PreferredErtsVsn).
-- 
1.5.3.5

Reply via email to