[oe-commits] Koen Kooi : lockdown: steal some bits from openmoko that will dump prefferred_versions to TMPDIR

git version control git at git.openembedded.org
Wed May 27 22:02:42 UTC 2009


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

Author: Koen Kooi <koen at openembedded.org>
Date:   Thu May 28 00:00:19 2009 +0200

lockdown: steal some bits from openmoko that will dump prefferred_versions to TMPDIR
* freeze.inc would work as well, but I got this working first

---

 classes/lockdown.bbclass |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/classes/lockdown.bbclass b/classes/lockdown.bbclass
new file mode 100644
index 0000000..45b9761
--- /dev/null
+++ b/classes/lockdown.bbclass
@@ -0,0 +1,41 @@
+addtask show_versions before do_build
+do_show_versions[nostamp] = "1"
+python do_show_versions() {
+	import sys
+
+	localdata = bb.data.createCopy(d)
+	bb.data.update_data(localdata)
+
+	src_uri = bb.data.getVar('SRC_URI', localdata, 1)
+	if not src_uri:
+		return 1
+
+	try:
+		bb.fetch.init(src_uri.split(),d)
+	except bb.fetch.NoMethodError:
+		(type, value, traceback) = sys.exc_info()
+		raise bb.build.FuncFailed("No method: %s" % value)
+
+
+	src_uri = bb.data.getVar("SRC_URI", d, False)
+	pn = bb.data.getVar("PN", d, True)
+	src_revs = open("%s/src_revs.inc" % bb.data.getVar("TMPDIR", d, 1), "a")
+	src_dates = open("%s/src_dates.inc" % bb.data.getVar("TMPDIR", d, 1), "a")
+	pref_versions = open("%s/preferred_versions.inc" % bb.data.getVar("TMPDIR", d, 1), "a")
+	if "SRCREV" in bb.data.getVar("PV", d, False):
+		print >> src_revs, 'SRCREV_pn-%(pn)s ?= "%(rev)s"' % { 'pn' : pn, 'rev' : bb.data.getVar("SRCREV", d, True) }
+	elif "cvs://" in src_uri or "svn://" in src_uri or "git://" in src_uri:
+		print >> src_dates, 'SRCDATE_pn-%(pn)s ?= "%(date)s"' % { 'pn' : pn, 'date' : bb.data.getVar("SRCDATE", d, True) }
+
+	print >> pref_versions, 'PREFERRED_VERSION_%(pn)s = "%(version)s"' % { "pn" : pn, 'version' : bb.data.getVar("PV", d, True) }
+	src_revs.close()
+	src_dates.close()
+	pref_versions.close()
+}
+
+addtask lockdown
+do_lockdown[nostamp] = "1"
+do_lockdown[recrdeptask] = "do_show_versions"
+python do_lockdown() {
+}
+





More information about the Openembedded-commits mailing list