summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch')
-rw-r--r--recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch236
1 files changed, 174 insertions, 62 deletions
diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch
index 1e84eeb7e..4221df5c8 100644
--- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch
+++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0001-dbc2val-add-installation-mechanism.patch
@@ -1,93 +1,202 @@
-From 603b5a584bd2b348befc9bab8f1ea0a7974f9d77 Mon Sep 17 00:00:00 2001
+From 22062d99a89922e02b626e4701feaac8947af5fb Mon Sep 17 00:00:00 2001
From: Scott Murray <scott.murray@konsulko.com>
-Date: Wed, 11 May 2022 15:31:25 -0400
-Subject: [PATCH] dbc2val: add installation mechanism
+Date: Fri, 7 Oct 2022 15:54:48 -0400
+Subject: [PATCH 1/2] dbc2val: add installation mechanism
Add setup.py and setup.cfg to allow installing the dbc2val module
and dbcfeeder.py in a way suitable for packaging. Some of the
imports in the scripts have been tweaked to enable running against
an installed copy of dbc2val.
-Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+Upstream-Status: pending
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
- kuksa_feeders/dbc2val/__init__.py | 0
- kuksa_feeders/dbc2val/dbc2vssmapper.py | 12 ++++-----
- kuksa_feeders/dbc2val/dbcfeeder.py | 6 ++---
- kuksa_feeders/setup.cfg | 31 ++++++++++++++++++++++
- kuksa_feeders/setup.py | 36 ++++++++++++++++++++++++++
- 5 files changed, 75 insertions(+), 10 deletions(-)
- create mode 100644 kuksa_feeders/dbc2val/__init__.py
- create mode 100644 kuksa_feeders/setup.cfg
- create mode 100644 kuksa_feeders/setup.py
+ dbc2val/__init__.py | 0
+ dbc2val/databroker.py | 4 +--
+ dbc2val/dbc2vssmapper.py | 12 +++----
+ dbc2val/dbcfeeder.py | 8 ++---
+ dbc2val/gen_proto/__init__.py | 0
+ dbc2val/gen_proto/sdv/__init__.py | 0
+ dbc2val/gen_proto/sdv/databroker/__init__.py | 0
+ .../gen_proto/sdv/databroker/v1/__init__.py | 0
+ .../gen_proto/sdv/databroker/v1/broker_pb2.py | 2 +-
+ .../sdv/databroker/v1/broker_pb2_grpc.py | 2 +-
+ .../sdv/databroker/v1/collector_pb2.py | 2 +-
+ .../sdv/databroker/v1/collector_pb2_grpc.py | 2 +-
+ setup.cfg | 31 ++++++++++++++++
+ setup.py | 36 +++++++++++++++++++
+ 14 files changed, 82 insertions(+), 17 deletions(-)
+ create mode 100644 dbc2val/__init__.py
+ create mode 100644 dbc2val/gen_proto/__init__.py
+ create mode 100644 dbc2val/gen_proto/sdv/__init__.py
+ create mode 100644 dbc2val/gen_proto/sdv/databroker/__init__.py
+ create mode 100644 dbc2val/gen_proto/sdv/databroker/v1/__init__.py
+ create mode 100644 setup.cfg
+ create mode 100644 setup.py
-diff --git a/kuksa_feeders/dbc2val/__init__.py b/kuksa_feeders/dbc2val/__init__.py
+diff --git a/dbc2val/__init__.py b/dbc2val/__init__.py
new file mode 100644
index 0000000..e69de29
-diff --git a/kuksa_feeders/dbc2val/dbc2vssmapper.py b/kuksa_feeders/dbc2val/dbc2vssmapper.py
-index a43d1bd..1718154 100644
---- a/kuksa_feeders/dbc2val/dbc2vssmapper.py
-+++ b/kuksa_feeders/dbc2val/dbc2vssmapper.py
-@@ -11,8 +11,8 @@
- ########################################################################
+diff --git a/dbc2val/databroker.py b/dbc2val/databroker.py
+index c1a941a..ba52980 100644
+--- a/dbc2val/databroker.py
++++ b/dbc2val/databroker.py
+@@ -16,13 +16,13 @@
+ import logging
+
+ import grpc
+-from gen_proto.sdv.databroker.v1 import (
++from dbc2val.gen_proto.sdv.databroker.v1 import (
+ broker_pb2,
+ broker_pb2_grpc,
+ collector_pb2,
+ collector_pb2_grpc,
+ )
+-from gen_proto.sdv.databroker.v1 import types_pb2 as types # for export
++from dbc2val.gen_proto.sdv.databroker.v1 import types_pb2 as types # for export
+
+ log = logging.getLogger(__name__)
+
+diff --git a/dbc2val/dbc2vssmapper.py b/dbc2val/dbc2vssmapper.py
+index 05b78f1..d76c068 100644
+--- a/dbc2val/dbc2vssmapper.py
++++ b/dbc2val/dbc2vssmapper.py
+@@ -20,8 +20,8 @@
+
import yaml
-import transforms.mapping
-import transforms.math
+from dbc2val.transforms import mapping
+from dbc2val.transforms import math
+ import logging
-
- class mapper:
-@@ -22,9 +22,9 @@ class mapper:
+ log = logging.getLogger(__name__)
+@@ -33,13 +33,13 @@ class mapper:
self.mapping = yaml.full_load(file)
- self.transforms={}
-- self.transforms['fullmapping']=transforms.mapping.mapping(discard_non_matching_items=True)
-- self.transforms['partialmapping']=transforms.mapping.mapping(discard_non_matching_items=False)
-- self.transforms['math']=transforms.math.math()
-+ self.transforms['fullmapping']=mapping.mapping(discard_non_matching_items=True)
-+ self.transforms['partialmapping']=mapping.mapping(discard_non_matching_items=False)
-+ self.transforms['math']=math.math()
-
-
+ self.transforms = {}
+- self.transforms["fullmapping"] = transforms.mapping.mapping(
++ self.transforms["fullmapping"] = mapping.mapping(
+ discard_non_matching_items=True
+ )
+- self.transforms["partialmapping"] = transforms.mapping.mapping(
++ self.transforms["partialmapping"] = mapping.mapping(
+ discard_non_matching_items=False
+ )
+- self.transforms["math"] = transforms.math.math()
++ self.transforms["math"] = math.math()
-@@ -62,4 +62,4 @@ class mapper:
+ for key in self.mapping.keys():
+ self.mapping[key]["lastupdate"] = 0.0
+@@ -93,4 +93,4 @@ class mapper:
def __getitem__(self, item):
return self.mapping[item]
-
\ No newline at end of file
+
-diff --git a/kuksa_feeders/dbc2val/dbcfeeder.py b/kuksa_feeders/dbc2val/dbcfeeder.py
-index 71939c6..56c316a 100755
---- a/kuksa_feeders/dbc2val/dbcfeeder.py
-+++ b/kuksa_feeders/dbc2val/dbcfeeder.py
-@@ -16,10 +16,7 @@ import configparser
- import queue
- import json
+diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py
+index 5267369..7daaa2b 100755
+--- a/dbc2val/dbcfeeder.py
++++ b/dbc2val/dbcfeeder.py
+@@ -28,16 +28,13 @@ import sys
+ import time
+ from signal import SIGINT, SIGTERM, signal
+-import canplayer
-import dbc2vssmapper
-import dbcreader
+ import grpc
-import j1939reader
--import elm2canbridge
-+from dbc2val import dbc2vssmapper, dbcreader, j1939reader, elm2canbridge
-
- scriptDir= os.path.dirname(os.path.realpath(__file__))
- sys.path.append(os.path.join(scriptDir, "../../"))
-@@ -27,6 +24,7 @@ from kuksa_viss_client import KuksaClientThread
-
- print("kuksa.val DBC example feeder")
- config_candidates=['/config/dbc_feeder.ini', '/etc/dbc_feeder.ini', os.path.join(scriptDir, 'config/dbc_feeder.ini')]
-+configfile = None
- for candidate in config_candidates:
- if os.path.isfile(candidate):
- configfile=candidate
-diff --git a/kuksa_feeders/setup.cfg b/kuksa_feeders/setup.cfg
++from dbc2val import dbc2vssmapper, dbcreader, j1939reader, canplayer
+
+ # kuksa related
+ from kuksa_viss_client import KuksaClientThread
+ # databroker related
+-import databroker
++from dbc2val import databroker
+
+ # global variable for usecase, default databroker
+ USE_CASE = ""
+@@ -289,6 +286,7 @@ def parse_config(filename):
+ "/etc/dbc_feeder.ini",
+ "config/dbc_feeder.ini",
+ ]
++ configfile = None
+ for candidate in config_candidates:
+ if os.path.isfile(candidate):
+ configfile = candidate
+diff --git a/dbc2val/gen_proto/__init__.py b/dbc2val/gen_proto/__init__.py
+new file mode 100644
+index 0000000..e69de29
+diff --git a/dbc2val/gen_proto/sdv/__init__.py b/dbc2val/gen_proto/sdv/__init__.py
+new file mode 100644
+index 0000000..e69de29
+diff --git a/dbc2val/gen_proto/sdv/databroker/__init__.py b/dbc2val/gen_proto/sdv/databroker/__init__.py
+new file mode 100644
+index 0000000..e69de29
+diff --git a/dbc2val/gen_proto/sdv/databroker/v1/__init__.py b/dbc2val/gen_proto/sdv/databroker/v1/__init__.py
new file mode 100644
-index 0000000..4b69ccf
+index 0000000..e69de29
+diff --git a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py
+index 98dc94a..6deacfb 100644
+--- a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py
++++ b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2.py
+@@ -12,7 +12,7 @@ from google.protobuf import symbol_database as _symbol_database
+ _sym_db = _symbol_database.Default()
+
+
+-from gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2
++from dbc2val.gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2
+
+
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1esdv/databroker/v1/broker.proto\x12\x11sdv.databroker.v1\x1a\x1dsdv/databroker/v1/types.proto\"*\n\x14GetDatapointsRequest\x12\x12\n\ndatapoints\x18\x01 \x03(\t\"\xb0\x01\n\x12GetDatapointsReply\x12I\n\ndatapoints\x18\x01 \x03(\x0b\x32\x35.sdv.databroker.v1.GetDatapointsReply.DatapointsEntry\x1aO\n\x0f\x44\x61tapointsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"!\n\x10SubscribeRequest\x12\r\n\x05query\x18\x02 \x01(\t\"\x9c\x01\n\x0eSubscribeReply\x12=\n\x06\x66ields\x18\x01 \x03(\x0b\x32-.sdv.databroker.v1.SubscribeReply.FieldsEntry\x1aK\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"#\n\x12GetMetadataRequest\x12\r\n\x05names\x18\x01 \x03(\t\"=\n\x10GetMetadataReply\x12)\n\x04list\x18\x01 \x03(\x0b\x32\x1b.sdv.databroker.v1.Metadata2\x9b\x02\n\x06\x42roker\x12_\n\rGetDatapoints\x12\'.sdv.databroker.v1.GetDatapointsRequest\x1a%.sdv.databroker.v1.GetDatapointsReply\x12U\n\tSubscribe\x12#.sdv.databroker.v1.SubscribeRequest\x1a!.sdv.databroker.v1.SubscribeReply0\x01\x12Y\n\x0bGetMetadata\x12%.sdv.databroker.v1.GetMetadataRequest\x1a#.sdv.databroker.v1.GetMetadataReplyb\x06proto3')
+diff --git a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py
+index 5c87db1..bc6be8b 100644
+--- a/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py
++++ b/dbc2val/gen_proto/sdv/databroker/v1/broker_pb2_grpc.py
+@@ -2,7 +2,7 @@
+ """Client and server classes corresponding to protobuf-defined services."""
+ import grpc
+
+-from gen_proto.sdv.databroker.v1 import broker_pb2 as sdv_dot_databroker_dot_v1_dot_broker__pb2
++from dbc2val.gen_proto.sdv.databroker.v1 import broker_pb2 as sdv_dot_databroker_dot_v1_dot_broker__pb2
+
+
+ class BrokerStub(object):
+diff --git a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py
+index 25d69dd..ea15409 100644
+--- a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py
++++ b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2.py
+@@ -12,7 +12,7 @@ from google.protobuf import symbol_database as _symbol_database
+ _sym_db = _symbol_database.Default()
+
+
+-from gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2
++from dbc2val.gen_proto.sdv.databroker.v1 import types_pb2 as sdv_dot_databroker_dot_v1_dot_types__pb2
+
+
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!sdv/databroker/v1/collector.proto\x12\x11sdv.databroker.v1\x1a\x1dsdv/databroker/v1/types.proto\"\xba\x01\n\x17UpdateDatapointsRequest\x12N\n\ndatapoints\x18\x01 \x03(\x0b\x32:.sdv.databroker.v1.UpdateDatapointsRequest.DatapointsEntry\x1aO\n\x0f\x44\x61tapointsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"\xaf\x01\n\x15UpdateDatapointsReply\x12\x44\n\x06\x65rrors\x18\x01 \x03(\x0b\x32\x34.sdv.databroker.v1.UpdateDatapointsReply.ErrorsEntry\x1aP\n\x0b\x45rrorsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x30\n\x05value\x18\x02 \x01(\x0e\x32!.sdv.databroker.v1.DatapointError:\x02\x38\x01\"\xba\x01\n\x17StreamDatapointsRequest\x12N\n\ndatapoints\x18\x01 \x03(\x0b\x32:.sdv.databroker.v1.StreamDatapointsRequest.DatapointsEntry\x1aO\n\x0f\x44\x61tapointsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.sdv.databroker.v1.Datapoint:\x02\x38\x01\"\xaf\x01\n\x15StreamDatapointsReply\x12\x44\n\x06\x65rrors\x18\x01 \x03(\x0b\x32\x34.sdv.databroker.v1.StreamDatapointsReply.ErrorsEntry\x1aP\n\x0b\x45rrorsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x30\n\x05value\x18\x02 \x01(\x0e\x32!.sdv.databroker.v1.DatapointError:\x02\x38\x01\"R\n\x19RegisterDatapointsRequest\x12\x35\n\x04list\x18\x01 \x03(\x0b\x32\'.sdv.databroker.v1.RegistrationMetadata\"\x9d\x01\n\x14RegistrationMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\tdata_type\x18\x02 \x01(\x0e\x32\x1b.sdv.databroker.v1.DataType\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x32\n\x0b\x63hange_type\x18\x04 \x01(\x0e\x32\x1d.sdv.databroker.v1.ChangeType\"\x93\x01\n\x17RegisterDatapointsReply\x12H\n\x07results\x18\x01 \x03(\x0b\x32\x37.sdv.databroker.v1.RegisterDatapointsReply.ResultsEntry\x1a.\n\x0cResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x32\xd3\x02\n\tCollector\x12n\n\x12RegisterDatapoints\x12,.sdv.databroker.v1.RegisterDatapointsRequest\x1a*.sdv.databroker.v1.RegisterDatapointsReply\x12h\n\x10UpdateDatapoints\x12*.sdv.databroker.v1.UpdateDatapointsRequest\x1a(.sdv.databroker.v1.UpdateDatapointsReply\x12l\n\x10StreamDatapoints\x12*.sdv.databroker.v1.StreamDatapointsRequest\x1a(.sdv.databroker.v1.StreamDatapointsReply(\x01\x30\x01\x62\x06proto3')
+diff --git a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py
+index 419bfde..2dee751 100644
+--- a/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py
++++ b/dbc2val/gen_proto/sdv/databroker/v1/collector_pb2_grpc.py
+@@ -2,7 +2,7 @@
+ """Client and server classes corresponding to protobuf-defined services."""
+ import grpc
+
+-from gen_proto.sdv.databroker.v1 import collector_pb2 as sdv_dot_databroker_dot_v1_dot_collector__pb2
++from dbc2val.gen_proto.sdv.databroker.v1 import collector_pb2 as sdv_dot_databroker_dot_v1_dot_collector__pb2
+
+
+ class CollectorStub(object):
+diff --git a/setup.cfg b/setup.cfg
+new file mode 100644
+index 0000000..70aab60
--- /dev/null
-+++ b/kuksa_feeders/setup.cfg
++++ b/setup.cfg
@@ -0,0 +1,31 @@
+[metadata]
+name = dbc2val
@@ -105,11 +214,11 @@ index 0000000..4b69ccf
+ Development Status :: 3 - Alpha
+ Environment :: Console
+ Programming Language :: Python :: 3
-+ License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
++ License :: OSI Approved :: Apache Software License
+ Operating System :: OS Independent
+ Topic :: Software Development
+
-+license_file = ../LICENSE
++license_file = LICENSE.txt
+
+[options]
+python_requires = >=3.6
@@ -120,11 +229,11 @@ index 0000000..4b69ccf
+packages=find:
+include_package_data = True
+scripts=dbc2val/dbcfeeder.py
-diff --git a/kuksa_feeders/setup.py b/kuksa_feeders/setup.py
+diff --git a/setup.py b/setup.py
new file mode 100644
-index 0000000..ad08d17
+index 0000000..55951cc
--- /dev/null
-+++ b/kuksa_feeders/setup.py
++++ b/setup.py
@@ -0,0 +1,36 @@
+# To avoid shipping dbcfeeder.py in the module itself, use the
+# technique outlined at:
@@ -154,7 +263,7 @@ index 0000000..ad08d17
+ "template": "{tag}",
+ "dev_template": "{tag}-{ccount}",
+ "dirty_template": "{tag}-{ccount}-dirty",
-+ "starting_version": "0.1.11",
++ "starting_version": "0.1.0",
+ "version_callback": None,
+ "version_file": None,
+ "count_commits_from_version_file": False
@@ -162,3 +271,6 @@ index 0000000..ad08d17
+ setup_requires=['setuptools-git-versioning'],
+ cmdclass={'build_py': build_py},
+)
+--
+2.37.3
+