From nobody Wed Dec 17 15:50:44 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D23491B4255 for ; Mon, 9 Dec 2024 14:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755665; cv=none; b=OqYg1zfJVuC77rTnfr5J7atsNqqPsdyRulDuU/XoHTifbIlhSlpcZSWOYs34licX9IkOn+LZI7FuNYt0Lk1R+KOTRVbmVuXAvyJudpdCOeTcVLWLwpPXiMY4/pSw7djuV06wAy1nwzpuHTpBxyXrv5mz5gWBwqqCoWr8VCXkweY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755665; c=relaxed/simple; bh=5FuMwi7o2xRwdUfs1aV90j5M8c0AOHVcS7+vgnVx8qk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=SkJdUZSRYK4tpZmVoAAHrvh57Isy174TdVb7DTbags+FSNU1KTDbiM25sKPnWgdnCpBveV2nwVvoys3uWdM/D0gd8SlZLXmp+5Izx9uiT5jUVvyLzplmlSa7g63EbrkO7ahTVb9EpAkzXvUfwetFGbEDZXznyDb+q81SlE/jppU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=V9/hxOr2; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V9/hxOr2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733755662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hTqrHx/rHjwvoh4VZ+UElp504YgxK2FnTVLIGZu5YYE=; b=V9/hxOr2gZXsXGKp77WI7JbxLCngyiCndfWOfBOjzWTAlpVcDbT4nwKc4DWNYI/JA/jJ2j +V78rrf11cKZLd8AE412fod0lEonBi1jTzTbinmSyGp6lwM87y8Vwkcks0wDgbP8OJ2x00 WBr5jRUc9vKXInCdzMg6dHOY1P1MRSE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-386-FFq4fNz3OZ6FifAExIuh5g-1; Mon, 09 Dec 2024 09:47:38 -0500 X-MC-Unique: FFq4fNz3OZ6FifAExIuh5g-1 X-Mimecast-MFC-AGG-ID: FFq4fNz3OZ6FifAExIuh5g Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E49B019560BC; Mon, 9 Dec 2024 14:47:36 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.182]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7B73A1956095; Mon, 9 Dec 2024 14:47:33 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org, stfomichev@gmail.com Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH v2 1/5] tools: ynl: move python code to separate sub-directory Date: Mon, 9 Dec 2024 15:47:13 +0100 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Move python code to a separate directory so it can be packaged as a python module. Updates existing references in selftests and docs. Also rename ynl-gen-[c|rst] to ynl_gen_[c|rst], avoid dashes as these prevent easy imports for entrypoints. Signed-off-by: Jan Stancek --- Documentation/Makefile | 2 +- Documentation/networking/multi-pf-netdev.rst | 4 ++-- Documentation/networking/napi.rst | 4 ++-- Documentation/networking/netlink_spec/readme.txt | 2 +- Documentation/userspace-api/netlink/intro-specs.rst | 8 ++++---- tools/net/ynl/Makefile | 2 ++ tools/net/ynl/generated/Makefile | 2 +- tools/net/ynl/lib/.gitignore | 1 - tools/net/ynl/lib/Makefile | 1 - tools/net/ynl/pyynl/.gitignore | 2 ++ tools/net/ynl/pyynl/__init__.py | 0 tools/net/ynl/{ =3D> pyynl}/cli.py | 0 tools/net/ynl/{ =3D> pyynl}/ethtool.py | 0 tools/net/ynl/{ =3D> pyynl}/lib/__init__.py | 0 tools/net/ynl/{ =3D> pyynl}/lib/nlspec.py | 0 tools/net/ynl/{ =3D> pyynl}/lib/ynl.py | 0 tools/net/ynl/{ynl-gen-c.py =3D> pyynl/ynl_gen_c.py} | 0 tools/net/ynl/{ynl-gen-rst.py =3D> pyynl/ynl_gen_rst.py} | 0 tools/net/ynl/ynl-regen.sh | 2 +- tools/testing/selftests/net/lib/py/ynl.py | 4 ++-- tools/testing/selftests/net/ynl.mk | 3 ++- 21 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 tools/net/ynl/pyynl/.gitignore create mode 100644 tools/net/ynl/pyynl/__init__.py rename tools/net/ynl/{ =3D> pyynl}/cli.py (100%) rename tools/net/ynl/{ =3D> pyynl}/ethtool.py (100%) rename tools/net/ynl/{ =3D> pyynl}/lib/__init__.py (100%) rename tools/net/ynl/{ =3D> pyynl}/lib/nlspec.py (100%) rename tools/net/ynl/{ =3D> pyynl}/lib/ynl.py (100%) rename tools/net/ynl/{ynl-gen-c.py =3D> pyynl/ynl_gen_c.py} (100%) rename tools/net/ynl/{ynl-gen-rst.py =3D> pyynl/ynl_gen_rst.py} (100%) diff --git a/Documentation/Makefile b/Documentation/Makefile index fa71602ec961..52c6c5a3efa9 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -104,7 +104,7 @@ quiet_cmd_sphinx =3D SPHINX $@ --> file://$(abspath $(= BUILDDIR)/$3/$4) YNL_INDEX:=3D$(srctree)/Documentation/networking/netlink_spec/index.rst YNL_RST_DIR:=3D$(srctree)/Documentation/networking/netlink_spec YNL_YAML_DIR:=3D$(srctree)/Documentation/netlink/specs -YNL_TOOL:=3D$(srctree)/tools/net/ynl/ynl-gen-rst.py +YNL_TOOL:=3D$(srctree)/tools/net/ynl/pyynl/ynl_gen_rst.py =20 YNL_RST_FILES_TMP :=3D $(patsubst %.yaml,%.rst,$(wildcard $(YNL_YAML_DIR)/= *.yaml)) YNL_RST_FILES :=3D $(patsubst $(YNL_YAML_DIR)%,$(YNL_RST_DIR)%, $(YNL_RST_= FILES_TMP)) diff --git a/Documentation/networking/multi-pf-netdev.rst b/Documentation/n= etworking/multi-pf-netdev.rst index 2cd25d81aaa7..2f5a5bb3ca9a 100644 --- a/Documentation/networking/multi-pf-netdev.rst +++ b/Documentation/networking/multi-pf-netdev.rst @@ -89,7 +89,7 @@ Observability =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The relation between PF, irq, napi, and queue can be observed via netlink = spec:: =20 - $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml = --dump queue-get --json=3D'{"ifindex": 13}' + $ ./tools/net/ynl/pyynl/cli.py --spec Documentation/netlink/specs/netdev= .yaml --dump queue-get --json=3D'{"ifindex": 13}' [{'id': 0, 'ifindex': 13, 'napi-id': 539, 'type': 'rx'}, {'id': 1, 'ifindex': 13, 'napi-id': 540, 'type': 'rx'}, {'id': 2, 'ifindex': 13, 'napi-id': 541, 'type': 'rx'}, @@ -101,7 +101,7 @@ The relation between PF, irq, napi, and queue can be ob= served via netlink spec:: {'id': 3, 'ifindex': 13, 'napi-id': 542, 'type': 'tx'}, {'id': 4, 'ifindex': 13, 'napi-id': 543, 'type': 'tx'}] =20 - $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml = --dump napi-get --json=3D'{"ifindex": 13}' + $ ./tools/net/ynl/pyynl/cli.py --spec Documentation/netlink/specs/netdev= .yaml --dump napi-get --json=3D'{"ifindex": 13}' [{'id': 543, 'ifindex': 13, 'irq': 42}, {'id': 542, 'ifindex': 13, 'irq': 41}, {'id': 541, 'ifindex': 13, 'irq': 40}, diff --git a/Documentation/networking/napi.rst b/Documentation/networking/n= api.rst index 02720dd71a76..6083210ab2a4 100644 --- a/Documentation/networking/napi.rst +++ b/Documentation/networking/napi.rst @@ -199,13 +199,13 @@ parameters mentioned above use hyphens instead of und= erscores: =20 Per-NAPI configuration can be done programmatically in a user application or by using a script included in the kernel source tree: -``tools/net/ynl/cli.py``. +``tools/net/ynl/pyynl/cli.py``. =20 For example, using the script: =20 .. code-block:: bash =20 - $ kernel-source/tools/net/ynl/cli.py \ + $ kernel-source/tools/net/ynl/pyynl/cli.py \ --spec Documentation/netlink/specs/netdev.yaml \ --do napi-set \ --json=3D'{"id": 345, diff --git a/Documentation/networking/netlink_spec/readme.txt b/Documentati= on/networking/netlink_spec/readme.txt index 6763f99d216c..030b44aca4e6 100644 --- a/Documentation/networking/netlink_spec/readme.txt +++ b/Documentation/networking/netlink_spec/readme.txt @@ -1,4 +1,4 @@ SPDX-License-Identifier: GPL-2.0 =20 This file is populated during the build of the documentation (htmldocs) by= the -tools/net/ynl/ynl-gen-rst.py script. +tools/net/ynl/pyynl/ynl_gen_rst.py script. diff --git a/Documentation/userspace-api/netlink/intro-specs.rst b/Document= ation/userspace-api/netlink/intro-specs.rst index bada89699455..a4435ae4628d 100644 --- a/Documentation/userspace-api/netlink/intro-specs.rst +++ b/Documentation/userspace-api/netlink/intro-specs.rst @@ -15,7 +15,7 @@ developing Netlink related code. The tool is implemented = in Python and can use a YAML specification to issue Netlink requests to the kernel. Only Generic Netlink is supported. =20 -The tool is located at ``tools/net/ynl/cli.py``. It accepts +The tool is located at ``tools/net/ynl/pyynl/cli.py``. It accepts a handul of arguments, the most important ones are: =20 - ``--spec`` - point to the spec file @@ -27,7 +27,7 @@ YAML specs can be found under ``Documentation/netlink/spe= cs/``. =20 Example use:: =20 - $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/ethtool.yaml= \ + $ ./tools/net/ynl/pyynl/cli.py --spec Documentation/netlink/specs/ethtoo= l.yaml \ --do rings-get \ --json '{"header":{"dev-index": 18}}' {'header': {'dev-index': 18, 'dev-name': 'eni1np1'}, @@ -75,7 +75,7 @@ the two marker lines like above to a file, add that file = to git, and run the regeneration tool. Grep the tree for ``YNL-GEN`` to see other examples. =20 -The code generation itself is performed by ``tools/net/ynl/ynl-gen-c.py`` +The code generation itself is performed by ``tools/net/ynl/pyynl/ynl_gen_c= .py`` but it takes a few arguments so calling it directly for each file quickly becomes tedious. =20 @@ -84,7 +84,7 @@ YNL lib =20 ``tools/net/ynl/lib/`` contains an implementation of a C library (based on libmnl) which integrates with code generated by -``tools/net/ynl/ynl-gen-c.py`` to create easy to use netlink wrappers. +``tools/net/ynl/pyynl/ynl_gen_c.py`` to create easy to use netlink wrapper= s. =20 YNL basics ---------- diff --git a/tools/net/ynl/Makefile b/tools/net/ynl/Makefile index d1cdf2a8f826..5268b91bf7ed 100644 --- a/tools/net/ynl/Makefile +++ b/tools/net/ynl/Makefile @@ -21,5 +21,7 @@ clean distclean: fi \ done rm -f libynl.a + rm -rf pyynl/__pycache__ + rm -rf pyynl/lib/__pycache__ =20 .PHONY: all clean distclean $(SUBDIRS) diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Mak= efile index 7db5240de58a..00af721b1571 100644 --- a/tools/net/ynl/generated/Makefile +++ b/tools/net/ynl/generated/Makefile @@ -12,7 +12,7 @@ include ../Makefile.deps YNL_GEN_ARG_ethtool:=3D--user-header linux/ethtool_netlink.h \ --exclude-op stats-get =20 -TOOL:=3D../ynl-gen-c.py +TOOL:=3D../pyynl/ynl_gen_c.py =20 GENS_PATHS=3D$(shell grep -nrI --files-without-match \ 'protocol: netlink' \ diff --git a/tools/net/ynl/lib/.gitignore b/tools/net/ynl/lib/.gitignore index 296c4035dbf2..a4383358ec72 100644 --- a/tools/net/ynl/lib/.gitignore +++ b/tools/net/ynl/lib/.gitignore @@ -1,2 +1 @@ -__pycache__/ *.d diff --git a/tools/net/ynl/lib/Makefile b/tools/net/ynl/lib/Makefile index 94c49cca3dca..4b2b98704ff9 100644 --- a/tools/net/ynl/lib/Makefile +++ b/tools/net/ynl/lib/Makefile @@ -19,7 +19,6 @@ ynl.a: $(OBJS) =20 clean: rm -f *.o *.d *~ - rm -rf __pycache__ =20 distclean: clean rm -f *.a diff --git a/tools/net/ynl/pyynl/.gitignore b/tools/net/ynl/pyynl/.gitignore new file mode 100644 index 000000000000..b801cd2d016e --- /dev/null +++ b/tools/net/ynl/pyynl/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +lib/__pycache__/ diff --git a/tools/net/ynl/pyynl/__init__.py b/tools/net/ynl/pyynl/__init__= .py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/net/ynl/cli.py b/tools/net/ynl/pyynl/cli.py similarity index 100% rename from tools/net/ynl/cli.py rename to tools/net/ynl/pyynl/cli.py diff --git a/tools/net/ynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py similarity index 100% rename from tools/net/ynl/ethtool.py rename to tools/net/ynl/pyynl/ethtool.py diff --git a/tools/net/ynl/lib/__init__.py b/tools/net/ynl/pyynl/lib/__init= __.py similarity index 100% rename from tools/net/ynl/lib/__init__.py rename to tools/net/ynl/pyynl/lib/__init__.py diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/pyynl/lib/nlspec.py similarity index 100% rename from tools/net/ynl/lib/nlspec.py rename to tools/net/ynl/pyynl/lib/nlspec.py diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py similarity index 100% rename from tools/net/ynl/lib/ynl.py rename to tools/net/ynl/pyynl/lib/ynl.py diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/pyynl/ynl_gen_c.py similarity index 100% rename from tools/net/ynl/ynl-gen-c.py rename to tools/net/ynl/pyynl/ynl_gen_c.py diff --git a/tools/net/ynl/ynl-gen-rst.py b/tools/net/ynl/pyynl/ynl_gen_rst= .py similarity index 100% rename from tools/net/ynl/ynl-gen-rst.py rename to tools/net/ynl/pyynl/ynl_gen_rst.py diff --git a/tools/net/ynl/ynl-regen.sh b/tools/net/ynl/ynl-regen.sh index a37304dcc88e..81b4ecd89100 100755 --- a/tools/net/ynl/ynl-regen.sh +++ b/tools/net/ynl/ynl-regen.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause =20 -TOOL=3D$(dirname $(realpath $0))/ynl-gen-c.py +TOOL=3D$(dirname $(realpath $0))/pyynl/ynl_gen_c.py =20 force=3D search=3D diff --git a/tools/testing/selftests/net/lib/py/ynl.py b/tools/testing/self= tests/net/lib/py/ynl.py index a0d689d58c57..9c0e5a89eb12 100644 --- a/tools/testing/selftests/net/lib/py/ynl.py +++ b/tools/testing/selftests/net/lib/py/ynl.py @@ -13,14 +13,14 @@ try: SPEC_PATH =3D KSFT_DIR / "net/lib/specs" =20 sys.path.append(tools_full_path.as_posix()) - from net.lib.ynl.lib import YnlFamily, NlError + from net.lib.ynl.pyynl.lib import YnlFamily, NlError else: # Running in tree tools_full_path =3D KSRC / "tools" SPEC_PATH =3D KSRC / "Documentation/netlink/specs" =20 sys.path.append(tools_full_path.as_posix()) - from net.ynl.lib import YnlFamily, NlError + from net.ynl.pyynl.lib import YnlFamily, NlError except ModuleNotFoundError as e: ksft_pr("Failed importing `ynl` library from kernel sources") ksft_pr(str(e)) diff --git a/tools/testing/selftests/net/ynl.mk b/tools/testing/selftests/n= et/ynl.mk index d43afe243779..12e7cae251be 100644 --- a/tools/testing/selftests/net/ynl.mk +++ b/tools/testing/selftests/net/ynl.mk @@ -31,7 +31,8 @@ $(OUTPUT)/libynl.a: $(YNL_SPECS) $(OUTPUT)/.libynl-$(YNL_= GENS_HASH).sig $(Q)cp $(top_srcdir)/tools/net/ynl/libynl.a $(OUTPUT)/libynl.a =20 EXTRA_CLEAN +=3D \ - $(top_srcdir)/tools/net/ynl/lib/__pycache__ \ + $(top_srcdir)/tools/net/ynl/pyynl/__pycache__ \ + $(top_srcdir)/tools/net/ynl/pyynl/lib/__pycache__ \ $(top_srcdir)/tools/net/ynl/lib/*.[ado] \ $(OUTPUT)/.libynl-*.sig \ $(OUTPUT)/libynl.a --=20 2.43.0 From nobody Wed Dec 17 15:50:44 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFE971C5CB3 for ; Mon, 9 Dec 2024 14:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755668; cv=none; b=cezq2BjA01G2alDi4DB+FgEBO1wFRcNpRbqActgPcsAf877MdYzmagBXeX9jVydDL4MRODdnkr2bMP8bMjdJmAtdG4uk8/BNY997zMH/A4skkSOqQk+ww0+C8ct+XSghVkxsgraxGb/XNGbwFberTg+rUX91na03o3oyn4ignHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755668; c=relaxed/simple; bh=Ruj9EpI/QVkcbt3Z9LyeeOHR4SURDqqGhN024gxfiNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=I92NbJSkV0caWGOOgr59PrSeSKVi+x9LeQA8XqMk+vfNmt+WeZ4Y/lV4R18qCECGqxqk7GZ1ucHKJrLGANtbrLORaohcisPjPC3YnzQ9svC5VGGZMi1WkvjiiRIUohu197QjHXmIlubbbKw8uVfxODQ1z2MkAn3a8ydwpE+IvqQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=i1317gPX; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i1317gPX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733755665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p63aB6h+Gkmn4rzU5XjiQhRt8zOAxjKtKLZ3OhsF+oY=; b=i1317gPXChTJM/VGpAEsCEehNnaMQWvGiGp7M54wzmavIr2BRgT0c5ePwhh1Fy4qZg7n2o Rk3976fcGNJQbdX+QVBowDsuyNQHzF/COFu2ijrbUfhp0gwgiYQpRX+OU2rOtUjOkNVTVk dNqcgppj+H12wzkcf6wVWMipqpe/iqc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-220-PAmk5tRBP4CZb-RtTRFjsQ-1; Mon, 09 Dec 2024 09:47:42 -0500 X-MC-Unique: PAmk5tRBP4CZb-RtTRFjsQ-1 X-Mimecast-MFC-AGG-ID: PAmk5tRBP4CZb-RtTRFjsQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D92F31954211; Mon, 9 Dec 2024 14:47:40 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.182]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6F1241956089; Mon, 9 Dec 2024 14:47:37 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org, stfomichev@gmail.com Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH v2 2/5] tools: ynl: provide symlinks to user-facing scripts for compatibility Date: Mon, 9 Dec 2024 15:47:14 +0100 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" For backwards compatibility provide also symlinks from original location of user facing scripts. Signed-off-by: Jan Stancek --- tools/net/ynl/cli.py | 1 + tools/net/ynl/ethtool.py | 1 + tools/net/ynl/ynl-gen-c.py | 1 + tools/net/ynl/ynl-gen-rst.py | 1 + 4 files changed, 4 insertions(+) create mode 120000 tools/net/ynl/cli.py create mode 120000 tools/net/ynl/ethtool.py create mode 120000 tools/net/ynl/ynl-gen-c.py create mode 120000 tools/net/ynl/ynl-gen-rst.py diff --git a/tools/net/ynl/cli.py b/tools/net/ynl/cli.py new file mode 120000 index 000000000000..c26fb97ae611 --- /dev/null +++ b/tools/net/ynl/cli.py @@ -0,0 +1 @@ +pyynl/cli.py \ No newline at end of file diff --git a/tools/net/ynl/ethtool.py b/tools/net/ynl/ethtool.py new file mode 120000 index 000000000000..deea4569a939 --- /dev/null +++ b/tools/net/ynl/ethtool.py @@ -0,0 +1 @@ +pyynl/ethtool.py \ No newline at end of file diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py new file mode 120000 index 000000000000..716d34fa1257 --- /dev/null +++ b/tools/net/ynl/ynl-gen-c.py @@ -0,0 +1 @@ +pyynl/ynl_gen_c.py \ No newline at end of file diff --git a/tools/net/ynl/ynl-gen-rst.py b/tools/net/ynl/ynl-gen-rst.py new file mode 120000 index 000000000000..b02558f540ec --- /dev/null +++ b/tools/net/ynl/ynl-gen-rst.py @@ -0,0 +1 @@ +pyynl/ynl_gen_rst.py \ No newline at end of file --=20 2.43.0 From nobody Wed Dec 17 15:50:44 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C9D81B4254 for ; Mon, 9 Dec 2024 14:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755673; cv=none; b=Gk//ve5opcaY4cce3ob/R3uW6bkfkCiPj5urTY8yPcKvcv7p/DdQitZsC0cH2w8aItOzpmDoSkT36awn5Hts+ixFoQd/j/AVHjB+rapq03vxhiV91KRYTHBFj9meFH/ffKqd/tQirzhoeCeLsHlnt4vFH23FCiRGUb5Z67C73zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755673; c=relaxed/simple; bh=6VdqSl8alXvH6pPsK78wHQAqoCIfIhg5UpI5s40sgg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=atT9jWs04zJ9sI9dkZ+d57DYUd/S9kqGqGTDLPauEtN5tYLFL6oHskqgkLhi7S5qaKkSpL6gSG0Dusr54EaEP61idQDVTfI68rwhm0dJpwdn3AHon7nNy2rr4C/lI3xvdUcwTZgioCcxavdbMG17a7SE2YkFPzcH+Yy2hJz1Gxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cTXuCPdX; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cTXuCPdX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733755671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l7tcKVC1kh1dFVI8oN1xiQyOlNqxnj21TIJYyRp/op8=; b=cTXuCPdXcSdCQiyw+gmrN2US8ddn/pYdw8a5ATIlfTXP5qlu8GTcP1eCkw0rCoxRuSh+Fu 933nD0Nhcr8mhSd2xdCUOfU5zBZvLImPh77HFkssh6ps/h5xZPD3Z7nJVRS178yozlAx+l 4lOF24sNvb27xkiKrXRCxhUNSjRNxUQ= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-402-0HX661lWNk2VIEQC5cRWAg-1; Mon, 09 Dec 2024 09:47:46 -0500 X-MC-Unique: 0HX661lWNk2VIEQC5cRWAg-1 X-Mimecast-MFC-AGG-ID: 0HX661lWNk2VIEQC5cRWAg Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BCE8A1954221; Mon, 9 Dec 2024 14:47:44 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.182]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5BB241956089; Mon, 9 Dec 2024 14:47:41 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org, stfomichev@gmail.com Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH v2 3/5] tools: ynl: add initial pyproject.toml for packaging Date: Mon, 9 Dec 2024 15:47:15 +0100 Message-ID: <18b1997fdbacf056dbcedcdb82f350703c6da8b0.1733755068.git.jstancek@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jan Stancek --- tools/net/ynl/pyproject.toml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tools/net/ynl/pyproject.toml diff --git a/tools/net/ynl/pyproject.toml b/tools/net/ynl/pyproject.toml new file mode 100644 index 000000000000..677ea8f4c185 --- /dev/null +++ b/tools/net/ynl/pyproject.toml @@ -0,0 +1,26 @@ +[build-system] +requires =3D ["setuptools>=3D61.0"] +build-backend =3D "setuptools.build_meta" + +[project] +name =3D "pyynl" +authors =3D [ + {name =3D "Donald Hunter", email =3D "donald.hunter@gmail.com"}, + {name =3D "Jakub Kicinski", email =3D "kuba@kernel.org"}, +] +description =3D "yaml netlink (ynl)" +version =3D "0.0.1" +requires-python =3D ">=3D3.9" +dependencies =3D [ + "pyyaml=3D=3D6.*", + "jsonschema=3D=3D4.*" +] + +[tool.setuptools.packages.find] +include =3D ["pyynl", "pyynl.lib"] + +[project.scripts] +ynl =3D "pyynl.cli:main" +ynl-ethtool =3D "pyynl.ethtool:main" +ynl-gen-c =3D "pyynl.ynl_gen_c:main" +ynl-gen-rst =3D "pyynl.ynl_gen_rst:main" --=20 2.43.0 From nobody Wed Dec 17 15:50:44 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96FF91E9B2F for ; Mon, 9 Dec 2024 14:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755678; cv=none; b=AO0m/b1mazPKk6SQLtabxN9uJqbbWixkLj8ZjrqgjWQwefhTr7O/H6DQRj7B1BseV7iSHX974vdxkShiD6OTD2BvBVljTjJbNFYkBs6vl80rb93tRn92VGzDRW8JoUlLC9H7Xy8GZOIlDHpT7KIwJlKBoej8kCPjN8ZeMZ1Hqdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755678; c=relaxed/simple; bh=bQAv1UxQssB3tMoCrEaPaH8YhrV81zDOO65SEhBhWbg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=f3pDrmD5Wygl0NYY5K87NcpiuLvojgDfYPepVIvyZNOguepkOWu4BQSfi8IpS++p+qru9BCO2g77C/G73D1ciu9ECSdJSfP7RY55y8SoHX8XytqK7f2uIuPas8X6G/GG3qTJz3UdOsVxb+vF9WUW+qj7TSrQOfV05tmbF+nkQrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RgIwddtD; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RgIwddtD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733755675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1CKW1cKzOvQu3PHZh9xUbsjiPM1Bs37pILAwq3THS0w=; b=RgIwddtDutg+Q0EGqbK8ZQIl/28rLwf7o4CE3VylXYuVH4cu4Vil2Arm9xCq5MHVuvhvqn PiRaqnQLqwK37cyAxa/X7V4FcUGk4C0IYOwU5SNIRaNGq2vTSSgv6q1T5roBxVh1cSxtd/ HGtpP2uATf5gWdM8/BJRPNO6VHi3LpQ= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-aedGucq1PdC4i2Yg68nA4w-1; Mon, 09 Dec 2024 09:47:52 -0500 X-MC-Unique: aedGucq1PdC4i2Yg68nA4w-1 X-Mimecast-MFC-AGG-ID: aedGucq1PdC4i2Yg68nA4w Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B30911956052; Mon, 9 Dec 2024 14:47:48 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.182]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 48068195608A; Mon, 9 Dec 2024 14:47:45 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org, stfomichev@gmail.com Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH v2 4/5] tools: ynl: add install target for specs and docs Date: Mon, 9 Dec 2024 15:47:16 +0100 Message-ID: <0271f19ad8f5453d2fea5b0f05648b9c2667d771.1733755068.git.jstancek@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Generate docs using ynl_gen_rst and add install target for both specs and generates rst files. Signed-off-by: Jan Stancek --- tools/net/ynl/generated/.gitignore | 1 + tools/net/ynl/generated/Makefile | 34 +++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tools/net/ynl/generated/.gitignore b/tools/net/ynl/generated/.= gitignore index ade488626d26..859a6fb446e1 100644 --- a/tools/net/ynl/generated/.gitignore +++ b/tools/net/ynl/generated/.gitignore @@ -1,2 +1,3 @@ *-user.c *-user.h +*.rst diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Mak= efile index 00af721b1571..d28509ac0573 100644 --- a/tools/net/ynl/generated/Makefile +++ b/tools/net/ynl/generated/Makefile @@ -7,12 +7,18 @@ ifeq ("$(DEBUG)","1") CFLAGS +=3D -g -fsanitize=3Daddress -fsanitize=3Dleak -static-libasan endif =20 +INSTALL ?=3D install +prefix ?=3D /usr +datarootdir ?=3D $(prefix)/share +docdir ?=3D $(datarootdir)/doc + include ../Makefile.deps =20 YNL_GEN_ARG_ethtool:=3D--user-header linux/ethtool_netlink.h \ --exclude-op stats-get =20 TOOL:=3D../pyynl/ynl_gen_c.py +TOOL_RST:=3D../pyynl/ynl_gen_rst.py =20 GENS_PATHS=3D$(shell grep -nrI --files-without-match \ 'protocol: netlink' \ @@ -22,7 +28,11 @@ SRCS=3D$(patsubst %,%-user.c,${GENS}) HDRS=3D$(patsubst %,%-user.h,${GENS}) OBJS=3D$(patsubst %,%-user.o,${GENS}) =20 -all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) +SPECS_PATHS=3D$(wildcard ../../../../Documentation/netlink/specs/*.yaml) +SPECS=3D$(patsubst ../../../../Documentation/netlink/specs/%.yaml,%,${SPEC= S_PATHS}) +RSTS=3D$(patsubst %,%.rst,${SPECS}) + +all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS) =20 protos.a: $(OBJS) @echo -e "\tAR $@" @@ -40,8 +50,12 @@ protos.a: $(OBJS) @echo -e "\tCC $@" @$(COMPILE.c) $(CFLAGS_$*) -o $@ $< =20 +%.rst: ../../../../Documentation/netlink/specs/%.yaml $(TOOL2) + @echo -e "\tGEN_RST $@" + @$(TOOL_RST) -o $@ -i $< + clean: - rm -f *.o + rm -f *.o *.rst =20 distclean: clean rm -f *.c *.h *.a @@ -49,5 +63,19 @@ distclean: clean regen: @../ynl-regen.sh =20 -.PHONY: all clean distclean regen +install-rsts: + @echo -e "\tINSTALL generated docs" + @$(INSTALL) -d $(DESTDIR)$(docdir)/ynl + @$(INSTALL) -m 0644 $(RSTS) $(DESTDIR)$(docdir)/ynl/ + +install-specs: + @echo -e "\tINSTALL specs" + @$(INSTALL) -d $(DESTDIR)$(datarootdir)/ynl + @$(INSTALL) -m 0644 ../../../../Documentation/netlink/*.yaml $(DESTDIR)$(= datarootdir)/ynl/ + @$(INSTALL) -d $(DESTDIR)$(datarootdir)/ynl/specs + @$(INSTALL) -m 0644 ../../../../Documentation/netlink/specs/*.yaml $(DEST= DIR)$(datarootdir)/ynl/specs/ + +install: install-rsts install-specs + +.PHONY: all clean distclean regen install .DEFAULT_GOAL: all --=20 2.43.0 From nobody Wed Dec 17 15:50:44 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 168791B4251 for ; Mon, 9 Dec 2024 14:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755679; cv=none; b=oCtslhXCKqhjHSTjEexUlgWi34mhvjNktT7S8dEwR5sD5icK9e0/xzS5n9LYd+OKR5B44Cpn7BD7KDZt7igZ694e0ZYxUR2u7dOOonkBDYh6MXaMo+rExZEXRMAQAzNcHyv8EDv6NOoHnfdboU41pHvo/henSLhzAwx7bV9RTjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733755679; c=relaxed/simple; bh=5L5/QKETaA0ZzUZT5pfI7dgJYc6P10VRFXK70b7x1oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=q+MW+QssnU6oo2Ay+3D76oWr9RFfIocbXxk1rxw3l0vPuUBWr9/3+dBJC3mqCzyVey7zu3EXbPzzNjDI1Np7xV3hjYa2b1vRVKSTzRia1P0wQOR77zJAKLg8/5lG34RVtw7fxSS9LWq0MHg94k1Hm/M4GtNP7Idu8jYZI88Il+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=aeE3xiJe; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aeE3xiJe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733755677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CDX1t6Lz6Nzmh2lZRUVmXSqrClGnwSF3XrGiwKdpOyU=; b=aeE3xiJerLLFp3MeoY319alQ4ekatyLox9RTldgH+SFO1dUs5DEAfUmTFdUV/1f+1Sw9MT +CBCMlW0PuOTexMtIwCXTgjIcC/zIPmtUJCLW6aMOkXLxoyRMRRPHiwk6D0gySsfl3l21i Wd/LqaaVUto9N97nwE6Fj/KtQ42h8Dw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-t2nFFN6xNvaCMUFdXth6Pg-1; Mon, 09 Dec 2024 09:47:54 -0500 X-MC-Unique: t2nFFN6xNvaCMUFdXth6Pg-1 X-Mimecast-MFC-AGG-ID: t2nFFN6xNvaCMUFdXth6Pg Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8FE8D1955D58; Mon, 9 Dec 2024 14:47:52 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.182]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 43350195608A; Mon, 9 Dec 2024 14:47:48 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org, stfomichev@gmail.com Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH v2 5/5] tools: ynl: add main install target Date: Mon, 9 Dec 2024 15:47:17 +0100 Message-ID: <59e64ba52e7fb7d15248419682433ec5a732650b.1733755068.git.jstancek@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" This will install C library, specs, rsts and pyynl. The initial structure is: $ mkdir /tmp/myroot $ make DESTDIR=3D/tmp/myroot install /usr /usr/lib64 /usr/lib64/libynl.a /usr/lib/python3.XX/site-packages/pyynl/* /usr/lib/python3.XX/site-packages/pyynl-0.0.1.dist-info/* /usr/bin /usr/bin/ynl /usr/bin/ynl-ethtool /usr/bin/ynl-gen-c /usr/bin/ynl-gen-rst /usr/share /usr/share/doc /usr/share/doc/ynl /usr/share/doc/ynl/*.rst /usr/share/ynl /usr/share/ynl/genetlink-c.yaml /usr/share/ynl/genetlink-legacy.yaml /usr/share/ynl/genetlink.yaml /usr/share/ynl/netlink-raw.yaml /usr/share/ynl/specs /usr/share/ynl/specs/devlink.yaml /usr/share/ynl/specs/dpll.yaml /usr/share/ynl/specs/ethtool.yaml /usr/share/ynl/specs/fou.yaml /usr/share/ynl/specs/handshake.yaml /usr/share/ynl/specs/mptcp_pm.yaml /usr/share/ynl/specs/netdev.yaml /usr/share/ynl/specs/net_shaper.yaml /usr/share/ynl/specs/nfsd.yaml /usr/share/ynl/specs/nftables.yaml /usr/share/ynl/specs/nlctrl.yaml /usr/share/ynl/specs/ovs_datapath.yaml /usr/share/ynl/specs/ovs_flow.yaml /usr/share/ynl/specs/ovs_vport.yaml /usr/share/ynl/specs/rt_addr.yaml /usr/share/ynl/specs/rt_link.yaml /usr/share/ynl/specs/rt_neigh.yaml /usr/share/ynl/specs/rt_route.yaml /usr/share/ynl/specs/rt_rule.yaml /usr/share/ynl/specs/tcp_metrics.yaml /usr/share/ynl/specs/tc.yaml /usr/share/ynl/specs/team.yaml Signed-off-by: Jan Stancek --- tools/net/ynl/Makefile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tools/net/ynl/Makefile b/tools/net/ynl/Makefile index 5268b91bf7ed..116a7fcfc540 100644 --- a/tools/net/ynl/Makefile +++ b/tools/net/ynl/Makefile @@ -1,5 +1,16 @@ # SPDX-License-Identifier: GPL-2.0 =20 +include ../../scripts/Makefile.arch + +INSTALL ?=3D install +prefix ?=3D /usr +ifeq ($(LP64), 1) + libdir_relative =3D lib64 +else + libdir_relative =3D lib +endif +libdir ?=3D $(prefix)/$(libdir_relative) + SUBDIRS =3D lib generated samples =20 all: $(SUBDIRS) libynl.a @@ -23,5 +34,15 @@ clean distclean: rm -f libynl.a rm -rf pyynl/__pycache__ rm -rf pyynl/lib/__pycache__ + rm -rf pyynl.egg-info + rm -rf build + +install: libynl.a + @echo -e "\tINSTALL libynl.a" + @$(INSTALL) -d $(DESTDIR)$(libdir) + @$(INSTALL) -m 0644 libynl.a $(DESTDIR)$(libdir)/libynl.a + @echo -e "\tINSTALL pyynl" + @pip install --prefix=3D$(DESTDIR)$(prefix) . + @make -C generated install =20 -.PHONY: all clean distclean $(SUBDIRS) +.PHONY: all clean distclean install $(SUBDIRS) --=20 2.43.0