[PATCH 10/13] qemu: leave existing tree alone after the initial clone

Daniel Gomez <[email protected]> Fri, 12 Jun 2026 14:36:48 +0200
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

ansible.builtin.git defaults to update: true and runs git checkout to
the configured version on every invocation. For the qemu component
that detaches HEAD onto QEMU_GIT_VERSION every time the user runs any
make qemu* target, which silently drops the developer off whatever
branch they were on and refuses outright when there are uncommitted
changes. QEMU is a build tool the developer iterates on, not the
system under test, so reproducibility-on-every-run is the wrong
default here.

Set update: false on the git task so QEMU_GIT_VERSION applies on the
initial clone only and the tree is the developer's after that. The
docs note how to move to a new ref (check it out by hand, or remove
the tree and rerun make qemu-fetch).

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 docs/qemu.md                        | 6 ++++++
 playbooks/roles/qemu/tasks/main.yml | 1 +
 2 files changed, 7 insertions(+)

diff --git a/docs/qemu.md b/docs/qemu.md
index 396c589c..fc14505a 100644
--- a/docs/qemu.md
+++ b/docs/qemu.md
@@ -41,6 +41,12 @@ mirror by `scripts/infer_last_stable_qemu.sh`; when no mirror is present it
 falls back to a recent release. Override it to pin a specific tag, and use at
 least v7.2.0 for CXL support.
 
+This ref applies on the initial clone only. Once `QEMU_GIT_DATA_PATH` exists
+the qemu role leaves it alone, so a developer can switch branches, make local
+commits and rebuild without losing work. To move to a new ref, check it out in
+the tree by hand, or remove the tree and rerun `make qemu-fetch` to clone
+fresh at `QEMU_GIT_VERSION`.
+
 ## Build target (`QEMU_TARGET`)
 
 The QEMU `--target-list` value, derived from the target architecture:
diff --git a/playbooks/roles/qemu/tasks/main.yml b/playbooks/roles/qemu/tasks/main.yml
index 8298adcf..599ca736 100644
--- a/playbooks/roles/qemu/tasks/main.yml
+++ b/playbooks/roles/qemu/tasks/main.yml
@@ -53,6 +53,7 @@
     repo: "{{ qemu_git }}"
     dest: "{{ qemu_data }}"
     version: "{{ qemu_version }}"
+    update: false
   tags: ["qemu_fetch"]
 
 - name: Create the out-of-tree build directory

-- 
2.54.0