aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-01-26 10:44:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-29 08:49:44 +0000
commita321b28c8dafc9775f465ce7c0f6bcbe8ccc2945 (patch)
tree80c927c15a5d8dffbeda8d837e9c4e34a1b20500
parent8644d7bde6a30aec4e666ad59ff148f04c616a21 (diff)
downloadopenembedded-core-contrib-a321b28c8dafc9775f465ce7c0f6bcbe8ccc2945.tar.gz
python: fix parse dependencies
Adding a file-checksums flag for the manifest to do_split_packages doesn't achieve anything as do_split_packages isn't a task. Changing this to tha task do_package shows that the path is wrong, but we also know that as the manifest is in SRC_URI any changes to it would result in a rebuild anyway, so this line can be deleted. However there is a problem of the recipe not being reparsed when it needs to be, if the JSON has changed. The main bitbake process can hash the recipe and use stale data from the cache as it hasn't considered the manifest file changing. This results in non-determinism warnings when the worker parses the recipe again and comes to a different hash (as the manifest has changed, so the packaging changed). Solve this by calling bb.parse.mark_dependency() to declare the dependency on the manifest. Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/recipes-devtools/python/python3_3.5.3.bb45
-rw-r--r--meta/recipes-devtools/python/python_2.7.13.bb38
2 files changed, 39 insertions, 44 deletions
diff --git a/meta/recipes-devtools/python/python3_3.5.3.bb b/meta/recipes-devtools/python/python3_3.5.3.bb
index 970ba63445..3ae0db2b8b 100644
--- a/meta/recipes-devtools/python/python3_3.5.3.bb
+++ b/meta/recipes-devtools/python/python3_3.5.3.bb
@@ -228,21 +228,22 @@ FILES_${PN}-man = "${datadir}/man"
BBCLASSEXTEND = "nativesdk"
RPROVIDES_${PN} += "${PN}-modules"
-
+
# We want bytecode precompiled .py files (.pyc's) by default
# but the user may set it on their own conf
-
INCLUDE_PYCS ?= "1"
python(){
+ import json
- pythondir = d.getVar('THISDIR',True)
+ filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
+ # This python changes the datastore based on the contents of a file, so mark
+ # that dependency.
+ bb.parse.mark_dependency(d, filename)
- # Read JSON manifest
- import json
- with open(pythondir+'/python3/python3-manifest.json') as manifest_file:
+ with open(filename) as manifest_file:
python_manifest=json.load(manifest_file)
-
+
include_pycs = d.getVar('INCLUDE_PYCS')
packages = d.getVar('PACKAGES').split()
@@ -282,28 +283,24 @@ python(){
d.setVar('PACKAGES', ' '.join(packages))
d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
}
-do_split_packages[file-checksums] += "${THISDIR}/python/python3-manifest.json:True"
-
-
# Files needed to create a new manifest
SRC_URI += "file://create_manifest3.py file://get_module_deps3.py file://python3-manifest.json"
do_create_manifest() {
-
-# This task should be run with every new release of Python.
-# We must ensure that PACKAGECONFIG enables everything when creating
-# a new manifest, this is to base our new manifest on a complete
-# native python build, containing all dependencies, otherwise the task
-# wont be able to find the required files.
-# e.g. BerkeleyDB is an optional build dependency so it may or may not
-# be present, we must ensure it is.
-
-cd ${WORKDIR}
-# This needs to be executed by python-native and NOT by HOST's python
-nativepython3 create_manifest3.py
-cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
-}
+ # This task should be run with every new release of Python.
+ # We must ensure that PACKAGECONFIG enables everything when creating
+ # a new manifest, this is to base our new manifest on a complete
+ # native python build, containing all dependencies, otherwise the task
+ # wont be able to find the required files.
+ # e.g. BerkeleyDB is an optional build dependency so it may or may not
+ # be present, we must ensure it is.
+
+ cd ${WORKDIR}
+ # This needs to be executed by python-native and NOT by HOST's python
+ nativepython3 create_manifest3.py
+ cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
+}
# bitbake python -c create_manifest
addtask do_create_manifest
diff --git a/meta/recipes-devtools/python/python_2.7.13.bb b/meta/recipes-devtools/python/python_2.7.13.bb
index dbafb955f9..337c7447bb 100644
--- a/meta/recipes-devtools/python/python_2.7.13.bb
+++ b/meta/recipes-devtools/python/python_2.7.13.bb
@@ -202,12 +202,14 @@ RPROVIDES_${PN} += "${PN}-modules"
INCLUDE_PYCS ?= "1"
python(){
+ import json
- pythondir = d.getVar('THISDIR',True)
+ filename = os.path.join(d.getVar('THISDIR'), 'python', 'python2-manifest.json')
+ # This python changes the datastore based on the contents of a file, so mark
+ # that dependency.
+ bb.parse.mark_dependency(d, filename)
- # Read JSON manifest
- import json
- with open(pythondir+'/python/python2-manifest.json') as manifest_file:
+ with open(filename) as manifest_file:
python_manifest=json.load(manifest_file)
include_pycs = d.getVar('INCLUDE_PYCS')
@@ -215,7 +217,6 @@ python(){
packages = d.getVar('PACKAGES').split()
pn = d.getVar('PN')
-
newpackages=[]
for key in python_manifest:
@@ -250,25 +251,22 @@ python(){
d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
}
-do_split_packages[file-checksums] += "${THISDIR}/python/python2-manifest.json:True"
-
# Files needed to create a new manifest
SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json"
do_create_manifest() {
-
-# This task should be run with every new release of Python.
-# We must ensure that PACKAGECONFIG enables everything when creating
-# a new manifest, this is to base our new manifest on a complete
-# native python build, containing all dependencies, otherwise the task
-# wont be able to find the required files.
-# e.g. BerkeleyDB is an optional build dependency so it may or may not
-# be present, we must ensure it is.
-
-cd ${WORKDIR}
-# This needs to be executed by python-native and NOT by HOST's python
-nativepython create_manifest2.py
-cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json
+ # This task should be run with every new release of Python.
+ # We must ensure that PACKAGECONFIG enables everything when creating
+ # a new manifest, this is to base our new manifest on a complete
+ # native python build, containing all dependencies, otherwise the task
+ # wont be able to find the required files.
+ # e.g. BerkeleyDB is an optional build dependency so it may or may not
+ # be present, we must ensure it is.
+
+ cd ${WORKDIR}
+ # This needs to be executed by python-native and NOT by HOST's python
+ nativepython create_manifest2.py
+ cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json
}
# bitbake python -c create_manifest