[1/3] kernel-yocto: improve error checking on non-git repos

Submitted by Bruce Ashfield on Sept. 3, 2013, 3:16 p.m.


Message ID ce9e2f9982e150dd1fdbb8a6b624d38784d27705.1378221277.git.bruce.ashfield@windriver.com
State Accepted
Commit 0ebf67e8b4f7aaf259d7abac4af645070d846ec8
Headers show

Commit Message

Bruce Ashfield Sept. 3, 2013, 3:16 p.m.
While non-git kernel repos are not the preferred format for a kernel upstream,
they are supported. Depending on the creator of the archive the expanded
source directory name varies. If the recipe for the kernel doesn't properly
set S to the right value, a cryptic git error message is produced. We can
detect the situation and offer some advice on how to fix the issue.

A second check is also added in this commit for archive based kernel repos
which won't have a SRCREV to validate. If we have no SRCREV or SRCREV is
INVALID, we can exit the branch validation step immediately. This saves yet
another cryptic git error message and simplifies a custom tgz based recipe.

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
 meta/classes/kernel-yocto.bbclass |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 26d449a..97a5fa7 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -176,7 +176,17 @@  do_kernel_checkout() {
 		# case 3: we have no git repository at all. 
 		# To support low bandwidth options for building the kernel, we'll just 
 		# convert the tree to a git repo and let the rest of the process work unchanged
+		# if ${S} hasn't been set to the proper subdirectory a default of "linux" is 
+		# used, but we can't initialize that empty directory. So check it and throw a
+		# clear error
 	        cd ${S}
+		if [ ! -f "Makefile" ]; then
+			echo "[ERROR]: S is not set to the linux source directory. Check "
+			echo "         the recipe and set S to the proper extracted subdirectory"
+			exit 1
+		fi
 		git init
 		git add .
 		git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
@@ -288,7 +298,8 @@  do_validate_branches() {
 	set +e
 	# if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
 	# check and we can exit early
-	if [ "${SRCREV_machine}" = "AUTOINC" ]; then
+	if [ "${SRCREV_machine}" = "AUTOINC" ] || "${SRCREV_machine}" = "INVALID" ] ||
+	   [ "${SRCREV_machine}" = "" ]; then