Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Cc: Troy Lee <troy_lee@aspeedtech.com>,
	Jamin Lin <jamin_lin@aspeedtech.com>,
	Vince Chang <vince_chang@aspeedtech.com>
Subject: [PATCH v1 2/2] reproducible: Handle nested git repos in find_git_repositories
Date: Fri, 15 May 2026 09:36:19 +0000	[thread overview]
Message-ID: <20260515093615.126849-3-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20260515093615.126849-1-jamin_lin@aspeedtech.com>

When EXTERNALSRC contains multiple nested git repositories (from
multiple SRC_URI git entries with different destsuffix values),
find_git_repositories() walks into sub-repos and
get_source_date_epoch_from_git() subsequently fails with exit code 128
when running 'git log -1' inside them.

Two fixes:
- Stop os.walk recursion when a .git entry is found (dirs[:] = []) to
  avoid descending into nested repos.
- Change 'git log -1' from check=True to check=False with explicit
  error handling, so a failing nested repo is skipped gracefully
  instead of raising CalledProcessError and aborting do_unpack.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 meta/lib/oe/reproducible.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py
index a80376010a..6bb25da55a 100644
--- a/meta/lib/oe/reproducible.py
+++ b/meta/lib/oe/reproducible.py
@@ -82,6 +82,7 @@ def find_git_repositories(d, sourcedir):
         for root, dirs, files in os.walk(mainpath, topdown=True):
             if '.git' in dirs or '.git' in files:
                 git_repositories.append(root)
+                dirs[:] = []  # don't recurse into nested git repos (multiple SRC_URI destsuffix)
 
     if not git_repositories:
         bb.warn('Failed to find any git repositories in UNPACKDIR or S')
@@ -105,7 +106,10 @@ def get_source_date_epoch_from_git(d, sourcedir):
 
         bb.debug(1, "git repository: %s" % repo_path)
         p = subprocess.run(['git', '-C', repo_path, 'log', '-1', '--pretty=%ct'],
-                           check=True, stdout=subprocess.PIPE)
+                           check=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        if p.returncode != 0:
+            bb.debug(1, "git log failed for %s (exit %d): %s" % (repo_path, p.returncode, p.stdout.decode('utf-8')))
+            continue
         source_dates.append(int(p.stdout.decode('utf-8')))
 
     if source_dates:
-- 
2.43.0


  parent reply	other threads:[~2026-05-15  9:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  9:36 [PATCH v1 0/2] oe: Fix build failures with multiple git SRC_URI entries Jamin Lin
2026-05-15  9:36 ` [PATCH v1 1/2] externalsrc: Handle nested git repos from multiple " Jamin Lin
2026-05-18 19:16   ` Paul Barker
2026-05-19  6:28     ` Jamin Lin
2026-05-19 10:04       ` [OE-core] " Paul Barker
2026-05-20  3:25         ` Jamin Lin
2026-05-20  5:24           ` Jamin Lin
2026-05-19  7:07     ` Jamin Lin
2026-05-19  9:09       ` Jamin Lin
2026-05-15  9:36 ` Jamin Lin [this message]
2026-05-18 19:22   ` [PATCH v1 2/2] reproducible: Handle nested git repos in find_git_repositories Paul Barker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515093615.126849-3-jamin_lin@aspeedtech.com \
    --to=jamin_lin@aspeedtech.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=troy_lee@aspeedtech.com \
    --cc=vince_chang@aspeedtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox