[arch-commits] Commit in (6 files)

David Runge dvzrv at gemini.archlinux.org
Sun Feb 13 23:49:35 UTC 2022


    Date: Sunday, February 13, 2022 @ 23:49:34
  Author: dvzrv
Revision: 1133098

Add python-spsdk as new dependency for python-pynitrokey.

Remove version pinning: https://github.com/NXPmicro/spsdk/issues/35
Remove use of pypemicro:
https://github.com/NXPmicro/pypemicro/issues/10
https://github.com/NXPmicro/spsdk/issues/30
Remove use of pyocd-pemicro:
https://github.com/pyocd/pyOCD/issues/1319
Remove use of libusbsio: https://github.com/NXPmicro/spsdk/issues/36

Added:
  python-spsdk/
  python-spsdk/repos/
  python-spsdk/trunk/
  python-spsdk/trunk/PKGBUILD
  python-spsdk/trunk/python-spsdk-1.6.0-remove_libusbsio.patch
  python-spsdk/trunk/python-spsdk-1.6.0-remove_pypemicro.patch

-------------------------------------------+
 PKGBUILD                                  |   96 ++++++++++++++++++++
 python-spsdk-1.6.0-remove_libusbsio.patch |  129 ++++++++++++++++++++++++++++
 python-spsdk-1.6.0-remove_pypemicro.patch |   28 ++++++
 3 files changed, 253 insertions(+)

Added: python-spsdk/trunk/PKGBUILD
===================================================================
--- python-spsdk/trunk/PKGBUILD	                        (rev 0)
+++ python-spsdk/trunk/PKGBUILD	2022-02-13 23:49:34 UTC (rev 1133098)
@@ -0,0 +1,96 @@
+# Maintainer: David Runge <dvzrv at archlinux.org>
+
+_name=spsdk
+pkgname=python-spsdk
+pkgver=1.6.0
+pkgrel=1
+pkgdesc="NXP Secure Provisioning SDK"
+arch=(any)
+url="https://github.com/NXPmicro/spsdk"
+license=(BSD)
+depends=(
+  python-asn1crypto
+  python-astunparse
+  python-bincopy
+  python-bitstring
+  python-click
+  python-click-option-group
+  python-cmsis-pack-manager
+  python-colorama
+  python-commentjson
+  python-crcmod
+  python-cryptography
+  python-deepmerge
+  python-fastjsonschema
+  python-hexdump
+  python-jinja
+  python-oscrypto
+  python-pycryptodome
+  python-pylink-square
+  python-pyocd
+  python-pyserial
+  python-ruamel-yaml
+  python-sly
+)
+makedepends=(python-setuptools)
+checkdepends=(
+  python-jsonschema
+  python-pytest
+  python-voluptuous
+  python-yaml
+)
+# pypi sdist tarball has no tests: https://github.com/NXPmicro/spsdk/issues/37
+# source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
+source=(
+  $_name-$pkgver.tar.gz::https://github.com/NXPmicro/$_name/archive/refs/tags/$pkgver.tar.gz
+  $pkgname-1.6.0-remove_pypemicro.patch
+  $pkgname-1.6.0-remove_libusbsio.patch
+)
+sha512sums=('ced4a60427ebf9f726ffdda5fb941cf07cfd9c13885a9683d0a098398f49b3b515ac6bfb44756710a7b7b9db1f08bba43e5dc61b41104e5be3e72dfe8070e593'
+            '7bfb3739053284ba0b4084c1f84e37e307233fa7b52adf403fa5c574393d71e08ea02bdc927106b036d1055f6efd6c326b534d697c1d5f6c097def53dbafc560'
+            '7774590f9e859ef1fb520876cb4e856dc8ce964769d16102bf0f480dd968074d0550d03e4601a314c88f57d627bf452f36b08d9a7fc5dc3374ab29c7fcc72da2')
+b2sums=('de62d70ef4ff9478693f5188b08819ed36104a7ae9df016d9e60d2293aeaa3b5256bcfd110c86f0ae87c0ad36e43d777a8fb15e0d7cd3b85f6db62a9fb894d95'
+        '2c68116494b5e7ff51e59ec79dd3e354e2a8035ab35e29b27a097d7baa47e48c71a2cdac651920c76cd29097c5e8710e74106e41a4b3d5f543e259ef7404beac'
+        '3aa82795c61ab419deaf60a29a2cadf549a2d4f1446e2af5b959fa22164845018a03028c4a7523564419d9bdb8eb73180607b8d12e63ed57579647643b7398bb')
+
+prepare() {
+  cd $_name-$pkgver
+  # remove all version pinning and overly explicit version bounds
+  # https://github.com/NXPmicro/spsdk/issues/35
+  sed -e 's|>=.*||g;s|==.*||g;s|~=.*||g;s|<.*||g' -i requirements{,-develop}.txt
+  # remove dependency on python-pypemicro as it vendors prebuilt shared libraries
+  # https://github.com/NXPmicro/spsdk/issues/30
+  # https://github.com/NXPmicro/pypemicro/issues/10
+  sed '/pypemicro/d' -i requirements.txt
+  patch -Np1 -i ../$pkgname-1.6.0-remove_pypemicro.patch
+  # remove dependency on python-pyocd-pemicro as it vendors prebuilt shared libraries via python-pypemicro
+  # https://github.com/pyocd/pyOCD/issues/1319
+  # https://github.com/NXPmicro/spsdk/issues/30
+  # https://github.com/NXPmicro/pypemicro/issues/10
+  sed '/pyocd-pemicro/d' -i requirements.txt
+  # remove dependency on python-libusbsio as it vendors prebuilt shared libraries
+  # https://github.com/NXPmicro/spsdk/issues/36
+  sed '/libusbsio/d' -i requirements.txt
+  patch -Np1 -i ../$pkgname-1.6.0-remove_libusbsio.patch
+}
+
+build() {
+  cd $_name-$pkgver
+  python setup.py build
+}
+
+check() {
+  cd $_name-$pkgver
+  export PYTHONPATH="build:$PYTHONPATH"
+  # ignore failing tests due to removal of libusbsio
+  # ignore failing tests due to incompatible bincopy: https://github.com/NXPmicro/spsdk/issues/38
+  pytest -v --ignore tests/utils/test_nxpdevscan.py --ignore tests/elftosb/test_elftosb_mbi.py \
+   -k "not test_parse_image_file_invalid and not test_load_binary_image"
+}
+
+package() {
+  cd $_name-$pkgver
+  python setup.py install --optimize=1 --root="$pkgdir"
+  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
+  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
+}

Added: python-spsdk/trunk/python-spsdk-1.6.0-remove_libusbsio.patch
===================================================================
--- python-spsdk/trunk/python-spsdk-1.6.0-remove_libusbsio.patch	                        (rev 0)
+++ python-spsdk/trunk/python-spsdk-1.6.0-remove_libusbsio.patch	2022-02-13 23:49:34 UTC (rev 1133098)
@@ -0,0 +1,129 @@
+diff -ruN a/spsdk/mboot/interfaces/__init__.py b/spsdk/mboot/interfaces/__init__.py
+--- a/spsdk/mboot/interfaces/__init__.py	2022-02-04 14:27:29.000000000 +0100
++++ b/spsdk/mboot/interfaces/__init__.py	2022-02-14 00:15:14.754121893 +0100
+@@ -10,4 +10,3 @@
+ from .base import Interface
+ from .uart import Uart, scan_uart
+ from .usb import RawHid, scan_usb
+-from .usbsio import UsbSioI2C, UsbSioSPI, scan_usbsio
+diff -ruN a/spsdk/mboot/interfaces/usb.py b/spsdk/mboot/interfaces/usb.py
+--- a/spsdk/mboot/interfaces/usb.py	2022-02-04 14:27:29.000000000 +0100
++++ b/spsdk/mboot/interfaces/usb.py	2022-02-14 00:12:32.227394246 +0100
+@@ -11,8 +11,6 @@
+ from struct import pack, unpack_from
+ from typing import Sequence, Union
+ 
+-import libusbsio
+-
+ from spsdk.utils.usbfilter import NXPUSBDeviceFilter, USBDeviceFilter
+ 
+ from ..commands import CmdPacket, CmdResponse, parse_cmd_response
+@@ -249,23 +247,4 @@
+         :param usb_device_filter: USBDeviceFilter object
+         :return: List of interfaces found
+         """
+-        devices = []
+-
+-        # use HID_API of LIBUSBSIO library to enumerate all USB HID devices
+-        sio = libusbsio.usbsio()
+-        all_hid_devices = sio.HIDAPI_Enumerate()
+-
+-        # iterate on all devices found
+-        for dev in all_hid_devices:
+-            if usb_device_filter.compare(dev) is True:
+-                new_device = RawHid()
+-                new_device.device = sio.HIDAPI_DeviceCreate()
+-                new_device.vid = dev["vendor_id"]
+-                new_device.pid = dev["product_id"]
+-                new_device.vendor_name = dev["manufacturer_string"]
+-                new_device.product_name = dev["product_string"]
+-                new_device.interface_number = dev["interface_number"]
+-                new_device.path = dev["path"]
+-                devices.append(new_device)
+-
+-        return devices
++        return []
+diff -ruN a/spsdk/sdp/interfaces/usb.py b/spsdk/sdp/interfaces/usb.py
+--- a/spsdk/sdp/interfaces/usb.py	2022-02-04 14:27:29.000000000 +0100
++++ b/spsdk/sdp/interfaces/usb.py	2022-02-14 00:16:40.930819269 +0100
+@@ -8,11 +8,8 @@
+ """Module for USB communication with a terget using SDP protocol."""
+ 
+ import logging
+-import platform
+ from typing import Sequence, Tuple, Union
+ 
+-import libusbsio
+-
+ from spsdk import SPSDKError
+ from spsdk.utils.usbfilter import NXPUSBDeviceFilter, USBDeviceFilter
+ 
+@@ -240,21 +237,4 @@
+         :param usb_device_filter: USBDeviceFilter object
+         :return: List of interfaces found
+         """
+-        devices = []
+-        sio = libusbsio.usbsio()
+-        all_hid_devices = sio.HIDAPI_Enumerate()
+-
+-        # iterate on all devices found
+-        for dev in all_hid_devices:
+-            if usb_device_filter.compare(dev) is True:
+-                new_device = RawHid()
+-                new_device.device = sio.HIDAPI_DeviceCreate()
+-                new_device.vid = dev["vendor_id"]
+-                new_device.pid = dev["product_id"]
+-                new_device.vendor_name = dev["manufacturer_string"]
+-                new_device.product_name = dev["product_string"]
+-                new_device.interface_number = dev["interface_number"]
+-                new_device.path = dev["path"]
+-                devices.append(new_device)
+-
+-        return devices
++        return []
+diff -ruN a/spsdk/utils/nxpdevscan.py b/spsdk/utils/nxpdevscan.py
+--- a/spsdk/utils/nxpdevscan.py	2022-02-04 14:27:29.000000000 +0100
++++ b/spsdk/utils/nxpdevscan.py	2022-02-14 00:18:41.700860824 +0100
+@@ -11,7 +11,6 @@
+ import logging
+ from typing import Sequence
+ 
+-import libusbsio
+ from serial.tools.list_ports import comports
+ 
+ from spsdk.mboot.interfaces.uart import scan_uart as mb_scan_uart
+@@ -41,33 +40,7 @@
+     :extend_vid_list: list of VIDs, to extend the default NXP VID list (int)
+     :return: list of dicts corresponding to NXP devices
+     """
+-    sio = libusbsio.usbsio()
+-    all_usb_devices = sio.HIDAPI_Enumerate()
+-    nxp_usb_devices = []
+-
+-    search_vids = NXP_USB_DEVICE_VIDS
+-
+-    if extend_vid_list is not None:
+-        search_vids = list(set(search_vids) | set(extend_vid_list))
+-
+-    for usb_device in all_usb_devices:
+-        for nxp_vid in search_vids:
+-            if nxp_vid == usb_device["vendor_id"]:
+-                # We found our device, let's create container for it
+-                vid = usb_device["vendor_id"]
+-                pid = usb_device["product_id"]
+-                path = convert_usb_path(usb_device["path"])
+-                product_string = usb_device["product_string"]
+-                manufacturer_string = usb_device["manufacturer_string"]
+-                name = ", ".join(get_usb_device_name(vid, pid, None))
+-                usb_dev = USBDeviceDescription(
+-                    vid, pid, path, product_string, manufacturer_string, name
+-                )
+-
+-                nxp_usb_devices.append(usb_dev)
+-                break
+-
+-    return nxp_usb_devices
++    return []
+ 
+ 
+ def search_nxp_uart_devices() -> Sequence[DeviceDescription]:

Added: python-spsdk/trunk/python-spsdk-1.6.0-remove_pypemicro.patch
===================================================================
--- python-spsdk/trunk/python-spsdk-1.6.0-remove_pypemicro.patch	                        (rev 0)
+++ python-spsdk/trunk/python-spsdk-1.6.0-remove_pypemicro.patch	2022-02-13 23:49:34 UTC (rev 1133098)
@@ -0,0 +1,28 @@
+diff -ruN a/spsdk/debuggers/__init__.py b/spsdk/debuggers/__init__.py
+--- a/spsdk/debuggers/__init__.py	2022-02-04 14:27:29.000000000 +0100
++++ b/spsdk/debuggers/__init__.py	2022-02-14 00:01:52.710415054 +0100
+@@ -9,5 +9,4 @@
+ 
+ from .debug_probe import DebugProbe
+ from .debug_probe_jlink import DebugProbePyLink
+-from .debug_probe_pemicro import DebugProbePemicro
+ from .debug_probe_pyocd import DebugProbePyOCD
+diff -ruN a/spsdk/debuggers/utils.py b/spsdk/debuggers/utils.py
+--- a/spsdk/debuggers/utils.py	2022-02-04 14:27:29.000000000 +0100
++++ b/spsdk/debuggers/utils.py	2022-02-14 00:05:11.017196467 +0100
+@@ -15,7 +15,6 @@
+ from spsdk import SPSDKError
+ from spsdk.debuggers.debug_probe import DebugProbe, SPSDKDebugProbeError, SPSDKProbeNotFoundError
+ from spsdk.debuggers.debug_probe_jlink import DebugProbePyLink
+-from spsdk.debuggers.debug_probe_pemicro import DebugProbePemicro
+ 
+ # Import all supported debug probe classes
+ from spsdk.debuggers.debug_probe_pyocd import DebugProbePyOCD
+@@ -23,7 +22,6 @@
+ PROBES = {
+     "pyocd": DebugProbePyOCD,
+     "jlink": DebugProbePyLink,
+-    "pemicro": DebugProbePemicro,
+ }
+ 
+ logger = logging.getLogger(__name__)



More information about the arch-commits mailing list