Subject: [bug#65630] [PATCH v2 2/2] gnu: onnx: Update to 1.14.1

From: Andy Tai <[email-masked]>
Date: Sat, 2 Sep 2023 20:44:17 -0700

* gnu/packages/machine-learning.scm (onnx): Update to 1.14.1
* gnu/packages/patches/onnx-skip-model-downloads.patch: Adjust to onnx 1.14.1
* gnu/packages/patches/onnx-use-system-googletest.patch: Adjust to onnx 1.14.1
---
 gnu/packages/machine-learning.scm                    | 12 ++++++++----
 gnu/packages/patches/onnx-skip-model-downloads.patch |  8 ++++----
 .../patches/onnx-use-system-googletest.patch         |  8 +++-----
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 53778114eb..d8d99addd1 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1025,7 +1025,7 @@ (define-public shogun
 (define-public onnx
   (package
     (name "onnx")
-    (version "1.12.0")
+    (version "1.14.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -1033,7 +1033,7 @@ (define-public onnx
                     (commit (string-append "v" version))))
               (sha256
                (base32
-                "1g9f1hviksbn7gi6fnd0dsm7nf0w3yia0mjj33d9mggklrl0db6x"))
+                "1lg67z5kzky5qmfcll6dg9pkbdric4d2zwxs89ljc0nyla9rsm35"))
               (file-name (git-file-name name version))
               (patches (search-patches "onnx-use-system-googletest.patch"
                                        "onnx-shared-libraries.patch"
@@ -1059,7 +1059,9 @@ (define-public onnx
                               (string-append "-DCMAKE_INSTALL_RPATH=" out
                                              "/lib")
                               "-DCMAKE_VERBOSE_MAKEFILE=ON"
-
+                              "-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
+                              "-DONNX_OPT_USE_SYSTEM_PROTOBUF=ON"
+                               ; force system copy use;
                               "-DBUILD_SHARED_LIBS=ON"))
 
                       ;; This environment variable is honored by 'setup.py',
@@ -1090,10 +1092,12 @@ (define-public onnx
            pybind11
            python-coverage
            python-nbval
+           python-parameterized
+           python-protobuf
            python-pytest
            python-pytest-runner))
     (inputs
-     (list protobuf))
+     (list protobuf ))
     (propagated-inputs
      (list python-numpy python-protobuf python-six python-tabulate
            python-typing-extensions))
diff --git a/gnu/packages/patches/onnx-skip-model-downloads.patch b/gnu/packages/patches/onnx-skip-model-downloads.patch
index 4ab55b4ceb..e96f4cb7d9 100644
--- a/gnu/packages/patches/onnx-skip-model-downloads.patch
+++ b/gnu/packages/patches/onnx-skip-model-downloads.patch
@@ -6,10 +6,10 @@ diff --git a/onnx/backend/test/runner/__init__.py b/onnx/backend/test/runner/__i
 index 049ed57b..f236f1bf 100644
 --- a/onnx/backend/test/runner/__init__.py
 +++ b/onnx/backend/test/runner/__init__.py
-@@ -202,6 +202,7 @@ class Runner(object):
-             print('Start downloading model {} from {}'.format(
-                 model_test.model_name,
-                 model_test.url))
+@@ -227,6 +227,7 @@ class Runner(object):
+             print(
+                 f"Start downloading model {model_test.model_name} from {model_test.url}"
+             )
 +            raise unittest.SkipTest('Skipping download')
              urlretrieve(model_test.url, download_file.name)
              print('Done')
diff --git a/gnu/packages/patches/onnx-use-system-googletest.patch b/gnu/packages/patches/onnx-use-system-googletest.patch
index 5dfcbc6dc3..4279ea37c6 100644
--- a/gnu/packages/patches/onnx-use-system-googletest.patch
+++ b/gnu/packages/patches/onnx-use-system-googletest.patch
@@ -28,21 +28,19 @@ index 0aa9fda2..a573170c 100644
 
  if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
 diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake
-index e29a93ff..ae146390 100644
+index e71b92a7..30c446ce 100644
 --- a/cmake/unittest.cmake
 +++ b/cmake/unittest.cmake
-@@ -6,8 +6,8 @@ include(${ONNX_ROOT}/cmake/Utils.cmake)
+@@ -7,7 +7,7 @@ include(${ONNX_ROOT}/cmake/Utils.cmake)
 
  find_package(Threads)
 
 -set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES})
--set(${ONNXIFI_TEST_DRIVER}_libs ${googletest_STATIC_LIBRARIES})
 +set(${UT_NAME}_libs ${GTEST_LIBRARIES})
-+set(${ONNXIFI_TEST_DRIVER}_libs ${GTEST_LIBRARIES})
 
  list(APPEND ${UT_NAME}_libs onnx)
  list(APPEND ${UT_NAME}_libs onnx_proto)
-@@ -31,10 +31,10 @@ function(AddTest)
+@@ -22,10 +22,10 @@ function(AddTest)
    list(REMOVE_DUPLICATES _UT_SOURCES)
 
    add_executable(${_UT_TARGET} ${_UT_SOURCES})
-- 
2.41.0