GNU bug report logs - #69126
[PATCH 0/2] gnu: Add type-safe.

Previous Next

Package: guix-patches;

Reported by: "Paul A. Patience" <paul <at> apatience.com>

Date: Wed, 14 Feb 2024 15:35:02 UTC

Severity: normal

Tags: patch

Done: Sharlatan Hellseher <sharlatanus <at> gmail.com>

To reply to this bug, email your comments to 69126 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Wed, 14 Feb 2024 15:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Paul A. Patience" <paul <at> apatience.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 14 Feb 2024 15:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: guix-patches <at> gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH 0/2] gnu: Add type-safe.
Date: Wed, 14 Feb 2024 15:33:36 +0000
Paul A. Patience (2):
  gnu: Add debug-assert.
  gnu: Add type-safe.

 gnu/packages/cpp.scm | 81 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 80 insertions(+), 1 deletion(-)


base-commit: 570ef13a87bb54d3410c431700ba78316a2641e2
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Wed, 14 Feb 2024 15:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: 69126 <at> debbugs.gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH 1/2] gnu: Add debug-assert.
Date: Wed, 14 Feb 2024 15:36:15 +0000
* gnu/packages/cpp.scm (debug-assert): New variable.

Change-Id: I4cee49ea2f5b761ab72bb7b063c2ea8fd99b991c
---
 gnu/packages/cpp.scm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 62a1923571..2456de5002 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -38,7 +38,7 @@
 ;;; Copyright © 2023 Liliana Marie Prikler <liliana.prikler <at> gmail.com>
 ;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
-;;; Copyright © 2023 Paul A. Patience <paul <at> apatience.com>
+;;; Copyright © 2023-2024 Paul A. Patience <paul <at> apatience.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3048,3 +3048,29 @@ (define-public tl-optional
 the std::optional for C++11/14/17, with support for monadic operations added in
 C++23.")
     (license license:cc0)))
+
+(define-public debug-assert
+  ;; Newer version than last release, which was in 2018, is required for
+  ;; type_safe.
+  (let ((commit "d33781479baccf52a28e5c3c5a6da5ac59b09179")
+        (revision "0"))
+    (package
+      (name "debug-assert")
+      (version (git-version "1.3.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/foonathan/debug_assert")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0njbzx767pndpl8hq5falr4c8m0xsr6njh0943xf8xkcqq6splpz"))))
+      (build-system cmake-build-system)
+      (arguments (list #:tests? #f))    ; no tests
+      (home-page "https://github.com/foonathan/debug_assert")
+      (synopsis "Assertion macro for C++")
+      (description "debug_assert is a C++11 header-only library which provides the
+@code{DEBUG_ASSERT()} macro, which among other features can be selectively
+enabled in different parts of your code.")
+      (license license:zlib))))
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Wed, 14 Feb 2024 15:37:02 GMT) Full text and rfc822 format available.

Message #11 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: 69126 <at> debbugs.gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH 2/2] gnu: Add type-safe.
Date: Wed, 14 Feb 2024 15:36:20 +0000
* gnu/packages/cpp.scm (type-safe): New variable.

Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
---
 gnu/packages/cpp.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2456de5002..cf0771e470 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3074,3 +3074,56 @@ (define-public debug-assert
 @code{DEBUG_ASSERT()} macro, which among other features can be selectively
 enabled in different parts of your code.")
       (license license:zlib))))
+
+(define-public type-safe
+  (package
+    (name "type-safe")
+    (version "0.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/foonathan/type_safe")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ijd5grkbzfcmkqydka5ncl7ab4rc3307qr0ywwgzqsifr3ks0fd"))
+       (modules '((guix build utils)))
+       ;; Remove bundled debug_assert.
+       ;; Keep external/external.cmake because it enables
+       ;; TYPE_SAFE_HAS_IMPORTED_TARGETS, required for installing the CMake
+       ;; config files.
+       (snippet #~(delete-file-recursively "external/debug_assert"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "-DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON"
+                   "-DTYPE_SAFE_BUILD_DOC=OFF") ; needs standardese
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'fix-dependencies
+                 (lambda _
+                   (substitute* "test/CMakeLists.txt"
+                     (("^if\\(NOT EXISTS .*/catch\\.hpp\\)") "if(FALSE)")
+                     (("^(target_include_directories\\(type_safe_test) .*"
+                       all prefix)
+                      (string-append all prefix " PRIVATE \""
+                                     #$(this-package-native-input "catch2")
+                                     "/include/catch2\")\n")))))
+               (add-after 'install 'fix-cmake-config
+                 (lambda _
+                   (substitute* (string-append
+                                 #$output
+                                 "/lib/cmake/type_safe/type_safe-config.cmake")
+                     (("^(find_dependency\\(debug_assert)\\)" _ prefix)
+                      (string-append prefix " PATHS \""
+                                     #$(this-package-input "debug-assert")
+                                     "/lib/cmake/debug_assert\")"))))))))
+    (native-inputs (list catch2))
+    (inputs (list debug-assert))
+    (home-page "https://github.com/foonathan/type_safe")
+    (synopsis "C++ abstractions for preventing bugs via the type system")
+    (description "type_safe is a C++ header-only library which provides
+abstractions for defining more appropriate types, thus allowing C++'s type
+system to prevent more bugs.")
+    (license license:expat)))
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Wed, 14 Feb 2024 21:29:02 GMT) Full text and rfc822 format available.

Message #14 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: Skyler Ferris <skyvine <at> protonmail.com>
To: "Paul A. Patience" <paul <at> apatience.com>, 69126 <at> debbugs.gnu.org
Subject: Re: [bug#69126] [PATCH 0/2] gnu: Add type-safe.
Date: Wed, 14 Feb 2024 21:27:49 +0000
Hi Paul,

I am adding some review notes to this issue. To avoid any potential 
confusion I want to be clear that I am not a committer, but I am adding 
these notes in hopes that it will help a committer process these patches 
more efficiently.

Regards,
Skyler





Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Wed, 14 Feb 2024 21:30:02 GMT) Full text and rfc822 format available.

Message #17 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: Skyler Ferris <skyvine <at> protonmail.com>
To: "Paul A. Patience" <paul <at> apatience.com>, 69126 <at> debbugs.gnu.org
Subject: Re: [bug#69126] [PATCH 1/2] gnu: Add debug-assert.
Date: Wed, 14 Feb 2024 21:29:05 +0000
Things needing attention:

`guix lint` issues a warning that the beginning of the description 
starts with a lowercase letter. IMO this is reasonable because the first 
word is the name of the project, and it is a common convention for 
project names to remain lowercased (the README in the project follows 
this convention). However I am not sure how the Guix maintainers 
consider this.

The arguments form is attached to a comment saying that there are no 
tests, but it looks like the repository does contain a test in the 
`test_package` directory with a separate CMakelists.txt file. I haven't 
spent much time with the cmake build system in Guix, would it be 
reasonable to replace the check phase with a procedure that uses the 
file in this directory? If not then it might be helpful to replace the 
comment with one explaining that, while tests exist, it is not feasible 
to run them for some specific reason.

More details:

This diff applies cleanly to commit 
ac470c516e19f194228edf9e348bdbc7fc10f97a.

The following paragraph contains notes about the confidence level of 
source integrity. These notes are provided to indicate that due 
attention has been given to this matter and to provide transparency into 
the level of confidence in the source as well as the entities trusted 
with maintaining integrity. The "optimal" level of confidence is 
use-case dependent, as is the trustability of any given entity. These 
notes are provided for transparency to the committer and any other 
interested parties and should not be interpreted as criticism of the commit.

The commit used in the source form is signed by PGP key 
5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23. The key is expired but NOT 
revoked. It is available on the Ubuntu keyserver 
(http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x5de3e0509c47ea3cf04a42d34aee18f83afdeb23) 
with several other signatures, though none that are trusted by my 
keyring. It is also available on the OpenPGP keyserver 
(https://keys.openpgp.org/vks/v1/by-fingerprint/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23) 
but without a UID, meaning the email address was not verified. Note that 
one of the UIDs listed in the Ubuntu server is "GitHub (web-flow 
commit)", implying that the GitHub server is ultimately responsible for 
maintaining integrity.

`./pre-inst-env guix build debug-assert` succeeded on my machine, an 
x86_64 Xen guest. Additionally, the following program (based on the 
example in the README) successfully compiled and produced the expected 
output.

main.cpp
```
#include <debug_assert.hpp>

struct mymodule : debug_assert::default_handler, 
debug_assert::set_level<static_cast<unsigned int>(-1)> {};

int main(void) {
     DEBUG_ASSERT(1 +1 == 3, my_module{}, debug_assert::level<2>{});
}
```

```
$ ./pre-inst-env guix shell gcc-toolchain debug-assert -C -- g++ 
-std=c++11 main.cpp
$ ./a.out
[debug assert] main.cpp:6: Assertion '1 +1 == 3' failed.
Aborted
```

The LICENSE file provided in the source repository matches the contents 
I see at https://directory.fsf.org/wiki/License:Zlib.





Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Wed, 14 Feb 2024 21:32:02 GMT) Full text and rfc822 format available.

Message #20 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: Skyler Ferris <skyvine <at> protonmail.com>
To: "Paul A. Patience" <paul <at> apatience.com>, 69126 <at> debbugs.gnu.org
Subject: Re: [bug#69126] [PATCH 2/2] gnu: Add type-safe.
Date: Wed, 14 Feb 2024 21:30:57 +0000
Things needing attention:

When I tried to compile a file which included `type_safe/integer.hpp` 
from a container (see below for exact commands & source), I got an error 
that the debug_assert header could not be found. I resolved this by 
changing the debug-assert package from a normal input into a propagated 
input, but there could be other ways to solve this.

main.cpp
```
#include <type_safe/integer.hpp>

int main(void) {
     type_safe::integer<int> tsi(1);
     return tsi.get();
}
```

```
$ ./pre-inst-env guix shell gcc-toolchain type-safe -C -- g++ -std=c++11 
main.cpp
<error indicating that debug_assert.hpp was not found>
```

More details:

This diff applies cleanly to commit 
ac470c516e19f194228edf9e348bdbc7fc10f97a, after applying the previous 
commit in this series.

As with the review on the previous patch, notes about confidence in 
source integrity are provided as an indication of attention and to 
provide transparency. The commit tagged v0.2.3 does not have a signature 
on it, but the commit 3 steps prior has a good signature. It uses the 
same signing key as debug-assert, so all of the notes from there apply 
here as well.

`./pre-inst-env guix build type-safe` succeeded on my machine, an x86_64 
Xen guest. Additionally, after fixing the issue noted in the "Things 
needing attention" section, the following test file produced an expected 
compiler error indicating that the type_safe::integer needs an initial 
value.

main.cpp
```
#include <type_safe/integer.hpp>

int main(void) {
     type_safe::integer<int> tsi;
     return tsi.get();
}
```

Once I added an initial value as shown in the "Things needing attention" 
section, the file built successfully and the executable returned the 
expected exit code.

```
$ ./pre-inst-env guix shell gcc-toolchain type-safe -C -- g++ -std=c++11 
main.cpp
$ ./a.out
$ echo $?
1
```

The license file in the project matches the contents I see at 
https://directory.fsf.org/wiki/License:Expat.






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Thu, 15 Feb 2024 14:04:02 GMT) Full text and rfc822 format available.

Message #23 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: Skyler Ferris <skyvine <at> protonmail.com>
Cc: 69126 <at> debbugs.gnu.org
Subject: Re: [bug#69126] [PATCH 1/2] gnu: Add debug-assert.
Date: Thu, 15 Feb 2024 14:02:42 +0000
Hello,

Thanks for reviewing my patches.

On 2024-02-14 16:29:05-05:00, Skyler Ferris wrote:
> `guix lint` issues a warning that the beginning of the description
> starts with a lowercase letter. IMO this is reasonable because the first
> word is the name of the project, and it is a common convention for
> project names to remain lowercased (the README in the project follows
> this convention). However I am not sure how the Guix maintainers
> consider this.

I was aware of the issue, and I share your opinion.
Sometimes project authors write the project name lowercased but in a
fixed-width font, in which case I use either @samp{} or @code{}, which
guix lint does not raise an error for.
However, this author does not, so I left it as such.
For what it's worth, I counted a few hundred instances of a lowercased
project name without @samp{} or @code{} in the first line of the
description across the Guix codebase.
I will leave it to the discretion of the committer.

> The arguments form is attached to a comment saying that there are no
> tests, but it looks like the repository does contain a test in the
> `test_package` directory with a separate CMakelists.txt file. I haven't
> spent much time with the cmake build system in Guix, would it be
> reasonable to replace the check phase with a procedure that uses the
> file in this directory? If not then it might be helpful to replace the
> comment with one explaining that, while tests exist, it is not feasible
> to run them for some specific reason.

The test_package directory seems to test the installation of
debug_assert with the Conan package manager, so there is nothing to do
here.

Best regards,
Paul





Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Thu, 15 Feb 2024 14:25:01 GMT) Full text and rfc822 format available.

Message #26 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: Skyler Ferris <skyvine <at> protonmail.com>
Cc: 69126 <at> debbugs.gnu.org
Subject: Re: [bug#69126] [PATCH 2/2] gnu: Add type-safe.
Date: Thu, 15 Feb 2024 14:23:53 +0000

On 2024-02-14 16:30:57-05:00, Skyler Ferris wrote:
> When I tried to compile a file which included `type_safe/integer.hpp`
> from a container (see below for exact commands & source), I got an error
> that the debug_assert header could not be found. I resolved this by
> changing the debug-assert package from a normal input into a propagated
> input, but there could be other ways to solve this.

Nice catch.
I have been using the type_safe library via CMake, which I made work in
the fix-cmake-config phase, but I forgot to consider the case you raised.
I've fixed the issue and will submit a patch presently.

Thanks for providing sample code and invocation, it made it quicker to
test.

Best regards,
Paul





Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Thu, 15 Feb 2024 14:27:02 GMT) Full text and rfc822 format available.

Message #29 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: 69126 <at> debbugs.gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH v2] gnu: Add type-safe.
Date: Thu, 15 Feb 2024 14:25:55 +0000
* gnu/packages/cpp.scm (type-safe): New variable.

Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
---
This patch addresses the issue raised by Skylar Ferris.

 gnu/packages/cpp.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2456de5002..f7e502d1bf 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3074,3 +3074,63 @@ (define-public debug-assert
 @code{DEBUG_ASSERT()} macro, which among other features can be selectively
 enabled in different parts of your code.")
       (license license:zlib))))
+
+(define-public type-safe
+  (package
+    (name "type-safe")
+    (version "0.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/foonathan/type_safe")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ijd5grkbzfcmkqydka5ncl7ab4rc3307qr0ywwgzqsifr3ks0fd"))
+       (modules '((guix build utils)))
+       ;; Remove bundled debug_assert.
+       ;; Keep external/external.cmake because it enables
+       ;; TYPE_SAFE_HAS_IMPORTED_TARGETS, required for installing the CMake
+       ;; config files.
+       (snippet #~(delete-file-recursively "external/debug_assert"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "-DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON"
+                   "-DTYPE_SAFE_BUILD_DOC=OFF") ; needs standardese
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'fix-dependencies
+                 (lambda _
+                   (substitute*
+                       (list "include/type_safe/detail/assert.hpp"
+                             "include/type_safe/detail/force_inline.hpp")
+                     (("#include <debug_assert.hpp>")
+                      (string-append "#include <"
+                                     #$(this-package-input "debug-assert")
+                                     "/include/debug_assert.hpp>")))
+                   (substitute* "test/CMakeLists.txt"
+                     (("^if\\(NOT EXISTS .*/catch\\.hpp\\)") "if(FALSE)")
+                     (("^(target_include_directories\\(type_safe_test) .*"
+                       all prefix)
+                      (string-append all prefix " PRIVATE \""
+                                     #$(this-package-native-input "catch2")
+                                     "/include/catch2\")\n")))))
+               (add-after 'install 'fix-cmake-config
+                 (lambda _
+                   (substitute* (string-append
+                                 #$output
+                                 "/lib/cmake/type_safe/type_safe-config.cmake")
+                     (("^(find_dependency\\(debug_assert)\\)" _ prefix)
+                      (string-append prefix " PATHS \""
+                                     #$(this-package-input "debug-assert")
+                                     "/lib/cmake/debug_assert\")"))))))))
+    (native-inputs (list catch2))
+    (inputs (list debug-assert))
+    (home-page "https://github.com/foonathan/type_safe")
+    (synopsis "C++ abstractions for preventing bugs via the type system")
+    (description "type_safe is a C++ header-only library which provides
+abstractions for defining more appropriate types, thus allowing C++'s type
+system to prevent more bugs.")
+    (license license:expat)))

base-commit: 0191a95edf076b5cd24326d49e54ce13f2bdb0d4
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Sat, 17 Feb 2024 08:46:02 GMT) Full text and rfc822 format available.

Message #32 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: "Paul A. Patience" <paul <at> apatience.com>, 69126 <at> debbugs.gnu.org
Subject: Re: [PATCH v2] gnu: Add type-safe.
Date: Sat, 17 Feb 2024 09:43:53 +0100
Am Donnerstag, dem 15.02.2024 um 14:25 +0000 schrieb Paul A. Patience:
> * gnu/packages/cpp.scm (type-safe): New variable.
> 
> Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
> ---
> This patch addresses the issue raised by Skylar Ferris.
Hi, the convention when renewing patches is to keep the order of the
old.  Even if you don't resend all of them (which many for the record
do), it makes sense to still calls this v2 2/2 unless 1/2 is already
pushed.

>  gnu/packages/cpp.scm | 60
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 2456de5002..f7e502d1bf 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -3074,3 +3074,63 @@ (define-public debug-assert
>  @code{DEBUG_ASSERT()} macro, which among other features can be
> selectively
>  enabled in different parts of your code.")
>        (license license:zlib))))
> +
> +(define-public type-safe
> +  (package
> +    (name "type-safe")
> +    (version "0.2.3")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/foonathan/type_safe")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32
> "0ijd5grkbzfcmkqydka5ncl7ab4rc3307qr0ywwgzqsifr3ks0fd"))
> +       (modules '((guix build utils)))
> +       ;; Remove bundled debug_assert.
> +       ;; Keep external/external.cmake because it enables
> +       ;; TYPE_SAFE_HAS_IMPORTED_TARGETS, required for installing
> the CMake
> +       ;; config files.
> +       (snippet #~(delete-file-recursively
> "external/debug_assert"))))
You could also rewrite the top-level CMake file so that this is not an
issue.  Alternatively, use the (let ((keep …)) …) pattern, so that the
code is self-explanatory.
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list #:configure-flags
> +           #~(list "-DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON"
> +                   "-DTYPE_SAFE_BUILD_DOC=OFF") ; needs standardese
Can we package that or is there some bootstrapping issue?
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'fix-dependencies
> +                 (lambda _
> +                   (substitute*
> +                       (list "include/type_safe/detail/assert.hpp"
> +                            
> "include/type_safe/detail/force_inline.hpp")
> +                     (("#include <debug_assert.hpp>")
> +                      (string-append "#include <"
> +                                     #$(this-package-input "debug-
> assert")
> +                                     "/include/debug_assert.hpp>")))
Use search-input-file.
> +                   (substitute* "test/CMakeLists.txt"
> +                     (("^if\\(NOT EXISTS .*/catch\\.hpp\\)")
> "if(FALSE)")
> +                    
> (("^(target_include_directories\\(type_safe_test) .*"
> +                       all prefix)
> +                      (string-append all prefix " PRIVATE \""
> +                                     #$(this-package-native-input
> "catch2")
> +                                     "/include/catch2\")\n")))))
Use search-input-directory.
> +               (add-after 'install 'fix-cmake-config
> +                 (lambda _
> +                   (substitute* (string-append
> +                                 #$output
> +                                 "/lib/cmake/type_safe/type_safe-
> config.cmake")
> +                     (("^(find_dependency\\(debug_assert)\\)" _
> prefix)
> +                      (string-append prefix " PATHS \""
> +                                     #$(this-package-input "debug-
> assert")
> +                                    
> "/lib/cmake/debug_assert\")"))))))))
In general, I'd encourage writing a patch to fix both this and the
issues pointed out above.  Note, that CMake has its way of locating
packages per cmake files or pkgconfig, so hard-coding directories as
done here is typically *not* needed.
> +    (native-inputs (list catch2))
> +    (inputs (list debug-assert))
> +    (home-page "https://github.com/foonathan/type_safe")
> +    (synopsis "C++ abstractions for preventing bugs via the type
> system")
> +    (description "type_safe is a C++ header-only library which
> provides
> +abstractions for defining more appropriate types, thus allowing
> C++'s type
> +system to prevent more bugs.")
> +    (license license:expat)))

Cheers

Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Tue, 20 Feb 2024 19:35:02 GMT) Full text and rfc822 format available.

Message #35 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: 69126 <at> debbugs.gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH v3 0/2] gnu: Add type-safe.
Date: Tue, 20 Feb 2024 19:33:18 +0000
Resubmitting the patch series as per Liliana Marie Prikler's suggestion.
No changes since the last.

Paul A. Patience (2):
  gnu: Add debug-assert.
  gnu: Add type-safe.

 gnu/packages/cpp.scm | 88 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 87 insertions(+), 1 deletion(-)


base-commit: 570ef13a87bb54d3410c431700ba78316a2641e2
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Tue, 20 Feb 2024 19:35:02 GMT) Full text and rfc822 format available.

Message #38 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: 69126 <at> debbugs.gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH v3 1/2] gnu: Add debug-assert.
Date: Tue, 20 Feb 2024 19:33:26 +0000
* gnu/packages/cpp.scm (debug-assert): New variable.

Change-Id: I4cee49ea2f5b761ab72bb7b063c2ea8fd99b991c
---
 gnu/packages/cpp.scm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 62a1923571..2456de5002 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -38,7 +38,7 @@
 ;;; Copyright © 2023 Liliana Marie Prikler <liliana.prikler <at> gmail.com>
 ;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
-;;; Copyright © 2023 Paul A. Patience <paul <at> apatience.com>
+;;; Copyright © 2023-2024 Paul A. Patience <paul <at> apatience.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3048,3 +3048,29 @@ (define-public tl-optional
 the std::optional for C++11/14/17, with support for monadic operations added in
 C++23.")
     (license license:cc0)))
+
+(define-public debug-assert
+  ;; Newer version than last release, which was in 2018, is required for
+  ;; type_safe.
+  (let ((commit "d33781479baccf52a28e5c3c5a6da5ac59b09179")
+        (revision "0"))
+    (package
+      (name "debug-assert")
+      (version (git-version "1.3.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/foonathan/debug_assert")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0njbzx767pndpl8hq5falr4c8m0xsr6njh0943xf8xkcqq6splpz"))))
+      (build-system cmake-build-system)
+      (arguments (list #:tests? #f))    ; no tests
+      (home-page "https://github.com/foonathan/debug_assert")
+      (synopsis "Assertion macro for C++")
+      (description "debug_assert is a C++11 header-only library which provides the
+@code{DEBUG_ASSERT()} macro, which among other features can be selectively
+enabled in different parts of your code.")
+      (license license:zlib))))
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#69126; Package guix-patches. (Tue, 20 Feb 2024 19:35:03 GMT) Full text and rfc822 format available.

Message #41 received at 69126 <at> debbugs.gnu.org (full text, mbox):

From: "Paul A. Patience" <paul <at> apatience.com>
To: 69126 <at> debbugs.gnu.org
Cc: "Paul A. Patience" <paul <at> apatience.com>
Subject: [PATCH v3 2/2] gnu: Add type-safe.
Date: Tue, 20 Feb 2024 19:33:33 +0000
* gnu/packages/cpp.scm (type-safe): New variable.

Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
---
 gnu/packages/cpp.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2456de5002..f7e502d1bf 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3074,3 +3074,63 @@ (define-public debug-assert
 @code{DEBUG_ASSERT()} macro, which among other features can be selectively
 enabled in different parts of your code.")
       (license license:zlib))))
+
+(define-public type-safe
+  (package
+    (name "type-safe")
+    (version "0.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/foonathan/type_safe")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ijd5grkbzfcmkqydka5ncl7ab4rc3307qr0ywwgzqsifr3ks0fd"))
+       (modules '((guix build utils)))
+       ;; Remove bundled debug_assert.
+       ;; Keep external/external.cmake because it enables
+       ;; TYPE_SAFE_HAS_IMPORTED_TARGETS, required for installing the CMake
+       ;; config files.
+       (snippet #~(delete-file-recursively "external/debug_assert"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "-DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON"
+                   "-DTYPE_SAFE_BUILD_DOC=OFF") ; needs standardese
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'fix-dependencies
+                 (lambda _
+                   (substitute*
+                       (list "include/type_safe/detail/assert.hpp"
+                             "include/type_safe/detail/force_inline.hpp")
+                     (("#include <debug_assert.hpp>")
+                      (string-append "#include <"
+                                     #$(this-package-input "debug-assert")
+                                     "/include/debug_assert.hpp>")))
+                   (substitute* "test/CMakeLists.txt"
+                     (("^if\\(NOT EXISTS .*/catch\\.hpp\\)") "if(FALSE)")
+                     (("^(target_include_directories\\(type_safe_test) .*"
+                       all prefix)
+                      (string-append all prefix " PRIVATE \""
+                                     #$(this-package-native-input "catch2")
+                                     "/include/catch2\")\n")))))
+               (add-after 'install 'fix-cmake-config
+                 (lambda _
+                   (substitute* (string-append
+                                 #$output
+                                 "/lib/cmake/type_safe/type_safe-config.cmake")
+                     (("^(find_dependency\\(debug_assert)\\)" _ prefix)
+                      (string-append prefix " PATHS \""
+                                     #$(this-package-input "debug-assert")
+                                     "/lib/cmake/debug_assert\")"))))))))
+    (native-inputs (list catch2))
+    (inputs (list debug-assert))
+    (home-page "https://github.com/foonathan/type_safe")
+    (synopsis "C++ abstractions for preventing bugs via the type system")
+    (description "type_safe is a C++ header-only library which provides
+abstractions for defining more appropriate types, thus allowing C++'s type
+system to prevent more bugs.")
+    (license license:expat)))
-- 
2.41.0






Reply sent to Sharlatan Hellseher <sharlatanus <at> gmail.com>:
You have taken responsibility. (Sun, 03 Nov 2024 23:39:01 GMT) Full text and rfc822 format available.

Notification sent to "Paul A. Patience" <paul <at> apatience.com>:
bug acknowledged by developer. (Sun, 03 Nov 2024 23:39:01 GMT) Full text and rfc822 format available.

Message #46 received at 69126-done <at> debbugs.gnu.org (full text, mbox):

From: Sharlatan Hellseher <sharlatanus <at> gmail.com>
To: 69126-done <at> debbugs.gnu.org
Subject: [PATCH 0/2] gnu: Add type-safe.
Date: Sun, 03 Nov 2024 23:37:52 +0000
[Message part 1 (text/plain, inline)]
Hi,

I've refreshed versions, built, lint locally.

Pushed 84266a8f74..d33626fb07 to master.

--
Thanks,
Oleg
[signature.asc (application/pgp-signature, inline)]

Message sent on to "Paul A. Patience" <paul <at> apatience.com>:
bug#69126. (Mon, 04 Nov 2024 13:13:02 GMT) Full text and rfc822 format available.

Message #49 received at 69126-submitter <at> debbugs.gnu.org (full text, mbox):

From: Steve George <steve <at> futurile.net>
To: control <at> debbugs.gnu.org
Cc: 69126-submitter <at> debbugs.gnu.org
Subject: closing 69126
Date: Mon, 4 Nov 2024 13:12:11 +0000
close 69126 
# Hi Paul - committed d33626fb07e5a8369b1be1dff87f399be90d85d4
# Thanks for sending!
quit





This bug report was last modified 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.