classes/conf: Handle Distro PR change in sanity.bbclass
authorRichard Purdie <rpurdie@linux.intel.com>
Mon, 27 Oct 2008 18:46:51 +0000 (18:46 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Mon, 27 Oct 2008 19:28:26 +0000 (19:28 +0000)
This patch:
* Moves the ABI variables into a new abi_version.conf (like Poky).
* Renames SANITY_ABI to OELAYOUT_ABI since it has uses outside
  sanity.bbclass and sanity.conf.
* Adds checks to sanity.bbclass so the user is notified when DISTRO_PR
  changes in a similar way to the OELAYOUT_ABI versions.

classes/sanity.bbclass
conf/bitbake.conf
conf/sanity.conf

index b925d05..c9effb5 100644 (file)
@@ -140,7 +140,7 @@ def check_sanity(e):
        #
        # Check the 'ABI' of TMPDIR
        #
-       current_abi = data.getVar('SANITY_ABI', e.data, True)
+       current_abi = data.getVar('OELAYOUT_ABI', e.data, True)
        abifile = data.getVar('SANITY_ABIFILE', e.data, True)
        if os.path.exists(abifile):
                f = file(abifile, "r")
@@ -156,6 +156,22 @@ def check_sanity(e):
                f.write(current_abi)
        f.close()
 
+       #
+       # Check the Distro PR value didn't change
+       #
+       distro_pr = data.getVar('DISTRO_PR', e.data, True)
+       prfile = data.getVar('SANITY_PRFILE', e.data, True)
+       if os.path.exists(prfile):
+               f = file(prfile, "r")
+               pr = f.read().strip()
+               if (pr != distro_pr):
+                       # Code to convert from one ABI to another could go here if possible.
+                       messages = messages + "Error, DISTRO_PR has changed (%s to %s) which means all packages need to rebuild. Please remove your TMPDIR so this can happen. For autobuilder setups you can avoid this by using a TMPDIR that include DISTRO_PR in the path.\n" % (pr, distro_pr)
+       else:
+               f = file(prfile, "w")
+               f.write(distro_pr)
+       f.close()
+
        if messages != "":
                raise_sanity_error(messages)
 
index ab8fa9d..6207e5b 100644 (file)
@@ -580,6 +580,7 @@ include conf/machine/${MACHINE}.conf
 include conf/distro/${DISTRO}.conf
 include conf/documentation.conf
 require conf/sanity.conf
+require conf/abi_version.conf
 
 ##################################################################
 # Weak variables (usually to retain backwards compatibility)
index e5fe748..d6ecfa6 100644 (file)
@@ -5,14 +5,8 @@
 # Expert users can confirm their sanity with "touch conf/sanity.conf"
 BB_MIN_VERSION = "1.8.10"
 
-#
-# SANITY_ABI allows us to notify users when the format of TMPDIR changes in 
-# an incompatible way. Such changes should usually be detailed in the commit
-# that breaks the format and have been previously discussed on the mailing list 
-# with general agreement from the core team.
-#
-SANITY_ABI = "2"
 SANITY_ABIFILE = "${TMPDIR}/abi_version"
+SANITY_PRFILE = "${TMPDIR}/distro_pr"
 
 INHERIT += "sanity"