From 447a8079f4cbb9426d4a3c9a62e4f95ce519c11d Mon Sep 17 00:00:00 2001
From: Bernhard M. Wiedemann <bwiedemann+opensusegit@suse.de>
Date: Sep 08 2020 20:47:00 +0000
Subject: Update armnn to rev 11 via SR 832531


https://build.opensuse.org/request/show/832531
by user Guillaume_G + dimstar_suse

---

diff --git a/0005-add-armnn-mobilenet-test-example.patch b/0005-add-armnn-mobilenet-test-example.patch
index 5c4eb03..884f5cf 100644
--- a/0005-add-armnn-mobilenet-test-example.patch
+++ b/0005-add-armnn-mobilenet-test-example.patch
@@ -7,6 +7,7 @@ Upstream-Status: Inappropriate [TI only test code]
 Signed-off-by: Qin Su <qsu@ti.com>
 Signed-off-by: Djordje Senicic <x0157990@ti.com>
 [Guillaume's update: Add boost_log dep]
+[Guillaume's update: Update to apply on top of 20.08]
 ---
  tests/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++++++
  1 file changed, 41 insertions(+)
@@ -23,7 +24,7 @@ index dfcf4b48..5a78d3a6 100644
  include(CheckIncludeFiles)
  
 @@ -348,3 +351,42 @@ if(BUILD_ARMNN_QUANTIZER)
-     add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources})
+     target_include_directories(ImageCSVFileGenerator PRIVATE ../src/armnnUtils)
      ImageTensorExecutor(ImageCSVFileGenerator)
  endif()
 +
diff --git a/armnn-20.05.tar.gz b/armnn-20.05.tar.gz
deleted file mode 120000
index 7ff4219..0000000
--- a/armnn-20.05.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-/ipfs/bafybeibamwz5f6jt7yukux2ovoynyuhslfxbrohbjhflbemyuozo4phtxm
\ No newline at end of file
diff --git a/armnn-20.08.tar.gz b/armnn-20.08.tar.gz
new file mode 120000
index 0000000..76d8cbc
--- /dev/null
+++ b/armnn-20.08.tar.gz
@@ -0,0 +1 @@
+/ipfs/bafybeib2pmjwadhhfzqw4433vwr7hbatm4ytfjufqauhffiza3i5fvaliu
\ No newline at end of file
diff --git a/armnn-fix-catch.patch b/armnn-fix-catch.patch
deleted file mode 100644
index 9ad1536..0000000
--- a/armnn-fix-catch.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- armnn-20.05.orig/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp	2020-06-08 08:53:31.543112449 +0200
-+++ armnn-20.05/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp	2020-06-08 08:54:20.503535598 +0200
-@@ -34,7 +34,7 @@ static const int GENERAL_ERROR = -100;
-             auto r_local = v;                       \
-             if (r_local != 0) { return r_local;}    \
-         }                                           \
--        catch(armnn::Exception e)                                  \
-+        catch(armnn::Exception &e)                                  \
-         { \
-             ARMNN_LOG(error) << "Oops: " << e.what(); \
-             return GENERAL_ERROR; \
-@@ -332,4 +332,4 @@ int main(int argc, char* argv[])
- 
-     ARMNN_LOG(info) << "Run completed";
-     return 0;
--}
-\ Pas de fin de ligne à la fin du fichier
-+}
diff --git a/armnn.changes b/armnn.changes
index 884ff65..c28089b 100644
--- a/armnn.changes
+++ b/armnn.changes
@@ -1,4 +1,27 @@
 -------------------------------------------------------------------
+Fri Sep  4 16:07:09 UTC 2020 - Guillaume GARDET <guillaume.gardet@opensuse.org>
+
+- Add python support, disabled for now as it does not install
+  files atm
+
+-------------------------------------------------------------------
+Fri Sep  4 14:56:36 UTC 2020 - Guillaume GARDET <guillaume.gardet@opensuse.org>
+
+- Package libtimelineDecoderJson
+
+-------------------------------------------------------------------
+Thu Sep  3 11:18:40 UTC 2020 - Guillaume GARDET <guillaume.gardet@opensuse.org>
+
+- Update to 20.08:
+  * Changelog: https://github.com/ARM-software/armnn/releases/tag/v20.08
+- Refresh patch:
+  * 0005-add-armnn-mobilenet-test-example.patch
+- Drop upstream patch:
+  * armnn-fix-catch.patch
+- Disable ONNX on Tumbleweed since there is a compatibility issue
+  with ONNX 1.7.0, see: https://github.com/ARM-software/armnn/issues/419
+
+-------------------------------------------------------------------
 Wed Jun 17 07:19:10 UTC 2020 - Guillaume GARDET <guillaume.gardet@opensuse.org>
 
 - Build only where ComputeLibrary is built: 
diff --git a/armnn.spec b/armnn.spec
index e5328af..c795ce4 100644
--- a/armnn.spec
+++ b/armnn.spec
@@ -15,9 +15,12 @@
 # Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
-
 # Disable LTO until UnitTests passes with LTO enabled - https://github.com/ARM-software/armnn/issues/341
 %define _lto_cflags %{nil}
+
+# Disable Python binding for now
+%bcond_with PyArmnn
+
 %define target @BUILD_FLAVOR@%{nil}
 %if "%{target}" != ""
 %define package_suffix -%{target}
@@ -63,15 +66,16 @@
 %else  # suse_version
 %bcond_with armnn_tf
 %endif # suse_version
-# ONNX is available on Leap 15.2+/SLE15SP2+
-%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200
+# ONNX is available on Leap 15.2+/SLE15SP2+, but there is a compatibility issue
+# with ONNX 1.7.0 in Tumbleweed - https://github.com/ARM-software/armnn/issues/419
+%if 0%{?sle_version} >= 150200
 %bcond_without armnn_onnx
 %else
 %bcond_with armnn_onnx
 %endif
 %define version_major 20
-%define version_minor 05
-%define version_lib 21
+%define version_minor 08
+%define version_lib 22
 # Do not package ArmnnConverter and ArmnnQuantizer, by default
 %bcond_with armnn_tools
 # Enable CAFFE
@@ -85,8 +89,6 @@ Group:          Development/Libraries/Other
 URL:            https://developer.arm.com/products/processors/machine-learning/arm-nn
 Source0:        https://github.com/ARM-software/armnn/archive/v%{version}.tar.gz#/armnn-%{version}.tar.gz
 Source1:        armnn-rpmlintrc
-# PATCH-FIX-UPSTREAM - https://github.com/ARM-software/armnn/issues/398
-Patch01:        armnn-fix-catch.patch
 # PATCHES to add downstream ArmnnExamples binary - https://layers.openembedded.org/layerindex/recipe/87610/
 Patch200:       0003-add-more-test-command-line-arguments.patch
 Patch201:       0005-add-armnn-mobilenet-test-example.patch
@@ -153,6 +155,11 @@ BuildRequires:  tensorflow2-devel
 BuildRequires:  tensorflow-devel
 %endif
 %endif
+%if %{with PyArmnn}
+BuildRequires:  python3-devel
+BuildRequires:  python3-wheel
+BuildRequires:  swig >= 4
+%endif
 %if %{with compute_cl}
 Recommends:     Mesa-libOpenCL
 %endif
@@ -263,7 +270,7 @@ modification – across Arm Cortex CPUs and Arm Mali GPUs.
 This package contains the libarmnn library from armnn.
 
 %package -n libarmnnBasePipeServer%{version_lib}%{?package_suffix}
-Summary:        libarmnn from armnn
+Summary:        libarmnnBasePipeServer from armnn
 Group:          Development/Libraries/C and C++
 %if "%{target}" == "opencl"
 Conflicts:      libarmnnBasePipeServer%{version_lib}
@@ -281,7 +288,7 @@ modification – across Arm Cortex CPUs and Arm Mali GPUs.
 This package contains the libarmnnBasePipeServer library from armnn.
 
 %package -n libtimelineDecoder%{version_lib}%{?package_suffix}
-Summary:        libarmnn from armnn
+Summary:        libtimelineDecoder from armnn
 Group:          Development/Libraries/C and C++
 %if "%{target}" == "opencl"
 Conflicts:      libtimelineDecoder%{version_lib}
@@ -298,6 +305,24 @@ modification – across Arm Cortex CPUs and Arm Mali GPUs.
 
 This package contains the libtimelineDecoder library from armnn.
 
+%package -n libtimelineDecoderJson%{version_lib}%{?package_suffix}
+Summary:        libtimelineDecoderJson from armnn
+Group:          Development/Libraries/C and C++
+%if "%{target}" == "opencl"
+Conflicts:      libtimelineDecoderJson%{version_lib}
+%else
+Conflicts:      libtimelineDecoderJson%{version_lib}-opencl
+%endif
+
+%description -n libtimelineDecoderJson%{version_lib}%{?package_suffix}
+Arm NN is an inference engine for CPUs, GPUs and NPUs.
+It bridges the gap between existing NN frameworks and the underlying IP.
+It enables efficient translation of existing neural network frameworks,
+such as TensorFlow and Caffe, allowing them to run efficiently – without
+modification – across Arm Cortex CPUs and Arm Mali GPUs.
+
+This package contains the libtimelineDecoder library from armnn.
+
 %if %{with armnn_flatbuffers}
 %package -n libarmnnSerializer%{version_lib}%{?package_suffix}
 Summary:        libarmnnSerializer from armnn
@@ -398,7 +423,6 @@ This package contains the libarmnnOnnxParser library from armnn.
 
 %prep
 %setup -q -n armnn-%{version}
-%patch1 -p1
 %if %{with armnn_extra_tests}
 %patch200 -p1
 %patch201 -p1
@@ -407,7 +431,7 @@ This package contains the libarmnnOnnxParser library from armnn.
 %patch204 -p1
 %patch205 -p1
 # Add Boost log as downstream extra test requires it
-sed -i 's/find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework system filesystem program_options)/find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework system filesystem log program_options)/' ./cmake/GlobalConfig.cmake
+sed -i 's/find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework filesystem system program_options)/find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework filesystem system log program_options)/' ./cmake/GlobalConfig.cmake
 %endif
 
 %build
@@ -498,6 +522,13 @@ sed -i 's/-Werror//' ./cmake/GlobalConfig.cmake
   -DBUILD_UNIT_TESTS=OFF \
   -DBUILD_TESTS=OFF \
 %endif
+%if %{with PyArmnn}
+  -DBUILD_PYTHON_WHL=ON \
+  -DBUILD_PYTHON_SRC=ON \
+%else
+  -DBUILD_PYTHON_WHL=OFF \
+  -DBUILD_PYTHON_SRC=OFF \
+%endif
 %if %{with armnn_extra_tests}
   -DBUILD_ARMNN_EXAMPLES=ON
 %else
@@ -625,6 +656,9 @@ LD_LIBRARY_PATH="$(pwd)/build/" \
 %files -n libtimelineDecoder%{version_lib}%{?package_suffix}
 %{_libdir}/libtimelineDecoder.so.*
 
+%files -n libtimelineDecoderJson%{version_lib}%{?package_suffix}
+%{_libdir}/libtimelineDecoderJson.so.*
+
 %if %{with armnn_flatbuffers}
 %files -n libarmnnSerializer%{version_lib}%{?package_suffix}
 %{_libdir}/libarmnnSerializer.so.*
@@ -680,6 +714,7 @@ LD_LIBRARY_PATH="$(pwd)/build/" \
 %{_libdir}/libarmnn.so
 %{_libdir}/libarmnnBasePipeServer.so
 %{_libdir}/libtimelineDecoder.so
+%{_libdir}/libtimelineDecoderJson.so
 %if %{with armnn_flatbuffers}
 %{_libdir}/libarmnnSerializer.so
 %{_libdir}/libarmnnTfLiteParser.so