Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboard: Add onboard virtual keyboard to scarthgap #734

Closed
wants to merge 147 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
510b797
conf: move templates
amstewart Nov 30, 2023
6c5a000
kernel-performance-tests: Add container load test
chaitu236 Nov 29, 2023
8cd2c62
layer.conf: assert nanbield compatibility
amstewart Dec 1, 2023
0b1fe79
linux-nilrt-nohz: Downgrade to 5.15 kernel
Sep 15, 2023
15cd89f
ni-rtfeatures: fixup spelling in initscript
amstewart Dec 5, 2023
e7a3d3e
ni-rtfeatures: handle poweron reset_source
amstewart Dec 5, 2023
d553da2
k-cont-perf-tests: print run-cyclictest output
dylan-matthew-turner Dec 5, 2023
f0d5fe6
ptest-runner: add a user/group for ptest
amstewart Dec 11, 2023
6cabd05
mousepad: upgrade bbappend to 0.6.%
amstewart Dec 11, 2023
3ec3437
procps: make bbappend apply to all versions
amstewart Dec 11, 2023
f540e35
gnupg: remove bbappend
amstewart Dec 12, 2023
aa156cf
syslog-ng: upgrade bbappend to 4.%
amstewart Dec 12, 2023
e1e26ad
onboard: remove recipe
amstewart Dec 12, 2023
081bbf4
uutils-coreutils: remove selinux PACKAGECONFIG
amstewart Dec 13, 2023
e9e77a4
curl; upgrade bbappend to 8.4.0
amstewart Dec 13, 2023
86a44ca
glibc: add upstream-status trailer to patch
amstewart Dec 13, 2023
eab3533
util-linux: drop satisfied backport
amstewart Dec 13, 2023
f310f3b
initscripts: add upstream-status to patches
amstewart Dec 13, 2023
04e7129
docker-functional-tests: correct docker RDEPENDS
amstewart Dec 13, 2023
2f5b330
busybox: fixup upstream-status trailer in patches
amstewart Dec 13, 2023
780254b
xinput-calibrator: add upstream-status trailer
amstewart Dec 15, 2023
cf08374
grub: add .patch upstream-status trailers
amstewart Dec 15, 2023
7a6b4ab
valgrind: add .patch upstream-status trailers
amstewart Dec 15, 2023
cb3cc7e
xserver-xfce-init: remove unnecessary gplv2 .patch
amstewart Dec 15, 2023
c796a09
kernel-*-performance-tests: re-factor common files
gratian Dec 13, 2023
11dd767
kernel-containerized-performance-tests: re-factor docker files
gratian Dec 13, 2023
13a4bdc
kernel-containerized-performance-tests: pull container build logic in…
gratian Dec 14, 2023
677d057
kernel-containerized-performance-tests: re-factor the need for wrappe…
gratian Dec 14, 2023
696352b
kernel-*-performance-tests: re-factor load wrapper scripts
gratian Dec 15, 2023
9fea47f
kernel-containerized-performance-tests: factor out docker calls
gratian Dec 15, 2023
43ffcb3
kernel-containerized-performance-tests: run two cyclictest containers…
gratian Dec 15, 2023
bb2109e
nilrt.conf: dump distro and feed versions for 24Q3
amstewart Jan 2, 2024
8ab7ed0
fio.cfg: Enable options to reduce memory footprint
chaitu236 Jan 3, 2024
bd0ff52
Revert "Revert "linux-nilrt-next: Bump version to latest 6.6 developm…
chaitu236 Jan 4, 2024
432f03c
kernel-performance-tests: Remove stopped containers
chaitu236 Jan 8, 2024
fb3dafe
linux-nilrt-nohz: add guidance for faster boots on some 9030s
jeminor Jan 10, 2024
dd34b15
kernel-tests: Add options to get current dmesg log from database
jpautler Jan 11, 2024
d041d7d
kernel-tests: Update debugging options
jpautler Jan 12, 2024
508d017
kernel-tests: fix detection of current vs next kernels
jpautler Jan 18, 2024
de2a050
kernel-tests: fix previous dmesg record selection logic
jpautler Jan 18, 2024
312186a
fw_printenv: Refactor variable printing and avoid duplicates
jeminor Jan 12, 2024
c36c84c
fw_printenv: Simplify GRUB variable printing
jeminor Jan 19, 2024
7af720c
python3-schema: add recipe
amstewart Jan 19, 2024
6f0b527
utf8cpp: add recipe
amstewart Jan 19, 2024
32843da
ni-grpc-device: upgrade to 2.4.0
amstewart Jan 22, 2024
7b6f77d
nilrt-recovery-media: fixup ISO symlink
amstewart Jan 25, 2024
4997272
nilrt-base-system-image: fixup runmode rootfs path
amstewart Jan 26, 2024
5440523
kernel-ctn-perf-tests: fixup docker RDEPENDS
amstewart Jan 26, 2024
8392073
pkggrp-ni-desirable: remove ntpdate
amstewart Jan 26, 2024
fcafbc8
pkggrp-ni-internal-deps: rm ni-grpc-device
amstewart Jan 26, 2024
65070b9
ni-hw-scripts-common: fixup allarch variables
amstewart Jan 29, 2024
fbf97fc
ni-rtfeatures: fixup allarch variables
amstewart Jan 29, 2024
201124f
fixup! fw_printenv: Simplify GRUB variable printing
jeminor Jan 22, 2024
5bad074
kernel-tests: add replacement pattern for filesystem UUIDs
jpautler Jan 22, 2024
d3787a1
fs_permissions_diff: Ignore all version changes
jeminor Jan 26, 2024
32bd887
fw_permissions_diff: Add command-line option for previous maniests
jeminor Jan 26, 2024
f978d8a
Revert "linux-nilrt-nohz: Downgrade to 5.15 kernel"
gratian Jan 29, 2024
68546d2
fw_permissions_diff: Run logrotate before running the test
jeminor Jan 31, 2024
d59e7f1
kernel-test-nohz: tweak latency limits for kernels >5.15
gratian Jan 31, 2024
b1a0257
kernel_tests: add rc patch version logic and fix rt-patch version logic
jpautler Jan 31, 2024
d27a45b
kernel-tests: shorten and simplify first line of test output
jpautler Feb 5, 2024
ecc3aaf
salt: remove deprecated RDEPENDS
amstewart Jan 30, 2024
888e74c
pkggrp-ni-runmode: remove deprecated packages
amstewart Jan 30, 2024
1a3394d
curl: rebase patches for curl 8.6.0
amstewart Feb 12, 2024
107bd15
glibc: reapply patches for glibc_2.39-22
amstewart Feb 12, 2024
01ac041
curl: drop nicurl patches and bbappends
amstewart Feb 14, 2024
fcc19e8
grub: reapply patches for grub 2.12
amstewart Feb 15, 2024
36ea91b
salt: remove python3-pytest-salt RDEP
amstewart Feb 15, 2024
50b8e7a
initrdscripts: remove efifix script
jpautler Feb 22, 2024
971c3d3
Replace egrep with grep -E in recovery tool files
jpautler Feb 22, 2024
1d80fbd
ni_provisioning: fix efibootmgr output parsing
jpautler Feb 23, 2024
2494471
pkggrp-ni-internal-deps: add ntfs-3g dep to PXI PS
Apr 8, 2024
6e6771f
opkg-utils: revert break to opkg-feeds
Apr 8, 2024
ef5ff03
layer.conf: Set layer compatibility to scarthgap
chaitu236 Apr 10, 2024
d4a2cc5
fs_permissions_diff: Modify the test to run from a developer machine
jpautler Apr 16, 2024
5cd749f
fs_permissions_diff: Display current manifest details in all cases
jpautler Apr 19, 2024
bd0b331
fs_permissions_diff: Fix run-time error caused by missing parameter
jpautler Apr 22, 2024
476d19b
fs_permissions_diff: Ensure recent manifest is not earlier than basis…
jpautler Apr 22, 2024
2d6a687
fixup! fs_permissions_diff: Ensure recent manifest is not earlier tha…
jpautler Apr 22, 2024
dfe607d
ni-systemimage: Remove unnecessary dependencies
chaitu236 Apr 17, 2024
5f564d9
ni-systemimage: Add getall
chaitu236 Apr 17, 2024
5187018
fs_permissions_diff: Make diff hash stable despite stripped versions
jpautler Apr 24, 2024
2f51522
ni-systeimage: Fix set functionality
chaitu236 Apr 24, 2024
e2bc4f0
ni-systemimage: Remove nigrubfs dir in cleanup
chaitu236 Apr 24, 2024
6d9cbd2
ni-systemimage: Add setall
chaitu236 Apr 19, 2024
5da3cf3
ni_provisioning.safemode: Split common code
chaitu236 Apr 22, 2024
14e3a31
ni-systemreplication: Add for USB replication
chaitu236 Apr 22, 2024
12ae662
fs_permissions_diff: Rename command line args to specify manifests
jpautler Apr 26, 2024
aa4fe56
fs_permissions_diff: Cleanup/improve logging output
jpautler Apr 29, 2024
9627f48
fs_permissions_diff: Pass dynamic command-line arguments
jpautler May 1, 2024
4432c89
recipes-devtools: Add python3-backports-ssl-match-hostname
May 9, 2024
266c8bf
salt: RDEPEND on charset-normalizer
May 10, 2024
2e53f49
Move Skyline RDEPENDS to packagegroup
May 10, 2024
045a3f7
packagefeed-ni-extra: temporarily disable unbuildable packages
rajendra-desai-ni May 13, 2024
7662609
passwd/group: add uid/gid for arpwatch
rajendra-desai-ni May 13, 2024
e0840fa
nisystemreplication: Initialize grubenv
chaitu236 Apr 25, 2024
d5cb7cf
grub_old.cfg: Add grub menu options for usb replication
chaitu236 May 1, 2024
eedf115
ni-netcfgutil: Add required dependencies to RDEPENDS
chaitu236 May 2, 2024
0abebf5
nilrt-recovery-media: Install nirtcfg
chaitu236 May 7, 2024
241b8c0
nisystemimage: Handle netcfg operations in setall
chaitu236 May 7, 2024
c5fd7cb
populateconfig: Check for directory presence before creating links
chaitu236 May 8, 2024
51a77e3
grub.cfg: Replace grub.cfg with grub_old.cfg
chaitu236 May 10, 2024
88360d7
cyclictest-container: install influxdb with apt
rajendra-desai-ni May 17, 2024
496a073
nisystemreplication: Improve error msg
chaitu236 May 16, 2024
44dd9b4
nisystemreplication: Custom image name for "Get Image"
chaitu236 May 23, 2024
56191de
nisystemreplication: Custom image name for "Set Image"
chaitu236 May 24, 2024
2ed060b
nisystemreplication: Ask user for confirmation
chaitu236 May 27, 2024
3f3f175
nisystemreplication: Check if image fits on media
chaitu236 May 28, 2024
8eae7a7
nisystemreplication: Mount NIRECOVERY async
chaitu236 May 28, 2024
8e418d6
nisystemreplication: Add compatibility checks
chaitu236 May 28, 2024
024b8cc
nisystemreplication: Add support for answers file
chaitu236 May 29, 2024
5a8f5ae
nisystemimage: Show progress for get and set
chaitu236 May 17, 2024
ec4f425
nisystemimage: Disable progress bar by default
chaitu236 May 30, 2024
95741ae
nisystemreplication: Replicate ext4 features
chaitu236 Jun 27, 2024
3e903c7
nisystemreplication: Detect unsupported fs features during "Get Image"
chaitu236 Jun 27, 2024
2ed5683
rtgroups: set priority for ktimers/*
gratian Aug 5, 2024
86dc2a1
nilrt.conf: Bump NILRT_FEED_NAME
chaitu236 Aug 5, 2024
1c98ae3
kernel-test-nohz: use 'tsc=reliable'
gratian Aug 5, 2024
adf02cd
kernel-test-nohz: run test at FIFO/1
gratian Aug 5, 2024
fb8be7d
kernel-test-nohz: fix max latency check in validate_results
gratian Aug 7, 2024
8b84d2d
kernel_dmesg_diff.py: Update the software IO TLB filter rule.
erickshepherdNI Aug 12, 2024
c683180
packagegroups: add pkggrp-ni-snac
Aug 13, 2024
2b025f3
pkggrp-ni-snac: add initial top level deps
Aug 13, 2024
fe72374
pkggrp-ni-snac: remove unneeded append assignment
Aug 14, 2024
6da2d19
pkggrp-ni-internal-deps: Add PAtools dependencies
usercw88 Aug 15, 2024
689d16e
.github: Add pull request template
amstewart Aug 19, 2024
8dc36c6
pkggrp-ni-internal-deps: change nissl contact
amstewart Aug 15, 2024
2fb4222
libpwquality: Build recipe
texasaggie97 Aug 20, 2024
94ffc6e
libpwquality: Add config file to recipe
texasaggie97 Aug 20, 2024
a3fbdd4
nisystemreplication: Split image files to fit FAT32
chaitu236 Aug 21, 2024
b09f844
tmux-ipk: Add tmux configuration file to tmux IPK
texasaggie97 Aug 19, 2024
b877114
rtgroups: adjust ksoftirqd and rcu* priorities
gratian Aug 21, 2024
33df896
rt_tests: add ptest to catch default FIFO/1 tasks
gratian Aug 21, 2024
6edcf25
ni-utils: remove unused wl12xx workaround
gratian Aug 21, 2024
51b5ef2
nisystemreplication: Fix unexpected differences
chaitu236 Aug 22, 2024
3718278
packagegroup-ni-runmode: add nftables
rtollert Aug 29, 2024
b03a949
packagegroup-ni-snac: add firewalld
rtollert Aug 29, 2024
eeb7b91
libpam: enable pam-plugin-faillock when it's installed and customize …
AlexHearnNI Aug 27, 2024
6633023
sudo: give the sudo group permission to run the sudo command
AlexHearnNI Sep 5, 2024
50e89ba
recipes-ni: add nilrt-snac recipe
amstewart Sep 6, 2024
dcc67ef
pkggrp-ni-snac: add nilrt-snac
amstewart Sep 6, 2024
8e6ecc2
pkggrp-ni-internal-deps: enable ni-grpc-device
rajendra-desai-ni Sep 13, 2024
889156f
nilrt-snac: add integration ptests
amstewart Sep 13, 2024
4713fbd
pkggrp-ni-smoke: use tabs for indentation
amstewart Sep 13, 2024
80eff37
pkggrp-ni-ptest-smoke: add nilrt-snac-ptest
amstewart Sep 13, 2024
052582b
nilrt_snac: remove unneeded RDEPENDS
amstewart Sep 13, 2024
6c2a2de
onboard: add onboard to next branch (scarthgap)
pratheekshasn Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ni-grpc-device: upgrade to 2.4.0
Upstream grpc-device's CMakeLists has been substantially reworked since
version 1, breaking its functionality in OE in new and exciting ways.
Repatch the file with new fixes, many of which can be upstreamed.

Signed-off-by: Alex Stewart <[email protected]>
amstewart committed Jan 26, 2024

Verified

This commit was signed with the committer’s verified signature.
billyjacoby Billy Jacoby
commit 32843da03af0d2a335fab79fd8e5e5fc3eef542a
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From e74df62e09595d32ef8c52a359fcfb29f432d7e2 Mon Sep 17 00:00:00 2001
From: Alex Stewart <[email protected]>
Date: Tue, 23 Jan 2024 15:57:22 -0500
Subject: [PATCH] CMakeLists: find gpr library

The ni_grpc_device_server must be linked to the grpc-provided gpr.so
library during compilation.

Modify the CMakeLists logic to find and link gpr.so.

Signed-off-by: Alex Stewart <[email protected]>
---
CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c966a2b..67074c65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ endif()
if(CMAKE_CROSSCOMPILING)
find_program(_PROTOBUF_PROTOC protoc)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
+ find_library(_GRPC_GPR gpr)

if(NOT _GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN)
find_package(gRPC REQUIRED)
@@ -441,6 +442,7 @@ endif()
target_link_libraries(ni_grpc_device_server
${_REFLECTION}
${_GRPC_GRPCPP}
+ ${_GRPC_GPR}
${_PROTOBUF_LIBPROTOBUF}
${CMAKE_DL_LIBS}
nlohmann_json::nlohmann_json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From aca928177133eea00462fa720034bc203a959add Mon Sep 17 00:00:00 2001
From: Alex Stewart <[email protected]>
Date: Thu, 18 Jan 2024 14:37:36 -0500
Subject: [PATCH] Subject: [PATCH] CMakeLists.txt: remove local protobuf
includes

When building grpc from within OE, protobuf is supplied by the native
sysroot. Do not add an includes path to the un-checked-out submodule.

Upstream-Status: Inappropriate [Would break non-cross-compile builds]

Signed-off-by: Alex Stewart <[email protected]>
---
CMakeLists.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d52498d7..5471d6cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,7 +250,6 @@ function(GenerateGrpcSources)
ARGS --grpc_out "${proto_out_path}"
--cpp_out "${proto_out_path}"
-I "${proto_path}"
- -I ${CMAKE_SOURCE_DIR}/third_party/grpc/third_party/protobuf/src/
-I ${CMAKE_SOURCE_DIR}/imports/protobuf
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${proto_file}"
@@ -787,4 +786,4 @@ endif()
# add_test( NAME UnitTests COMMAND UnitTestsRunner )
add_test( NAME UnitTests COMMAND UnitTestsRunner )
add_test( NAME IntegrationTests COMMAND IntegrationTestsRunner )
-add_test( NAME SystemTests COMMAND SystemTestsRunner )
\ No newline at end of file
+add_test( NAME SystemTests COMMAND SystemTestsRunner )

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 7de2f0751b126851a003392f2cc08901e84bfd5e Mon Sep 17 00:00:00 2001
From: Alex Stewart <[email protected]>
Date: Fri, 19 Jan 2024 14:45:14 -0500
Subject: [PATCH] CMakeLists: fixup utf8cpp library link

The utf8cpp cmake library namespace is incorrectly identified as
'utf8cpp', instead of the proper 'utf8cpp:utf8cpp'. As a result, cmake
does not link the utf8.h header and compilation fails.

Correct the library namespace.

Signed-off-by: Alex Stewart <[email protected]>
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5471d6cd..48b5c07e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -452,7 +452,7 @@ target_link_libraries(ni_grpc_device_server
${_PROTOBUF_LIBPROTOBUF}
${CMAKE_DL_LIBS}
nlohmann_json::nlohmann_json
- utf8cpp
+ utf8cpp::utf8cpp
)

set_target_properties(ni_grpc_device_server PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From 6536cafe3d6e753fdc4de70b3cfc3360e39cdfb5 Mon Sep 17 00:00:00 2001
From: Alex Stewart <[email protected]>
Date: Mon, 22 Jan 2024 10:37:19 -0500
Subject: [PATCH] CMakeLists: use native python3 binaries

The existing CMakeLists implementation assumes that you want to setup a
python virtual environment, instead of using what is provided by the
local system. For OE, this isn't sensible since part of the missions is
to build the whole native toolchain.

So remove this functionality.

Signed-off-by: Alex Stewart <[email protected]>
---
CMakeLists.txt | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48b5c07e..6c966a2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,14 +41,7 @@ else()
endif()

#----------------------------------------------------------------------
-CreateVirtualEnvironment(virtual_environment
- REQUIREMENTS_TXT
- ${CMAKE_SOURCE_DIR}/python_build_requirements.txt
- ENV_NAME
- venv
- OUT_PYTHON_EXE
- PYTHON_EXE
-)
+set(PYTHON_EXE ${Python3_EXECUTABLE})

#----------------------------------------------------------------------
# Use the utfcpp targets directly from this build, only when not cross-compiling.
@@ -191,7 +184,7 @@ foreach(api ${nidrivers})
${nidriver_client_srcs}
"${service_output_dir}/${api}/${api}_client.cpp")
endif()
- set(proto_dependencies ${codegen_dependencies} ${codegen_scripts} virtual_environment)
+ set(proto_dependencies ${codegen_dependencies} ${codegen_scripts})
add_custom_command(OUTPUT ${output_files}
${gen_command}
COMMENT "Generating proto file and service for ${api}"
@@ -211,7 +204,6 @@ add_custom_command(
DEPENDS
${all_codegen_dependencies}
${codegen_scripts}
- virtual_environment
)

set(nidriver_service_srcs
116 changes: 69 additions & 47 deletions recipes-ni/ni-grpc-device/ni-grpc-device_git.bb
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ HOMEPAGE = "https://github.com/ni/grpc-device"
SECTION = "base"
LICENSE = "MIT & Apache-2.0"
LIC_FILES_CHKSUM = "\
file://LICENSE;md5=08ed4de411f83eee0363c9d12e31e92d \
file://ThirdPartyNotices.txt;md5=6def9ca42f278e76d89243699fae2b67 \
file://LICENSE;md5=f7f2c0314387ea903bd40965abfad353 \
file://ThirdPartyNotices.txt;md5=57283cec49f9773bb10bac48da2e56df \
"


@@ -17,79 +17,101 @@ DEPENDS += "\
python3-grpcio-tools-native \
python3-mako-native \
python3-native \
utf8cpp-native \
python3-schema-native \
"

PV = "1.1.0"
PV = "2.4.0"


SRC_URI = "\
git://github.com/ni/grpc-device.git;name=grpc-device;branch=main;protocol=https \
file://0001-CMakeLists.txt-remove-local-protobuf-includes.patch \
file://0001-semaphore.h-fix-undefined-condition_variable-type.patch \
file://0002-CMakeLists-use-find_package-for-gtest-dep.patch \
file://ptest \
file://0001-Subject-PATCH-CMakeLists.txt-remove-local-protobuf-i.patch \
file://0002-CMakeLists-fixup-utf8cpp-library-link.patch \
file://0003-CMakeLists-use-native-python3-binaries.patch \
file://0001-CMakeLists-find-gpr-library.patch \
"
SRCREV_grpc-device = "15508bba63a6c289a32445ffb7f8986c99a2f286"
SRCREV_grpc-device = "aeef9995eb634ed5dc4d87dc5adbfd7c66d9fa64"
SRCREV_FORMAT = "grpc-device"

S = "${WORKDIR}/git"


inherit cmake python3native

EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=Release"
EXTRA_OECMAKE += "-DCMAKE_CROSSCOMPILING=True -DCMAKE_BUILD_TYPE=Release"
OECMAKE_TARGET_COMPILE = "ni_grpc_device_server"
OECMAKE_GENERATOR = "Unix Makefiles"


inherit ptest

BUILD_PTEST = "${B}/ptest"
RDEPENDS:${PN}-ptest += "\
${PN} \
bash \
python3-grpcio \
"

do_compile_ptest:append () {
install -d ${BUILD_PTEST}
python3 -m grpc_tools.protoc \
-I${S}/source/protobuf \
--python_out=${BUILD_PTEST} \
--grpc_python_out=${BUILD_PTEST} \
${S}/source/protobuf/session.proto
}

do_install_ptest:append () {
install -d ${D}${PTEST_PATH}
install -m 0755 ${WORKDIR}/ptest/run-ptest ${D}${PTEST_PATH}/

install -m 0644 ${S}/examples/session/enumerate-device.py ${D}${PTEST_PATH}/

# These files are generated by the do_compile_ptest task.
install -m 0644 ${BUILD_PTEST}/session_pb2_grpc.py ${D}${PTEST_PATH}/
install -m 0644 ${BUILD_PTEST}/session_pb2.py ${D}${PTEST_PATH}/
}


#inherit ptest
#
#BUILD_PTEST = "${B}/ptest"
#RDEPENDS:${PN}-ptest += "\
# ${PN} \
# bash \
# python3-grpcio \
#"
#
#do_compile_ptest:append () {
# install -d ${BUILD_PTEST}
# python3 -m grpc_tools.protoc \
# -I${S}/source/protobuf \
# --python_out=${BUILD_PTEST} \
# --grpc_python_out=${BUILD_PTEST} \
# ${S}/source/protobuf/session.proto
#}
#
#do_install_ptest:append () {
# install -d ${D}${PTEST_PATH}
# install -m 0755 ${WORKDIR}/ptest/run-ptest ${D}${PTEST_PATH}/
#
# install -m 0644 ${S}/examples/session/enumerate-device.py ${D}${PTEST_PATH}/
#
# # These files are generated by the do_compile_ptest task.
# install -m 0644 ${BUILD_PTEST}/session_pb2_grpc.py ${D}${PTEST_PATH}/
# install -m 0644 ${BUILD_PTEST}/session_pb2.py ${D}${PTEST_PATH}/
#}


serverdir = "${D}${libdir}/${BPN}"
# grpc-device does not provide an 'install' target (yet); so overwrite the whole
# of do_install, to keep cmake from building anything further.
do_install () {
# install server binaries
install -d ${D}${bindir}
install --mode=0755 ${B}/ni_grpc_device_server ${D}${bindir}
# install server components
install -d ${serverdir}
install --mode=0755 ${B}/ni_grpc_device_server ${serverdir}
install --mode=0644 ${B}/server_config.json ${serverdir}/server_config.json.example
install --mode=0644 ${B}/server_capabilities.json ${serverdir}

# install default server_config
# package .proto files for use by developers
install -d ${D}${datadir}/${BPN}
install --mode=0644 ${B}/server_config.json ${D}${datadir}/${BPN}/server_config.json.example
install --mode=0644 ${S}/generated/**/*.proto ${D}${datadir}/${BPN}
install --mode=0644 ${S}/imports/protobuf/*.proto ${D}${datadir}/${BPN}

# package .proto files for use by developers
install -d ${D}${includedir}/${BPN}
install --mode=0644 ${S}/generated/**/*.proto ${D}${includedir}/${BPN}
install --mode=0644 ${S}/source/protobuf/session.proto ${D}${includedir}/${BPN}
# install example files
install -d ${D}${datadir}/${BPN}
cp -r ${S}/examples ${D}${datadir}/${BPN}
}


PACKAGE_BEFORE_PN = "${PN}-examples"

# ${PN}
RDEPENDS:${PN} += "\
grpc \
protobuf \
"

# ${PN}-dev
FILES:${PN}-dev:append = "${datadir}/${BPN}/*.proto"
RDEPENDS:${PN}-dev:append = "\
grpc-dev \
"

# ${PN}-examples
FILES:${PN}-examples = "${datadir}/${BPN}/examples"
RDEPENDS:${PN}-examples = "\
python3 \
"