From patchwork Mon Jan 20 13:04:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis OSTERLAND-HEIM X-Patchwork-Id: 55837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FEB9C02181 for ; Mon, 20 Jan 2025 13:10:53 +0000 (UTC) Received: from enterprise02.smtp.diehl.com (enterprise02.smtp.diehl.com [193.201.238.220]) by mx.groups.io with SMTP id smtpd.web10.36198.1737378644903563826 for ; Mon, 20 Jan 2025 05:10:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@diehl.com header.s=default header.b=whCz4l1c; spf=pass (domain: diehl.com, ip: 193.201.238.220, mailfrom: prvs=108336ff4=denis.osterland@diehl.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diehl.com; i=@diehl.com; q=dns/txt; s=default; t=1737378645; x=1768914645; h=from:to:subject:date:message-id: content-transfer-encoding:mime-version; bh=XvnJcltGxwU9gDUHjTv1dg2Uv/V6HpVTIu5Iwfcu5AU=; b=whCz4l1cGIC4FnLz7AzRTi+iiBBt2EH/zaaORa2weQRYKUlEiFBxTtuv CgdMLXRThGbDCmrlsVF2/Y3+2XT4up/UQOGlQ9xBlGQf8/nccWJSAgEBf kGXw/m05qdG8AgjFUVrBhoYh2uf45hBZkMzDXp/20ZUQ8C415WiVhALDR ibiJSSzVHLNOOPHmt5boan23aYrVL2gY4Vu7eQLGH5lm44UpaOV4gRufr OqWNkVNUSjcb1fu8PYdwSHG/lnABWddIt+nZbHAMAwlNt52GhzSw/+3mC 6esOOZGxbjaNpjKc78PxNujy9/8p0sMCmgutK7qSs3ctDA16BNwQQXP69 g==; X-CSE-ConnectionGUID: U1IwXz6bTYSMscg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Vsef+OmAnIIRM7NntXEmIiOW29gOzcXrC21yR+44r/zFBaVmj8YTjN02L8ntU TVjgDj4a2nkvejjjvRzXXa4Zh6kMbojoIrPr3DtuElbhHXziq4boVoXLOP+BgzveGU8V4v1P Xcvhs6OMx3ynXJOkW4uwHk1QXM2Csnr1Xi1Vibq33+ptGRfkN0N+NxwaZiNjfJ4Uspu99xlI hR2XiCipZRBRTc2Azg+tnhTXhR5wqJiEtntdRWo21UUIMYZrMUh5cY5llpHJAJGz+/wJw7Ed NpENrX6J9tABCnhjHizytSKe6XLzAO9yS9Mw8/Uwuuon5rdUVCvg4lLQok7y49HdwGOsF5Dq //Q95Vffl1P7IrhORGdaY8aPryNWrMSx7pPHiJKVrqOb0dM2/MrZmf2sRQ2AjiQu118LI8kJ 7KFFNU3FRCCX7GGImA2oZG/QvKR3j4VTPxyttG75w8obHkQqH3WBfzAWzGvvHQ1Mn3OPerLc qbKdZTGbvuPGHuEYFG00n3XIRTM2AXVIkQtswgU1yDr8rXIsmy39arO8r7Nf7oC3IpS2n/Cn wMUHz6I9hB9FmiXjv9jALKU33gd0Tj9dZ7EbTc/eIU1I8RX7c8+jQ9mBC8/IWGODdCuqs5cA 93J67miLqyoS2s8WPB/wxSS25gJ1cQ5K+lX2JBpAcMPU+xaroIs9CbYmxK2mCbLBB6Qc/QHB VWulh7kJjHXKC41GQnEZaqI2iah3wcqDaQQ50Vn6iZ6d7iYY43ApErQ6RtGQijLW0Epe+rkh Y3VOYpfD6vKtq1s9TasHU9PpChS+VB X-Talos-CUID: 9a23:Z4j8yGDW1oolZGH6ExQ+1VEkCJ4vTkzm6WzbLGWhMUN4YqLAHA== X-Talos-MUID: 9a23:QLF0zAZgXXxAL+BThQPgoSx/a5ZSs6GnKWInyZYtss6uDHkl X-IronPort-AV: E=Sophos;i="6.13,219,1732575600"; d="scan'208";a="104256337" From: Denis OSTERLAND-HEIM To: "openembedded-core@lists.openembedded.org" Subject: [PATCH] create-spdx: support line numbers Thread-Topic: [PATCH] create-spdx: support line numbers Thread-Index: AdtrO7lORJKBZ1X1RqyDPwGQL2g+Fw== Date: Mon, 20 Jan 2025 13:04:58 +0000 Message-ID: <1e91d93673d7414baea355383b0f0ebe@diehl.com> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-disclaimerprocessed: True MIME-Version: 1.0 X-GBS-PROC: AvLZyVEBsXnffHjQqcUo3GrkwECuKz0rD/zx0KJ7IyZWT4PLlht/DwY9ASCK6I+7779YMmcRVs61Z/dv9AMcEaoEMWLmicsb8Fs1Gjwt9ow= X-GBS-PROCJOB: T6vXm0tbutBs2F3Hr04tXPEHf68YyV4INRyAJ+o/4XsqLS+Yxc9cF03/LrCPJ7lZ List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 Jan 2025 13:10:53 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210028 LIC_FILES_CHKSUM supports begin-/endline for licenses included in for instance header files. This patch adds support for line numbers to NO_GENERIC_LICENSE, too. Signed-off-by: Denis Osterland-Heim --- Resent without signature meta/classes/create-spdx-2.2.bbclass | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.45.2 Diehl Metering GmbH, Donaustrasse 120, 90451 Nuernberg Sitz der Gesellschaft: Ansbach, Registergericht: Ansbach HRB 69 Geschaeftsfuehrer: Dr. Christof Bosbach (Sprecher), Dipl.-Dolm. Annette Geuther, Dipl.-Kfm. Reiner Edel, Jean-Claude Luttringer Bitte denken Sie an die Umwelt, bevor Sie diese E-Mail drucken. Diese E-Mail kann vertrauliche Informationen enthalten. Sollten die in dieser E-Mail enthaltenen Informationen nicht für Sie bestimmt sein, informieren Sie bitte unverzueglich den Absender per E-Mail und loeschen Sie diese E-Mail in Ihrem System. Jede unberechtigte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt. Informationen zum Datenschutz finden Sie auf unserer Homepage. Before printing, think about environmental responsibility.This message may contain confidential information. If you are not authorized to receive this information please advise the sender immediately by reply e-mail and delete this message without making any copies. Any form of unauthorized use, publication, reproduction, copying or disclosure of the e-mail is not permitted. Information about data protection can be found on our homepage. diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass index 27242ecf70..494bde117f 100644 --- a/meta/classes/create-spdx-2.2.bbclass +++ b/meta/classes/create-spdx-2.2.bbclass @@ -75,11 +75,17 @@ def convert_license_to_spdx(lic, license_data, document, d, existing={}): pass if extracted_info.extractedText is None: # If it's not SPDX or PD, then NO_GENERIC_LICENSE must be set - filename = d.getVarFlag('NO_GENERIC_LICENSE', name) + entry = d.getVarFlag('NO_GENERIC_LICENSE', name).split(';') + filename = entry[0] + params = {i.split('=')[0]: i.split('=')[1] for i in entry[1:] if '=' in i} + beginline = int(params.get('beginline', 1)) + endline = params.get('endline', None) + if endline: + endline = int(endline) if filename: filename = d.expand("${S}/" + filename) with open(filename, errors="replace") as f: - extracted_info.extractedText = f.read() + extracted_info.extractedText = "".join(line for idx, line in enumerate(f, 1) if beginline <= idx and idx <= (endline or idx)) else: bb.fatal("Cannot find any text for license %s" % name)