[oe-layersetup] oe-layertool-setup.sh: Provide valid image names

Message ID 20220318182805.6734-1-nm@ti.com
State Accepted
Delegated to: Ryan Eatmon
Headers show
Series [oe-layersetup] oe-layertool-setup.sh: Provide valid image names | expand

Commit Message

Nishanth Menon March 18, 2022, 6:28 p.m. UTC
Instead of providing generic image names that could change in the
future, lets try and parse the possible valid image names that users can
potentially use.

Signed-off-by: Nishanth Menon <nm@ti.com>
---

example output (with dunfell-config.txt):
	https://gist.github.com/nmenon/7c79070e048dda2397581ba8a72a1cdf

 oe-layertool-setup.sh | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

Patch

diff --git a/oe-layertool-setup.sh b/oe-layertool-setup.sh
index 85be8b03f7d0..92945209771c 100755
--- a/oe-layertool-setup.sh
+++ b/oe-layertool-setup.sh
@@ -773,6 +773,35 @@  EOM
     sed -i "s|^DL_DIR.*|DL_DIR = \"${dldir}\"|" $confdir/local.conf
 }
 
+print_image_names() {
+    SOURCES="${1}"
+    FOLDERS=`find "${SOURCES}" -type d -a -iname images|grep recipes-core|sed -e "s/.*sources\///g"|cut -d '/' -f1|sort -u -r`
+    IMAGES=""
+    for FOLDER in ${FOLDERS}
+    do
+        RECO=""
+        if [ "${FOLDER}" == "meta-arago" ]; then
+            RECO="[recommended]"
+        fi
+        echo "From ${FOLDER}${RECO}:"
+        F_IMAGE_FOLDERS=`find "${SOURCES}/${FOLDER}" -type d -a -iname images|grep recipes-core`
+        for IMG_FOLDER in ${F_IMAGE_FOLDERS}
+        do
+            F_IMAGES=`find "${IMG_FOLDER}" -iname *.bb`
+            if [ -n "${F_IMAGES}" ]; then
+                for img in ${F_IMAGES}
+                do
+                    name=`basename "${img}"|sed 's/\.bb$//g'`
+                    summary=`grep SUMMARY "${img}"|cut -d '=' -f2| sed 's/["/]//g'|xargs  echo`
+                    if [ -z "${summary}" ]; then
+                        summary="No Summary available"
+                    fi
+                    echo -e "\t${name}: ${summary}"
+                done
+            fi
+        done
+    done
+}
 
 create_setenv_file() {
 cat << EOM
@@ -792,13 +821,9 @@  For example:
     MACHINE=xxxxx bitbake <target>
 
 Common targets are:
-    core-image-minimal
-    core-image-sato
-    meta-toolchain
-    meta-toolchain-sdk
-    adt-installer
-    meta-ide-support
 EOM
+print_image_names ${sourcedir}
+
 
     # Write the setenv file
 cat > $confdir/setenv << EOM