]> code.ossystems Code Review - openembedded-core.git/commitdiff
python3: Fix do_create_manifest for python3-sqlite3
authorAlejandro Enedino Hernandez Samaniego <alejandro.enedino.hernandez-samaniego@xilinx.com>
Fri, 30 Mar 2018 06:28:31 +0000 (23:28 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 30 Mar 2018 08:39:37 +0000 (09:39 +0100)
Some of the sqlite3 files ended up in python3-misc incorrectly,
this is caused becuse we couldnt add the whole ${libdir}/python3/sqlite3
folder on the package because we also have another sqlite3-tests
package that needs to include another folder from that directory.

This patch not only fixes the do_create_manifest script to handle this
situation, but also patches the manifest (created using the script)
which also fixes a hiddn runtime dependency that we wouldn't have seen.

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/python/python3/create_manifest3.py
meta/recipes-devtools/python/python3/python3-manifest.json

index 43e95ce96b03c536dad7baad600de55cd1be74a1..212ddd434a12e214f742faa61fe09e2aa9ca43eb 100644 (file)
@@ -124,7 +124,6 @@ for value in old_manifest['core']['files']:
   # Get module name , shouldnt be affected by libdir/bindir
   value = os.path.splitext(os.path.basename(os.path.normpath(value)))[0]
 
-
   # Launch separate task for each module for deterministic behavior
   # Each module will only import what is necessary for it to work in specific
   print ('Getting dependencies for module: %s' % value)
@@ -203,8 +202,20 @@ for key in old_manifest:
             if value not in new_manifest[key]['files']:
                 new_manifest[key]['files'].append(value)
             continue
+
         # Get module name , shouldnt be affected by libdir/bindir
-        value = os.path.splitext(os.path.basename(os.path.normpath(value)))[0]
+        # We need to check if the imported module comes from another (e.g. sqlite3.dump)
+        path,value = os.path.split(value)
+        path = os.path.basename(path)
+        value = os.path.splitext(os.path.basename(value))[0]
+
+        # If this condition is met, it means we need to import it from another module
+        # or its the folder itself (e.g. unittest)
+        if path == key:
+          if value:
+            value = path + '.' + value
+          else:
+            value = path
 
         # Launch separate task for each module for deterministic behavior
         # Each module will only import what is necessary for it to work in specific
@@ -292,19 +303,20 @@ for key in old_manifest:
                                        new_manifest[key]['rdepends'].append(newkey)
                                     break
                     else:
-                      # Debug
-                      print('Adding %s to %s FILES' % (item, key))
-                      # Since it wasnt found on another package, its not an RDEP, so add it to FILES for this package
-                      if isCached(item):
-                          new_manifest[key]['cached'].append(item)
-                      else:
-                          new_manifest[key]['files'].append(item)
-                      if item.endswith('*'):
-                          wildcards.append(item)
-                      if item not in allfiles:
-                          allfiles.append(item)
-                      else:
-                          repeated.append(item)
+                      # A module shouldn't contain itself (${libdir}/python3/sqlite3 shouldnt be on sqlite3 files)
+                      if os.path.basename(item) != key:
+                        print('Adding %s to %s FILES' % (item, key))
+                        # Since it wasnt found on another package, its not an RDEP, so add it to FILES for this package
+                        if isCached(item):
+                            new_manifest[key]['cached'].append(item)
+                        else:
+                            new_manifest[key]['files'].append(item)
+                        if item.endswith('*'):
+                            wildcards.append(item)
+                        if item not in allfiles:
+                            allfiles.append(item)
+                        else:
+                            repeated.append(item)
 
 print ('The following files are repeated (contained in more than one package), please check which package should get it:')
 print (repeated)
@@ -322,3 +334,4 @@ for key in new_manifest:
 # Create the manifest from the data structure that was built
 with open('python3-manifest.json.new','w') as outfile:
     json.dump(new_manifest,outfile,sort_keys=True, indent=4)
+    outfile.write("\n")
index 911be8e971a27409296d7ed9b8d1561fe44d8620..26fa613eff6feedff6b1ded8038b303fb6fe463a 100644 (file)
         ],
         "rdepends": [
             "core",
-            "stringold",
-            "netserver"
+            "stringold"
         ],
         "summary": "Python logging support"
     },
     },
     "sqlite3": {
         "cached": [
-            "${libdir}/python3.5/sqlite3/__pycache__/*.pyc"
+            "${libdir}/python3.5/sqlite3/__pycache__",
+            "${libdir}/python3.5/sqlite3/__pycache__/dbapi2.*.pyc",
+            "${libdir}/python3.5/sqlite3/__pycache__/dump.*.pyc"
         ],
         "files": [
             "${libdir}/python3.5/lib-dynload/_sqlite3.*.so",
-            "${libdir}/python3.5/sqlite3/*.py"
+            "${libdir}/python3.5/sqlite3/dbapi2.py",
+            "${libdir}/python3.5/sqlite3/dump.py"
         ],
         "rdepends": [
-            "core"
+            "core",
+            "datetime"
         ],
         "summary": "Python Sqlite3 database support"
     },
         ],
         "summary": "Python XML-RPC support"
     }
-}
+}
\ No newline at end of file