guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#42404] [PATCH 3/5] gnu: Add rnp.


From: Justus Winter
Subject: [bug#42404] [PATCH 3/5] gnu: Add rnp.
Date: Fri, 24 Jul 2020 14:43:41 +0200

* gnu/packages/openpgp.scm (rnp): New variable.
* gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch: New file.
* gnu/packages/patches/rnp-fix-gnupg-list-packets.patch: New file.
* gnu/packages/patches/rnp-fix-test-setup.patch: New file.
* gnu/packages/patches/rnp-fix-test.patch: New file.
* gnu/packages/patches/rnp-fix-true-false.patch: New file.
* gnu/packages/patches/rnp-unbundle-googletest.patch: New file.
---
 gnu/local.mk                                  |   6 +
 gnu/packages/openpgp.scm                      |  81 +++++-
 .../patches/rnp-disable-ruby-rnp-tests.patch  |  26 ++
 .../patches/rnp-fix-gnupg-list-packets.patch  |  37 +++
 gnu/packages/patches/rnp-fix-test-setup.patch |  36 +++
 gnu/packages/patches/rnp-fix-test.patch       |  31 +++
 gnu/packages/patches/rnp-fix-true-false.patch | 255 ++++++++++++++++++
 .../patches/rnp-unbundle-googletest.patch     |  45 ++++
 8 files changed, 516 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch
 create mode 100644 gnu/packages/patches/rnp-fix-gnupg-list-packets.patch
 create mode 100644 gnu/packages/patches/rnp-fix-test-setup.patch
 create mode 100644 gnu/packages/patches/rnp-fix-test.patch
 create mode 100644 gnu/packages/patches/rnp-fix-true-false.patch
 create mode 100644 gnu/packages/patches/rnp-unbundle-googletest.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f8a8c16124..68a8d2ae42 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1500,6 +1500,12 @@ dist_patch_DATA =                                        
        \
   %D%/packages/patches/rtags-separate-rct.patch                        \
   %D%/packages/patches/racket-store-checksum-override.patch    \
   %D%/packages/patches/retroarch-disable-online-updater.patch  \
+  %D%/packages/patches/rnp-disable-ruby-rnp-tests.patch                \
+  %D%/packages/patches/rnp-fix-gnupg-list-packets.patch                \
+  %D%/packages/patches/rnp-fix-test-setup.patch                        \
+  %D%/packages/patches/rnp-fix-test.patch                      \
+  %D%/packages/patches/rnp-fix-true-false.patch                        \
+  %D%/packages/patches/rnp-unbundle-googletest.patch           \
   %D%/packages/patches/ruby-rack-ignore-failing-test.patch     \
   %D%/packages/patches/ruby-sanitize-system-libxml.patch       \
   %D%/packages/patches/ruby-tzinfo-data-ignore-broken-test.patch\
diff --git a/gnu/packages/openpgp.scm b/gnu/packages/openpgp.scm
index 94beab9929..ccc76f7ef7 100644
--- a/gnu/packages/openpgp.scm
+++ b/gnu/packages/openpgp.scm
@@ -19,11 +19,19 @@
 (define-module (gnu packages openpgp)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crypto)
   #:use-module (gnu packages gnupg)
-  #:use-module (gnu packages multiprecision))
+  #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages web))
 
 (define-public libtmcg
   (package
@@ -92,3 +100,74 @@ implementation is in experimental state and should NOT be 
used in production
 environments.")
     (home-page "https://www.nongnu.org/dkgpg/";)
     (license license:gpl2+)))
+
+(define-public rnp
+  (package
+    (name "rnp")
+    (version "0.13.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rnpgp/rnp";)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "04b2a5cwy91i41vgix6ws99bg93fav8qizx92bivc75lxii8gisz"))
+              (patches
+               (search-patches "rnp-unbundle-googletest.patch"
+                               "rnp-disable-ruby-rnp-tests.patch"
+                               "rnp-fix-test-setup.patch"
+                               "rnp-fix-test.patch"
+                               "rnp-fix-gnupg-list-packets.patch"
+                               "rnp-fix-true-false.patch"))))
+    (build-system cmake-build-system)
+    (arguments '(#:configure-flags
+                 '("-DBUILD_SHARED_LIBS=on"
+                   "-DBUILD_TESTING=on")
+                 #:phases
+                 (modify-phases %standard-phases
+                   (add-after 'unpack 'fixes
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (copy-recursively (assoc-ref inputs "googletest-source")
+                                         "src/tests/googletest-src")
+                       (substitute* "src/tests/support.cpp"
+                         (("/bin/cp") (which "cp")))
+                       #t))
+                   (replace 'check
+                     (lambda _
+                       ;; Some OpenPGP certificates used by the tests expire.
+                       ;; To work around that, set the time to roughly the
+                       ;; release date.
+                       (invoke "faketime" "2020-01-15" "make" "test"))))))
+    (native-inputs
+     `(("gnupg" ,gnupg) ; for tests
+       ("googletest-source" ,(package-source googletest)) ; for tests
+       ("libfaketime" ,libfaketime) ; for tests
+       ("pkg-config" ,pkg-config)
+       ("python2" ,python-2.7)))
+    (inputs `(("botan" ,botan)
+              ("bzip2" ,bzip2)
+              ("json-c" ,json-c)
+              ("zlib" ,zlib)))
+    (synopsis
+     "RFC4880-compliant OpenPGP library written in C++")
+    (description
+     "Set of OpenPGP (RFC4880) tools that works on Linux, *BSD and macOS as a
+replacement of GnuPG.  It is maintained by Ribose after being forked from
+NetPGP, itself originally written for NetBSD.
+
+librnp is the library used by rnp for all OpenPGP functions, useful for
+developers to build against.  It is a “real” library, not a wrapper like GPGME
+of GnuPG.")
+    (home-page "https://www.rnpgp.com/";)
+    (license
+     ;; RNP contains code written by Ribose and code derived from netpgp.
+     (list
+      ;; Ribose's BSD 2-Clause License and NetBSD's BSD 2-Clause License
+      ;; (netpgp).
+      license:bsd-2
+      ;; Nominet UK's Apache 2.0 Licence (netpgp).
+      license:asl2.0
+      ;; Nominet UK's BSD 3-Clause License (netpgp).
+      license:bsd-3))))
diff --git a/gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch 
b/gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch
new file mode 100644
index 0000000000..4fc1838275
--- /dev/null
+++ b/gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch
@@ -0,0 +1,26 @@
+From 9f3c07601393e219cc5979f93fda57bf2d07dee7 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 16:10:21 +0200
+Subject: [PATCH 6/6] Disable ruby-rnp tests.
+
+Prevents cmake from cloning the ruby-rnp repository in order to run its tests.
+---
+ src/tests/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
+index 2f0a1c3f..1c82edbf 100644
+--- a/src/tests/CMakeLists.txt
++++ b/src/tests/CMakeLists.txt
+@@ -164,7 +164,7 @@ foreach(suite IN LISTS suitelist)
+ endforeach()
+ 
+ # cruby does not currently play nice with ASaN et al.
+-if (NOT ENABLE_SANITIZERS AND BUILD_SHARED_LIBS AND NOT WIN32)
++if (NOT ENABLE_SANITIZERS AND BUILD_SHARED_LIBS AND NOT WIN32 AND IGNORE)
+   include(ExternalProject)
+   set(_sourcedir "${CMAKE_BINARY_DIR}/ruby-rnp")
+   if (DEFINED ENV{RUBY_RNP_INSTALL})
+-- 
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-fix-gnupg-list-packets.patch 
b/gnu/packages/patches/rnp-fix-gnupg-list-packets.patch
new file mode 100644
index 0000000000..5d57f8f7d0
--- /dev/null
+++ b/gnu/packages/patches/rnp-fix-gnupg-list-packets.patch
@@ -0,0 +1,37 @@
+From 4cb5b2c1d3783bfad3c4f77b2ad2ac89921e91f4 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 16:03:32 +0200
+Subject: [PATCH 4/6] Make invoking GnuPG more robust.
+
+GnuPG will try to read its state even for operations that do not
+require it, e.g. listing packets.  If the state directory does not
+exist, GnuPG will try to create it.  If this fails, GnuPG errors out.
+
+In some build environments, $HOME may not exist or may not be
+writable (e.g. in Guix and Nix, $HOME does not exist).  This leads to
+a spurious test failures when GnuPG is invoked to inspect packets.
+
+Fix this by using the current directory as GnuPG state directory.
+
+Merged upstream as 681e3be65594469f2e6e5912b4371d1af981d7c7.
+---
+ src/tests/cli_tests.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/tests/cli_tests.py b/src/tests/cli_tests.py
+index 74b28983..2b7d772a 100755
+--- a/src/tests/cli_tests.py
++++ b/src/tests/cli_tests.py
+@@ -106,7 +106,8 @@ RNP_TO_GPG_CIPHERS = {'AES' : 'aes128', 'AES192' : 
'aes192', 'AES256' : 'aes256'
+         'IDEA' : 'idea', '3DES' : '3des', 'CAST5' : 'cast5', 'BLOWFISH' : 
'blowfish'}
+ 
+ def check_packets(fname, regexp):
+-    ret, output, err = run_proc(GPG, ['--list-packets', path_for_gpg(fname)])
++    ret, output, err = run_proc(GPG, ['--homedir', '.',
++                                      '--list-packets', path_for_gpg(fname)])
+     if ret != 0:
+         logging.error(err)
+         return None
+-- 
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-fix-test-setup.patch 
b/gnu/packages/patches/rnp-fix-test-setup.patch
new file mode 100644
index 0000000000..8c0ffee5cc
--- /dev/null
+++ b/gnu/packages/patches/rnp-fix-test-setup.patch
@@ -0,0 +1,36 @@
+From f544b3e63416f3a824ed2955d119ea0d36c88b36 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 16:00:37 +0200
+Subject: [PATCH] Make test environment setup more robust.
+
+Previously, a failing test leaving RNP or GnuPG state directories
+behind would cause all tests following it to fail.  Improve this by
+removing the directories first should they exist.
+
+Merged upstream as 203224f0b1505dba17837c03da603e5b98ab125a.
+---
+ src/tests/cli_tests.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/tests/cli_tests.py b/src/tests/cli_tests.py
+index 2b7d772a..8261486f 100755
+--- a/src/tests/cli_tests.py
++++ b/src/tests/cli_tests.py
+@@ -704,12 +704,14 @@ def setup(loglvl):
+     RNPDIR = path.join(WORKDIR, '.rnp')
+     RNP = os.getenv('RNP_TESTS_RNP_PATH') or 'rnp'
+     RNPK = os.getenv('RNP_TESTS_RNPKEYS_PATH') or 'rnpkeys'
++    shutil.rmtree(RNPDIR, ignore_errors=True)
+     os.mkdir(RNPDIR, 0700)
+ 
+     GPGDIR = path.join(WORKDIR, '.gpg')
+     GPGHOME =  path_for_gpg(GPGDIR) if is_windows() else GPGDIR
+     GPG = os.getenv('RNP_TESTS_GPG_PATH') or find_utility('gpg')
+     GPGCONF = os.getenv('RNP_TESTS_GPGCONF_PATH') or find_utility('gpgconf')
++    shutil.rmtree(GPGDIR, ignore_errors=True)
+     os.mkdir(GPGDIR, 0700)
+ 
+ def data_path(subpath):
+-- 
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-fix-test.patch 
b/gnu/packages/patches/rnp-fix-test.patch
new file mode 100644
index 0000000000..4a590dd400
--- /dev/null
+++ b/gnu/packages/patches/rnp-fix-test.patch
@@ -0,0 +1,31 @@
+From fd0122b0f77fdd0b9e136ba7a3a07e48f6c3080c Mon Sep 17 00:00:00 2001
+From: Nickolay Olshevsky <o.nickolay@gmail.com>
+Date: Wed, 11 Mar 2020 18:16:35 +0200
+Subject: [PATCH 2/6] Fix possible rare failure in test_key_unlock_pgp() test.
+
+Fixed upstream in ba5030620dba3e8684b31ef28687390ca693bf9d.
+---
+ src/tests/key-unlock.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/tests/key-unlock.cpp b/src/tests/key-unlock.cpp
+index 66a44f0d..f7491757 100644
+--- a/src/tests/key-unlock.cpp
++++ b/src/tests/key-unlock.cpp
+@@ -148,9 +148,10 @@ TEST_F(rnp_tests, test_key_unlock_pgp)
+     // verify (negative)
+     std::fstream verf("dummyfile.dat.pgp",
+                       std::ios_base::binary | std::ios_base::out | 
std::ios_base::in);
+-    off_t        versize = file_size("dummyfile.dat.pgp");
+-    verf.seekg(versize - 3, std::ios::beg);
+-    verf.write("0x0C", 1);
++    verf.seekg(-3, std::ios::end);
++    char bt = verf.peek() ^ 0xff;
++    verf.seekp(-3, std::ios::end);
++    verf.write(&bt, 1);
+     verf.close();
+     assert_false(cli_rnp_process_file(&cfg, &rnp));
+     rnp_cfg_free(&cfg);
+-- 
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-fix-true-false.patch 
b/gnu/packages/patches/rnp-fix-true-false.patch
new file mode 100644
index 0000000000..32ba8bd75b
--- /dev/null
+++ b/gnu/packages/patches/rnp-fix-true-false.patch
@@ -0,0 +1,255 @@
+From 028a2f50fbf47d989bbf79be589945bec55b4825 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 15:57:57 +0200
+Subject: [PATCH 3/6] Use 'true' and 'false' instead of 'TRUE' and 'FALSE'.
+
+The latter are not guaranteed to be defined.
+
+Fixed upstream in 0a28a7e982cb229ba041290af073e6d7ede19955.
+---
+ src/lib/rnp.cpp   | 10 ++++-----
+ src/tests/ffi.cpp | 56 +++++++++++++++++++++++------------------------
+ 2 files changed, 33 insertions(+), 33 deletions(-)
+
+diff --git a/src/lib/rnp.cpp b/src/lib/rnp.cpp
+index a87511a4..9c0385d1 100644
+--- a/src/lib/rnp.cpp
++++ b/src/lib/rnp.cpp
+@@ -5927,7 +5927,7 @@ key_to_json(json_object *jso, rnp_key_handle_t handle, 
uint32_t flags)
+         return RNP_ERROR_OUT_OF_MEMORY;
+     }
+     // revoked
+-    json_object *jsorevoked = json_object_new_boolean(key->revoked ? TRUE : 
FALSE);
++    json_object *jsorevoked = json_object_new_boolean(key->revoked ? true : 
false);
+     if (!jsorevoked) {
+         return RNP_ERROR_OUT_OF_MEMORY;
+     }
+@@ -5992,7 +5992,7 @@ key_to_json(json_object *jso, rnp_key_handle_t handle, 
uint32_t flags)
+     }
+     json_object_object_add(jso, "public key", jsopublic);
+     json_object_object_add(
+-      jsopublic, "present", json_object_new_boolean(have_pub ? TRUE : FALSE));
++      jsopublic, "present", json_object_new_boolean(have_pub ? true : false));
+     if (flags & RNP_JSON_PUBLIC_MPIS) {
+         json_object *jsompis = json_object_new_object();
+         if (!jsompis) {
+@@ -6011,7 +6011,7 @@ key_to_json(json_object *jso, rnp_key_handle_t handle, 
uint32_t flags)
+     }
+     json_object_object_add(jso, "secret key", jsosecret);
+     json_object_object_add(
+-      jsosecret, "present", json_object_new_boolean(have_sec ? TRUE : FALSE));
++      jsosecret, "present", json_object_new_boolean(have_sec ? true : false));
+     if (have_sec) {
+         bool locked = pgp_key_is_locked(handle->sec);
+         if (flags & RNP_JSON_SECRET_MPIS) {
+@@ -6029,13 +6029,13 @@ key_to_json(json_object *jso, rnp_key_handle_t handle, 
uint32_t flags)
+                 }
+             }
+         }
+-        json_object *jsolocked = json_object_new_boolean(locked ? TRUE : 
FALSE);
++        json_object *jsolocked = json_object_new_boolean(locked ? true : 
false);
+         if (!jsolocked) {
+             return RNP_ERROR_OUT_OF_MEMORY;
+         }
+         json_object_object_add(jsosecret, "locked", jsolocked);
+         json_object *jsoprotected =
+-          json_object_new_boolean(pgp_key_is_protected(handle->sec) ? TRUE : 
FALSE);
++          json_object_new_boolean(pgp_key_is_protected(handle->sec) ? true : 
false);
+         if (!jsoprotected) {
+             return RNP_ERROR_OUT_OF_MEMORY;
+         }
+diff --git a/src/tests/ffi.cpp b/src/tests/ffi.cpp
+index 4224bb7d..28a4f867 100644
+--- a/src/tests/ffi.cpp
++++ b/src/tests/ffi.cpp
+@@ -800,10 +800,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_pair)
+     rnp_key_handle_t primary = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -814,10 +814,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_pair)
+     rnp_key_handle_t sub = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -878,10 +878,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_pair_dsa_elg)
+     rnp_key_handle_t primary = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -892,10 +892,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_pair_dsa_elg)
+     rnp_key_handle_t sub = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -958,10 +958,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_primary)
+     rnp_key_handle_t primary = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -1021,10 +1021,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_sub)
+     char *           primary_grip = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         primary_grip = strdup(json_object_get_string(jsogrip));
+         assert_non_null(primary_grip);
+@@ -1079,10 +1079,10 @@ TEST_F(rnp_tests, test_ffi_keygen_json_sub)
+     rnp_key_handle_t sub = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -2483,10 +2483,10 @@ TEST_F(rnp_tests, 
test_ffi_keygen_json_sub_pass_required)
+     char *           primary_grip = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"primary", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         primary_grip = strdup(json_object_get_string(jsogrip));
+         assert_non_null(primary_grip);
+@@ -2557,10 +2557,10 @@ TEST_F(rnp_tests, 
test_ffi_keygen_json_sub_pass_required)
+     rnp_key_handle_t sub = NULL;
+     {
+         json_object *jsokey = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
++        assert_int_equal(true, json_object_object_get_ex(parsed_results, 
"sub", &jsokey));
+         assert_non_null(jsokey);
+         json_object *jsogrip = NULL;
+-        assert_int_equal(TRUE, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
++        assert_int_equal(true, json_object_object_get_ex(jsokey, "grip", 
&jsogrip));
+         assert_non_null(jsogrip);
+         const char *grip = json_object_get_string(jsogrip);
+         assert_non_null(grip);
+@@ -3821,7 +3821,7 @@ TEST_F(rnp_tests, test_ffi_key_to_json)
+     assert_int_equal(rnp_strcasecmp(json_object_get_string(get_json_obj(jso, 
"grip")),
+                                     
"20A48B3C61525DCDF8B3B9D82C6BBCF4D8BFB5E5"),
+                      0);
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "revoked")), 
FALSE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "revoked")), 
false);
+     assert_int_equal(json_object_get_int64(get_json_obj(jso, "creation 
time")), 1511313500);
+     assert_int_equal(json_object_get_int64(get_json_obj(jso, "expiration")), 
0);
+     // usage
+@@ -3843,7 +3843,7 @@ TEST_F(rnp_tests, test_ffi_key_to_json)
+                                     
"FFFA72FC225214DC712D0127172EE13E88AF93B4"),
+                      0);
+     // public key
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "public 
key.present")), TRUE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "public 
key.present")), true);
+     assert_int_equal(
+       rnp_strcasecmp(json_object_get_string(get_json_obj(jso, "public 
key.mpis.point")),
+                      
"04B0C6F2F585C1EEDF805C4492CB683839D5EAE6246420780F063D558"
+@@ -3851,14 +3851,14 @@ TEST_F(rnp_tests, test_ffi_key_to_json)
+                      "793CEBAE8600BEEF"),
+       0);
+     // secret key
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.present")), TRUE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.present")), true);
+     assert_int_equal(
+       rnp_strcasecmp(json_object_get_string(get_json_obj(jso, "secret 
key.mpis.x")),
+                      
"46DE93CA439735F36B9CF228F10D8586DA824D88BBF4E24566D5312D061802C8"),
+       0);
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.locked")), FALSE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.locked")), false);
+     assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.protected")),
+-                     FALSE);
++                     false);
+     // userids
+     assert_int_equal(json_object_array_length(get_json_obj(jso, "userids")), 
1);
+     
assert_int_equal(rnp_strcasecmp(json_object_get_string(json_object_array_get_idx(
+@@ -3907,7 +3907,7 @@ TEST_F(rnp_tests, test_ffi_key_to_json)
+     assert_int_equal(rnp_strcasecmp(json_object_get_string(get_json_obj(jso, 
"grip")),
+                                     
"FFFA72FC225214DC712D0127172EE13E88AF93B4"),
+                      0);
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "revoked")), 
FALSE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "revoked")), 
false);
+     assert_int_equal(json_object_get_int64(get_json_obj(jso, "creation 
time")), 1511313500);
+     assert_int_equal(json_object_get_int64(get_json_obj(jso, "expiration")), 
0);
+     // usage
+@@ -3924,21 +3924,21 @@ TEST_F(rnp_tests, test_ffi_key_to_json)
+     // subkey grips
+     assert_null(get_json_obj(jso, "subkey grips"));
+     // public key
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "public 
key.present")), TRUE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "public 
key.present")), true);
+     assert_int_equal(
+       rnp_strcasecmp(json_object_get_string(get_json_obj(jso, "public 
key.mpis.point")),
+                      
"04E2746BA4D180011B17A6909EABDBF2F3733674FBE00B20A3B857C2597233651544150B"
+                      
"896BCE7DCDF47C49FC1E12D5AD86384D26336A48A18845940A3F65F502"),
+       0);
+     // secret key
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.present")), TRUE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.present")), true);
+     assert_int_equal(
+       rnp_strcasecmp(json_object_get_string(get_json_obj(jso, "secret 
key.mpis.x")),
+                      
"DF8BEB7272117AD7AFE2B7E882453113059787FBC785C82F78624EE7EF2117FB"),
+       0);
+-    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.locked")), FALSE);
++    assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.locked")), false);
+     assert_int_equal(json_object_get_boolean(get_json_obj(jso, "secret 
key.protected")),
+-                     FALSE);
++                     false);
+     // userids
+     assert_null(get_json_obj(jso, "userids"));
+     // signatures
+-- 
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-unbundle-googletest.patch 
b/gnu/packages/patches/rnp-unbundle-googletest.patch
new file mode 100644
index 0000000000..d573895ecf
--- /dev/null
+++ b/gnu/packages/patches/rnp-unbundle-googletest.patch
@@ -0,0 +1,45 @@
+From 3d435bbc8c73c78260f510a8d7fd02f81e22f125 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 16:10:12 +0200
+Subject: [PATCH 5/6] Unbundle googletest.
+
+---
+ src/tests/CMakeLists.txt          | 2 +-
+ src/tests/gtest-CMakeLists.txt.in | 8 ++++----
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
+index 1a7ab905..2f0a1c3f 100644
+--- a/src/tests/CMakeLists.txt
++++ b/src/tests/CMakeLists.txt
+@@ -50,7 +50,7 @@ endif()
+ # maintain compiler/linker settings on Windows
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+ # add to our build (provides gtest_main target)
+-add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
++add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest-src
+                  ${CMAKE_CURRENT_BINARY_DIR}/googletest-build
+                  EXCLUDE_FROM_ALL)
+ 
+diff --git a/src/tests/gtest-CMakeLists.txt.in 
b/src/tests/gtest-CMakeLists.txt.in
+index b8878ea5..16cd49ad 100644
+--- a/src/tests/gtest-CMakeLists.txt.in
++++ b/src/tests/gtest-CMakeLists.txt.in
+@@ -4,10 +4,10 @@ project(googletest-download NONE)
+ 
+ include(ExternalProject)
+ ExternalProject_Add(googletest
+-  GIT_REPOSITORY    https://github.com/google/googletest.git
+-  GIT_TAG           master
+-  GIT_SHALLOW       yes
+-  SOURCE_DIR        "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
++#  GIT_REPOSITORY    https://github.com/google/googletest.git
++#  GIT_TAG           master
++#  GIT_SHALLOW       yes
++  SOURCE_DIR        "${CMAKE_CURRENT_SOURCE_DIR}/googletest-src"
+   BINARY_DIR        "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
+   CONFIGURE_COMMAND ""
+   BUILD_COMMAND     ""
+-- 
+2.20.1
+
-- 
2.20.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]