[oe-commits] Holger Hans Peter Freyther : classes/conf: Handle Distro PR changes more gracefully
GIT User account
git at amethyst.openembedded.net
Sat Oct 18 17:27:30 UTC 2008
Module: openembedded.git
Branch: shared/file-pr-revert
Commit: f4eb6eb562fb3c53b4128185287d3f3364e25188
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=f4eb6eb562fb3c53b4128185287d3f3364e25188
Author: Holger Hans Peter Freyther <zecke at selfish.org>
Date: Sat Oct 18 18:16:39 2008 +0200
classes/conf: Handle Distro PR changes more gracefully
This patch:
* Reverts the FILE_PR changes.
* Mangles the PR values by including the DISTRO_PR value in the package
classes.
* 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/package.bbclass | 6 ++++++
classes/package_deb.bbclass | 6 +++---
classes/package_ipk.bbclass | 6 +++---
classes/package_rpm.bbclass | 8 ++++----
classes/package_tar.bbclass | 4 ++--
classes/sanity.bbclass | 18 +++++++++++++++++-
conf/abi_version.conf | 15 +++++++++++++++
conf/bitbake.conf | 2 +-
conf/sanity.conf | 8 +-------
9 files changed, 52 insertions(+), 21 deletions(-)
diff --git a/classes/package.bbclass b/classes/package.bbclass
index a12bfb0..5daa706 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -4,6 +4,12 @@
PKGDEST = "${WORKDIR}/install"
+def build_package_revision(d):
+ file_pr = bb.data.getVar('PR', d, True)
+ distro_pr = bb.data.getVar('DISTRO_PR', d, True) or ""
+ return "%s%s" % (file_pr, distro_pr)
+
+
def legitimize_package_name(s):
"""
Make sure package names are legitimate strings
diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass
index e59d194..64d8d4e 100644
--- a/classes/package_deb.bbclass
+++ b/classes/package_deb.bbclass
@@ -131,7 +131,7 @@ python do_package_deb () {
pass
if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
from bb import note
- note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
+ note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), build_package_revision(localdata)))
bb.utils.unlockfile(lf)
continue
@@ -149,9 +149,9 @@ python do_package_deb () {
fields = []
pe = bb.data.getVar('PE', d, 1)
if pe and int(pe) > 0:
- fields.append(["Version: %s:%s-%s\n", ['PE', 'PV', 'PR']])
+ fields.append(["Version: %s:%s-%s%s\n", ['PE', 'PV', 'PR', 'DISTRO_PR']])
else:
- fields.append(["Version: %s-%s\n", ['PV', 'PR']])
+ fields.append(["Version: %s-%s%s\n", ['PV', 'PR', 'DISTRO_PR']])
fields.append(["Description: %s\n", ['DESCRIPTION']])
fields.append(["Section: %s\n", ['SECTION']])
fields.append(["Priority: %s\n", ['PRIORITY']])
diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass
index f05b744..438d4a1 100644
--- a/classes/package_ipk.bbclass
+++ b/classes/package_ipk.bbclass
@@ -178,7 +178,7 @@ python do_package_ipk () {
pass
if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
from bb import note
- note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
+ note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), build_package_revision(localdata)))
bb.utils.unlockfile(lf)
continue
@@ -193,9 +193,9 @@ python do_package_ipk () {
fields = []
pe = bb.data.getVar('PE', d, 1)
if pe and int(pe) > 0:
- fields.append(["Version: %s:%s-%s\n", ['PE', 'PV', 'PR']])
+ fields.append(["Version: %s:%s-%s%s\n", ['PE', 'PV', 'PR', 'DISTRO_PR']])
else:
- fields.append(["Version: %s-%s\n", ['PV', 'PR']])
+ fields.append(["Version: %s-%s%s\n", ['PV', 'PR', 'DISTRO_PR']])
fields.append(["Description: %s\n", ['DESCRIPTION']])
fields.append(["Section: %s\n", ['SECTION']])
fields.append(["Priority: %s\n", ['PRIORITY']])
diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass
index 6713f8f..e10ad90 100644
--- a/classes/package_rpm.bbclass
+++ b/classes/package_rpm.bbclass
@@ -10,7 +10,6 @@ python write_specfile() {
out_vartranslate = {
"PKG": "Name",
"PV": "Version",
- "PR": "Release",
"DESCRIPTION": "%description",
"ROOT": "BuildRoot",
"LICENSE": "License",
@@ -41,7 +40,7 @@ python write_specfile() {
pass
if not files:
from bb import note
- note("Not creating empty archive for %s-%s-%s" % (bb.data.getVar('PKG',d, 1), bb.data.getVar('PV', d, 1), bb.data.getVar('PR', d, 1)))
+ note("Not creating empty archive for %s-%s-%s" % (bb.data.getVar('PKG',d, 1), bb.data.getVar('PV', d, 1), build_package_revision(d)))
return
# output .spec using this metadata store
@@ -58,6 +57,7 @@ python write_specfile() {
if out_vartranslate[var][0] == "%":
continue
fd.write("%s\t: %s\n" % (out_vartranslate[var], bb.data.getVar(var, d)))
+ fd.write("Release\t: %s\n" % build_package_revision(d))
fd.write("Summary\t: .\n")
for var in out_vartranslate.keys():
@@ -79,8 +79,8 @@ python write_specfile() {
bb.build.exec_func('BUILDSPEC', d)
# move the rpm into the pkgoutdir
- rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d)
- outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d)
+ rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${PV}-${PR}${DISTRO_PR}.${TARGET_ARCH}.rpm', d)
+ outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${PV}-${PR}${DISTRO_PR}.${TARGET_ARCH}.rpm', d)
bb.movefile(rpm, outrpm)
}
diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass
index 876cec6..9ce0c98 100644
--- a/classes/package_tar.bbclass
+++ b/classes/package_tar.bbclass
@@ -5,7 +5,7 @@ IMAGE_PKGTYPE ?= "tar"
python package_tar_fn () {
import os
from bb import data
- fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (bb.data.getVar('PKG', d), bb.data.getVar('PV', d), bb.data.getVar('PR', d)))
+ fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (bb.data.getVar('PKG', d), bb.data.getVar('PV', d), build_package_revision(d)))
fn = bb.data.expand(fn, d)
bb.data.setVar('PKGFN', fn, d)
}
@@ -86,7 +86,7 @@ python do_package_tar () {
os.chdir(root)
from glob import glob
if not glob('*'):
- bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
+ bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), build_package_revision(localdata)))
continue
ret = os.system("tar -czf %s %s" % (tarfn, '.'))
if ret != 0:
diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass
index 7aabe04..8b0ca4d 100644
--- a/classes/sanity.bbclass
+++ b/classes/sanity.bbclass
@@ -138,7 +138,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")
@@ -154,6 +154,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)
diff --git a/conf/abi_version.conf b/conf/abi_version.conf
new file mode 100644
index 0000000..7939d65
--- /dev/null
+++ b/conf/abi_version.conf
@@ -0,0 +1,15 @@
+#
+# OELAYOUT_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.
+#
+OELAYOUT_ABI = "2"
+
+#
+# DISTRO_PR allows us to regenerate all packages when a fundamental change is
+# made which requires such a global change. This is appended to the recipe
+# specific PR values when set. A default value is given here but a distro can
+# override this value.
+#
+DISTRO_PR ?= ""
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index c5feb09..309d471 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -145,7 +145,6 @@ P = "${PN}-${PV}"
##################################################################
# Distro default
##################################################################
-DISTRO_PR ?= ""
# Package info.
@@ -578,6 +577,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)
diff --git a/conf/sanity.conf b/conf/sanity.conf
index e5fe748..d6ecfa6 100644
--- a/conf/sanity.conf
+++ b/conf/sanity.conf
@@ -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"
More information about the Openembedded-commits
mailing list