[oe-commits] Chris Larson : srctree, clean: cleanup & split out do_clean bits into clean .bbclass.

git version control git at git.openembedded.org
Wed Aug 26 21:47:24 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 2259a81628ac8bafb19e2b9ba9acca1c0dad341d
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=2259a81628ac8bafb19e2b9ba9acca1c0dad341d

Author: Chris Larson <clarson at mvista.com>
Date:   Wed Aug 26 14:44:04 2009 -0700

srctree, clean: cleanup & split out do_clean bits into clean.bbclass.

Signed-off-by: Chris Larson <clarson at mvista.com>

---

 classes/clean.bbclass   |   53 ++++++++++++++++++++++++++++++
 classes/srctree.bbclass |   82 +++++-----------------------------------------
 2 files changed, 62 insertions(+), 73 deletions(-)

diff --git a/classes/clean.bbclass b/classes/clean.bbclass
new file mode 100644
index 0000000..65c1ab5
--- /dev/null
+++ b/classes/clean.bbclass
@@ -0,0 +1,53 @@
+def clean_builddir(d):
+	from shutil import rmtree
+
+	builddir = d.getVar("B", True)
+	srcdir = d.getVar("S", True)
+	if builddir != srcdir:
+		rmtree(builddir, ignore_errors=True)
+
+def clean_stamps(d):
+	from glob import glob
+	from bb import note
+	from bb.data import expand
+	from os import unlink
+
+	note("Removing stamps")
+	for stamp in glob(expand('${STAMP}.*', d)):
+		try:
+			unlink(stamp)
+		except OSError:
+			pass
+
+def clean_workdir(d):
+	from shutil import rmtree
+	from bb import note
+
+	workdir = d.getVar("WORKDIR", 1)
+	note("Removing %s" % workdir)
+	rmtree(workdir, ignore_errors=True)
+
+def clean_git(d):
+	from subprocess import call
+
+	call(["git", "clean", "-d", "-f", "-X"], cwd=d.getVar("S", True))
+
+def clean_make(d):
+	import bb
+
+	bb.note("Running make clean")
+	try:
+		bb.build.exec_func("__do_clean_make", d)
+	except bb.build.FuncFailed:
+		pass
+
+__do_clean_make () {
+	oe_runmake clean
+}
+
+python do_clean () {
+	clean_stamps(d)
+	clean_workdir(d)
+	clean_builddir(d)
+	clean_make(d)
+}
diff --git a/classes/srctree.bbclass b/classes/srctree.bbclass
index 67cb9ff..ce9cb83 100644
--- a/classes/srctree.bbclass
+++ b/classes/srctree.bbclass
@@ -14,29 +14,13 @@
 # operation.
 
 
+# Grab convenience methods & sane default for do_clean
+inherit clean
+
+# Build here
 S = "${FILE_DIRNAME}"
 SRC_URI = ""
 
-#TYPE = "${@'${PN}'.replace('${BPN}', '').strip()}"
-#WORKDIR = "${S}/tmp${TYPE}.${MULTIMACH_HOST_SYS}"
-#STAMP = "${WORKDIR}/tasks/stamp"
-#WORKDIR_LOCAL = "${S}/tmp${TYPE}.${MULTIMACH_HOST_SYS}"
-#T = "${WORKDIR_LOCAL}/bitbake-tasks"
-
-# Hack, so things don't explode in builds that don't inherit package
-do_package ?= "    pass"
-do_package[func] = "1"
-do_package[python] = "1"
-addtask package after do_populate_staging
-
-# This stuff is needed to facilitate variants (normal, native, cross, sdk)
-# that share a ${S}.  It's ugly as hell.  Only really necessary for recipes
-# that can't use a ${B}, and which have variants like native.  Not sure what
-# the best solution is long term.
-#
-# We merge configure+compile+install into the populate_staging task, uses a
-# lock file.  This ensures that none of the tasks which access ${S} can
-# interleave amongst the recipes that share that ${S}.
 
 def merge_tasks(d):
 	"""
@@ -130,56 +114,8 @@ python do_populate_staging () {
 }
 do_populate_staging[lockfiles] += "${S}/.lock"
 
-make_do_clean () {
-	oe_runmake clean
-}
-
-def clean_builddir(d):
-	from shutil import rmtree
-
-	builddir = d.getVar("B", True)
-	srcdir = d.getVar("S", True)
-	if builddir != srcdir:
-		rmtree(builddir, ignore_errors=True)
-
-def clean_stamps(d):
-	from glob import glob
-	from bb import note
-	from bb.data import expand
-	from os import unlink
-
-	note("Removing stamps")
-	for stamp in glob(expand('${STAMP}.*', d)):
-		try:
-			unlink(stamp)
-		except OSError:
-			pass
-
-def clean_workdir(d):
-	from shutil import rmtree
-	from bb import note
-
-	workdir = d.getVar("WORKDIR", 1)
-	note("Removing %s" % workdir)
-	rmtree(workdir, ignore_errors=True)
-
-def clean_git(d):
-	from subprocess import call
-
-	call(["git", "clean", "-d", "-f", "-X"], cwd=d.getVar("S", True))
-
-def clean_make(d):
-	import bb
-
-	bb.note("Running make clean")
-	try:
-		bb.build.exec_func("make_do_clean", d)
-	except bb.build.FuncFailed:
-		pass
-
-python do_clean () {
-	clean_stamps(d)
-	clean_workdir(d)
-	clean_builddir(d)
-	clean_make(d)
-}
+# Hack, so things don't explode in builds that don't inherit package
+do_package ?= "    pass"
+do_package[func] = "1"
+do_package[python] = "1"
+addtask package after do_populate_staging





More information about the Openembedded-commits mailing list