From patchwork Fri Jan 9 13:19:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 78355 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 ABF04D1A61E for ; Fri, 9 Jan 2026 13:20:18 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.9817.1767964808674647659 for ; Fri, 09 Jan 2026 05:20:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JOB8Isgt; spf=pass (domain: gmail.com, ip: 209.85.128.66, mailfrom: alex.kanavin@gmail.com) Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-47d5e021a53so32028825e9.3 for ; Fri, 09 Jan 2026 05:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767964807; x=1768569607; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mHwj1MYlmFXdhER1JtffzSMeZjAz69yHCY9L82g67wo=; b=JOB8Isgtx7MFPJkJN4L2pu4liZT2Nfh8JF5huaVGpjW2MaEJlFSD0sqzJYZb6CTaoy 9C2d4hgPjwOjKK0QfizVefaEQTjAVsoIFOX2whtaW3Vp3qU+0yVOGEgUdLoJygXQ/OMj JJhKniKYJ1RECgE4M8XdZlcqJS3nmLCVlLd3jqgZZtG6Av7ofXwZ2551sDwofZB4+sVx mOLbZYwV+Iz5iVt0bUGigR7cvwXjExLVARIWzszg0hXhtECe3GkM/RatEgy5bDxQdQHB A0G9weSZ+sOnX7PIRKXghvEGZA4hLjzqMvEntcakIe7/r0d0nZN2DxkhzR0duZgVNkCX /WGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767964807; x=1768569607; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mHwj1MYlmFXdhER1JtffzSMeZjAz69yHCY9L82g67wo=; b=cOlwURDyYpy+6TqP2IU9WBoiKKFrivj6GDnC1qUJhSb8WkPqtjxZQpJfWQ/F6b0QW0 FBhcYDH72wbYIcemMKGJdYMybJgPYS4admVBZaQyjpDOwodam4gAyB9q0gDhdsL5l5Kb pknS8TcJIJ98J2dQtPMReTR1MHsW+9GIujAXZ18CORm+CXe8ZsbsWrrjN1DDTMAcwJ6B Z0AZF5djgWGNFRf+BAwZ302JHhoLD40CBa2bLS6b/t/6zns8gW8k79PAvSeYpMPzfRzZ LAmouAVISe8D95RrK9zvTgXKQRpqv4EHoICcpuL2UUQCPdsx7DriJIxUaySrjeSzv4Dt GBVw== X-Gm-Message-State: AOJu0Yx7KXglCMOto29iV9myxZuIKxOejYCL0wMxjaL9XyqE90HESw/h KISODFudZqNVq+/OjMfiJ9B5+0HhgkgrbVwJpa8H/P+pH9qSTdxJxkGzqJ3lq3Io X-Gm-Gg: AY/fxX5lCuhTvSn2oKgBSEcw5ypPIDB+nS2vKwFqxDo8uIUy8oK/Ds/U3bYEtT8YeYM OSX6Hm2mP4IBpYdfv6Gx2CR+l8Gt5rEaRip0AFOYZ5Ojpum7iBAyHRnVw5WOIP9t29PklART4GE +6HuVA1Il29zWdmrozpKRa6AhlxIbZ3hRxDCGGgHUQ+Ql0VrjOPa3TCBS/pDIhNgf7/A4E/EG0T I9WpB9Lqc6P8GgwmBAMYWVh93zzy79xONF3/ggL5AsEmJi7gkD4bqCNOIe6XcqHPYKM5PwGDw3Y ECt5F110JfgSK4e3MMJi7sV7cJAlURWX01gS68Y6jBlRg1xNuBupvhINUnKK6fscrTXu7pImFSU BBL0B5Ei73eynJ46RzhuugieGEJHShStl2d/kNz6FDL98sX2Co0X5VWJh3YyVfOIb20XB+/pf2W qEOkNMT/SKpJWBw2X5CL13c3YxWgjhaS+j6h8G4oZwwEFdYPM= X-Google-Smtp-Source: AGHT+IGY4s053tgDg/sdDA+MUMsEq7zYH55Zh6lJePQLo7LzyY0MeJULTphXyNCptfU/VBq8XcdoQQ== X-Received: by 2002:a05:600c:5306:b0:477:7b16:5f88 with SMTP id 5b1f17b1804b1-47d84b0a992mr88172725e9.6.1767964806843; Fri, 09 Jan 2026 05:20:06 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f6953fasm202291505e9.5.2026.01.09.05.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 05:20:06 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 1/5] doc: document fixed revisions override in bitbake-setup manual Date: Fri, 9 Jan 2026 14:19:56 +0100 Message-ID: <20260109132000.2372791-1-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 09 Jan 2026 13:20:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18723 From: Alexander Kanavin Signed-off-by: Alexander Kanavin --- .../bitbake-user-manual-environment-setup.rst | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst b/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst index ec1bdeecd..fcffab812 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst +++ b/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst @@ -938,3 +938,51 @@ Here is an example file that overrides the branch of the BitBake repository to - The ``sources`` section contains the same options as the ``sources`` option of a :term:`Generic Configuration` file. See the :ref:`ref-bbsetup-section-config-reference` section for more information. + +.. _ref-bbsetup-fixed-revisions: + +Fixed source revisions +====================== + +:term:`Generic Configuration` can set source revisions in ``rev`` to a tag or a branch. +Bitbake-setup will make sure the actual revision will match the tag or branch when performing +initializations or updates, and will capture the revisions in a :ref:`_ref-bbsetup-source-overrides` +file. + +This file is named ``sources-fixed-revisions.json`` and is available in ``layers/`` +under the :term:`Setup` directory (as well as under ``config/`` for backwards compatibility). +It can be used to keep record of what was checked out when using configurations that do not +specify exact revisions. + +Also, as it is an override file, it can be combined with the original configurations +to initialize a setup in a reproducible way that guarantees an exact, never-changing +set of revisions, by using the ``--source-overrides`` option of the +:ref:`ref-bbsetup-command-init` command. + +For example if the original configuration had specified only a master branch +for a source:: + + "bitbake": { + "git-remote": { + "remotes": { + "origin": { + "uri": "https://git.openembedded.org/bitbake" + } + }, + "branch": "master", + "rev": "master" + } + + +the override will contain the exact revisions:: + + "bitbake": { + "git-remote": { + "remotes": { + "origin": { + "uri": "https://git.openembedded.org/bitbake" + } + }, + "branch": "master", + "rev": "720df1a53452983c1c832f624490e255cf389204" + } From patchwork Fri Jan 9 13:19:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 78354 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 BBDB6D1A62D for ; Fri, 9 Jan 2026 13:20:18 +0000 (UTC) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.9811.1767964809279692048 for ; Fri, 09 Jan 2026 05:20:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gONfeZ6j; spf=pass (domain: gmail.com, ip: 209.85.128.51, mailfrom: alex.kanavin@gmail.com) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4775ae5684fso20308605e9.1 for ; Fri, 09 Jan 2026 05:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767964808; x=1768569608; 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=Tiiw1L+ytdtJISvqhpS7HrLUdpHl6gbjyrk1CL7n61w=; b=gONfeZ6jCsHdB42WBnJPNaaGehfYiLXj1icN3nyXXBczGtcoKgyVTYXrOu8orhJUP5 S+PdHrzvQFom/6aBRvd138IL1XHarwBJSfVmFNO665J4KsDROXSp/bReWcyhzMRkMPhn Zut9LswNrvFiRZ27SOHVyyXVjGp5fEtk9szICxsG2DMk9qgQg8jUqh9Kllf0Kgpimq7Y gL+vmjOCg9YFLoQ6FrsS55VpOtAjTQFLC2B3OsfVrHXG8ImPopGNPH3/+2ZYo3JoDk6R MY/wqMNBNbhHvg14uBqNtRfkrrls3/f7yFMbVQ3+BmCrxN4Ohjnch+N9WMFerFD3MYsg lqjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767964808; x=1768569608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Tiiw1L+ytdtJISvqhpS7HrLUdpHl6gbjyrk1CL7n61w=; b=l9ROU1A/zHWrM08BrbANOigvOWOsL/ri0Ijj7ybfHpfk+ss9uelbSuswtJwe1t71qY +LHOAZNGR4lZrLI8MQ/pZBcQ/J4gsWQtBZ4vqkCFEw4sica6LPmQAUbOxDs6JmkS7maA fUOyc0Px7h7FyZm0ZkMa/SU79eNwD8CF+HxtirujaxIjhcfbWqY0z33C6+8i+rnZ9zE5 LCwUma+PesOsEwtYjVvJBenDvvEapLOiLXuMy/r/QLb72fHqwWhPSfx6gUD8EGyJ+MI+ DwbADwVQBRsY4ObqBClsDdq0KktGtGVjQiwALbCbt1ZihTwfaCPIGvZrqfKhaAYnoTk5 O4Jg== X-Gm-Message-State: AOJu0Yz7VqdRZ5ZYj1oNSM8CPrS7woDJhS0z0tk64jEiF+Vmt7F+0Se3 hp5fCqnG7mmL34iRO393ysBjvvaHmYC+N/kcEdqukxMj7pfUqLyM4c/XXbb6rw== X-Gm-Gg: AY/fxX4MXlUdUKowFl+pxYFnC9dotAeN4JAJ3XTleUef2SZXZm1Vx17KJq1WvddWycG qblDNX5N1NB4P+fO+U3dxhfK657MV87GTsIZlWtxtyGl1WX7YmObLbGS3DBM3Hf+1iidfdGnqKz asRJhF010wa+gj8gNo56JSFjkXic3m7dcW4QNfem7kOCFb5/fhQsdLCWiWbl9JnKQFOM6iWhAxV JW6aTiRCAMt2Ep6XKeqlWeDNus1FD+vGthOq69qKtnS6zctdi5dFlK7v63au3A7Z8JTcLguFl8Y LI92m6AQEcjchhQD6A4/C94vw+Hf9O0UljrJ4AK0h7KNVEcLe4OC+npwopKCRcvTJtjMDAfBXxQ 0nYmFhyVSAfv8eo/Tq0o6hItLp10ar1vceVcfAEjbZy76J/AnjzByYLl3O5e9cp0J2mJH/1Rk5O zzRu89AydHJQhGEhZ/Nbd1uRIvECL1dhnbypsPmh1Szcz+jRs= X-Google-Smtp-Source: AGHT+IEkZ6+DS+j+lXDzuLVcciF0WmfvYLewyy44HqTG+ynA6RvF1OEzfZRt0A2daoWWw8LC3S2OuA== X-Received: by 2002:a05:600c:45c3:b0:46e:48fd:a1a9 with SMTP id 5b1f17b1804b1-47d84b3f642mr101423255e9.33.1767964807548; Fri, 09 Jan 2026 05:20:07 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f6953fasm202291505e9.5.2026.01.09.05.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 05:20:07 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 2/5] bitbake-setup: ensure paths with timestamps in them are unique Date: Fri, 9 Jan 2026 14:19:57 +0100 Message-ID: <20260109132000.2372791-2-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260109132000.2372791-1-alex.kanavin@gmail.com> References: <20260109132000.2372791-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 09 Jan 2026 13:20:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18724 From: Alexander Kanavin There have been instances where directories with timestamps in them are created within the same second, and their paths clash as the timestamp in them is the same for both, as the timestamp is accurate to 1 second. This adds a check for the directory existence and then adds an ever-increasing counter until there's a path that isn't yet created. [YOCTO #16121] Signed-off-by: Alexander Kanavin --- bin/bitbake-setup | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 06255b112..4ccf47e87 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -93,6 +93,17 @@ def _write_layer_list(dest, repodirs): with open(layers_f, 'w') as f: json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4) +def add_unique_timestamp_to_path(path): + timestamp = time.strftime("%Y%m%d%H%M%S") + path_unique = "{}.{}".format(path, timestamp) + if os.path.exists(path_unique): + import itertools + for i in itertools.count(start=1): + path_unique = "{}.{}.{}".format(path, timestamp, i) + if not os.path.exists(path_unique): + break + return path_unique + def checkout_layers(layers, layerdir, d): def _checkout_git_remote(r_remote, repodir, layers_fixed_revisions): rev = r_remote['rev'] @@ -242,9 +253,8 @@ def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_c raise Exception("Cannot complete setting up a bitbake build directory from OpenEmbedded template '{}' as oe-setup-build was not found in any layers; please use oe-init-build-env manually.".format(template)) bitbake_confdir = os.path.join(bitbake_builddir, 'conf') - timestamp = time.strftime("%Y%m%d%H%M%S") - backup_bitbake_confdir = os.path.join(bitbake_builddir, 'conf-backup.{}'.format(timestamp)) - upstream_bitbake_confdir = os.path.join(bitbake_builddir, 'conf-upstream.{}'.format(timestamp)) + backup_bitbake_confdir = add_unique_timestamp_to_path(os.path.join(bitbake_builddir, 'conf-backup')) + upstream_bitbake_confdir = add_unique_timestamp_to_path(os.path.join(bitbake_builddir, 'conf-upstream')) if os.path.exists(bitbake_confdir): os.rename(bitbake_confdir, backup_bitbake_confdir) @@ -760,7 +770,7 @@ def install_buildtools(top_dir, settings, args, d): shutil.rmtree(buildtools_install_dir) install_buildtools = os.path.join(args.setup_dir, 'layers/oe-scripts/install-buildtools') - buildtools_download_dir = os.path.join(args.setup_dir, 'buildtools-downloads/{}'.format(time.strftime("%Y%m%d%H%M%S"))) + buildtools_download_dir = add_unique_timestamp_to_path(os.path.join(args.setup_dir, 'buildtools-downloads/buildtools')) logger.plain("Buildtools archive is downloaded into {} and its content installed into {}".format(buildtools_download_dir, buildtools_install_dir)) subprocess.check_call("{} -d {} --downloads-directory {}".format(install_buildtools, buildtools_install_dir, buildtools_download_dir), shell=True) From patchwork Fri Jan 9 13:19:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 78351 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 AAE6AD1A623 for ; Fri, 9 Jan 2026 13:20:18 +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.msgproc01-g2.9818.1767964810076635355 for ; Fri, 09 Jan 2026 05:20:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=W5VIbZEs; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: alex.kanavin@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-47d493a9b96so25251175e9.1 for ; Fri, 09 Jan 2026 05:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767964808; x=1768569608; 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=xFu5lhkrxPgZPOqnSmBLnqC98ebar0RJTdyfmfIIZc0=; b=W5VIbZEsOUABpaipXsdrc5k42Nn2mfEWFGDeevsnol/BtQ9l0cM7B0LYLBNaBCbA7c xB3EluTiyVmsN6GbyAWdjx9aIkmx+sYec2EY0epCvIVP/CE0/S2Ap12LsRTddSaoZphX 6JDwOKRgfdf1YrSxn1XZJ2IbjLnzgUK/sDad42CvFDGt90UYMNw65cFUzP5h5Ku+lJ8T LGqdwkQbDq/ZBAabn49w9lLoUWGLzNuhFZJd2RkcP2RVxUenzvwONsjbtYdvFAgxA/1h UPt/JIA0KKXWLGibAiUfi3b+q/jEkfWQvwLKamX2L6jCpKCUqwzrB+DVJBF+Y4fxqHH9 vsbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767964808; x=1768569608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xFu5lhkrxPgZPOqnSmBLnqC98ebar0RJTdyfmfIIZc0=; b=lrT9XerNpnuquuVGN2Xv8/YvZB2wjIyHirtu8TCQ62n9z/B27bM/5/EcxJAqJPiORd pUFubGD6cET4FYL1sdPrah5x1GNcog+iSk5qRYnMKrEfpol8JdJd5Z8uTP9T+Kjy+UT1 pj83DDQo9vdbn8ZHclRCVy/W/RcQO2RtlessH/E+kmI7Qvy2+ZTCUWrW1KT2nktfeKd5 m1hfgjhS2EI4CrSeFPwt1gNvKAaabxAac65IR21E7UCIFqUKwasvmkv/9laF9UDsDnvK cV4bXtqZRM4MSI2jjgPCugr0kPR4yXwC+B6aPDXirzzD77Ew8ji+tqHTMj9ZdYH7vOJw jDng== X-Gm-Message-State: AOJu0YxQX2ke0qV2el9FqR0VcQ/7X5jhUYIpG3EjagVjiGCT3IbvPBaw ttXVXUme3n9qEXDeo4qm5BrRlpqa9rKTRqBJUlJMnpmEo0x9vStrt7qDsDBk4w== X-Gm-Gg: AY/fxX7/5Zrjo56m64HbSddmrzzpVyjx9S/0E/yvrT7zrOO9fCC6FCBYs1ZHRByARar 5qN7RdY3cKyjjtVgaKWzxTLEzSm/EuEm3WEvGVcM5cvRRa3sQHfTVIvX8JhOUoZiRrN0csVCuuv 3Ax+cwCMkVB+3dNvgfMvm3v6RGPJRacsUdoIOeQ0R4J9UnBN8O7ib7dG1G34lxXrRPh138svq7S jdsGUiwM7iNH4pVokTsGC8iCKUuIEHFcGTvuhB2ZZvgsoCKXcZj37fG4/QDCYSWJCULWre588Zt wvrXPO1rxFaMiSC/82E7wY2TJfqFEmnZRaiaGUNLWECjYoENSrY76gHepHRfDWSi0nwjanU1Ec2 x4PbiYr6DYyAOg0ztmDRyq1dRDfRLrFiX78T23GqGN0vgnr6Z1qw1kA/pnu6DHnsDvPo3kU7akv t07EWw6WQMwydDI4NYedXWqHrGzAC1BS4NSGRHZ3dfTwyls0E= X-Google-Smtp-Source: AGHT+IHPxN3wr8Oh/Zej0Qm7QbmTUsP9K41ekL6S3Mh05UTYoXPqzQ5hGzdkb0G/LTi2nF15p4h9Sw== X-Received: by 2002:a05:600c:3b15:b0:45c:4470:271c with SMTP id 5b1f17b1804b1-47d84b36bcbmr99672455e9.18.1767964808289; Fri, 09 Jan 2026 05:20:08 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f6953fasm202291505e9.5.2026.01.09.05.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 05:20:07 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 3/5] bitbake-setup: allow empty commits in configuration history repo Date: Fri, 9 Jan 2026 14:19:58 +0100 Message-ID: <20260109132000.2372791-3-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260109132000.2372791-1-alex.kanavin@gmail.com> References: <20260109132000.2372791-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 09 Jan 2026 13:20:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18725 From: Alexander Kanavin This can happen when a user has checked out a different commit in a component under layers/. 'bitbake-setup update' will reset to the commit in the configuration, but there will be no changes to it, and so no difference in the config history repo to be committed. Signed-off-by: Alexander Kanavin --- bin/bitbake-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 4ccf47e87..93c11bd09 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -81,7 +81,7 @@ def write_sources_fixed_revisions(config_dir, layer_dir, config_data): def commit_config(config_dir): bb.process.run("git -C {} add .".format(config_dir)) - bb.process.run("git -C {} commit --no-verify -a -m 'Configuration at {}'".format(config_dir, time.asctime())) + bb.process.run("git -C {} commit --allow-empty --no-verify -a -m 'Configuration at {}'".format(config_dir, time.asctime())) def _write_layer_list(dest, repodirs): layers = [] From patchwork Fri Jan 9 13:19:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 78352 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 AD8A3D1A627 for ; Fri, 9 Jan 2026 13:20:18 +0000 (UTC) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.9819.1767964816334836372 for ; Fri, 09 Jan 2026 05:20:16 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OJJscVSf; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: alex.kanavin@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-42fbc544b09so3136328f8f.1 for ; Fri, 09 Jan 2026 05:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767964814; x=1768569614; 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=l38EmLbEs/q+pJtj4FX5IOhTWDuJ3EOLPFjZG4IX070=; b=OJJscVSfrQ1d+C9lMqagP/zLTdI7/OIQELNO5I1vw+IT32SS1bl7LcggY30D25pICd 9NeO2DcZhJxnKMj1M3R+OX06IIvsfYXpl2K4/y4YUL33Wqta/dINcLDFhF628lHNBW/9 wqaVfrNRgy5pwR4fqDlV+Oh8hM65XnPlnNse9LeEx5V3tKsJRnM4zYTAZgIAs57Q+hPs 1I00wolou+7l38FQdaT5sf2FkF+8tkC0mwsx3GUZrCwbrT0gGBBgkutkCsP7vLK4VODw MPkd/dqbKXSprKx8uRza+Hj3O9GGLukhj2xhLnB0IxnwhJ2BsvHzbUnsbzxJB+TH2pC5 lIXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767964814; x=1768569614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l38EmLbEs/q+pJtj4FX5IOhTWDuJ3EOLPFjZG4IX070=; b=JdC3r1ldWRsrcBxSDaINF4+bMZT4CFQf6dCf5puBU7uvGfXJ2EjNZUE4fWVhFqynQg 0moM9gOYPzHUu913R3pE3dv/d2WtIwpDjk6DQLTbIHtr4L924SZIJ4VNJq7c9E2Uwe50 NlMo4SxP1jGs+lbvCPJQ2qnUylrc5d1lqS+Ypb2FlJXlLHmh2w5z1VNXCxO6iNc5PvEl p7Icno6ChkZ+qRCK01hZdLWWWKgLKQyS1s5llvyRd6APhw0/hDCmyrAOKfvqhIZVTlG9 2j7ATtDJ+eO3wn95p8TR/ph0CDB5iy91jpcchwOqrJBENLUdqwyYR1O5TrozTE0uM+Qy e4HQ== X-Gm-Message-State: AOJu0Yxrwn9RMgGysSJcxBNTqOkJQDOwfjF2q8jmvD7/CuuYbqKRUqsU OnftlsuGvxLeGUZCLa6SpTDMH0HsOhcekaASHbADPJSMFc4DqaGUyc+HkiCL1Q== X-Gm-Gg: AY/fxX78GwhGv2b4htzxmdCbXGUjY0yCJ3LgF/gxoNdl8jWHBb4GKtnF7J8YgOsGppH fN5oAPheLMNbFDkWPTY+UyonJO4uNlF7ijznbv3wDm5W1a+B/asp/BWfGEeeSyCrHOAC1fWn4Lg L0AN9Y7Gix7PWUFAJLraGIhc2VV4O//8IZaDvzKIkW0RP1jozcuTaJNqOQ6uADbU+qJ45n7rIoL gZiGmTCB+97ytfo70JO2HV4E9FXI9GoBfMJudGUPtNForcBwxMGvm04hOJTupaA4qvzAgeiLba8 6zQhLY9mG5QeEcGoro44WCQ9OYYCEd2mNxxUs7+jh0tdTGBRF2waO2p3O9EUHFTrnGrSSzvpZE6 Bk+pMs4mQdx+IyKeXAyHEyliDFsHv2K3X7m8r4s4+sg2p3mQZClq4rS4d9o/mP3tbI/0KdaaANo ty/v1bJN/d3hDr2LSbTtwk0i5SorWMCaeh7JMDQBHp91TtJ5c= X-Google-Smtp-Source: AGHT+IGrSagSKiCIRb0Cmgu3zUd8kehei5FVFpq+DWMFEFBR3lANreQ5lPVDUW5Gdq8UxoyMqOW+3A== X-Received: by 2002:a05:600c:4ed1:b0:47d:18b0:bb9a with SMTP id 5b1f17b1804b1-47d84b54031mr112401295e9.33.1767964809835; Fri, 09 Jan 2026 05:20:09 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f6953fasm202291505e9.5.2026.01.09.05.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 05:20:08 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 4/5] bitbake-setup: correct several scenarios in layer updates Date: Fri, 9 Jan 2026 14:19:59 +0100 Message-ID: <20260109132000.2372791-4-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260109132000.2372791-1-alex.kanavin@gmail.com> References: <20260109132000.2372791-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 09 Jan 2026 13:20:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18727 From: Alexander Kanavin There were untested scenarios in layer updates which did not work properly. The most serious of them is updating a remote layer which had user-made local modifications (e.g. newly made local commits or edited files without a commit). Bitbake-setup relies on git fetcher's unpack operation which simply wipes it all out. Yes, the user should've used -L option to symlink a local clone from elsewhere; this advice doesn't help when their work is gone. To address this, a git hook is added that prevents making commits in checkouts under layers/ that are managed by bitbake-setup. The hook directs users to clone the layer they'd like to modify separately and then use 'init -L' option. (note: later on this workflow can be streamlined by converting parts of an existing setup to local sources, or perhaps ability to 'detach' parts of layers/ from bitbake-setup's modifications, so that it's not necessary to do a full re-init). This still does not cover local modifications without making commits, so there's also a function that checks if such modifications have been made, and a code that moves the layer into a backup location if the function returns true. I considered asking the user what to do (similar to bitbake config handling), but this would've resulted in a half-updated, possibly broken layer set which ultimately just would be more confusing. The local modification check is a part of a broader newly added logic block that handles already existing sources, and in particular addresses yet another issue: when a local source replaces a git remote or another local source, this scenario failed with 'file exists' errors (thanks to Anibal Limon for spotting that). In this case the original symlink is removed first. If the original is a git checkout, it is backed up if there are local modifications, or simply removed otherwise. Signed-off-by: Alexander Kanavin --- bin/bitbake-setup | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 93c11bd09..abe7614c8 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -104,7 +104,7 @@ def add_unique_timestamp_to_path(path): break return path_unique -def checkout_layers(layers, layerdir, d): +def checkout_layers(layers, confdir, layerdir, d): def _checkout_git_remote(r_remote, repodir, layers_fixed_revisions): rev = r_remote['rev'] branch = r_remote.get('branch', None) @@ -128,6 +128,31 @@ def checkout_layers(layers, layerdir, d): logger.plain("Making a symbolic link {} pointing to {}".format(dst, src)) os.symlink(src, dst) + def _has_local_modifications(r_name, r_path): + fixed_revisions = json.load(open(os.path.join(confdir, "sources-fixed-revisions.json"))) + rev = fixed_revisions['sources'][r_name]['git-remote']['rev'] + status = bb.process.run('git -C {} status --porcelain'.format(r_path))[0] + if status: + return True + diff = bb.process.run('git -C {} diff {}'.format(r_path, rev))[0] + if diff: + return True + return False + + def _restrict_commits(r_name, r_path): + hook_path = os.path.join(r_path, '.git', 'hooks', 'pre-commit') + restrict_hook = """#!/bin/sh +echo "This repository is managed by bitbake-setup, and making commits is restricted. +If you wish to make local modifications, clone it separately, and re-initialize using +bitbake-setup init -L {} /path/to/repo/checkout" +exit 1 +""".format(r_name) + with open(hook_path, 'w') as f: + f.write(restrict_hook) + import stat + st = os.stat(hook_path) + os.chmod(hook_path, st.st_mode | stat.S_IEXEC) + layers_fixed_revisions = copy.deepcopy(layers) repodirs = [] oesetupbuild = None @@ -141,10 +166,26 @@ def checkout_layers(layers, layerdir, d): r_local = r_data.get('local') if r_remote and r_local: raise Exception("Source {} contains both git-remote and local properties.".format(r_name)) + + repodir_path = os.path.join(layerdir, repodir) + if os.path.lexists(repodir_path): + if os.path.islink(repodir_path): + os.remove(repodir_path) + elif _has_local_modifications(r_name, repodir_path): + backup_path = add_unique_timestamp_to_path(repodir_path + '-backup') + logger.warning("""Source {} in {} contains local modifications. Renaming to {} to preserve them. +For local development work it is recommended to clone the needed layers separately and re-initialize using -L option: +bitbake-setup init -L {} /path/to/repo/checkout""".format( + r_name, repodir_path, backup_path, r_name)) + os.rename(repodir_path, backup_path) + else: + shutil.rmtree(repodir_path) + if r_remote: _checkout_git_remote(r_remote, repodir, layers_fixed_revisions) + _restrict_commits(r_name, repodir_path) if r_local: - _symlink_local(os.path.expanduser(r_local["path"]), os.path.join(layerdir,repodir)) + _symlink_local(os.path.expanduser(r_local["path"]), repodir_path) if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')): oesetupbuild = os.path.join(layerdir, repodir, 'scripts/oe-setup-build') @@ -354,7 +395,7 @@ def merge_overrides_into_sources(sources, overrides): def update_build(config, confdir, setupdir, layerdir, d, update_bb_conf="prompt"): layer_config = merge_overrides_into_sources(config["data"]["sources"], config["source-overrides"]["sources"]) - sources_fixed_revisions = checkout_layers(layer_config, layerdir, d) + sources_fixed_revisions = checkout_layers(layer_config, confdir, layerdir, d) bitbake_config = config["bitbake-config"] thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_conf) From patchwork Fri Jan 9 13:20:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 78353 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 C0A63D1A628 for ; Fri, 9 Jan 2026 13:20:18 +0000 (UTC) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.9813.1767964812252937734 for ; Fri, 09 Jan 2026 05:20:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=f1i1iycb; spf=pass (domain: gmail.com, ip: 209.85.128.50, mailfrom: alex.kanavin@gmail.com) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-47755de027eso25083265e9.0 for ; Fri, 09 Jan 2026 05:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767964811; x=1768569611; 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=Ij90d5M737kUKvADqyblyXi7XMuhZXxlIuc/FwmDHsg=; b=f1i1iycb/0gwdTb4eW4GR0KDQqmGxjlFKd1Fn14ST29sAo1KAWMnuVBlXimbtUKxxP qK609JNezZgBhyPG91Huo2TwwgSeTNIk26KqAmGBqIzV9s8TnqvOW/UzZmp+zyyDGWkk UBOk9fg40420L9FvpJrKD6rQhoC+ylTxHDR9it1HowyHHuLrqQJtlq8Kav3igIwwrWFJ 9xcXu1NwoZ6a3FJPtB1zghBh0gSTpHORg7jMHjdmtYYxywX93CpYOJ9+spXEyiD0r29S O38bG63Z8jsBSbu9DhA/NGpEl8eb4TNKIjekRZKKeShtqia37IFPMUuGt3p1sPB8C6fl 4UHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767964811; x=1768569611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ij90d5M737kUKvADqyblyXi7XMuhZXxlIuc/FwmDHsg=; b=FAk37KkLcwV5VClSK98WNvdEg/8HVwCsrzwOtPxgVsDnRCmHGCZa3npLWbu+Rsoio1 daCGBLbfWy9kMq757mQb+tHwHAKszzyw811aDmG30gmAKe+9aIV72CcJEV/RUuJFmm9k 8JH9tBQgrXFcLjiyan6UyhST/XRZMw0Ld7PCLy17esSB5hxX3TA60cfOu1gqdU3HeIrd DVh1lJfKFE4GKqpMGc7MJrhZfxkSJeqkqHV6gjPp3FMp2k1qsvqW1GvV+BxXOPt1z3md uUpWBS2GKNq4otdhDg292wzLPNZUVd7PWpDXdPUE+n1P/XDXjyErs5GD+59JjEHCVewO 9Dxw== X-Gm-Message-State: AOJu0Yxquwy/b4ferIDnJcWNwTT24hIesNuqCK4xVsRMkxf/Neg2xyA0 eaBJ4FyHLa7yNQtZDjmGarXmZLfzOTi1c2IIiAJ8GRX8/+invKgEftSxE/1NtQ== X-Gm-Gg: AY/fxX4fbuEosr/SlfcbpOpuU1swaPFE2dsH2AO8fmSBo1zt3W7WRQhCjnxUCbuQKTr lIzftdmQS73g1Qd7KbKJ91kLvHImXYT3b13oP1QdIQT1FRNWD9YYknCvSwXLTTm+W7vKDF+CwfT YeU7S/cBXACK17jJq7GHPT6s73QAcmL9lu/8gTkL0GQIFja+Yydjx9fVNQmZgr2G0i2KhVGwK6O ghTRXShzPpT/RNlS9BBSanD8yQ0ks8GBxThe49OpArKb6KTcAI9YARbyarQHNdQYO6Dy7qm3r9G C2N/ks5XoVqu+k0no6U7B/+byNaU371lNV0DR180/Vc1Dzv6LlAyL/DjCGvDyq13zoFeED7w7SV znJG8JiG/e2a6q/E0YXS0LNH2oWvUPipWXVl4ds2+KLah77aLThpolz+rUeSHrmXS2yYaQkWnP7 qbHDwUP05O9qrf2BqMPED1FgFLDP+K3R78HOnBET+YAsekLjpOYMZ+dKzbfQ== X-Google-Smtp-Source: AGHT+IF0dwJl4E/w8VMtwWlub46Xn9rDINFpHxaabUwacouDXc64tVs3zg9OubINfI0DE2wDgdDnhg== X-Received: by 2002:a05:600c:3556:b0:477:8985:4036 with SMTP id 5b1f17b1804b1-47d84b086ccmr119070765e9.1.1767964810469; Fri, 09 Jan 2026 05:20:10 -0800 (PST) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f6953fasm202291505e9.5.2026.01.09.05.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 05:20:10 -0800 (PST) From: Alexander Kanavin To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 5/5] bitbake-setup: add tests for update scenarios fixed in the previous commit Date: Fri, 9 Jan 2026 14:20:00 +0100 Message-ID: <20260109132000.2372791-5-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260109132000.2372791-1-alex.kanavin@gmail.com> References: <20260109132000.2372791-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 09 Jan 2026 13:20:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18726 From: Alexander Kanavin This adds tests for the issues fixed in the previous commits: - transitions in sources from remote to local, from local to local and from local to remote - ensuring that local commits in sources are restricted - ensuring that source backups do happen when that is expected. Add a helper function that adds a test configuration with a local source in it. Signed-off-by: Alexander Kanavin --- lib/bb/tests/setup.py | 68 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py index 438dc0cd8..834d09854 100644 --- a/lib/bb/tests/setup.py +++ b/lib/bb/tests/setup.py @@ -175,6 +175,16 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) """ % (self.testrepopath, branch, rev) return self._add_json_config_to_registry_helper(name, sources) + def add_local_json_config_to_registry(self, name, path): + sources = """ + "test-repo": { + "local": { + "path": "%s" + } + } +""" % (path) + return self._add_json_config_to_registry_helper(name, sources) + def add_file_to_testrepo(self, name, content, script=False): fullname = os.path.join(self.testrepopath, name) os.makedirs(os.path.join(self.testrepopath, os.path.dirname(name)), exist_ok=True) @@ -413,7 +423,6 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) sums_after = _conf_chksum(f"{setuppath}/build/conf") self.assertEqual(sums_before, sums_after) - # check source overrides, local sources provided with symlinks, and custom setup dir name def _check_local_sources(custom_setup_dir): custom_setup_path = os.path.join(self.tempdir, 'bitbake-builds', custom_setup_dir) custom_layer_path = os.path.join(custom_setup_path, 'layers', 'test-repo') @@ -421,6 +430,63 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) self.assertEqual(self.testrepopath, os.path.realpath(custom_layer_path)) self.config_is_unchanged(custom_setup_path) + # Change the configuration to refer to a local source, then to another local source, then back to a git remote + # Run status/update after each change and verify that nothing breaks + c = 'gadget' + setuppath = self.get_setup_path('test-config-1', c) + self.config_is_unchanged(setuppath) + + json_1 = self.add_local_json_config_to_registry('test-config-1.conf.json', self.testrepopath) + os.environ['BBPATH'] = os.path.join(setuppath, 'build') + out = self.runbbsetup("update --update-bb-conf='yes'") + _check_local_sources(setuppath) + + prev_path = self.testrepopath + self.testrepopath = prev_path + "-2" + self.git("clone {} {}".format(prev_path, self.testrepopath), cwd=self.tempdir) + json_1 = self.add_local_json_config_to_registry('test-config-1.conf.json', self.testrepopath) + os.environ['BBPATH'] = os.path.join(setuppath, 'build') + out = self.runbbsetup("update --update-bb-conf='yes'") + _check_local_sources(setuppath) + + self.testrepopath = prev_path + json_1 = self.add_json_config_to_registry('test-config-1.conf.json', branch, branch) + os.environ['BBPATH'] = os.path.join(setuppath, 'build') + out = self.runbbsetup("update --update-bb-conf='yes'") + self.check_setupdir_files(setuppath, test_file_content) + + # Also check that there are no layer backups up to this point, then make a change that should + # result in a layer backup, and check that it does happen. + def _check_layer_backups(layer_path, expected_backups): + files = os.listdir(layer_path) + backups = len([f for f in files if 'backup' in f]) + self.assertEqual(backups, expected_backups, msg = "Expected {} layer backups, got {}, directory listing: {}".format(expected_backups, backups, files)) + + layers_path = os.path.join(setuppath, 'layers') + layer_path = os.path.join(layers_path, 'test-repo') + _check_layer_backups(layers_path, 0) + + ## edit a file without making a commit + with open(os.path.join(layer_path, 'local-modification'), 'w') as f: + f.write('locally-modified\n') + test_file_content = "modified-again\n" + self.add_file_to_testrepo('test-file', test_file_content) + os.environ['BBPATH'] = os.path.join(setuppath, 'build') + out = self.runbbsetup("update --update-bb-conf='yes'") + _check_layer_backups(layers_path, 1) + + ## edit a file and try to make a commit; this should be rejected + with open(os.path.join(layer_path, 'local-modification'), 'w') as f: + f.write('locally-modified-again\n') + self.git('add .', cwd=layer_path) + with self.assertRaisesRegex(bb.process.ExecutionError, "making commits is restricted"): + self.git('commit -m "Adding a local modification"', cwd=layer_path) + test_file_content = "modified-again-and-again\n" + self.add_file_to_testrepo('test-file', test_file_content) + out = self.runbbsetup("update --update-bb-conf='yes'") + _check_layer_backups(layers_path, 2) + + # check source overrides, local sources provided with symlinks, and custom setup dir name source_override_content = """ { "sources": {