Subject: [PATCH v2 7/9] gnu: monero: Use git-fetch.

From: Theodoros Foradis <[email-masked]>
Date: Sun, 8 Jul 2018 20:39:30 +0300

* gnu/packages/finance.scm (monero)[source]: Use git-fetch for
deterministic hash.
---
 gnu/packages/finance.scm | 183 ++++++++++++++++++++++++-----------------------
 1 file changed, 93 insertions(+), 90 deletions(-)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index a02d8ee69..94e7756e6 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -377,97 +377,100 @@ other machines/servers.  Electrum does not download the Bitcoin blockchain.")
   ;; The bundled easylogging++ is modified, and the changes will not be upstreamed.
   ;; The devs deem the lmdb driver too critical a consenus component, to use
   ;; the system's dynamically linked library.
-  (package
-    (name "monero")
-    (version "0.12.3.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/monero-project/monero/archive/v"
-                           version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (patches (search-patches "monero-use-system-miniupnpc.patch"))
-       (sha256
-        (base32
-         "0wmz7g48cay0irmny5k87x4z834w07bpyvsbs9chygk9ch9kp8sw"))))
-    (build-system cmake-build-system)
-    (native-inputs
-     `(("doxygen" ,doxygen)
-       ("googletest" ,googletest)
-       ("graphviz" ,graphviz)
-       ("pkg-config" ,pkg-config)))
-    (inputs
-     `(("bind" ,isc-bind)
-       ("boost" ,boost)
-       ("zeromq" ,zeromq)
-       ("cppzmq" ,cppzmq)
-       ("expat" ,expat)
-       ("libsodium" ,libsodium)
-       ("libunwind" ,libunwind)
-       ("lmdb" ,lmdb)
-       ("miniupnpc" ,monero-miniupnpc)
-       ("openssl" ,openssl)
-       ("rapidjson" ,rapidjson)
-       ("unbound" ,unbound)))
-    (arguments
-     `(#:out-of-source? #t
-       #:build-type "release"
-       #:configure-flags '("-DBUILD_TESTS=ON"
-                           ,@(if (string=? "aarch64-linux" (%current-system))
-                                 '("-DARCH=armv8-a")
-                                 '())
-                           "-DBUILD_GUI_DEPS=ON")
-       #:phases
-       (modify-phases %standard-phases
-         ;; tests/core_tests need a valid HOME
-         (add-before 'configure 'set-home
-           (lambda _
-             (setenv "HOME" (getcwd))
-             #t))
-         (add-after 'set-home 'fix-wallet-path-for-unit-tests
-           (lambda _
-             (substitute* "tests/unit_tests/serialization.cpp"
-               (("\\.\\./\\.\\./\\.\\./\\.\\./") "../../"))
-             #t))
-         (add-after 'fix-wallet-path-for-unit-tests 'change-log-path
-           (lambda _
-             (substitute* "contrib/epee/src/mlog.cpp"
-               (("epee::string_tools::get_current_module_folder\\(\\)")
-                "\".bitmonero\""))
-             (substitute* "contrib/epee/src/mlog.cpp"
-               (("return \\(") "return ((std::string(getenv(\"HOME\"))) / "))
-             #t))
-         (replace 'check
-           (lambda _
-             (invoke "make" "ARGS=-E 'unit_tests|libwallet_api_tests'"
-                     "test")))
-         ;; The excluded unit tests need network access
-         (add-after 'check 'unit-tests
-           (lambda _
-             (let ((excluded-unit-tests
-                    (string-join
-                     '("AddressFromURL.Success"
-                       "AddressFromURL.Failure"
-                       "DNSResolver.IPv4Success"
-                       "DNSResolver.DNSSECSuccess"
-                       "DNSResolver.DNSSECFailure"
-                       "DNSResolver.GetTXTRecord")
-                     ":")))
-               (invoke "tests/unit_tests/unit_tests"
-                       (string-append "--gtest_filter=-"
-                                      excluded-unit-tests)))))
-         (add-after 'install 'install-blockchain-import-export
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin")))
-               (install-file "bin/monero-blockchain-import" bin)
-               (install-file "bin/monero-blockchain-export" bin)))))))
-    (home-page "https://getmonero.org/")
-    (synopsis "Command-line interface to the Monero currency")
-    (description
-     "Monero is a secure, private, untraceable currency.  This package provides the
+  (let ((revision "0")
+        (commit "40530b294e6074dffb0d3de25d0442d3b85467b8"))
+    (package
+      (name "monero")
+      (version (string-append "0.12.3.0-" revision "."
+                              (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/monero-project/monero")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "01rksnlqy46nnc2zjqs1r0vzfn2n2ag25lar7c7iwhnmivbays61"))
+                (patches (search-patches "monero-use-system-miniupnpc.patch"))
+                (file-name (string-append name "-" version "-checkout"))))
+      (build-system cmake-build-system)
+      (native-inputs
+       `(("doxygen" ,doxygen)
+         ("googletest" ,googletest)
+         ("graphviz" ,graphviz)
+         ("pkg-config" ,pkg-config)))
+      (inputs
+       `(("bind" ,isc-bind)
+         ("boost" ,boost)
+         ("zeromq" ,zeromq)
+         ("cppzmq" ,cppzmq)
+         ("expat" ,expat)
+         ("libsodium" ,libsodium)
+         ("libunwind" ,libunwind)
+         ("lmdb" ,lmdb)
+         ("miniupnpc" ,monero-miniupnpc)
+         ("openssl" ,openssl)
+         ("rapidjson" ,rapidjson)
+         ("unbound" ,unbound)))
+      (arguments
+       `(#:out-of-source? #t
+         #:build-type "release"
+         #:configure-flags '("-DBUILD_TESTS=ON"
+                             ,@(if (string=? "aarch64-linux" (%current-system))
+                                   '("-DARCH=armv8-a")
+                                   '())
+                             "-DBUILD_GUI_DEPS=ON")
+         #:phases
+         (modify-phases %standard-phases
+           ;; tests/core_tests need a valid HOME
+           (add-before 'configure 'set-home
+             (lambda _
+               (setenv "HOME" (getcwd))
+               #t))
+           (add-after 'set-home 'fix-wallet-path-for-unit-tests
+             (lambda _
+               (substitute* "tests/unit_tests/serialization.cpp"
+                 (("\\.\\./\\.\\./\\.\\./\\.\\./") "../../"))
+               #t))
+           (add-after 'fix-wallet-path-for-unit-tests 'change-log-path
+             (lambda _
+               (substitute* "contrib/epee/src/mlog.cpp"
+                 (("epee::string_tools::get_current_module_folder\\(\\)")
+                  "\".bitmonero\""))
+               (substitute* "contrib/epee/src/mlog.cpp"
+                 (("return \\(") "return ((std::string(getenv(\"HOME\"))) / "))
+               #t))
+           (replace 'check
+             (lambda _
+               (invoke "make" "ARGS=-E 'unit_tests|libwallet_api_tests'"
+                       "test")))
+           ;; The excluded unit tests need network access
+           (add-after 'check 'unit-tests
+             (lambda _
+               (let ((excluded-unit-tests
+                      (string-join
+                       '("AddressFromURL.Success"
+                         "AddressFromURL.Failure"
+                         "DNSResolver.IPv4Success"
+                         "DNSResolver.DNSSECSuccess"
+                         "DNSResolver.DNSSECFailure"
+                         "DNSResolver.GetTXTRecord")
+                       ":")))
+                 (invoke "tests/unit_tests/unit_tests"
+                         (string-append "--gtest_filter=-"
+                                        excluded-unit-tests)))))
+           (add-after 'install 'install-blockchain-import-export
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (bin (string-append out "/bin")))
+                 (install-file "bin/monero-blockchain-import" bin)
+                 (install-file "bin/monero-blockchain-export" bin)))))))
+      (home-page "https://getmonero.org/")
+      (synopsis "Command-line interface to the Monero currency")
+      (description
+       "Monero is a secure, private, untraceable currency.  This package provides the
 Monero command line client and daemon.")
-    (license license:bsd-3)))
+      (license license:bsd-3))))
 
 (define-public monero-core
   (package
-- 
2.16.2