From 2ca1b5c639605bd9bf4d33fd39dc0eb1e368606c Mon Sep 17 00:00:00 2001 From: Emile Joubert Date: Mon, 20 Dec 2010 10:37:26 +0000 Subject: [PATCH] Remove dependency on crypto in webmachine --- deps/rabbitmq_management/Makefile | 2 +- .../deps/webmachine/10-crypto.patch | 117 ++++++++++++++++++ .../deps/webmachine/Makefile | 3 +- 3 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 deps/rabbitmq_management/deps/webmachine/10-crypto.patch diff --git a/deps/rabbitmq_management/Makefile b/deps/rabbitmq_management/Makefile index 48f9f953dc..7bb059334b 100644 --- a/deps/rabbitmq_management/Makefile +++ b/deps/rabbitmq_management/Makefile @@ -4,7 +4,7 @@ DEPS=rabbitmq-mochiweb rabbitmq-server rabbitmq-erlang-client rabbitmq-managemen INTERNAL_DEPS=webmachine RUNTIME_DEPS=webmachine -TEST_APPS=crypto inets mochiweb rabbit_mochiweb webmachine rabbit_management_agent amqp_client rabbit_management +TEST_APPS=inets mochiweb rabbit_mochiweb webmachine rabbit_management_agent amqp_client rabbit_management TEST_ARGS=-rabbit_mochiweb port 55672 START_RABBIT_IN_TESTS=true TEST_COMMANDS=rabbit_mgmt_test_all:all_tests() diff --git a/deps/rabbitmq_management/deps/webmachine/10-crypto.patch b/deps/rabbitmq_management/deps/webmachine/10-crypto.patch new file mode 100644 index 0000000000..95977d3209 --- /dev/null +++ b/deps/rabbitmq_management/deps/webmachine/10-crypto.patch @@ -0,0 +1,117 @@ +diff -r 0c4b60ac68b4 demo/ebin/webmachine_demo.app +--- a/demo/ebin/webmachine_demo.app Tue Jun 15 08:36:55 2010 -0400 ++++ b/demo/ebin/webmachine_demo.app Sat Dec 18 21:20:46 2010 +0000 +@@ -11,4 +11,4 @@ + {registered, []}, + {mod, {webmachine_demo_app, []}}, + {env, []}, +- {applications, [kernel, stdlib, crypto]}]}. ++ {applications, [kernel, stdlib]}]}. +diff -r 0c4b60ac68b4 demo/src/demo_fs_resource.erl +--- a/demo/src/demo_fs_resource.erl Tue Jun 15 08:36:55 2010 -0400 ++++ b/demo/src/demo_fs_resource.erl Sat Dec 18 21:20:46 2010 +0000 +@@ -143,7 +143,7 @@ + {LMod, ReqData, Context#context{metadata=[{'last-modified', + httpd_util:rfc1123_date(LMod)}|Context#context.metadata]}}. + +-hash_body(Body) -> mochihex:to_hex(binary_to_list(crypto:sha(Body))). ++hash_body(Body) -> mochihex:to_hex(binary_to_list(erlang:md5(Body))). + + generate_etag(ReqData, Context) -> + case maybe_fetch_object(Context, wrq:disp_path(ReqData)) of +diff -r 0c4b60ac68b4 demo/src/webmachine_demo.erl +--- a/demo/src/webmachine_demo.erl Tue Jun 15 08:36:55 2010 -0400 ++++ b/demo/src/webmachine_demo.erl Sat Dec 18 21:20:46 2010 +0000 +@@ -14,7 +14,6 @@ + %% @spec start() -> ok + %% @doc Start the webmachine_demo server. + start() -> +- ensure_started(crypto), + ensure_started(webmachine), + application:start(webmachine_demo). + +@@ -23,5 +22,4 @@ + stop() -> + Res = application:stop(webmachine_demo), + application:stop(webmachine), +- application:stop(crypto), + Res. +diff -r 0c4b60ac68b4 ebin/webmachine.app +--- a/ebin/webmachine.app Tue Jun 15 08:36:55 2010 -0400 ++++ b/ebin/webmachine.app Sat Dec 18 21:20:46 2010 +0000 +@@ -25,4 +25,4 @@ + {env, [ + {dispatch_list, []} + ]}, +- {applications, [kernel, stdlib, crypto]}]}. ++ {applications, [kernel, stdlib]}]}. +diff -r 0c4b60ac68b4 priv/templates/ebin/wmskel.app +--- a/priv/templates/ebin/wmskel.app Tue Jun 15 08:36:55 2010 -0400 ++++ b/priv/templates/ebin/wmskel.app Sat Dec 18 21:20:46 2010 +0000 +@@ -13,7 +13,6 @@ + {applications, [ + kernel, + stdlib, +- crypto, + mochiweb, + webmachine + ]}, +diff -r 0c4b60ac68b4 priv/templates/src/wmskel.erl +--- a/priv/templates/src/wmskel.erl Tue Jun 15 08:36:55 2010 -0400 ++++ b/priv/templates/src/wmskel.erl Sat Dec 18 21:20:46 2010 +0000 +@@ -18,7 +18,6 @@ + %% @spec start_link() -> {ok,Pid::pid()} + %% @doc Starts the app for inclusion in a supervisor tree + start_link() -> +- ensure_started(crypto), + ensure_started(mochiweb), + application:set_env(webmachine, webmachine_logger_module, + webmachine_logger), +@@ -28,7 +27,6 @@ + %% @spec start() -> ok + %% @doc Start the {{appid}} server. + start() -> +- ensure_started(crypto), + ensure_started(mochiweb), + application:set_env(webmachine, webmachine_logger_module, + webmachine_logger), +@@ -41,5 +39,4 @@ + Res = application:stop({{appid}}), + application:stop(webmachine), + application:stop(mochiweb), +- application:stop(crypto), + Res. +diff -r 0c4b60ac68b4 scripts/run_tests.escript +--- a/scripts/run_tests.escript Tue Jun 15 08:36:55 2010 -0400 ++++ b/scripts/run_tests.escript Sat Dec 18 21:20:46 2010 +0000 +@@ -21,7 +21,6 @@ + end, + proplists:get_value(modules, App)), + +- crypto:start(), + start_cover(Modules), + eunit:test(Modules, [verbose]), + analyze_cover(Modules); +diff -r 0c4b60ac68b4 src/webmachine.erl +--- a/src/webmachine.erl Tue Jun 15 08:36:55 2010 -0400 ++++ b/src/webmachine.erl Sat Dec 18 21:20:46 2010 +0000 +@@ -28,7 +28,6 @@ + %% @doc Start the webmachine server. + start() -> + webmachine_deps:ensure(), +- application:start(crypto), + application:start(webmachine). + + %% @spec stop() -> ok +diff -r 0c4b60ac68b4 src/webmachine_request.erl +--- a/src/webmachine_request.erl Tue Jun 15 08:36:55 2010 -0400 ++++ b/src/webmachine_request.erl Sat Dec 18 21:20:46 2010 +0000 +@@ -560,7 +560,7 @@ + {CT, _} -> + CT + end, +- Boundary = mochihex:to_hex(crypto:rand_bytes(8)), ++ Boundary = [96 + random:uniform(26) || _ <- lists:seq(1,70)], + HeaderList = [{"Content-Type", + ["multipart/byteranges; ", + "boundary=", Boundary]}], diff --git a/deps/rabbitmq_management/deps/webmachine/Makefile b/deps/rabbitmq_management/deps/webmachine/Makefile index f8d41587f3..20d0ebbfb4 100644 --- a/deps/rabbitmq_management/deps/webmachine/Makefile +++ b/deps/rabbitmq_management/deps/webmachine/Makefile @@ -29,7 +29,8 @@ $(LIB_PACKAGE_DIR): $(CHECKOUT_DIR) $(CHECKOUT_DIR): rm -rf $@-tmp hg clone -r $(REVISION) $(HG_UPSTREAM) $@-tmp - cd $@-tmp && patch -p1 < ../unrebar.patch && patch -p1 < ../uneunit.patch && cd .. && mv $@-tmp $@ + cd $@-tmp && patch -p1 < ../unrebar.patch && patch -p1 < ../uneunit.patch && \ + patch -p1 < ../10-crypto.patch && cd .. && mv $@-tmp $@ %.ez: $(LIB_PACKAGE_DIR) $(MAKE) -C $(LIB_PACKAGE_DIR) clean all