[oe-commits] org.oe.dev base.bbclass: Add code to make 'rebuild' continue to work after changes in bitbake. Bitbake 1.8.10 users should be unaffected, bitbake 1.8.11 users will need the latest svn stable branch bitbake. Only the rebuild task is affected by the changes

rpurdie commit openembedded-commits at lists.openembedded.org
Tue Feb 26 18:05:07 UTC 2008


base.bbclass: Add code to make 'rebuild' continue to work after changes in bitbake. Bitbake 1.8.10 users should be unaffected, bitbake 1.8.11 users will need the latest svn stable branch bitbake. Only the rebuild task is affected by the changes

Author: rpurdie at openembedded.org
Branch: org.openembedded.dev
Revision: 91782f0ec824ced8214a20e5d2f8b080c82c25d5
ViewMTN: http://monotone.openembedded.org/revision/info/91782f0ec824ced8214a20e5d2f8b080c82c25d5
Files:
1
classes/base.bbclass
Diffs:

#
# mt diff -r24fc5bcb6ca7629a829277b0e6a1e6e8734f60ec -r91782f0ec824ced8214a20e5d2f8b080c82c25d5
#
# 
# 
# patch "classes/base.bbclass"
#  from [1a4cea219c6fbdcac157bc9e75d192ac0d8ff7fc]
#    to [cb47f4951ca60041e077ae00509c54961b54d573]
# 
============================================================
--- classes/base.bbclass	1a4cea219c6fbdcac157bc9e75d192ac0d8ff7fc
+++ classes/base.bbclass	cb47f4951ca60041e077ae00509c54961b54d573
@@ -424,13 +424,21 @@ python base_do_clean() {
 	os.system('rm -f '+ dir)
 }
 
+#Uncomment this for bitbake 1.8.12
+#addtask rebuild after do_${BB_DEFAULT_TASK}
 addtask rebuild
 do_rebuild[dirs] = "${TOPDIR}"
 do_rebuild[nostamp] = "1"
 python base_do_rebuild() {
 	"""rebuild a package"""
-	bb.build.exec_task('do_clean', d)
-	bb.build.exec_task('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1), d)
+	from bb import __version__
+	try:
+		from distutils.version import LooseVersion
+	except ImportError:
+		def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1
+	if (LooseVersion(__version__) < LooseVersion('1.8.11')):
+		bb.build.exec_func('do_clean', d)
+		bb.build.exec_task('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1), d)
 }
 
 addtask mrproper
@@ -442,7 +450,7 @@ python base_do_mrproper() {
 	if dir == '/': bb.build.FuncFailed("wrong DATADIR")
 	bb.debug(2, "removing " + dir)
 	os.system('rm -rf ' + dir)
-	bb.build.exec_task('do_clean', d)
+	bb.build.exec_func('do_clean', d)
 }
 
 addtask fetch
@@ -663,6 +671,17 @@ python base_eventhandler() {
 		if pesteruser:
 			bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
 
+	#
+	# Handle removing stamps for 'rebuild' task
+	#
+	if name.startswith("StampUpdate"):
+		for (fn, task) in e.targets:
+			#print "%s %s" % (task, fn)         
+			if task == "do_rebuild":
+				dir = "%s.*" % e.stampPrefix[fn]
+				bb.note("Removing stamps: " + dir)
+				os.system('rm -f '+ dir)
+
 	if not data in e.__dict__:
 		return NotHandled
 
@@ -900,7 +919,19 @@ python () {
                 return
 
 python () {
+    import bb
+    from bb import __version__
     base_after_parse(d)
+
+    # Remove this for bitbake 1.8.12
+    try:
+        from distutils.version import LooseVersion
+    except ImportError:
+        def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1
+    if (LooseVersion(__version__) >= LooseVersion('1.8.11')):
+        deps = bb.data.getVarFlag('do_rebuild', 'deps', d) or []
+        deps.append('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1))
+        bb.data.setVarFlag('do_rebuild', 'deps', deps, d)
 }
 
 def check_app_exists(app, d):






More information about the Openembedded-commits mailing list