From patchwork Mon Feb 19 01:28:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 39674 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 D9FBBC54766 for ; Mon, 19 Feb 2024 01:28:56 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (EUR02-DB5-obe.outbound.protection.outlook.com [40.107.249.89]) by mx.groups.io with SMTP id smtpd.web10.32003.1708306128427355055 for ; Sun, 18 Feb 2024 17:28:48 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=O8DilAdw; spf=pass (domain: axis.com, ip: 40.107.249.89, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=inUoM9wCbHbkaEKWnczmTE+Yrp8LaHcQ4P4YSRQ64Fn4PXBWSP5UeI3c8v0JpvOxkFnTg/nzLK13s3e40NPYwlpAbWnUAYKfTjJ2BWpUa5s43Ituaeiw8rF+LlEUiFQnD/NIEkwEOaUsNHt3ut68EwdSCExA4qRMgWdAjE8wyY451mRDJ1KwNR5ypZPwqoI4kFfZIRtf0MocUEyZEaQhboHtdhVxWqO8hJHOVj75SxSJcuJL3WBzjBjiFHUq90XIhD0Ti+goGJsPee6jPGnYEisNrKCvZlc6wJudXKIWLV9QYsaKzm609B4YqG0Ql7+HxEf7C5xY8lTsKlFNm0qJXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YDPnVhCJxuxE/beEjaLsWFIWA4U4r5I/aI6AEl6S/dI=; b=KPeiLFIuxShfXVtRUhHRcZ/JYwrB1s51etd54XsUGgYHl9y3+NRGpyS0uM27/wdr5sN94qgZ1VSFhfUCCMcveYdbmrKhTuEPcHQPw2OmGTNAYIRJdUoZp5YulwYyGts/6bJMV/H13QpQiAOuXO/9by/KN0r4FtTtPmZ8n2QMS4SPJKVJ+AGsMj2O63r8Y3UIQRaLxegyKTwlRsKPcFblqp/T1/vYmeJRq0ZrGTOsgBJN3jhp6z2NddOXUhxhhpDFYGsDNvoKH9PQc2dydxWa7yKfAv1JubQWQ/VOeK05nzdq2s5jGE6cRpxN1Xp6hdFQdto2H7OnGZK7fi2FbPobPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YDPnVhCJxuxE/beEjaLsWFIWA4U4r5I/aI6AEl6S/dI=; b=O8DilAdwxAGklADVrhqDDliyzE5/UuG5Ug5W6wW5Da1tLWIdHEpjgO0McO2YMDcUkY4CThfjplxfuM2G0mtDA5SCAZ3PbT/8E2xI8bKaH81RjZxGEb2YxoM2M3TtzzuGUvGGOY6SblMsbIiTtN2uSkF2SVzgpErDiMPq/NyoiWY= Received: from DUZPR01CA0066.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::14) by AS8PR02MB10006.eurprd02.prod.outlook.com (2603:10a6:20b:616::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.34; Mon, 19 Feb 2024 01:28:44 +0000 Received: from DB1PEPF000509E3.eurprd03.prod.outlook.com (2603:10a6:10:3c2:cafe::31) by DUZPR01CA0066.outlook.office365.com (2603:10a6:10:3c2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38 via Frontend Transport; Mon, 19 Feb 2024 01:28:44 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509E3.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 19 Feb 2024 01:28:44 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:43 +0100 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:43 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 19 Feb 2024 02:28:43 +0100 Received: from saur (saur.se.axis.com [10.92.3.10]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 7FF8B14929 for ; Mon, 19 Feb 2024 02:28:43 +0100 (CET) Received: from saur.se.axis.com (localhost [127.0.0.1]) by saur (8.17.1/8.15.2) with ESMTPS id 41J1ShQJ3090818 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 19 Feb 2024 02:28:43 +0100 Received: (from pkj@localhost) by saur.se.axis.com (8.17.1/8.17.1/Submit) id 41J1Sh483090815 for openembedded-core@lists.openembedded.org; Mon, 19 Feb 2024 02:28:43 +0100 From: Peter Kjellerstedt To: Subject: [PATCHv2 1/5] lib/oe/patch: Make extractPatches() not extract ignored commits Date: Mon, 19 Feb 2024 02:28:28 +0100 Message-ID: <20240219012832.3090768-1-pkj@axis.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E3:EE_|AS8PR02MB10006:EE_ X-MS-Office365-Filtering-Correlation-Id: fd872c5c-3cc0-47bc-1e31-08dc30ea1cce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sUFec00Hu/zgJRJlBmu6PoESbQZgUBwqmgyBIwewYbjAXMoQInt3eJuZm+bvoNi7/90SuSCjj9/771C7VaaXJALroLxNQncgmdAbGl+iqFB8iOfNbVdCVIjkDoEC8obbaUsTfDzA8Hyh2zQNJ7HV3dbu0qAyo8TG6Rn5WqT/iRqznUwqPm/4tJO3BfHR/OWEfYusnu+LUA7kgvL/OfOXMZWlVcqZaiskOa0P8WlX3tN17Q7/gTIhYMF4vkvflurpBSBCDSgwcxkwJF8t0iGu/BfOkVv3IWObKTcOIUOz9EVMaH8CsJ/OwJ5oO1fum4rBxvSd8jMbEIZfQnEnV/M1aUckhMFRDzBP3JliVQsfB0hwsMJ7VhbZ0zibUvZtaym7PkHn1rriFvWCBvU7bVbc7dmt+D39pv4lnyvR9SreLT13g+bucaOZAYPjf4oWXfKgVqimJR6xjoTy59/KOMRqMs3eQN795i+Y9ZR5p5OOtnCjy0wUBURt7Fbwf+yIm5vL7zntDZMagNhiUw6JIQ/E4qtLCfk0d2osJDdDjVNbccTQIW/M90U9X2tyrVGgVOYZRig5nj1QlUofvifj3+pwAYaWyQwSQ6XdoBohdH+VmUQTdmoZqEMFjF2Qi6j+HbPCI5A7kzIgY4z41r5ArslNUQ== X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(346002)(396003)(39850400004)(230922051799003)(64100799003)(36860700004)(1800799012)(186009)(82310400011)(451199024)(40470700004)(46966006)(41300700001)(19627235002)(82740400003)(6916009)(2906002)(8676002)(8936002)(70206006)(70586007)(5660300002)(30864003)(42186006)(356005)(6666004)(966005)(36756003)(316002)(478600001)(1076003)(2616005)(426003)(336012)(26005)(83380400001)(81166007);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 01:28:44.2893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd872c5c-3cc0-47bc-1e31-08dc30ea1cce X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509E3.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR02MB10006 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, 19 Feb 2024 01:28:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/195854 If a commit is marked with "%% ignore" it means it is used by devtool to keep track of changes to the source code that are not the result of running do_patch(). These changes need to actually be ignored when extracting the patches as they typically make no sense as actual patches in a recipe. This also adds a new test for oe-selftest that verifies that there are no patches generated from ignored commits. Signed-off-by: Peter Kjellerstedt --- PATCHv2: Add EXCLUDE_FROM_WORLD = "1" to the sysdig-selftest recipe. .../0055-Add-cstdint-for-uintXX_t-types.patch | 38 +++++++++++ ...099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch | 29 ++++++++ .../sysdig/sysdig-selftest_0.28.0.bb | 66 +++++++++++++++++++ meta/lib/oe/patch.py | 16 ++--- meta/lib/oeqa/selftest/cases/devtool.py | 46 +++++++++++++ 5 files changed, 187 insertions(+), 8 deletions(-) create mode 100644 meta-selftest/recipes-extended/sysdig/sysdig-selftest/0055-Add-cstdint-for-uintXX_t-types.patch create mode 100644 meta-selftest/recipes-extended/sysdig/sysdig-selftest/0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch create mode 100644 meta-selftest/recipes-extended/sysdig/sysdig-selftest_0.28.0.bb diff --git a/meta-selftest/recipes-extended/sysdig/sysdig-selftest/0055-Add-cstdint-for-uintXX_t-types.patch b/meta-selftest/recipes-extended/sysdig/sysdig-selftest/0055-Add-cstdint-for-uintXX_t-types.patch new file mode 100644 index 0000000000..e564958dad --- /dev/null +++ b/meta-selftest/recipes-extended/sysdig/sysdig-selftest/0055-Add-cstdint-for-uintXX_t-types.patch @@ -0,0 +1,38 @@ +From 3d076ea588eb3c7f334133b4c31172a14beadf5b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 2 Feb 2023 20:18:27 -0800 +Subject: [PATCH] Add for uintXX_t types + +gcc 13 moved some includes around and as a result is no +longer transitively included [1]. Explicitly include it +for uintXX_t. + +[1] https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes + +Upstream-Status: Submitted [https://github.com/falcosecurity/libs/pull/862] +Signed-off-by: Khem Raj +--- + userspace/libsinsp/filter/parser.h | 1 + + userspace/libsinsp/filter_value.h | 1 + + 2 files changed, 2 insertions(+) + +--- a/userspace/libsinsp/filter/parser.h ++++ b/userspace/libsinsp/filter/parser.h +@@ -18,6 +18,7 @@ limitations under the License. + #pragma once + + #include "ast.h" ++#include + + // + // Context-free Grammar for Sinsp Filters +--- a/userspace/libsinsp/filter_value.h ++++ b/userspace/libsinsp/filter_value.h +@@ -18,6 +18,7 @@ limitations under the License. + #pragma once + + #include ++#include + #include + + // Used for CO_IN/CO_PMATCH filterchecks using PT_CHARBUFs to allow diff --git a/meta-selftest/recipes-extended/sysdig/sysdig-selftest/0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch b/meta-selftest/recipes-extended/sysdig/sysdig-selftest/0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch new file mode 100644 index 0000000000..903ccdf36a --- /dev/null +++ b/meta-selftest/recipes-extended/sysdig/sysdig-selftest/0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch @@ -0,0 +1,29 @@ +From ed8969a233adb6bf701de96d0fd0570e5ddcc787 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 21 Mar 2022 19:35:48 -0700 +Subject: [PATCH] cmake: Pass PROBE_NAME via CFLAGS + +This helps compliation of driver code where its calling modprobe on the +given kernel module via system() API + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7dceb7ae..e156c36f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -149,6 +149,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") + if(NOT DEFINED PROBE_NAME) + set(PROBE_NAME "scap") + endif() ++ add_definitions(-DPROBE_NAME="${PROBE_NAME}") + + set(DRIVERS_REPO "https://download.sysdig.com/scap-drivers") + +-- +2.35.1 + diff --git a/meta-selftest/recipes-extended/sysdig/sysdig-selftest_0.28.0.bb b/meta-selftest/recipes-extended/sysdig/sysdig-selftest_0.28.0.bb new file mode 100644 index 0000000000..2ce85fe451 --- /dev/null +++ b/meta-selftest/recipes-extended/sysdig/sysdig-selftest_0.28.0.bb @@ -0,0 +1,66 @@ +SUMMARY = "A New System Troubleshooting Tool Built for the Way You Work" +DESCRIPTION = "Sysdig is open source, system-level exploration: capture \ +system state and activity from a running Linux instance, then save, \ +filter and analyze." +HOMEPAGE = "http://www.sysdig.org/" +LICENSE = "Apache-2.0 & (MIT | GPL-2.0-only)" +LIC_FILES_CHKSUM = "file://COPYING;md5=f8fee3d59797546cffab04f3b88b2d44" + +inherit cmake pkgconfig + +#OECMAKE_GENERATOR = "Unix Makefiles" +JIT ?= "jit" +JIT:mipsarchn32 = "" +JIT:mipsarchn64 = "" +JIT:riscv64 = "" +JIT:riscv32 = "" +JIT:powerpc = "" +JIT:powerpc64le = "" +JIT:powerpc64 = "" + +#DEPENDS += "libb64 lua${JIT} zlib c-ares grpc-native grpc curl ncurses jsoncpp \ +# tbb jq openssl elfutils protobuf protobuf-native jq-native valijson" +RDEPENDS:${PN} = "bash" + +SRC_URI = "git://github.com/draios/sysdig.git;branch=dev;protocol=https;name=sysdig \ + git://github.com/falcosecurity/libs;protocol=https;branch=master;name=falco;subdir=git/falcosecurity-libs \ + file://0055-Add-cstdint-for-uintXX_t-types.patch;patchdir=./falcosecurity-libs \ + file://0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch \ + " +SRCREV_sysdig = "4fb6288275f567f63515df0ff0a6518043ecfa9b" +SRCREV_falco= "caa0e4d0044fdaaebab086592a97f0c7f32aeaa9" + +SRCREV_FORMAT = "sysdig_falco" + +S = "${WORKDIR}/git" + +EXTRA_OECMAKE = "\ + -DBUILD_DRIVER=OFF \ + -DMINIMAL_BUILD=ON \ + -DUSE_BUNDLED_DEPS=OFF \ + -DCREATE_TEST_TARGETS=OFF \ + -DDIR_ETC=${sysconfdir} \ + -DLUA_INCLUDE_DIR=${STAGING_INCDIR}/luajit-2.1 \ + -DFALCOSECURITY_LIBS_SOURCE_DIR=${S}/falcosecurity-libs \ + -DVALIJSON_INCLUDE=${STAGING_INCDIR}/valijson \ +" + +#CMAKE_VERBOSE = "VERBOSE=1" + +FILES:${PN} += " \ + ${DIR_ETC}/* \ + ${datadir}/zsh/* \ + ${prefix}/src/* \ +" +# Use getaddrinfo_a is a GNU extension in libsinsp +# It should be fixed in sysdig, until then disable +# on musl +# Something like this https://code.videolan.org/ePirat/vlc/-/commit/01fd9fe4c7f6c5558f7345f38abf0152e17853ab is needed to fix it +COMPATIBLE_HOST:libc-musl = "null" +COMPATIBLE_HOST:mips = "null" +COMPATIBLE_HOST:riscv64 = "null" +COMPATIBLE_HOST:riscv32 = "null" +COMPATIBLE_HOST:powerpc = "null" +COMPATIBLE_HOST:powerpc64le = "null" + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index d5ad4f3dc1..70cdb1d9c0 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -474,9 +474,9 @@ class GitApplyTree(PatchTree): out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.join(tree, name)) if out: for srcfile in out.split(): + outfile = os.path.basename(srcfile) for encoding in ['utf-8', 'latin-1']: patchlines = [] - outfile = None try: with open(srcfile, 'r', encoding=encoding, newline='') as f: for line in f: @@ -484,7 +484,8 @@ class GitApplyTree(PatchTree): outfile = line.split()[-1].strip() continue if line.startswith(GitApplyTree.ignore_commit_prefix): - continue + outfile = None + break patchlines.append(line) except UnicodeDecodeError: continue @@ -492,12 +493,11 @@ class GitApplyTree(PatchTree): else: raise PatchError('Unable to find a character encoding to decode %s' % srcfile) - if not outfile: - outfile = os.path.basename(srcfile) - bb.utils.mkdirhier(os.path.join(outdir, name)) - with open(os.path.join(outdir, name, outfile), 'w') as of: - for line in patchlines: - of.write(line) + if outfile: + bb.utils.mkdirhier(os.path.join(outdir, name)) + with open(os.path.join(outdir, name, outfile), 'w') as of: + for line in patchlines: + of.write(line) finally: shutil.rmtree(tempdir) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index d76b974fbb..c4dcdb4550 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -2228,6 +2228,52 @@ class DevtoolUpgradeTests(DevtoolBase): if files: self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files)) + def test_devtool_finish_update_patch(self): + # This test uses a modified version of the sysdig recipe from meta-oe. + # - The patches have been renamed. + # - The dependencies are commented out since the recipe is not being + # built. + # + # The sysdig recipe is interesting in that it fetches two different Git + # repositories, and there are patches for both. This leads to that + # devtool will create ignore commits as it uses Git submodules to keep + # track of the second repository. + # + # This test will verify that the ignored commits actually are ignored + # when a commit in between is modified. It will also verify that the + # updated patch keeps its original name. + + # Check preconditions + self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') + # Try modifying a recipe + self.track_for_cleanup(self.workspacedir) + recipe = 'sysdig-selftest' + recipefile = get_bb_var('FILE', recipe) + recipedir = os.path.dirname(recipefile) + result = runCmd('git status --porcelain .', cwd=recipedir) + if result.output.strip(): + self.fail('Recipe directory for %s contains uncommitted changes' % recipe) + tempdir = tempfile.mkdtemp(prefix='devtoolqa') + self.track_for_cleanup(tempdir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool modify %s %s' % (recipe, tempdir)) + self.add_command_to_tearDown('cd %s; rm %s/*; git checkout %s %s' % (recipedir, recipe, recipe, os.path.basename(recipefile))) + self.assertExists(os.path.join(tempdir, 'CMakeLists.txt'), 'Extracted source could not be found') + # Make a change to one of the existing commits + result = runCmd('echo "# A comment " >> CMakeLists.txt', cwd=tempdir) + result = runCmd('git status --porcelain', cwd=tempdir) + self.assertIn('M CMakeLists.txt', result.output) + result = runCmd('git commit --fixup HEAD^ CMakeLists.txt', cwd=tempdir) + result = runCmd('git show -s --format=%s', cwd=tempdir) + self.assertIn('fixup! cmake: Pass PROBE_NAME via CFLAGS', result.output) + result = runCmd('GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash devtool-base', cwd=tempdir) + result = runCmd('devtool finish %s meta-selftest' % recipe) + result = runCmd('devtool status') + self.assertNotIn(recipe, result.output, 'Recipe should have been reset by finish but wasn\'t') + self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') + expected_status = [(' M', '.*/0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch$')] + self._check_repo_status(recipedir, expected_status) + def test_devtool_rename(self): # Check preconditions self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') From patchwork Mon Feb 19 01:28:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 39672 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 E7970C54764 for ; Mon, 19 Feb 2024 01:28:56 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.84]) by mx.groups.io with SMTP id smtpd.web10.32005.1708306129137048565 for ; Sun, 18 Feb 2024 17:28:49 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=K0GyQBdr; spf=pass (domain: axis.com, ip: 40.107.21.84, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T7CfidgCIV3d3sgtUDUwykbiHs9sGGhcoTdiRGUhL9JOXrnVv9nLJZOrUKeXTcEFux1oCyk9PooQFmhum0rs1YcIx4sqmu1nAceYIH4wUb590b6otuwonk30VJ2Qv1c35bEOjJpbbtaTbIXJvi/zszCyCIlFlHGYEagqt15EoupMR9TKU6ffghlnThzAj1xdSQh0j035SIyUYuN9i4vTXZbZ2hgI8wGp5bRTES8MbUAXZ36SFFnB4je3BY6a3bq9ClDrYmcB1ikWEylXZkJ57TJbvazuCJ6WVLOdAxSIe1GEQWMKEKpQwLntv7Ze3ybM2Xj1VFkvWCSq3ZBDvdB0MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZUZfBVD8k3l0ympm9u+y9u/tvohKOSqq7uI1Vg7TOik=; b=A+xmKHvljHS/OCj05rxDFPMGxMPlAVRtzBZAMssqNu9rpVCgTxZ8hc2T2lOCC/DEVlguSEQtUrXVdT1iec629JBpYqpeYrPW2aXBzxzSe6xe9kpn9iINAAcE6V8EFmezFHy5RioBnzEDJb3MDilu33fhGhS8vNg3i0/LKLooQESfNbCKaPLB/bAXsubzxfizUPClGnD+Q/ftmW2nWijWn3nZVx1dJE+WXUOPmpfW3M5cTe+ZYLHt45lnrrlQv/aE7XLc0iO13NsVaIuwVfwwv0+unwkk41wemf+dARlaLZ7yOm8KMOLWuqAG6nBU1T04EjUSWPxNkdWZ0mLkMOADEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZUZfBVD8k3l0ympm9u+y9u/tvohKOSqq7uI1Vg7TOik=; b=K0GyQBdrz5Bqc20aHJ8G6WmOV2L9SfUVKqupdTP2NU297CQi9bVLwvHm3lXPZtH+MsWez1J81WrZXaAu7MRo/HopfvWKAHOUpJ447PhXLn9VMe/3uMMtLjhuTnq9tdXNEkxO8qKu2vlbu0R7VXIkM5s6O2hRIc6E7OZPOCAe8bE= Received: from DUZPR01CA0073.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::11) by PAVPR02MB9039.eurprd02.prod.outlook.com (2603:10a6:102:2fe::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.34; Mon, 19 Feb 2024 01:28:45 +0000 Received: from DB1PEPF000509E3.eurprd03.prod.outlook.com (2603:10a6:10:3c2:cafe::32) by DUZPR01CA0073.outlook.office365.com (2603:10a6:10:3c2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38 via Frontend Transport; Mon, 19 Feb 2024 01:28:45 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509E3.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 19 Feb 2024 01:28:45 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:43 +0100 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:43 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 19 Feb 2024 02:28:43 +0100 Received: from saur (saur.se.axis.com [10.92.3.10]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 9E1D91494E for ; Mon, 19 Feb 2024 02:28:43 +0100 (CET) Received: from saur.se.axis.com (localhost [127.0.0.1]) by saur (8.17.1/8.15.2) with ESMTPS id 41J1Sh153090822 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 19 Feb 2024 02:28:43 +0100 Received: (from pkj@localhost) by saur.se.axis.com (8.17.1/8.17.1/Submit) id 41J1Shp63090821 for openembedded-core@lists.openembedded.org; Mon, 19 Feb 2024 02:28:43 +0100 From: Peter Kjellerstedt To: Subject: [PATCHv2 2/5] lib/oe/patch: Add GitApplyTree.commitIgnored() Date: Mon, 19 Feb 2024 02:28:29 +0100 Message-ID: <20240219012832.3090768-2-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240219012832.3090768-1-pkj@axis.com> References: <20240219012832.3090768-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E3:EE_|PAVPR02MB9039:EE_ X-MS-Office365-Filtering-Correlation-Id: cc74c571-a0ae-41ae-7a2c-08dc30ea1d6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fql8TQNbtmNNMZDm77kEjw7WzinHktd8pAAqPsIbyCVTfnfabXyPuUfycuRB+vz5dJ3mO3zKSW2BIhYWN2vOzGxEDc4182Bxf1gGPv/Nm1Z+Vo55rnfw5YPQbuEWfSEHOJxP3u6LZRlAhOK5Wv29Lq//HmIJBWZ69EGd7lF8J42FLNEy+ufPwmlELkbTed1KkAEC+O1raLNZxJ3vgoK+uDZ5nAH6kapUu9dnbLFaBKLAiLtMrl0CKiH1Z9VsqpayfLnj4Z5YssEDSkmH6iPvmm5xhRn9JPx9HDLtML6rnT86chOyGh8AwpHIktqRv2Y7+aHk8WGm0gO+CNUmH420Om5DS0uXvscDbmr8b5gtEr38qWYcK3d6Ur5z1E0Z3WoB2ptoMWl6nNZIkbaOibRb9k7bmKovm5+/bKjPBgYbgCp27KfSEe1NRIYty7FosJ43nsWW2lxIg+z6tBkKKlC+zceIYgBg6O9Ubo9E2jxwMSt8BEyLInB/bRD76Zje3ltgg7Pk/hKKgwfm6G13Xp3RXAqvoSYR0OnFsgaru6S5/0t++2OyHLi6w88spJCKeGbRCy4UKXrdo+s9ag0HGg+MxO5zePEGKpjtMaHvu6w1dpYlZXA52HRFIGyvb8osi7Gw0sFNy6IZPFGXbHHSK/P/CRyGRTJ5FcV9VBx2Wp7gjoc= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39850400004)(396003)(346002)(136003)(376002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(36860700004)(1800799012)(46966006)(40470700004)(83380400001)(36756003)(2616005)(42186006)(6666004)(41300700001)(316002)(426003)(4744005)(5660300002)(336012)(2906002)(478600001)(70206006)(70586007)(8936002)(1076003)(8676002)(6916009)(26005)(81166007)(356005)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 01:28:45.3206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc74c571-a0ae-41ae-7a2c-08dc30ea1d6b X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509E3.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR02MB9039 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, 19 Feb 2024 01:28:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/195855 This function can be used to create a commit that devtool will ignore when creating/updating the patches. Signed-off-by: Peter Kjellerstedt --- PATCHv2: No changes. meta/lib/oe/patch.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 70cdb1d9c0..3ded5f3601 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -460,6 +460,16 @@ class GitApplyTree(PatchTree): cmd.append('--date="%s"' % date) return (tmpfile, cmd) + @staticmethod + def commitIgnored(subject, dir=None, files=None, d=None): + if files: + runcmd(['git', 'add'] + files, dir) + message = "%s\n\n%s" % (subject, GitApplyTree.ignore_commit_prefix) + cmd = ["git"] + GitApplyTree.gitCommandUserOptions(cmd, d=d) + cmd += ["commit", "-m", message, "--no-verify"] + runcmd(cmd, dir) + @staticmethod def extractPatches(tree, startcommits, outdir, paths=None): import tempfile From patchwork Mon Feb 19 01:28:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 39673 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 E84BBC54788 for ; Mon, 19 Feb 2024 01:28:56 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.57]) by mx.groups.io with SMTP id smtpd.web10.32006.1708306129359660017 for ; Sun, 18 Feb 2024 17:28:49 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=hLpH0m/f; spf=pass (domain: axis.com, ip: 40.107.21.57, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Skjq8S9IWRkGqZlLvNoW7UHSVdeBWVuDO0eMfmtaeMB+O4HCmTOBvSymKLxBaCRqoPqfejGRkldknyZz/rsFWLtodK/nbDi5A/VTb0VGryKxT10pfXH+reAdYIe62veDrTX3wlsiXKG97r+a+h+Bwz7CBghxbvRK/p7Y3KsWrmvKRg4dV/Iy/iIHH/uFhnCCfF4TT4NqY0smZYH0jcMC/iV5QqVyBilOpU2piq3pnIrxNSI4AvBNXeyQhltririNrxTAvyoEAcpCsjqX2488I6TvNW+PH/bI0KSWlv24IK6EzQkTi21GSMTICnug3NxrH8nAWbUjH5Q9W6gI09XBxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ft2p2mCPBCPctOqF3aCvRaVRYYsYVO02j0C+ap1fiGI=; b=lLFe9+EQ/0Kr52AmJmUjBvR3u5v/4j6i14EfVFtjRApxpw0ilv94ByseXSytQM/b+JkQD3qQqrxiGo9KJFJ+bsi0WOCToydIm2dMyHP8kxE8spB5iTVbrB/YaaW8LUqeCUi97TEFV9Kh2IwIaeMijLrssSYj5JI1jEIGu+EXrWD5aCdcT9dEwIMrKPyALGGdeosDml+jvmkYg9rZcoMfR62xTSjOx81zsHhKdLNyehWe+xPXSnqkvGePN8EZr6I49KCiY1eCUKPBrVarY/IT1CuDIfdVkf4wUgmKebEMeLiCc+flYVe+5bh4gSGOgXZ7cUQ+dsuf/C+4YIGacGeCxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ft2p2mCPBCPctOqF3aCvRaVRYYsYVO02j0C+ap1fiGI=; b=hLpH0m/fjXaiNYW3rHNhm0cOu0m9pxljdMSqRnvvcJgRlaBVtJLUfmB7sv9g857yr2+2A3q7puns3ZD61fg2HYO7pOQrOF+MXLF9NuTct0shn1KutiCeLPI+0pnijAIVsXFssD3nZkWjRzq4u64C/mINBXZabOSZywcApu8yFtg= Received: from DUZPR01CA0075.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::7) by AM7PR02MB6276.eurprd02.prod.outlook.com (2603:10a6:20b:1bb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Mon, 19 Feb 2024 01:28:45 +0000 Received: from DB1PEPF000509E3.eurprd03.prod.outlook.com (2603:10a6:10:3c2:cafe::ab) by DUZPR01CA0075.outlook.office365.com (2603:10a6:10:3c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.37 via Frontend Transport; Mon, 19 Feb 2024 01:28:45 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509E3.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 19 Feb 2024 01:28:45 +0000 Received: from SE-MAILARCH01W.axis.com (10.20.40.15) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:44 +0100 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAILARCH01W.axis.com (10.20.40.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:43 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 19 Feb 2024 02:28:43 +0100 Received: from saur (saur.se.axis.com [10.92.3.10]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id BB8A214929 for ; Mon, 19 Feb 2024 02:28:43 +0100 (CET) Received: from saur.se.axis.com (localhost [127.0.0.1]) by saur (8.17.1/8.15.2) with ESMTPS id 41J1Shjv3090831 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 19 Feb 2024 02:28:43 +0100 Received: (from pkj@localhost) by saur.se.axis.com (8.17.1/8.17.1/Submit) id 41J1ShJx3090828 for openembedded-core@lists.openembedded.org; Mon, 19 Feb 2024 02:28:43 +0100 From: Peter Kjellerstedt To: Subject: [PATCHv2 3/5] devtool: Make use of oe.patch.GitApplyTree.commitIgnored() Date: Mon, 19 Feb 2024 02:28:30 +0100 Message-ID: <20240219012832.3090768-3-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240219012832.3090768-1-pkj@axis.com> References: <20240219012832.3090768-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E3:EE_|AM7PR02MB6276:EE_ X-MS-Office365-Filtering-Correlation-Id: 0933edbd-98b6-49b4-3c52-08dc30ea1dae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bb+8qK+JaIcEAv/TZSxngNCzbmyyQBdstflUrEMDHnLlBLww6i0cCDoxyxix6jlZiYpR17ycUcD5o1AREv+Wk692ttFbEokYBP12WGa2zgoDbLxoa/ZpyNDpJtrP74fASTN6b6pRl1SgVMaKW/WDUKQVogX2hneGWGaI6OftyKbL0PGhndDa383+GemOw5m3y6BuLD63fPI/NnoH8kEvh7dMqA4AxgPKufYJLR9EKJdDiL/fOhDsiY+SdJX3E3D/AAjVCi8xttkt5Oer9NYI3FA7Ds9J20DG4+jOCvj95oIaWQl0Lr7k3vL1zYB/4HaqQg1Ct4h+eWXqAL8486EuJyybKQYy/YBV+CuUlXkml/B9zFcjMoJqjW9xB1FDztOehB10H9e1Kyd/RSXQ93EdNZJVwbHPlBM3ro/AllyjJVz8/kjpnJex3AXsPWon8Cm83NxqeYpb6kVgBmU5QISocTg8pqoNIJSv/RMvmzOXeiW+KZWcs5Q26Uk3lfhIFIPtAR7z+P8RsUn562qlgYiDbxhNixv6T6gFxRXpfkmqevBi9/pC64Nah28mlvnPj6mHdRsK5XClEIwiLAp+Coi6PUalpCNuxitQ+U8k9fDwk7l82ss0XF56NcyuRDyieKDwZi9fQB5Dotju49TWAVNdhPtQhstOv/mtLEDZvY1vb9k= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(346002)(376002)(396003)(39850400004)(230922051799003)(82310400011)(1800799012)(186009)(36860700004)(64100799003)(451199024)(46966006)(42186006)(316002)(6666004)(5660300002)(2906002)(70586007)(6916009)(8676002)(8936002)(70206006)(41300700001)(478600001)(2616005)(26005)(36756003)(1076003)(83380400001)(426003)(336012)(356005)(81166007)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 01:28:45.7581 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0933edbd-98b6-49b4-3c52-08dc30ea1dae X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509E3.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR02MB6276 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, 19 Feb 2024 01:28:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/195856 This makes use of the oe.patch.GitApplyTree.commitIgnored() function to create commits that shall be ignored by `devtool finish`. Signed-off-by: Peter Kjellerstedt --- PATCHv2: No changes. scripts/lib/devtool/__init__.py | 4 +--- scripts/lib/devtool/standard.py | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index c7fc3cfc41..6133c1c5b4 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py @@ -253,9 +253,7 @@ def setup_git_repo(repodir, version, devbranch, basetag='devtool-base', d=None): bb.process.run('git submodule add %s %s' % (remote_url, os.path.relpath(root, os.path.join(root, ".."))), cwd=os.path.join(root, "..")) found = True if found: - useroptions = [] - oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d) - bb.process.run('git %s commit -m "Adding additionnal submodule from SRC_URI\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=os.path.join(root, "..")) + oe.patch.GitApplyTree.commitIgnored("Add additional submodule from SRC_URI", dir=os.path.join(root, ".."), d=d) found = False if os.path.exists(os.path.join(repodir, '.gitmodules')): bb.process.run('git submodule foreach --recursive "git tag -f %s"' % basetag, cwd=repodir) diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index ccb7ea851b..6d7fd17fbd 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -484,11 +484,7 @@ def symlink_oelocal_files_srctree(rd, srctree): os.symlink('oe-local-files/%s' % fn, destpth) addfiles.append(os.path.join(relpth, fn)) if addfiles: - bb.process.run('git add %s' % ' '.join(addfiles), cwd=srctree) - useroptions = [] - oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=rd) - bb.process.run('git %s commit -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree) - + oe.patch.GitApplyTree.commitIgnored("Add local file symlinks", dir=srctree, files=addfiles, d=rd) def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False): """Extract sources of a recipe""" From patchwork Mon Feb 19 01:28:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 39670 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 C8D6DC48BF6 for ; Mon, 19 Feb 2024 01:28:56 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (EUR03-DBA-obe.outbound.protection.outlook.com [40.107.104.74]) by mx.groups.io with SMTP id smtpd.web11.32254.1708306128142012346 for ; Sun, 18 Feb 2024 17:28:48 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=KPJ1EfFJ; spf=pass (domain: axis.com, ip: 40.107.104.74, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOUvHSaHOz5NuGwoaH638GVrYjpnCaT6I9WV32yHyxyYedeD/MtQ+QJNjdaYcD5CKwF/PvPXfiDueEGEvjZ1gtdXP10QPaAapnjw9lGHECPZ3BEG4n/hTOjj6wtwKvUQjNHyX3Cwbq7ctvHI9h+ErEm6OZnWnZHx5CCtsIJjSlBst/2JcqdjgPsJKji22jjTbWD6n2tOokpKTgA8syHTzCJWmItBQrAFqHzfZX0KJQpTXf8hojJduQDlxk6HcXlQb8HmY7gxvPUtEmOnNkJ9H4BdyLft+Y1iXjF8BdrtF6ZL/Oe38MjrRw2SrSAfJ0rD90hXapgbQMJ5Jgx6UyOIQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L+RJcf5g8PvdC7dtJKYG01lgIcxYdyjatGWYQd7b6Ug=; b=WDsENPQpfFicvbPnjKOCeDlzgRD7le1gbzfdDR5w4FljdiC/l4AlStMPjJMa9ATEhLHWabvqhD/LHvmYGNyUo/RI+sGKyynwTpHFTE0plSDwwwXIgH1DpMHmNlgunv+ISAEf1/1zrDEGVPGE8PNpCDiu3yFWThUz5UhhLbHJ6j4qoIMynvlssmP5pZiSg+eU5gXWkG/eax7f3urHzFsDl+XH59dlzus5ZCR1yAT33om0hknUWGaD+iIkybhPhu1UxZTcbFTPSLKdlY3jx3RD1xBJlwy95HIPLdxZXwbQMj0l4712m0obCKrjHYFDYN7MPm+SYNhV5CjYG5LcVlytIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L+RJcf5g8PvdC7dtJKYG01lgIcxYdyjatGWYQd7b6Ug=; b=KPJ1EfFJEA+pZlZ6BlUCppz45ZxMb5ZDL8/K/z+MfCS4x7YT7a+RPW2M/BSKMDs3iRx1fbQAlBq8WO67RuO1q0MqzgERXc3BWVaZYm7E7NYEvGWOnAbYSkDpGY1qx9YV5ya1pFknwex840IcBxWy6gSeF91nATBZ4uV0VTXe4K4= Received: from AS9PR07CA0035.eurprd07.prod.outlook.com (2603:10a6:20b:46b::25) by PR3PR02MB6217.eurprd02.prod.outlook.com (2603:10a6:102:71::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29; Mon, 19 Feb 2024 01:28:45 +0000 Received: from AMS0EPF000001B2.eurprd05.prod.outlook.com (2603:10a6:20b:46b:cafe::4a) by AS9PR07CA0035.outlook.office365.com (2603:10a6:20b:46b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.15 via Frontend Transport; Mon, 19 Feb 2024 01:28:44 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by AMS0EPF000001B2.mail.protection.outlook.com (10.167.16.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Mon, 19 Feb 2024 01:28:44 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:44 +0100 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:43 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 19 Feb 2024 02:28:43 +0100 Received: from saur (saur.se.axis.com [10.92.3.10]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id D99171494E for ; Mon, 19 Feb 2024 02:28:43 +0100 (CET) Received: from saur.se.axis.com (localhost [127.0.0.1]) by saur (8.17.1/8.15.2) with ESMTPS id 41J1ShJ53090835 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 19 Feb 2024 02:28:43 +0100 Received: (from pkj@localhost) by saur.se.axis.com (8.17.1/8.17.1/Submit) id 41J1ShGw3090834 for openembedded-core@lists.openembedded.org; Mon, 19 Feb 2024 02:28:43 +0100 From: Peter Kjellerstedt To: Subject: [PATCHv2 4/5] patch.bbclass: Make use of oe.patch.GitApplyTree.commitIgnored() Date: Mon, 19 Feb 2024 02:28:31 +0100 Message-ID: <20240219012832.3090768-4-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240219012832.3090768-1-pkj@axis.com> References: <20240219012832.3090768-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001B2:EE_|PR3PR02MB6217:EE_ X-MS-Office365-Filtering-Correlation-Id: a611320e-5173-4f85-843d-08dc30ea1cd1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7VoJ+V7ewZSK5LFO2MtzcbI2t1yNZ1CmhNA8hIMCTkA/a/N3RaSFRq0otb07PQoZC3p2ySqEoDcambv12aj49twBdxSLrFOpmRpdQJomo+iYI3GjNjDkPREhziRJI9H+Etmf4MfkiGev++NZw25Prox1VRmpOI5wngAEoh35yNsvzX5MqtHxBJG33znSN4e63RCpijhs5nmQusSKyaJpTnNdWmRycKwvLQyAoKmYyXy4L8+QRxlcQhicfWLG9xcl24/o5Mp1b9DNTtDbFzKrrxHZGm+O+mT/do3hCrU2e+4pGYosdPCZ1MWlIw99EwXgI/A3BEaK+N3UUq1IJ6T6KLacf750Jjo0A0cynRawCPfQSqHa0+CaToXSrvskua3xVjsFJMfbGgMIrPJNhDbBEy0pXH8LWUG7NGN5P56LAE2ARHfKmPzpFGAJP04A28DVZbtpTGWU42NvB9pqS73xgZMWmrLsT0je0hAWvx1poVQXFuuQji3/IY6DDNaziKM/ZWb5F8wKuhWAPe+/jgT1uh9R1OTHlqVy307LiWBLBbzk1ceiwNCtDjeRdNySsVtaUOhPsHjMdluT+M+IfObKzGUkncfO+Y62iJZ82fnCepYgJjTXBPHuuSuhYYVxYny9lmkeqhnQ3/wHfZSSYdkptw== X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39850400004)(376002)(346002)(396003)(136003)(230922051799003)(451199024)(186009)(82310400011)(1800799012)(64100799003)(36860700004)(46966006)(40470700004)(8936002)(81166007)(356005)(8676002)(2906002)(6916009)(70586007)(70206006)(5660300002)(82740400003)(26005)(1076003)(36756003)(2616005)(83380400001)(41300700001)(336012)(426003)(478600001)(316002)(6666004)(42186006);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 01:28:44.3272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a611320e-5173-4f85-843d-08dc30ea1cd1 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001B2.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR02MB6217 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, 19 Feb 2024 01:28:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/195853 This makes use of the oe.patch.GitApplyTree.commitIgnored() function to create commits that shall be ignored by `devtool finish`. Signed-off-by: Peter Kjellerstedt --- PATCHv2: No changes. meta/classes-global/patch.bbclass | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta/classes-global/patch.bbclass b/meta/classes-global/patch.bbclass index e3157c7b18..e5786b1c9a 100644 --- a/meta/classes-global/patch.bbclass +++ b/meta/classes-global/patch.bbclass @@ -79,9 +79,7 @@ python patch_task_postfunc() { bb.process.run('git checkout patches', cwd=srcsubdir) stdout, _ = bb.process.run('git status --porcelain .', cwd=srcsubdir) if stdout: - useroptions = [] - oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d) - bb.process.run('git add .; git %s commit -a -m "Committing changes from %s\n\n%s"' % (' '.join(useroptions), func, oe.patch.GitApplyTree.ignore_commit_prefix + ' - from %s' % func), cwd=srcsubdir) + oe.patch.GitApplyTree.commitIgnored("Add changes from %s" % func, dir=srcsubdir, files=['.'], d=d) } def src_patches(d, all=False, expand=True): From patchwork Mon Feb 19 01:28:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 39671 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 C2E6EC48BC4 for ; Mon, 19 Feb 2024 01:28:56 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.49]) by mx.groups.io with SMTP id smtpd.web10.32007.1708306130684498781 for ; Sun, 18 Feb 2024 17:28:52 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@axis.com header.s=selector1 header.b=i4CE5S4e; spf=pass (domain: axis.com, ip: 40.107.8.49, mailfrom: peter.kjellerstedt@axis.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NS3LRAZQhVQAOLXbUf4OUl0X7bMyFrWXTF70tAZmFIYU4s9SVseLuWbghoM9pTfB25Dunkc75IlUr1C055/krRKILJi8gozmxgLfACukvnua4DpVPePeXjwG+CM6Zl0MbHVLrD58PM5wNM3Z6Q7OocoAIXkenx0A0G+4oXOce8qAlpg6pVYWfffWsHfRFC26SOYmD8xeTDqxVQI2Y5lCwReJSbkkLhyakUKD+VmCNx5c/iNYSiAnkiIwyed7uWaNNBtTiNkECadlo/t9+bD4yXqZ+90+gjFsPbZU4G4LynHI8S+I91/9fwqK0u+yAKaVMnxUo56iQ+OtcHeMYZATXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YqGcGuYlcMw6dELiBvSJFedNY2auIWePC0eRy8pmw3I=; b=OAXbOLeJ4X7u4BFnEyp4JEQdkTUE4zux9HdLbQD8VDEBLf4GTGzaPeJhjXYJRyzNSlR1K9q0hkjsmK01XYYnZhwRGpZZ8xT9+Onl8OoK+MLvHc7JpijIZ/Agdb7MnoPAbn+ldV4u5F5TH7nSJKD7DSssAktsehozNOvCubxwiHJJ5f4GxI1goAT63UYOxXKb1rBZQVEa+l6EizNW2MZNR5zhpjF0pporPN4ATwy8uYr241tdHxhbIRq9uXat2Vb0kK416FwNbAQFBHhSNGr+NmGhWVAK/YzEq/KB1gUlwIAhzNovABE/sK4bXytxAlOlVdhIbwhMk3UU9mR+N1IdHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YqGcGuYlcMw6dELiBvSJFedNY2auIWePC0eRy8pmw3I=; b=i4CE5S4enWa6kGoLcpjeozcxDvJLh5g/lg5acqwk7BEriT3aWnIEl+uNoPkU0imWreChlD3KC0B2dsxs+drtDD29AqLFn1F/IJyQo4Mgtsc0K/c9B9PmiuKKeRIVPVW3eNhjg/ytOzG9iE0PrOSqfmSXvZocFpYA97X7VMQbK94= Received: from DUZPR01CA0074.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::20) by DU0PR02MB8762.eurprd02.prod.outlook.com (2603:10a6:10:3ee::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Mon, 19 Feb 2024 01:28:46 +0000 Received: from DB1PEPF000509E3.eurprd03.prod.outlook.com (2603:10a6:10:3c2:cafe::96) by DUZPR01CA0074.outlook.office365.com (2603:10a6:10:3c2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38 via Frontend Transport; Mon, 19 Feb 2024 01:28:46 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509E3.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 19 Feb 2024 01:28:46 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:44 +0100 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Feb 2024 02:28:44 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 19 Feb 2024 02:28:44 +0100 Received: from saur (saur.se.axis.com [10.92.3.10]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 0338E14929 for ; Mon, 19 Feb 2024 02:28:44 +0100 (CET) Received: from saur.se.axis.com (localhost [127.0.0.1]) by saur (8.17.1/8.15.2) with ESMTPS id 41J1Sh4C3090840 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Mon, 19 Feb 2024 02:28:43 +0100 Received: (from pkj@localhost) by saur.se.axis.com (8.17.1/8.17.1/Submit) id 41J1ShXj3090839 for openembedded-core@lists.openembedded.org; Mon, 19 Feb 2024 02:28:43 +0100 From: Peter Kjellerstedt To: Subject: [PATCHv2 5/5] lib/oe/patch: Use git notes to store the filenames for the patches Date: Mon, 19 Feb 2024 02:28:32 +0100 Message-ID: <20240219012832.3090768-5-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240219012832.3090768-1-pkj@axis.com> References: <20240219012832.3090768-1-pkj@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E3:EE_|DU0PR02MB8762:EE_ X-MS-Office365-Filtering-Correlation-Id: e5627deb-fd16-4051-7526-08dc30ea1de7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hsSeUFw/8JvybwuPl77cLTIq6V7jV+slX07AagYUcyHo0zSoU+H7Wmz13ssjZu3I23u0AnR0lVjg6/jfOEAcfqJP91uyU1i1px2vBoR3hpR2aXlMZFiSFt1cZIf6gt/2inrqJqrAr0z8ArP/iQ0rXOT4GIt2pjBiXsCK5oggEXPfvan0V+avGMvSewAeD8vsrGS0+D1bIKLBuvYTx9mMlZ5I/770GUI748hr074UwLql0uUsBSJsLkn1jcuAhmlhkfA44pr6n5EFUz8uDFecsxE1llWLsTUHSBiqg3Fkg0Qh4Y1PrHqh0d4wImw+i0X341K+ObYI4vN1eoXWr7T0EbsqKf7S1E3IVT2kvqSuCyTcTo1be4fjIf4zkYG0rc0qbjdnYeoLmgXtfCaWyrlI6TjxlAW83pCbCo8aKTkxVOANkHFyehwV77ILlsFXRWWO1mZkPdtoi5Mf3C61J1+cBjXidi4G7mVy2VmhwQwGxXnzh7ufItJA9tbvJPs0MksDl+3xRI0bY62aQboOc3wfpOqHvlvtOp1Cks3aoln8DI7MBnJ+IlwLpjzB41G4DOC2KBbUMvHRNxWXDuOT6sUmyRUY05VA90JszxdWHfXu/G2/2F9r4TpiDTicMVEJI+nmGliGKvVjI1w9XWVtGtxr8dtPFQ4UuZpFPJthrgg5jtE= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(346002)(376002)(39850400004)(136003)(230922051799003)(230273577357003)(186009)(64100799003)(82310400011)(36860700004)(451199024)(1800799012)(46966006)(40470700004)(5660300002)(70206006)(70586007)(8676002)(8936002)(30864003)(6916009)(2906002)(356005)(81166007)(36756003)(82740400003)(42186006)(26005)(336012)(426003)(83380400001)(2616005)(41300700001)(478600001)(6666004)(316002)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 01:28:46.1331 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5627deb-fd16-4051-7526-08dc30ea1de7 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509E3.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR02MB8762 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, 19 Feb 2024 01:28:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/195857 The old way of keeping track of the filenames for the patches that correspond to the commits was to add a special comment line to the end of the commit message, e.g., "%% original patch: ", using a temporary git hook. This method had some drawbacks, e.g.: * It caused problems if one wanted to push the commits upstream as the comment line had to be manually removed. * The comment line would end up in patches if someone used git format-path rather than devtool finish to generate the patches. * The comment line could interfere with global Git hooks used to validate the format of the Git commit message. * When regenerating patches with `devtool finish --force-patch-refresh`, the process typically resulted in adding empty lines to the end of the commit messages in the updated patches. A better way of keeping track of the patch filenames is to use Git notes. This way the commit messages remain unaffected, but the information is still shown when, e.g., doing `git log`. A special Git notes space, refs/notes/devtool, is used to not intefere with the default Git notes. It is configured to be shown in, e.g., `git log` and to survive rewrites (i.e., `git commit --amend` and `git rebase`). Since there is no longer any need for a temporary Git hook, the code that manipulated the .git/hooks directory has also been removed. To avoid potential problems due to global Git hooks, --no-verify was added to the `git commit` command. To not cause troubles for those who have done `devtool modify` for a recipe with the old solution and then do `devtool finish` with the new solution, the code will fall back to look for the old strings in the commit message if no Git note can be found. While not technically motivated like above, the way to keep track of ignored commits is also changed to use Git notes to avoid having different methods to store similar information. Signed-off-by: Peter Kjellerstedt --- PATCHv2: * Remove the --fixed-value option from calls to git config. It was added in Git version 2.30, but OE Core currently only requires Git version 1.8.3.1. * Work around a bug (or feature?) in git rebase related to commits with notes that are completely absorbed by already existing commits during a rebase. * Configure notes.rewriteMode = ignore. This is part of the solution to the above problem. meta/lib/oe/patch.py | 109 +++++++++++++++--------- meta/lib/oeqa/selftest/cases/devtool.py | 9 +- scripts/lib/devtool/standard.py | 15 ++-- scripts/lib/devtool/upgrade.py | 24 +++++- 4 files changed, 103 insertions(+), 54 deletions(-) diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 3ded5f3601..60a0cc8291 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -294,8 +294,9 @@ class PatchTree(PatchSet): self.Pop(all=True) class GitApplyTree(PatchTree): - patch_line_prefix = '%% original patch' - ignore_commit_prefix = '%% ignore' + notes_ref = "refs/notes/devtool" + original_patch = 'original patch' + ignore_commit = 'ignore' def __init__(self, dir, d): PatchTree.__init__(self, dir, d) @@ -452,7 +453,7 @@ class GitApplyTree(PatchTree): # Prepare git command cmd = ["git"] GitApplyTree.gitCommandUserOptions(cmd, commituser, commitemail) - cmd += ["commit", "-F", tmpfile] + cmd += ["commit", "-F", tmpfile, "--no-verify"] # git doesn't like plain email addresses as authors if author and '<' in author: cmd.append('--author="%s"' % author) @@ -460,15 +461,53 @@ class GitApplyTree(PatchTree): cmd.append('--date="%s"' % date) return (tmpfile, cmd) + @staticmethod + def addNote(repo, ref, key, value=None): + note = key + (": %s" % value if value else "") + notes_ref = GitApplyTree.notes_ref + runcmd(["git", "config", "notes.rewriteMode", "ignore"], repo) + runcmd(["git", "config", "notes.displayRef", notes_ref, notes_ref], repo) + runcmd(["git", "config", "notes.rewriteRef", notes_ref, notes_ref], repo) + runcmd(["git", "notes", "--ref", notes_ref, "append", "-m", note, ref], repo) + + @staticmethod + def removeNote(repo, ref, key): + notes = GitApplyTree.getNotes(repo, ref) + notes = {k: v for k, v in notes.items() if k != key and not k.startswith(key + ":")} + runcmd(["git", "notes", "--ref", GitApplyTree.notes_ref, "remove", "--ignore-missing", ref], repo) + for note, value in notes.items(): + GitApplyTree.addNote(repo, ref, note, value) + + @staticmethod + def getNotes(repo, ref): + import re + + note = None + try: + note = runcmd(["git", "notes", "--ref", GitApplyTree.notes_ref, "show", ref], repo) + prefix = "" + except CmdError: + note = runcmd(['git', 'show', '-s', '--format=%B', ref], repo) + prefix = "%% " + + note_re = re.compile(r'^%s(.*?)(?::\s*(.*))?$' % prefix) + notes = dict() + for line in note.splitlines(): + m = note_re.match(line) + if m: + notes[m.group(1)] = m.group(2) + + return notes + @staticmethod def commitIgnored(subject, dir=None, files=None, d=None): if files: runcmd(['git', 'add'] + files, dir) - message = "%s\n\n%s" % (subject, GitApplyTree.ignore_commit_prefix) cmd = ["git"] GitApplyTree.gitCommandUserOptions(cmd, d=d) - cmd += ["commit", "-m", message, "--no-verify"] + cmd += ["commit", "-m", subject, "--no-verify"] runcmd(cmd, dir) + GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit) @staticmethod def extractPatches(tree, startcommits, outdir, paths=None): @@ -484,18 +523,20 @@ class GitApplyTree(PatchTree): out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.join(tree, name)) if out: for srcfile in out.split(): - outfile = os.path.basename(srcfile) + # This loop, which is used to remove any line that + # starts with "%% original patch", is kept for backwards + # compatibility. If/when that compatibility is dropped, + # it can be replaced with code to just read the first + # line of the patch file to get the SHA-1, and the code + # below that writes the modified patch file can be + # replaced with a simple file move. for encoding in ['utf-8', 'latin-1']: patchlines = [] try: with open(srcfile, 'r', encoding=encoding, newline='') as f: for line in f: - if line.startswith(GitApplyTree.patch_line_prefix): - outfile = line.split()[-1].strip() + if line.startswith("%% " + GitApplyTree.original_patch): continue - if line.startswith(GitApplyTree.ignore_commit_prefix): - outfile = None - break patchlines.append(line) except UnicodeDecodeError: continue @@ -503,11 +544,16 @@ class GitApplyTree(PatchTree): else: raise PatchError('Unable to find a character encoding to decode %s' % srcfile) - if outfile: - bb.utils.mkdirhier(os.path.join(outdir, name)) - with open(os.path.join(outdir, name, outfile), 'w') as of: - for line in patchlines: - of.write(line) + sha1 = patchlines[0].split()[1] + notes = GitApplyTree.getNotes(os.path.join(tree, name), sha1) + if GitApplyTree.ignore_commit in notes: + continue + outfile = notes.get(GitApplyTree.original_patch, os.path.basename(srcfile)) + + bb.utils.mkdirhier(os.path.join(outdir, name)) + with open(os.path.join(outdir, name, outfile), 'w') as of: + for line in patchlines: + of.write(line) finally: shutil.rmtree(tempdir) @@ -555,28 +601,11 @@ class GitApplyTree(PatchTree): return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) - # Add hooks which add a pointer to the original patch file name in the commit message reporoot = (runcmd("git rev-parse --show-toplevel".split(), self.dir) or '').strip() if not reporoot: raise Exception("Cannot get repository root for directory %s" % self.dir) - gitdir = (runcmd("git rev-parse --absolute-git-dir".split(), self.dir) or '').strip() - if not gitdir: - raise Exception("Cannot get gitdir for directory %s" % self.dir) - hooks_dir = os.path.join(gitdir, 'hooks') - hooks_dir_backup = hooks_dir + '.devtool-orig' - if os.path.lexists(hooks_dir_backup): - raise Exception("Git hooks backup directory already exists: %s" % hooks_dir_backup) - if os.path.lexists(hooks_dir): - shutil.move(hooks_dir, hooks_dir_backup) - os.mkdir(hooks_dir) - commithook = os.path.join(hooks_dir, 'commit-msg') - applyhook = os.path.join(hooks_dir, 'applypatch-msg') - with open(commithook, 'w') as f: - # NOTE: the formatting here is significant; if you change it you'll also need to - # change other places which read it back - f.write('echo "\n%s: $PATCHFILE" >> $1' % GitApplyTree.patch_line_prefix) - os.chmod(commithook, 0o755) - shutil.copy2(commithook, applyhook) + + patch_applied = True try: patchfilevar = 'PATCHFILE="%s"' % os.path.basename(patch['file']) if self._need_dirty_check(): @@ -587,7 +616,7 @@ class GitApplyTree(PatchTree): pass else: if output: - # The tree is dirty, not need to try to apply patches with git anymore + # The tree is dirty, no need to try to apply patches with git anymore # since they fail, fallback directly to patch output = PatchTree._applypatch(self, patch, force, reverse, run) output += self._commitpatch(patch, patchfilevar) @@ -620,10 +649,12 @@ class GitApplyTree(PatchTree): output = PatchTree._applypatch(self, patch, force, reverse, run) output += self._commitpatch(patch, patchfilevar) return output + except: + patch_applied = False + raise finally: - shutil.rmtree(hooks_dir) - if os.path.lexists(hooks_dir_backup): - shutil.move(hooks_dir_backup, hooks_dir) + if patch_applied: + GitApplyTree.addNote(self.dir, "HEAD", GitApplyTree.original_patch, os.path.basename(patch['file'])) class QuiltTree(PatchSet): diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index c4dcdb4550..d37848bdef 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -989,9 +989,10 @@ class DevtoolModifyTests(DevtoolBase): self.assertIn(tempdir, result.output) # Check git repo self._check_src_repo(tempdir) - # Check that the patch is correctly applied - # last commit message in the tree must contain - # %% original patch: + # Check that the patch is correctly applied. + # The last commit message in the tree must contain the following note: + # Notes (devtool): + # original patch: # .. patchname = None for uri in src_uri: @@ -999,7 +1000,7 @@ class DevtoolModifyTests(DevtoolBase): patchname = uri.replace("file://", "").partition('.patch')[0] + '.patch' self.assertIsNotNone(patchname) result = runCmd('git -C %s log -1' % tempdir) - self.assertIn("%%%% original patch: %s" % patchname, result.output) + self.assertIn("Notes (devtool):\n original patch: %s" % patchname, result.output) # Configure the recipe to check that the git dependencies are correctly patched in cargo config bitbake('-c configure %s' % testrecipe) diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 6d7fd17fbd..7972b4f822 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -937,14 +937,13 @@ def modify(args, config, basepath, workspace): seen_patches = [] for branch in branches: branch_patches[branch] = [] - (stdout, _) = bb.process.run('git log devtool-base..%s' % branch, cwd=srctree) - for line in stdout.splitlines(): - line = line.strip() - if line.startswith(oe.patch.GitApplyTree.patch_line_prefix): - origpatch = line[len(oe.patch.GitApplyTree.patch_line_prefix):].split(':', 1)[-1].strip() - if not origpatch in seen_patches: - seen_patches.append(origpatch) - branch_patches[branch].append(origpatch) + (stdout, _) = bb.process.run('git rev-list devtool-base..%s' % branch, cwd=srctree) + for sha1 in stdout.splitlines(): + notes = oe.patch.GitApplyTree.getNotes(srctree, sha1.strip()) + origpatch = notes.get(oe.patch.GitApplyTree.original_patch) + if origpatch and origpatch not in seen_patches: + seen_patches.append(origpatch) + branch_patches[branch].append(origpatch) # Need to grab this here in case the source is within a subdirectory srctreebase = srctree diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index ef58523dc8..fa5b8ef3c7 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py @@ -261,7 +261,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee revs = {} for path in paths: (stdout, _) = _run('git rev-parse HEAD', cwd=path) - revs[os.path.relpath(path,srctree)] = stdout.rstrip() + revs[os.path.relpath(path, srctree)] = stdout.rstrip() if no_patch: patches = oe.recipeutils.get_recipe_patches(crd) @@ -272,17 +272,35 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee _run('git checkout devtool-patched -b %s' % branch, cwd=path) (stdout, _) = _run('git branch --list devtool-override-*', cwd=path) branches_to_rebase = [branch] + stdout.split() + target_branch = revs[os.path.relpath(path, srctree)] + + # There is a bug (or feature?) in git rebase where if a commit with + # a note is fully rebased away by being part of an old commit, the + # note is still attached to the old commit. Avoid this by making + # sure all old devtool related commits have a note attached to them + # (this assumes git config notes.rewriteMode is set to ignore). + (stdout, _) = __run('git rev-list devtool-base..%s' % target_branch) + for rev in stdout.splitlines(): + if not oe.patch.GitApplyTree.getNotes(path, rev): + oe.patch.GitApplyTree.addNote(path, rev, "dummy") + for b in branches_to_rebase: - logger.info("Rebasing {} onto {}".format(b, revs[os.path.relpath(path,srctree)])) + logger.info("Rebasing {} onto {}".format(b, target_branch)) _run('git checkout %s' % b, cwd=path) try: - _run('git rebase %s' % revs[os.path.relpath(path, srctree)], cwd=path) + _run('git rebase %s' % target_branch, cwd=path) except bb.process.ExecutionError as e: if 'conflict' in e.stdout: logger.warning('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip())) _run('git rebase --abort', cwd=path) else: logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) + + # Remove any dummy notes added above. + (stdout, _) = __run('git rev-list devtool-base..%s' % target_branch) + for rev in stdout.splitlines(): + oe.patch.GitApplyTree.removeNote(path, rev, "dummy") + _run('git checkout %s' % branch, cwd=path) if tmpsrctree: