From patchwork Thu Nov 30 22:01:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35485 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 02914C10DCE for ; Thu, 30 Nov 2023 22:02:22 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web11.8240.1701381738204360162 for ; Thu, 30 Nov 2023 14:02:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=UpS0yhCx; spf=pass (domain: baylibre.com, ip: 209.85.128.42, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40b4746ae51so13830335e9.2 for ; Thu, 30 Nov 2023 14:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381735; x=1701986535; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9BmDN1+RRD2JSJlTHpXnX4DHNnxVXDnsKlyPlGhM9EE=; b=UpS0yhCxGFjxIwfJm2HD2lgfRPgwjQwX+GSsrVEM66WmguRNWRmJ4sEHcRis3hpcWM C66UbAsBFPrjmL3gmvYfRBThDjUkDLQ/Dji9VGEyoxXvBpKttZtGWmFQyxnQB54x/lW6 gSftV21toh/vIYtvKJWPFm1PlY38ezkPKtT1YRhUM6A5lCek+71n+cWDY/XHFMJHPmAj KDq7VtkTJ0J2yglr/HQdJpI4w00wzz1p3XghTgdX3yV5mDO62bx1gZGcUaVLIjQDGZM4 hgeibBbHCKQ6y0hTilk7QML/+izQVCfswc2/8RLr+ie7jMCjpAOL51PvHJaRYta2gYK7 FVhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381735; x=1701986535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9BmDN1+RRD2JSJlTHpXnX4DHNnxVXDnsKlyPlGhM9EE=; b=MkjWvKtjGV+XueA7ZEn+mm1P1yZ69xlS4G49Sp4uJrfVhHGhOsHvUNUe81YVWQ0qWK V9NfFp5/mPcbwjgX0kpOQO19rfSvwwnOO+5EIcFJipwqZrahGkii5SbFvp+U+C7hGt0h fsTv1V9gvcQbEqs1aVkcu7PCrzpL+kcZahUGMsaCJO+cnihdDNKXdGlg6Cj1piAHuglg 4MRQ0rHBB6/NWlK77seuvMOrRtK/wLlsyMUDAk0A6gm7CL9Hvmr/MXnrc2yG/hCvSwsh /E2/bKAzSq65B6uA8V7VL9KmbmwTk/XKp5I7tB0RclvDqJDg+ACN3VmgM6W6d6NU9psZ U9iA== X-Gm-Message-State: AOJu0Ywi7YIVXtqqfNzURvFLalOYkhXhO4DWoduT5XP92q2T7wv8vFDt vk1gM/vgZyTX31NwZEnKIbDes7zE4M1iPqTFZDq2Og== X-Google-Smtp-Source: AGHT+IEb02TxhHYRk1TbLIWezjUgz5erF7QRw2dRdQf2MmQrppvCme1UuhSvtCbbtyT1pLHDSqZJqw== X-Received: by 2002:a05:600c:3418:b0:40b:5e59:c568 with SMTP id y24-20020a05600c341800b0040b5e59c568mr65887wmp.146.1701381735746; Thu, 30 Nov 2023 14:02:15 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:15 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 1/8] recipetool: appendsrcfile(s): add dry-run mode Date: Thu, 30 Nov 2023 23:01:49 +0100 Message-ID: <20231130220156.726263-2-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191545 Add dry-run mode for recipetool appendsrcfile and appendsrcfiles, with if necessary, a diff of changes Signed-off-by: Julien Stephan --- scripts/lib/recipetool/append.py | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index 9dbb1cc4b5a..314ff4e20fd 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py @@ -18,6 +18,7 @@ import shutil import scriptutils import errno from collections import defaultdict +import difflib logger = logging.getLogger('recipetool') @@ -355,7 +356,35 @@ def appendsrc(args, files, rd, extralines=None): extralines.append('SRC_URI += {0}'.format(source_uri)) copyfiles[newfile] = srcfile - oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines) + dry_run_output = None + dry_run_outdir = None + if args.dry_run: + import tempfile + dry_run_output = tempfile.TemporaryDirectory(prefix='devtool') + dry_run_outdir = dry_run_output.name + + appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, redirect_output=dry_run_outdir) + if args.dry_run: + output = '' + appendfilename = os.path.basename(appendfile) + newappendfile = appendfile + if appendfile and os.path.exists(appendfile): + with open(appendfile, 'r') as f: + oldlines = f.readlines() + else: + appendfile = '/dev/null' + oldlines = [] + + with open(os.path.join(dry_run_outdir, appendfilename), 'r') as f: + newlines = f.readlines() + diff = difflib.unified_diff(oldlines, newlines, appendfile, newappendfile) + difflines = list(diff) + if difflines: + output += ''.join(difflines) + if output: + logger.info('Diff of changed files:\n%s' % output) + else: + logger.info('No changed files') tinfoil.modified_files() def appendsrcfiles(parser, args): @@ -436,6 +465,7 @@ def register_commands(subparsers): help='Create/update a bbappend to add or replace source files', description='Creates a bbappend (or updates an existing one) to add or replace the specified file in the recipe sources, either those in WORKDIR or those in the source tree. This command lets you specify multiple files with a destination directory, so cannot specify the destination filename. See the `appendsrcfile` command for the other behavior.') parser.add_argument('-D', '--destdir', help='Destination directory (relative to S or WORKDIR, defaults to ".")', default='', type=destination_path) + parser.add_argument('-n', '--dry-run', help='Dry run mode', action='store_true') parser.add_argument('files', nargs='+', metavar='FILE', help='File(s) to be added to the recipe sources (WORKDIR or S)', type=existing_path) parser.set_defaults(func=lambda a: appendsrcfiles(parser, a), parserecipes=True) @@ -443,6 +473,7 @@ def register_commands(subparsers): parents=[common_src], help='Create/update a bbappend to add or replace a source file', description='Creates a bbappend (or updates an existing one) to add or replace the specified files in the recipe sources, either those in WORKDIR or those in the source tree. This command lets you specify the destination filename, not just destination directory, but only works for one file. See the `appendsrcfiles` command for the other behavior.') + parser.add_argument('-n', '--dry-run', help='Dry run mode', action='store_true') parser.add_argument('file', metavar='FILE', help='File to be added to the recipe sources (WORKDIR or S)', type=existing_path) parser.add_argument('destfile', metavar='DESTFILE', nargs='?', help='Destination path (relative to S or WORKDIR, optional)', type=destination_path) parser.set_defaults(func=lambda a: appendsrcfile(parser, a), parserecipes=True) From patchwork Thu Nov 30 22:01:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35484 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 0D74DC46CA7 for ; Thu, 30 Nov 2023 22:02:22 +0000 (UTC) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web11.8241.1701381738833526135 for ; Thu, 30 Nov 2023 14:02:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=Mec6ER9P; spf=pass (domain: baylibre.com, ip: 209.85.128.54, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-40b4746ae3bso11022045e9.0 for ; Thu, 30 Nov 2023 14:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381737; x=1701986537; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TFVKm4pIe7h7Dz9AfxUKNMWAtw4drpneJh8hJVEETnQ=; b=Mec6ER9P4Gk6ok1XQHZbaeyRqSC7QQ9UCuYjopVTsAUt+9/BqqtlXXOfydUTg+KGhB 2H/iknSGmKChzsK/PQygZ6REpjvimfG02sgxYYBvqWYYFOGwoHzKWv1g5ijumttoYQYw WEh0ys+o6nAYSEDkAg/YA9lnAPzsbhDfBHBXnrij6DNXVxhWSctW6b89K2KOz+fRQg5x XjXGsvQ8QNHkfShWgPe0LW4LEVuaXzEN//yWnsxereqnNZaf2z7XmyTjAZKk990niYyz CjsveEKBIgEDi2zk39tt+FlsMUwKtVnvTNV2YMmauCkqPCZ5UWYp92s6dG8rbAgD2O8v zEyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381737; x=1701986537; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TFVKm4pIe7h7Dz9AfxUKNMWAtw4drpneJh8hJVEETnQ=; b=kFbieQWow3LOYUhTLEfDuGnsiSfOEPWXK5xCmJeceHi2S6ibwv04PEVI/e1vCdNrEN PqQbyrCIeK4iH8IGnEh8WJIKtRh2ZlAryayip4LzKOGBR/9JKN6wspJupknu4p5eGpcO 7ISmqIKUBacLkYM09MBFeTHprw/c+s18M6On9QKk44ICy93EoSVnjqfLco7R8z7uGqRm 8YLYL4BF9GHwa4Jv8TfYSCZZggZ9e0BKrxCwihtgLnLcM+qwc4J2x8wYtLczCaWcgZwK MM/oP2GKjjiWsyAAVW9HX6JdHDEns4cplp2fLmdUEbS8x724/3J5yHEHTRDd5MmLMDZU Nu/w== X-Gm-Message-State: AOJu0YwwWzhxyaeXAYBZoMzRUcwpaDeX7PpCD8gTxRDvhgQDAsKx1hkw nh4R3L4IDIqjyByJC3a9ILMcTTa6Vd05WseRtFULAA== X-Google-Smtp-Source: AGHT+IGkwN1X0DKDcMOlyXLKg30hfuomn0IVlupkeW4WW20XxepnqtggSaQ4k9n3znHPjCzBIo45rw== X-Received: by 2002:a7b:c41a:0:b0:40b:5e21:cc44 with SMTP id k26-20020a7bc41a000000b0040b5e21cc44mr67787wmi.111.1701381736739; Thu, 30 Nov 2023 14:02:16 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:16 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 2/8] recipeutils: bbappend_recipe: fix undefined variable Date: Thu, 30 Nov 2023 23:01:50 +0100 Message-ID: <20231130220156.726263-3-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191546 In the case get_bbappend_path returns None (could not find the layer containing the recipe) the error message tries to print the recipefile, but it is not defined. Fix it. Signed-off-by: Julien Stephan --- meta/lib/oe/recipeutils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index 3336db8ab06..7465a2d0ab4 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py @@ -702,6 +702,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, if not removevalues: removevalues = {} + recipefile = rd.getVar('FILE') # Determine how the bbappend should be named appendpath, pathok = get_bbappend_path(rd, destlayerdir, wildcardver) if not appendpath: From patchwork Thu Nov 30 22:01:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35486 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 B03E1C10F04 for ; Thu, 30 Nov 2023 22:02:21 +0000 (UTC) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mx.groups.io with SMTP id smtpd.web11.8242.1701381740115858589 for ; Thu, 30 Nov 2023 14:02:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=AH55iMZV; spf=pass (domain: baylibre.com, ip: 209.85.128.49, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40859dee28cso12956795e9.0 for ; Thu, 30 Nov 2023 14:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381738; x=1701986538; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=irohkeROhDHpKcZ2gm6k6FhrCsg9HzIhgY6tdZIIu4E=; b=AH55iMZVFBhBOaQKselkECs1kigIIj4F+s+0m3CM0RVSNti4F2OyySkzJMJSFk5aQu K5tprLa42SgLzF1KAZUCp5o9PYIHPhBMoPLo3tmDTcnQYNY127lAAMEpAxwkzOTSNG2b tGoreXJlUrtoO9/TFahTgn+C3RSP/A4OslspbbcpkrI9IbljdonPnVscQvJP5iIAqVdV h48f1RUaLoFRa4tcoSGy8pZJanrroDdabMsy97ItuEPqiv8tz9qIiTgrBYRaV7SyTZL/ /1b8HW0Jb2gbBtaKjYyvy1l86ooi3C7yxHzgGI6OF7IEwZ0wDROOuh+eX5upyTnATnHW e1lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381738; x=1701986538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=irohkeROhDHpKcZ2gm6k6FhrCsg9HzIhgY6tdZIIu4E=; b=GZM2IZYWbGvS6a2XM14WF2m7puh1Wnk5MH/YMdsK3t+JbiTMQKjFQFjf2L0+yEJM8C qyEIE/WZ6h8ZT7Vkb8IKIrhWOM7+WaxhTUmzr93CUVYfZS6cnzmSaSps8M2WUckYqVXX btUVpGWp/NElg+P7rpQoeglNOzEqC3Pbm2vtwLERKpMNCm+AG8nEhILdMH0gWHer/GVS IjbBduJiGz2fz0pju34oENsCpm5rOAupWBKoeZTDvWBIYcyfh+KOLgnCRg+AlCnaAWMA nIPSU4kS9CY0ftjUX5VG9/jm97wMxfNtjGvx+ZsPk6dakOLAyzsdQ5VEDv2oo+Z52YAg tFjw== X-Gm-Message-State: AOJu0YyBVrZghpb6HrbISTYvjYTAqbbYZq5CJndW3aJaRWYwGrFEBTqN H+AtGWmxcvJ40JzZjcAqRADSd3cHhsXpBSAz4GpuWw== X-Google-Smtp-Source: AGHT+IFTqtqHaSJHqPk+hxKrHUFmOI36nsQzBYNIVvlCb27fRCLH+/z+edtPwgBFbjZ6dh8NOBR9Ww== X-Received: by 2002:a05:600c:6908:b0:40b:5e22:97d with SMTP id fo8-20020a05600c690800b0040b5e22097dmr116095wmb.108.1701381737795; Thu, 30 Nov 2023 14:02:17 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:17 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 3/8] recipeutils: bbappend_recipe: add a way to specify the name of the file to add Date: Thu, 30 Nov 2023 23:01:51 +0100 Message-ID: <20231130220156.726263-4-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:21 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191547 bbappend_recipe can take a dict of source files to add to SRC_URI where the key is the full path to the file to be added and the value is the original file in the recipe space. Modify the dict value to use a tupple: (originalfile, newname), to allow specifying the name of the file we would like to add Signed-off-by: Julien Stephan --- meta/lib/oe/recipeutils.py | 20 ++++++++++++-------- scripts/lib/devtool/standard.py | 6 +++--- scripts/lib/recipetool/append.py | 4 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index 7465a2d0ab4..9784ae3b031 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py @@ -671,12 +671,13 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, rd: data dictionary for the recipe destlayerdir: base directory of the layer to place the bbappend in (subdirectory path from there will be determined automatically) - srcfiles: dict of source files to add to SRC_URI, where the value - is the full path to the file to be added, and the value is the - original filename as it would appear in SRC_URI or None if it - isn't already present. You may pass None for this parameter if - you simply want to specify your own content via the extralines - parameter. + srcfiles: dict of source files to add to SRC_URI, where the key + is the full path to the file to be added, and the value is a tuple + containing the original filename as it would appear in SRC_URI + or None if it isn't already present and the new name of the file or + None to use by default basename(original filename). + You may pass None for this parameter if you simply want to specify + your own content via the extralines parameter. install: dict mapping entries in srcfiles to a tuple of two elements: install path (*without* ${D} prefix) and permission value (as a string, e.g. '0644'). @@ -764,11 +765,14 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, copyfiles = {} if srcfiles: instfunclines = [] - for i, (newfile, origsrcfile) in enumerate(srcfiles.items()): + for i, (newfile, (origsrcfile, newname)) in enumerate(srcfiles.items()): srcfile = origsrcfile srcurientry = None if not srcfile: - srcfile = os.path.basename(newfile) + if newname: + srcfile = newname + else: + srcfile = os.path.basename(newfile) srcurientry = 'file://%s' % srcfile if params and params[i]: srcurientry = '%s;%s' % (srcurientry, ';'.join('%s=%s' % (k,v) for k,v in params[i].items())) diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index d53fb810071..fa473014f90 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -1568,7 +1568,7 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi update_srcuri = True if appendlayerdir: - files = dict((os.path.join(local_files_dir, key), val) for + files = dict((os.path.join(local_files_dir, key), (val, None)) for key, val in list(upd_f.items()) + list(new_f.items())) removevalues = {} if update_srcuri: @@ -1678,9 +1678,9 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil destpath = None srcuri = (rd.getVar('SRC_URI', False) or '').split() if appendlayerdir: - files = OrderedDict((os.path.join(local_files_dir, key), val) for + files = OrderedDict((os.path.join(local_files_dir, key), (val, None)) for key, val in list(upd_f.items()) + list(new_f.items())) - files.update(OrderedDict((os.path.join(patches_dir, key), val) for + files.update(OrderedDict((os.path.join(patches_dir, key), (val, None)) for key, val in list(upd_p.items()) + list(new_p.items()))) if files or remove_files: removevalues = None diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index 314ff4e20fd..09e314481f1 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py @@ -300,7 +300,7 @@ def appendfile(args): if st.st_mode & stat.S_IXUSR: perms = '0755' install = {args.newfile: (args.targetpath, perms)} - oe.recipeutils.bbappend_recipe(rd, args.destlayer, {args.newfile: sourcepath}, install, wildcardver=args.wildcard_version, machine=args.machine) + oe.recipeutils.bbappend_recipe(rd, args.destlayer, {args.newfile: (None, sourcepath)}, install, wildcardver=args.wildcard_version, machine=args.machine) tinfoil.modified_files() return 0 else: @@ -354,7 +354,7 @@ def appendsrc(args, files, rd, extralines=None): logger.warning('{0!r} is already in SRC_URI, not adding'.format(source_uri)) else: extralines.append('SRC_URI += {0}'.format(source_uri)) - copyfiles[newfile] = srcfile + copyfiles[newfile] = (None, srcfile) dry_run_output = None dry_run_outdir = None From patchwork Thu Nov 30 22:01:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35483 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 A225EC4167B for ; Thu, 30 Nov 2023 22:02:21 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.8243.1701381741047141162 for ; Thu, 30 Nov 2023 14:02:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=ohvYHV7t; spf=pass (domain: baylibre.com, ip: 209.85.128.44, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-40b4c2ef5cdso12637615e9.2 for ; Thu, 30 Nov 2023 14:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381739; x=1701986539; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jMfXYHiQrNo5DfcL2tWYB3u3GzBojpTX5Swow6nrWpA=; b=ohvYHV7t7a+zJFL6UFv2pNxL0yTEuhPRnEYGKrKUcgrjgWm9qRGrdo9fJ1Gj0S9PUY n5IFayyG8WpgmzKkVPt4EnQSLQ6K4ztS+AKi/pEXlOmHiO/cXgx6zVYrHCOThYXP0PbN IFQSWGSleLL1aIvLfY8o0SDfD5AHeNLigUtKUgysvTJMAoPPormKoSsUaolnk4EqFFoU yzogo8O8vJHDU1tcbLcc8FS+uaw28gT4rNK2EDut5KCUV/qq5mVlpQSP4DBd73OL0bQv MLkWqh9sgAun+KBeBkRTGE8tMr/aufywGt0W24mzElJuBQOZrkCMx17FcF5nwWOmOwMB IyAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381739; x=1701986539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jMfXYHiQrNo5DfcL2tWYB3u3GzBojpTX5Swow6nrWpA=; b=g7URPJ+uZWrXlSBqOrZUyhjCxD+6LLooOsKPeLF6sJoa6y63truaTFvHGPp3EQ4iDC 9FMr3tMr+w+9AwHxgBBg5o2nIrn3WF/cxe08vhdoyCEfJ/hSK2e28kHeCujhWVOYJTtK jsm0mVqXbkaX1KZ8e2W6fKIqR2z/nCGIGdZxX7zLJuSCmlNXJWKdJXieNsFqmuLY9Krr k7MQ47kXM7iFt4ETHSF/meNqJpD7U8UZ4vOGCQHJPsttzvgmEcH1/1q6qHdCLC0+o0XV o5K1NKw6in0NyusGbd+n6pJpXcg1X7dxgRWB21gNxYLRVbOf8EzPBiwkY4Xn1vILowus y1vw== X-Gm-Message-State: AOJu0Yxd0mz9acdBuTwzdbAfHeWSpfHi0mlISsiBg1upMYS0Hntoo89W igoYslRdjo3ZkgXzhafM72I0B6AOpXncaH6diiQoyw== X-Google-Smtp-Source: AGHT+IHPSgaWOVoRPR8HBVL0PjRt/5q/S7SEWE4W0WbKnTT94KAPBJFccH38xvK5d1k3WKI1lQIECQ== X-Received: by 2002:a05:600c:2206:b0:40b:5e4a:40b9 with SMTP id z6-20020a05600c220600b0040b5e4a40b9mr97905wml.217.1701381738994; Thu, 30 Nov 2023 14:02:18 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:18 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 4/8] recipetool: appendsrcfile(s): use params instead of extraline Date: Thu, 30 Nov 2023 23:01:52 +0100 Message-ID: <20231130220156.726263-5-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:21 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191548 appendsrc function relies on oe.recipeutils.bbappend_recipe to copy files and add the corresponding entries in SRC_URI. Currently, appendsrc function build itself the new SRC_URI entry to add the correct subdir param, and gives it using the extralines parameter. This has 2 drawbacks: - oe.recipeutils.bbappend_recipe can already do this if we specify the correct params, so we have duplicate code - the duplicated code is not fully functional: for example, it doesn't take into account the -m/--machine parameter So fix this by not using extralines but give correctly formatted params. Also remove the check for already existing entries as oe.recipeutils.bbappend_recipe already implement it The new bbappend file now have the SRC_URI entry after the FILESEXTRAPATHS so fix the selftest. And skip test_recipetool_appendsrcfile_existing_in_src_uri_diff_params test because recipetool appendsrcfiles used to not add new src_uri entry if the entry already exist even with different parameters while oe.recipeutils.bbappend_recipe adds it if parameters are different. So we need to figure out if we want to keep the old behaviour and if we need to patch oe.recipeutils.bbappend_recipe, and update the test or remove it. Signed-off-by: Julien Stephan --- meta/lib/oeqa/selftest/cases/recipetool.py | 10 ++++++++-- scripts/lib/recipetool/append.py | 23 ++++++++-------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 55cbba9ca74..b445a40cb10 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -1083,12 +1083,13 @@ class RecipetoolAppendsrcBase(RecipetoolBase): expectedlines = ['FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"\n', '\n'] + if has_src_uri: uri = 'file://%s' % filename if expected_subdir: uri += ';subdir=%s' % expected_subdir - expectedlines[0:0] = ['SRC_URI += "%s"\n' % uri, - '\n'] + expectedlines.extend(['SRC_URI += "%s"\n' % uri, + '\n']) return self._try_recipetool_appendsrcfile(testrecipe, newfile, destpath, options, expectedlines, [filename]) @@ -1148,6 +1149,11 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): self._test_appendsrcfile(testrecipe, filepath, has_src_uri=False) def test_recipetool_appendsrcfile_existing_in_src_uri_diff_params(self): + # recipetool appensrcfiles now relies on oe.recipeutils.bbappend_recipe to add src_uri entries, + # but oe.recipeutils.bbappend_recipe adds the new entry if the file already exist but have different parameters + # while before recipetool appendsrcfiles was rejecting it. So we need to figure out, which one is the correct way + # and if necessary patch oe.recipeutils.bbappend_recipe + self.skipTest("Skipping this test for now, because recipetool appendsrcfile changed his behaviour. Need to decide weither we should keep the old behaviour or not") testrecipe = 'base-files' subdir = 'tmp' filepath = self._get_first_file_uri(testrecipe) diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index 09e314481f1..d7597ca5154 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py @@ -300,6 +300,8 @@ def appendfile(args): if st.st_mode & stat.S_IXUSR: perms = '0755' install = {args.newfile: (args.targetpath, perms)} + if sourcepath: + sourcepath = os.path.basename(sourcepath) oe.recipeutils.bbappend_recipe(rd, args.destlayer, {args.newfile: (None, sourcepath)}, install, wildcardver=args.wildcard_version, machine=args.machine) tinfoil.modified_files() return 0 @@ -329,6 +331,7 @@ def appendsrc(args, files, rd, extralines=None): copyfiles = {} extralines = extralines or [] + params = [] for newfile, srcfile in files.items(): src_destdir = os.path.dirname(srcfile) if not args.use_workdir: @@ -339,22 +342,12 @@ def appendsrc(args, files, rd, extralines=None): src_destdir = os.path.join(os.path.relpath(srcdir, workdir), src_destdir) src_destdir = os.path.normpath(src_destdir) - source_uri = 'file://{0}'.format(os.path.basename(srcfile)) if src_destdir and src_destdir != '.': - source_uri += ';subdir={0}'.format(src_destdir) - - simple = bb.fetch.URI(source_uri) - simple.params = {} - simple_str = str(simple) - if simple_str in simplified: - existing = simplified[simple_str] - if source_uri != existing: - logger.warning('{0!r} is already in SRC_URI, with different parameters: {1!r}, not adding'.format(source_uri, existing)) - else: - logger.warning('{0!r} is already in SRC_URI, not adding'.format(source_uri)) + params.append({'subdir': src_destdir}) else: - extralines.append('SRC_URI += {0}'.format(source_uri)) - copyfiles[newfile] = (None, srcfile) + params.append({}) + + copyfiles[newfile] = (None, os.path.basename(srcfile)) dry_run_output = None dry_run_outdir = None @@ -363,7 +356,7 @@ def appendsrc(args, files, rd, extralines=None): dry_run_output = tempfile.TemporaryDirectory(prefix='devtool') dry_run_outdir = dry_run_output.name - appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, redirect_output=dry_run_outdir) + appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, params=params, redirect_output=dry_run_outdir) if args.dry_run: output = '' appendfilename = os.path.basename(appendfile) From patchwork Thu Nov 30 22:01:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35488 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 08BBFC46CA0 for ; Thu, 30 Nov 2023 22:02:32 +0000 (UTC) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web10.8313.1701381741659884616 for ; Thu, 30 Nov 2023 14:02:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=obCcP7Li; spf=pass (domain: baylibre.com, ip: 209.85.128.43, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40b4746ae51so13830815e9.2 for ; Thu, 30 Nov 2023 14:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381740; x=1701986540; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f0A2Csb82tyO8jIYeTdUPimOl0tZexdazW6BsrJplSs=; b=obCcP7LiG68tto7xmzZSyVOqylNdq0Ys5OFGKV/KHLWrYzjTWShhCoKoL054shbBgN pePPgzFoq6el3icGYsvcYKN12Yy6lb4+LEFbQyhJB8GWnHDkzdyq+vLN1+2NES1/JUt+ GjGOKWF6K7BTEE6WLD8ijqLCmSHfkymf9+4OcGbJcqoUvRDeuo5UJcUw+D/pJrTNUC6m BKauSxaWfmQ0QPTf+ABgMd/f0lqMuX2C6eKmrKskQAT64pYauKmufrmskGhJd/fr6giV 25N6ZFF+4gLUMPAi10GAngt40Gc9z7/xp5vthH3lYoF9SMkV7bjUY4YmipeCQqSkkLBz fUtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381740; x=1701986540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f0A2Csb82tyO8jIYeTdUPimOl0tZexdazW6BsrJplSs=; b=BRkZzbDWX0Gh2WEpq6XjsxsiIuo8tm/WXgwAB3MqTKmqPjKC9eqsfLroDhNSaw2N2c CjEWmGF078m4iqZ6lJhoZQV9Ig2KEQ3QQZcx2RTtfi3FenyqmbyUW0XuYq9sD4WEzwem 8qXgcUp4bEZZhN6C8Ker9bgyvVcY0SC/tq45iz0GlVlJQvTAvGBLIxVyZw41WmCVTfv1 NyDQJJiVfUZ4QuVGhOMqdvNpaGupjeQJ7RZCIibBD2Lxf+tAfgZTZpteWYp0xuuXutht SCud0+JR8EYnBxZUkn0qJFvGFfJoIzRQcqX+WSjZEjroCu/yArhPYGMfuZ1/1uwo22xC 9ajw== X-Gm-Message-State: AOJu0YzaOqgvZLKvazaR1hY2WJEjLDBDhtYXGKYG71Kqm88dTA03Mve0 70yjutH30imWumhb27E8pxTDAWACiwTB5Q5i83yZcA== X-Google-Smtp-Source: AGHT+IFcOf6rUclu3RVmFZ5RFai5rJfxggQ+ZCuz30rlDBXhkqo8BZztDxrDt2PwJ6UHtHzJiGzuMg== X-Received: by 2002:a05:600c:3582:b0:40b:5e1e:cfe with SMTP id p2-20020a05600c358200b0040b5e1e0cfemr83848wmq.57.1701381740008; Thu, 30 Nov 2023 14:02:20 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:19 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 5/8] recipeutils: bbappend_recipe: allow to patch the recipe itself Date: Thu, 30 Nov 2023 23:01:53 +0100 Message-ID: <20231130220156.726263-6-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191549 Add a new parameter update_original_recipe to allow to patch a recipe instead of creating/updating a bbappend Signed-off-by: Julien Stephan --- meta/lib/oe/recipeutils.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index 9784ae3b031..c768c5a4582 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py @@ -664,7 +664,7 @@ def get_bbappend_path(d, destlayerdir, wildcardver=False): return (appendpath, pathok) -def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, machine=None, extralines=None, removevalues=None, redirect_output=None, params=None): +def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, machine=None, extralines=None, removevalues=None, redirect_output=None, params=None, update_original_recipe=False): """ Writes a bbappend file for a recipe Parameters: @@ -698,19 +698,29 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, params: Parameters to use when adding entries to SRC_URI. If specified, should be a list of dicts with the same length as srcfiles. + update_original_recipe: + Force to update the original recipe instead of creating/updating + a bbapend. destlayerdir must contain the original recipe """ if not removevalues: removevalues = {} recipefile = rd.getVar('FILE') - # Determine how the bbappend should be named - appendpath, pathok = get_bbappend_path(rd, destlayerdir, wildcardver) - if not appendpath: - bb.error('Unable to determine layer directory containing %s' % recipefile) - return (None, None) - if not pathok: - bb.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.' % (os.path.join(destlayerdir, 'conf', 'layer.conf'), os.path.dirname(appendpath))) + if update_original_recipe: + if destlayerdir not in recipefile: + bb.error("destlayerdir %s doesn't contain the original recipe (%s), cannot update it" % (destlayerdir, recipefile)) + return (None, None) + + appendpath = recipefile + else: + # Determine how the bbappend should be named + appendpath, pathok = get_bbappend_path(rd, destlayerdir, wildcardver) + if not appendpath: + bb.error('Unable to determine layer directory containing %s' % recipefile) + return (None, None) + if not pathok: + bb.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.' % (os.path.join(destlayerdir, 'conf', 'layer.conf'), os.path.dirname(appendpath))) appenddir = os.path.dirname(appendpath) if not redirect_output: @@ -755,7 +765,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, bbappendlines.append((varname, op, value)) destsubdir = rd.getVar('PN') - if srcfiles: + if not update_original_recipe and srcfiles: bbappendlines.append(('FILESEXTRAPATHS:prepend', ':=', '${THISDIR}/${PN}:')) appendoverride = '' @@ -803,6 +813,8 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, # multiple times per operation when we're handling overrides) if os.path.exists(appendpath) and not os.path.exists(outfile): shutil.copy2(appendpath, outfile) + elif update_original_recipe: + outfile = recipefile else: bb.note('Writing append file %s' % appendpath) outfile = appendpath From patchwork Thu Nov 30 22:01:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35487 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 14F04C10DCE for ; Thu, 30 Nov 2023 22:02:32 +0000 (UTC) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by mx.groups.io with SMTP id smtpd.web10.8314.1701381743411739681 for ; Thu, 30 Nov 2023 14:02:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=FZ+qg2Gi; spf=pass (domain: baylibre.com, ip: 209.85.167.52, mailfrom: jstephan@baylibre.com) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-50abbb23122so2024308e87.3 for ; Thu, 30 Nov 2023 14:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381741; x=1701986541; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ob/M3cMQ1KqQvzFBI+qXBMu9o/DBcC9zNy7AYLBajCI=; b=FZ+qg2Gisp7Fss+e+/QeII/XXv+xY2xdNFH6GIRNUMzhGxagUI3qUefeZ21ckFxrCD Y2V/+uh5Tto3ea3D7yRKQFxup9kAh6oXoBHK9wG4beHFvZyd669K54e5zL2/1dVGfm8K AdRk2Nr/mnvRMrLkIUvuiXd0gXNaAZeF6JGAHjknNFsSEqQsYkqRS2b2jlh4rJP1cgSC mp6RjJTs62fGYGSv9K974HWDwXfcGD1oP6LRbLZtPqfYPQnGjGmUyQb8mmzKb3qRWIzf kWnPCMQvn2M+xl+2FuRnDIA9VSnE0BwUqNkc9O7D1rjASAzNIJ1ZNiujieltfKCA2rK2 etRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381741; x=1701986541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ob/M3cMQ1KqQvzFBI+qXBMu9o/DBcC9zNy7AYLBajCI=; b=wUj9bFuRSFcQvmUbNm+YGgaHFLLAgGcteiQv/kO0JJpv2w/L1FQffLMkLQrgeizxvC SLGrPlOT1ypOoUoSeHin/4POP4nZMkz/8He8SoFlDzlWRtITcGCzWY9uw6iEWOQiCNhC j/Lb23520b+4SoAPTCt3Sq+q9xFN5KDpr1ZrQXEUwiGLKy45UNmRwb0BeS6R9JsIqR0w om8RjpBNyMCkKJ2gQ//i//fNP2fZiSkoWiwVZOlYO7QxFRSswJn77X0y9CGcAibQisRk SVh+Mfr/s30BiWwyl7ewWmOvE8olXcWJBCErgRHTuIlAVt/OpLkF36/SXdYDL/EbSQ7v /bhA== X-Gm-Message-State: AOJu0Ywfe7mN7oxUGydB2Rq8QlMFFWjXdgn0WZ5MPFQJjpt/2Lse/IoD /Pb9pNC7z1/GIzGP3TDChCm6bo7z69ORMs10Qeo7vQ== X-Google-Smtp-Source: AGHT+IFFXIwMNP4tSO4GWNvlxX1zrQIdFmknRAQgtG7JdLGkiHw7n5q77qMefO5tVvoa06UQL0jWbg== X-Received: by 2002:a05:6512:3eb:b0:50b:d764:8048 with SMTP id n11-20020a05651203eb00b0050bd7648048mr138488lfq.123.1701381741006; Thu, 30 Nov 2023 14:02:21 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:20 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 6/8] recipetool: appendsrcfile(s): add a mode to update the recipe itself Date: Thu, 30 Nov 2023 23:01:54 +0100 Message-ID: <20231130220156.726263-7-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191550 Add a new option -u/--update-recipe to update the recipe itself instead of creating/updating a bbappend file Signed-off-by: Julien Stephan --- scripts/lib/recipetool/append.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index d7597ca5154..6c4c9183f78 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py @@ -356,7 +356,9 @@ def appendsrc(args, files, rd, extralines=None): dry_run_output = tempfile.TemporaryDirectory(prefix='devtool') dry_run_outdir = dry_run_output.name - appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, params=params, redirect_output=dry_run_outdir) + appendfile, _ = oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines, params=params, redirect_output=dry_run_outdir, update_original_recipe=args.update_recipe) + if not appendfile: + return if args.dry_run: output = '' appendfilename = os.path.basename(appendfile) @@ -458,6 +460,7 @@ def register_commands(subparsers): help='Create/update a bbappend to add or replace source files', description='Creates a bbappend (or updates an existing one) to add or replace the specified file in the recipe sources, either those in WORKDIR or those in the source tree. This command lets you specify multiple files with a destination directory, so cannot specify the destination filename. See the `appendsrcfile` command for the other behavior.') parser.add_argument('-D', '--destdir', help='Destination directory (relative to S or WORKDIR, defaults to ".")', default='', type=destination_path) + parser.add_argument('-u', '--update-recipe', help='Update recipe instead of creating (or updating) a bbapend file. DESTLAYER must contains the recipe to update', action='store_true') parser.add_argument('-n', '--dry-run', help='Dry run mode', action='store_true') parser.add_argument('files', nargs='+', metavar='FILE', help='File(s) to be added to the recipe sources (WORKDIR or S)', type=existing_path) parser.set_defaults(func=lambda a: appendsrcfiles(parser, a), parserecipes=True) @@ -466,6 +469,7 @@ def register_commands(subparsers): parents=[common_src], help='Create/update a bbappend to add or replace a source file', description='Creates a bbappend (or updates an existing one) to add or replace the specified files in the recipe sources, either those in WORKDIR or those in the source tree. This command lets you specify the destination filename, not just destination directory, but only works for one file. See the `appendsrcfiles` command for the other behavior.') + parser.add_argument('-u', '--update-recipe', help='Update recipe instead of creating (or updating) a bbapend file. DESTLAYER must contains the recipe to update', action='store_true') parser.add_argument('-n', '--dry-run', help='Dry run mode', action='store_true') parser.add_argument('file', metavar='FILE', help='File to be added to the recipe sources (WORKDIR or S)', type=existing_path) parser.add_argument('destfile', metavar='DESTFILE', nargs='?', help='Destination path (relative to S or WORKDIR, optional)', type=destination_path) From patchwork Thu Nov 30 22:01:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35489 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 22013C46CA7 for ; Thu, 30 Nov 2023 22:02:32 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.8246.1701381744190212899 for ; Thu, 30 Nov 2023 14:02:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=XC+Nj/by; spf=pass (domain: baylibre.com, ip: 209.85.128.44, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-40b552deba0so14961395e9.1 for ; Thu, 30 Nov 2023 14:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381742; x=1701986542; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UJwyWPnclH3jr3b3F8LYWUiK5AUVuMEhvjPO9KBHo2Y=; b=XC+Nj/by4AdO0quA3xZ+0L3YKZJU4CIKFGLcIliusuIgbKLdZaCHsS6cGTc/pDsZAa UDIaPxQ1tYnC0epa7JT37d4mxqiM9zrO2/CXLM6Cx1Ki51+U3dUsWVXYbtTonCIhS1B6 HuTubqYe2Fhc9REwiPL17NDES2IYt9HERAi93YR37ilqjf4D9oGVttBFbR0Sm0MYcm3H NgIU7AQbLiLgzlEM7WE92BggUKQZIysx6f16T+5fzIvQU4Y6tOaHKt/YeFGm9JPQaPkA GBI134CDDiKvs3nTqQU5NdJt/pVhPSQ9OvGtqO+7JZW2hK3MtL2L5OE8uk+NtYvdLN9w hldg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381742; x=1701986542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UJwyWPnclH3jr3b3F8LYWUiK5AUVuMEhvjPO9KBHo2Y=; b=fHVUzU8MJHvSKcVBoUOeydAoartHruygmVpPjHN9VWmUOCO2EmBd8lAVhk7tSktj1n Wn1rnNYz8VNFuBecdXZdu4hA317GUDkb4wKR3+1g3I1Wi+jedrT7L6MR2nW4to7uLDeG HdiV4IbDcg78NShrM9bPZHkcWI/hCf3fFHIdHFCc+26JKU/+K5wsxRzQCWyG7imBut5I BvQipu78PvJ/Czd9ytzdoZlAwo29687aSdZuaeMvVcL8bMAYZtJp8gJ7i5Fa72GP0T2s ry4rqaozjkDQlYIKwF3TtjXM43QHV35g+BKBgUBH86La+U0OUpfrY4/5lZqv5T3k3ByS kS0Q== X-Gm-Message-State: AOJu0YyCPfX2LplDLdNlrIVaxAvJxUoMRuXhKskvlgJlYtbQYzvdrLzN +3iSARgFWAoPGX5DxB3YYSmstOzmQuhKAsyKPOOXuw== X-Google-Smtp-Source: AGHT+IHY5EE/roP+GKr+lyBk++bccbxs8Y1/wX0x8Ovs4b79PUrJIA4pw/Bn98a41p4Nlak8k9GF3g== X-Received: by 2002:a7b:c8ca:0:b0:40b:5e1d:839f with SMTP id f10-20020a7bc8ca000000b0040b5e1d839fmr74253wml.51.1701381742130; Thu, 30 Nov 2023 14:02:22 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:21 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 7/8] oeqa/selftest/recipetool: appendsrfile: add test for machine Date: Thu, 30 Nov 2023 23:01:55 +0100 Message-ID: <20231130220156.726263-8-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191551 Add a new test for machine specific bbappend override Signed-off-by: Julien Stephan --- meta/lib/oeqa/selftest/cases/recipetool.py | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index b445a40cb10..7d5ac4b47a5 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -1056,7 +1056,7 @@ class RecipetoolAppendsrcBase(RecipetoolBase): if p.scheme == 'file': return p.netloc + p.path - def _test_appendsrcfile(self, testrecipe, filename=None, destdir=None, has_src_uri=True, srcdir=None, newfile=None, options=''): + def _test_appendsrcfile(self, testrecipe, filename=None, destdir=None, has_src_uri=True, srcdir=None, newfile=None, machine=None, options=''): if newfile is None: newfile = self.testfile @@ -1084,12 +1084,26 @@ class RecipetoolAppendsrcBase(RecipetoolBase): expectedlines = ['FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"\n', '\n'] + override = "" + if machine: + options += ' -m %s' % machine + override = ':append:%s' % machine + expectedlines.extend(['PACKAGE_ARCH = "${MACHINE_ARCH}"\n', + '\n']) + if has_src_uri: uri = 'file://%s' % filename if expected_subdir: uri += ';subdir=%s' % expected_subdir - expectedlines.extend(['SRC_URI += "%s"\n' % uri, - '\n']) + if machine: + src_uri_line = 'SRC_URI%s = " %s"\n' % (override, uri) + else: + src_uri_line = 'SRC_URI += "%s"\n' % uri + + expectedlines.extend([src_uri_line, '\n']) + + if machine: + filename = '%s/%s' % (machine, filename) return self._try_recipetool_appendsrcfile(testrecipe, newfile, destpath, options, expectedlines, [filename]) @@ -1162,6 +1176,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): output = self._test_appendsrcfile(testrecipe, filepath, subdir, has_src_uri=False) self.assertTrue(any('with different parameters' in l for l in output)) + def test_recipetool_appendsrcfile_machine(self): + self._test_appendsrcfile('base-files', 'a-file', machine='mymachine') + def test_recipetool_appendsrcfile_replace_file_srcdir(self): testrecipe = 'bash' filepath = 'Makefile.in' From patchwork Thu Nov 30 22:01:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 35490 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 08B7AC4167B for ; Thu, 30 Nov 2023 22:02:32 +0000 (UTC) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mx.groups.io with SMTP id smtpd.web10.8315.1701381744921090990 for ; Thu, 30 Nov 2023 14:02:25 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=145rE6tM; spf=pass (domain: baylibre.com, ip: 209.85.128.49, mailfrom: jstephan@baylibre.com) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40b552deba0so14961465e9.1 for ; Thu, 30 Nov 2023 14:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1701381743; x=1701986543; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HvE4x+BSWCykvr7+GHabCu0YsMh+yRIas/EieK3kU4E=; b=145rE6tMq5vHWBzT7Obuz+sqyzXtTs9kG6eW522a2cdrj4BK1mtvQ6RukPdPCTJfFI C8jj8HVpVV1mBUpmGPPoFdgSBTuugIMOlb5//TOy2cc9KibNIP8DYScgt0HdV1CBOd/o QxrhiRgn/fFLqy44au7l7seO8NfopCdZNjmUdBl+ihRAnWWlsNg50yc6qYjWz/DxjIfw VK8Q/vUVCp5ZqDcTkQ1VwVxKThsbmBNAQ77naX6hsCfqVeD+ZDelJh7wInt0lamSbTKb JoBANs9QYZtp07e7Ny+jqsP405uE0Totboi9EhN1cUZe7dfKNZfqe/S5FwnSZKerVEIX g6Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381743; x=1701986543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HvE4x+BSWCykvr7+GHabCu0YsMh+yRIas/EieK3kU4E=; b=VEV/OZ7ipUw5ug8jV28KOu7jGC2zZNCW5r0YueOO/egsF3hrzIZvbec0QMjbfdtpQy SiY81AJWXjNWok+ihfns6luTS5EJIkdtgmfzwuP0IT8Dn/HbhQAx+qnVuz0bw1Fiqjbf h5AoRkfBBea5EOINUIcLSvcOqsk5qbxl9ehhsLu0sAMzGgrDSp65Id7JZdOvVPvZ3Ghb U6EtmqWiFBIwS3QVMCB1bspA4P3spxpzwEkYrlBF0IXqgZnyLfhsF45LS12eL0c/T1Go fZ8Vhm5V9XCbmxvXg49O/k2Rh01NNDyj5f2RxQAvqUmvL4yFLGkwOK280f92sDwpDDX+ rRqw== X-Gm-Message-State: AOJu0YxeFy4wfa7+X9fX9HkAa8YKF+hUtU0o11w0J+bnM8C7e3t1sSE9 VO2xK1JEe8u604io03La2pLh6+RO4sC9SBSCtoCX3w== X-Google-Smtp-Source: AGHT+IFWwTcEkUzjIYMx9L7Q0sBIpbcNv7Puj1B2ZD55dI99IAy1bkr/s10eo3tOJJBwUQ5Ouam9yA== X-Received: by 2002:a05:600c:26d3:b0:40b:5e21:dd44 with SMTP id 19-20020a05600c26d300b0040b5e21dd44mr77925wmv.114.1701381743332; Thu, 30 Nov 2023 14:02:23 -0800 (PST) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id w3-20020a05600c474300b0040b36050f1bsm3231372wmo.44.2023.11.30.14.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:02:23 -0800 (PST) From: Julien Stephan To: openembedded-core@lists.openembedded.org Cc: Julien Stephan Subject: [PATCH 8/8] oeqa/selftest/recipetool: appendsrc: add test for update mode Date: Thu, 30 Nov 2023 23:01:56 +0100 Message-ID: <20231130220156.726263-9-jstephan@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231130220156.726263-1-jstephan@baylibre.com> References: <20231130220156.726263-1-jstephan@baylibre.com> MIME-Version: 1.0 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 ; Thu, 30 Nov 2023 22:02:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/191552 add a basic test for testing the update mode of recipetool appendsrcfile(s) Signed-off-by: Julien Stephan --- meta/lib/oeqa/selftest/cases/recipetool.py | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 7d5ac4b47a5..7a114335821 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -1179,6 +1179,34 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): def test_recipetool_appendsrcfile_machine(self): self._test_appendsrcfile('base-files', 'a-file', machine='mymachine') + def test_recipetool_appendsrcfile_update_recipe_basic(self): + testrecipe = "base-files" + recipefile = get_bb_var('FILE', testrecipe) + result = runCmd('bitbake-layers show-layers') + layerrecipe = None + for line in result.output.splitlines()[3:]: + with open("/tmp/juju.txt", "a") as file: + layer = line.split()[1] + print(layer, file=file) + if layer in recipefile: + layerrecipe = layer + break + self.assertTrue(layerrecipe, 'Unable to find the layer containing %s' % testrecipe) + cmd = 'recipetool appendsrcfile -u %s %s %s' % (layerrecipe, testrecipe, self.testfile) + result = runCmd(cmd) + self.assertNotIn('Traceback', result.output) + self.add_command_to_tearDown('cd %s; rm -f %s/%s; git checkout .' % (os.path.dirname(recipefile), testrecipe, os.path.basename(self.testfile))) + + expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)), + ('??', '.*/%s/%s/%s$' % (testrecipe, testrecipe, os.path.basename(self.testfile)))] + self._check_repo_status(os.path.dirname(recipefile), expected_status) + result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile)) + removelines = [] + addlines = [ + 'file://%s \\\\' % os.path.basename(self.testfile), + ] + self._check_diff(result.output, addlines, removelines) + def test_recipetool_appendsrcfile_replace_file_srcdir(self): testrecipe = 'bash' filepath = 'Makefile.in'