Author: ayoung
Date: Thu Mar 22 06:36:50 2012
New Revision: 9671

URL: http://svn.slimdevices.com/jive?rev=9671&view=rev
Log:
Calculate revision number for SqueezeOS and SqueezePlay based on concatenation 
of  Squeezeplay and Poky  revisions.

Introduce a python method, squeezeos_squeezeplay_revision(), into 
squeezeplay_svn.bb.
This is used for both the SQUEEZEPLAY_REVISION in the squeezeplay build and for 
the SQUEEZEOS_REVISION when writing out /etc/squeezeos.version and the image 
files.

Calculate the revision number by using the stashed git revision count or 
subversion revision number for squeezeplay and appending the revision number or 
count for the poky build we are in. If both are using subversion then assume 
(require) they use the same repo and use only the one revision number.

The calculation is done in a new task, make_squeezeos_squeezeplay_revision, in 
squeezeplay_svn.bb. This stashes the result in staging for use by 
squeezeos_squeezeplay_revision().

squeezeos-image-boot.bb's do_rootfs task is made dependent upon squeezeplay's 
do_make_squeezeos_squeezeplay_revision task to ensure that the squeezeplay git 
revision count is available, although the install dependencies would in fact 
make this unnecessary.

Modified:
    
7.8/trunk/squeezeos/poky/meta-squeezeos/classes/squeezeos-upgrade-image.bbclass
    
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/images/squeezeos-image-boot.bb
    
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/squeezeplay/squeezeplay_svn.bb

Modified: 
7.8/trunk/squeezeos/poky/meta-squeezeos/classes/squeezeos-upgrade-image.bbclass
URL: 
http://svn.slimdevices.com/jive/7.8/trunk/squeezeos/poky/meta-squeezeos/classes/squeezeos-upgrade-image.bbclass?rev=9671&r1=9670&r2=9671&view=diff
==============================================================================
--- 
7.8/trunk/squeezeos/poky/meta-squeezeos/classes/squeezeos-upgrade-image.bbclass 
(original)
+++ 
7.8/trunk/squeezeos/poky/meta-squeezeos/classes/squeezeos-upgrade-image.bbclass 
Thu Mar 22 06:36:50 2012
@@ -26,7 +26,7 @@
        cd ${tmpdir}
        md5sum zImage${IMAGE_SQUEEZEOS_EXTRA_VERSION} root.cramfs  > upgrade.md5
 
-       VERSION=${DISTRO_RELEASE}_r${SQUEEZEOS_REVISION}
+       VERSION=${DISTRO_RELEASE}_r${@squeezeos_squeezeplay_revision(d)}
 
        # Create zip
        rm -f ${DEPLOY_DIR_IMAGE}/${MACHINE}_${VERSION}.bin
@@ -43,6 +43,7 @@
 addtask squeezeos_image after do_rootfs before do_build
 
 squeezeos_version() {
-       echo "${DISTRO_RELEASE} r${SQUEEZEOS_REVISION}" > 
${IMAGE_ROOTFS}/etc/squeezeos.version
+       echo "${DISTRO_RELEASE} r${@squeezeos_squeezeplay_revision(d)}" > 
${IMAGE_ROOTFS}/etc/squeezeos.version
        echo `whoami`@`hostname` `date` >> ${IMAGE_ROOTFS}/etc/squeezeos.version
+       echo "Base build revision: " ${METADATA_REVISION} >> 
${IMAGE_ROOTFS}/etc/squeezeos.version
 }

Modified: 
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/images/squeezeos-image-boot.bb
URL: 
http://svn.slimdevices.com/jive/7.8/trunk/squeezeos/poky/meta-squeezeos/packages/images/squeezeos-image-boot.bb?rev=9671&r1=9670&r2=9671&view=diff
==============================================================================
--- 
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/images/squeezeos-image-boot.bb 
(original)
+++ 
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/images/squeezeos-image-boot.bb 
Thu Mar 22 06:36:50 2012
@@ -4,6 +4,8 @@
 PR = "r1"
 
 inherit image squeezeos-upgrade-image
+
+do_rootfs[depends] += "squeezeplay:do_make_squeezeos_squeezeplay_revision"
 
 IMAGE_INSTALL += " \
        squeezeos-base-files \

Modified: 
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/squeezeplay/squeezeplay_svn.bb
URL: 
http://svn.slimdevices.com/jive/7.8/trunk/squeezeos/poky/meta-squeezeos/packages/squeezeplay/squeezeplay_svn.bb?rev=9671&r1=9670&r2=9671&view=diff
==============================================================================
--- 
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/squeezeplay/squeezeplay_svn.bb 
(original)
+++ 
7.8/trunk/squeezeos/poky/meta-squeezeos/packages/squeezeplay/squeezeplay_svn.bb 
Thu Mar 22 06:36:50 2012
@@ -28,10 +28,51 @@
 DEPENDS += "${@base_conditional('ENABLE_SPPRIVATE', 'yes', 
'squeezeplay-private', '', d)}"
 EXTRA_OECONF += "${@base_conditional('ENABLE_SPPRIVATE', 'yes', 
'--with-spprivate', '', d)}"
 
-CFLAGS_prepend = '-DSQUEEZEPLAY_RELEASE=\\"${DISTRO_RELEASE}\\" 
-DSQUEEZEPLAY_REVISION=\\"${SQUEEZEOS_REVISION}\\"'
+CFLAGS_prepend = '-DSQUEEZEPLAY_RELEASE=\\"${DISTRO_RELEASE}\\" 
-DSQUEEZEPLAY_REVISION=\\"${@squeezeos_squeezeplay_revision(d)}\\"'
 
 EXTRA_OEMAKE = "all lua-lint"
 
+python do_make_squeezeos_squeezeplay_revision() {
+       import bb, os
+       
+       # 4 cases to consider: SqueezeOS and SqueezePlay could each have come 
from
+       # either subversion or git. Use length of revision string and presence
+       # of subversion (.svn) directory and .git_revision_count file to decide.
+       
+       osRevision = bb.data.getVar('SQUEEZEOS_REVISION', d, 1)
+       if len(osRevision) > 8: # assume a git revision hash
+               s = os.popen("cd %s; git rev-list %s -- | wc -l" % 
(bb.data.getVar('OEROOT', d, 1), bb.data.getVar('METADATA_REVISION', d, 
1))).read().strip()
+               osrev = "%05d" % int(s)
+       else:
+               osrev = osRevision
+
+       
+       os.chdir(bb.data.getVar('S', d, 1))
+       if os.path.exists('.svn'):
+               if len(osRevision) > 8: # assume a git revision hash
+                       # OS=git, SP=svn
+                       sprev = os.popen("svn info | sed -n 's/^Revision: //p' 
| head -1").read().strip()
+               else:
+                       # OS=svn, S=svn
+                       # Assume (require) same repository
+                       sprev = ""
+       elif os.path.exists('.git_revision_count'):
+               sprev = open(os.path.join(bb.data.getVar('S', d, 1), 
'.git_revision_count'), 'r').readline().strip()
+       else:
+               # SP type unknown - just use OS revision
+               sprev = ""
+               
+       staging = bb.data.getVar('STAGING_DIR_TARGET', d, 1)
+       bb.mkdirhier(staging)
+       revision = "%s%s" % (sprev, osrev)
+       open(os.path.join(staging, 'squeezeos_squeezeplay_revision'), 
'w').write("%s\n" % revision)
+}
+
+addtask make_squeezeos_squeezeplay_revision after do_unpack before do_configure
+
+def squeezeos_squeezeplay_revision(d):
+       import bb, os
+       return open(os.path.join(bb.data.getVar('STAGING_DIR_TARGET', d, 1), 
'squeezeos_squeezeplay_revision'), 'r').readline().strip()
 
 do_stage() {
        install -d ${STAGING_INCDIR}/squeezeplay

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to