You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2025/10/23 20:02:14 UTC

(couchdb-rebar) branch fix-deprecated-functions created (now 38ce64f)

This is an automated email from the ASF dual-hosted git repository.

jiahuili430 pushed a change to branch fix-deprecated-functions
in repository https://gitbox.apache.org/repos/asf/couchdb-rebar.git


      at 38ce64f  Replace deprecated functions for OTP 27

This branch includes the following new commits:

     new 38ce64f  Replace deprecated functions for OTP 27

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(couchdb-rebar) 01/01: Replace deprecated functions for OTP 27

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jiahuili430 pushed a commit to branch fix-deprecated-functions
in repository https://gitbox.apache.org/repos/asf/couchdb-rebar.git

commit 38ce64fe62a52ec29a7fea4ac8b8b9706bb2c447
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Thu Oct 23 14:49:22 2025 -0500

    Replace deprecated functions for OTP 27
---
 src/rebar_ct.erl            |  2 +-
 src/rebar_dialyzer.erl      |  4 ++--
 src/rebar_erlc_compiler.erl | 17 +++++++++--------
 src/rebar_escripter.erl     |  2 +-
 src/rebar_eunit.erl         |  2 +-
 5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl
index c033c58..ffbbe34 100644
--- a/src/rebar_ct.erl
+++ b/src/rebar_ct.erl
@@ -288,7 +288,7 @@ search_ct_specs_from(Cwd, TestDir, Config) ->
 build_name(Config) ->
     %% generate a unique name for our test node, we want
     %% to make sure the odds of name clashing are low
-    Random = integer_to_list(crypto:rand_uniform(0, 10000)),
+    Random = integer_to_list(rand:uniform(10000)),
     case rebar_config:get_local(Config, ct_use_short_names, false) of
         true -> "-sname test" ++ Random;
         false -> " -name test" ++ Random ++ "@" ++ net_adm:localhost()
diff --git a/src/rebar_dialyzer.erl b/src/rebar_dialyzer.erl
index 5dec614..852daad 100644
--- a/src/rebar_dialyzer.erl
+++ b/src/rebar_dialyzer.erl
@@ -238,9 +238,9 @@ deps_apps(Config) ->
     [element(1, Dep) || Dep <- rebar_config:get_local(Config, deps, [])].
 
 app_lib_dir(App) ->
-    case code:lib_dir(App, ebin) of
+    case code:lib_dir(App) of
         {error, _}=Err ->
             ?ABORT("Failed to get ebin dir for app: ~p~n~p~n", [App, Err]);
         Dir ->
-            Dir
+            filename:join(Dir, "ebin")
     end.
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index 412b29d..3638bc6 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -267,12 +267,13 @@ define_if(_Def, false) -> [].
 is_lib_avail(Config, DictKey, Mod, Hrl, Name) ->
     case rebar_config:get_xconf(Config, DictKey, undefined) of
         undefined ->
-            IsAvail = case code:lib_dir(Mod, include) of
-                          {error, bad_name} ->
-                              false;
-                          Dir ->
-                              filelib:is_regular(filename:join(Dir, Hrl))
-                      end,
+            IsAvail =
+                case code:lib_dir(Mod) of
+                    {error, bad_name} ->
+                        false;
+                    Dir ->
+                        filelib:is_regular(filename:join([Dir, "include", Hrl]))
+                end,
             NewConfig = rebar_config:set_xconf(Config, DictKey, IsAvail),
             ?DEBUG("~s availability: ~p\n", [Name, IsAvail]),
             {NewConfig, IsAvail};
@@ -705,9 +706,9 @@ expand_include_lib_path(File) ->
                  _ ->
                      filename:join(Parts)
              end,
-    case code:lib_dir(list_to_atom(Lib), list_to_atom(SubDir)) of
+    case code:lib_dir(list_to_atom(Lib)) of
         {error, bad_name} -> [];
-        Dir -> [filename:join(Dir, File1)]
+        Dir -> [filename:join([Dir, list_to_atom(SubDir), File1])]
     end.
 
 %%
diff --git a/src/rebar_escripter.erl b/src/rebar_escripter.erl
index 0cc43ef..7400c46 100644
--- a/src/rebar_escripter.erl
+++ b/src/rebar_escripter.erl
@@ -138,7 +138,7 @@ info_help(Description) ->
 get_app_beams([], Acc) ->
     Acc;
 get_app_beams([App | Rest], Acc) ->
-    case code:lib_dir(App, ebin) of
+    case code:lib_dir(App) of
         {error, bad_name} ->
             ?ABORT("Failed to get ebin/ directory for "
                    "~p escript_incl_apps.", [App]);
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index ebf76bc..5fa36b5 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -279,7 +279,7 @@ randomize_suites(Config, Modules) ->
         undefined ->
             Modules;
         "true" ->
-            Seed = crypto:rand_uniform(1, 65535),
+            Seed = rand:uniform(65535),
             randomize_suites1(Modules, Seed);
         String ->
             try list_to_integer(String) of