From 334a20160e0c4e8119478542fdacade1f268a1c1 Mon Sep 17 00:00:00 2001
From: Stephane Desneux <stephane.desneux@iot.bzh>
Date: Thu, 13 Jun 2019 10:27:55 +0000
Subject: [PATCH] distro-build-manifest: fix DIST_LAYERS due to new layout

New layout with subfolders causes incomplete DIST_LAYERS to be generated
in deploy/images/.../build-info.

This patches fixes how git repos are found in the layers directory.

Bug-AGL: SPEC-2450

Change-Id: I4b6a62b68064de12119e668522242677e11c65eb
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
---
 scripts/distro-manifest-generator.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/distro-manifest-generator.sh b/scripts/distro-manifest-generator.sh
index 834cde248..7552b9942 100755
--- a/scripts/distro-manifest-generator.sh
+++ b/scripts/distro-manifest-generator.sh
@@ -155,7 +155,7 @@ function _getgitmanifest() {
 
 	local gitrepo gitrev metagitdir sep=""
 	DIST_LAYERS=""
-	for metagitdir in $(ls -d $DIST_METADIR/*/.git); do
+	for metagitdir in $(find $DIST_METADIR -type d -name ".git"); do
 		gitrepo=$($REALPATH -Ls $metagitdir/.. --relative-to=$DIST_METADIR)
 		pushd $DIST_METADIR/$gitrepo &>/dev/null && {
 			gitrev=$( { $GIT describe --long --dirty --always 2>/dev/null || echo "unknown_revision"; } | tr ' \t' '__' )
-- 
2.16.6