]> code.ossystems Code Review - openembedded-core.git/commitdiff
package/scripts: Fix FILES_INFO handling
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Aug 2021 15:01:06 +0000 (16:01 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 17 Aug 2021 08:52:18 +0000 (09:52 +0100)
There is a long standing bug where FILES_INFO isn't written into pkgdata
with a package suffix. This means if the files are read into the datastore
as intended, the last one "wins".

Fix this to work as intended. Most of the call sites using the data need
to be updated to handle this and the overrides change correctly.

Also fix some other problematic references noticed along the way.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/insane.bbclass
meta/classes/package.bbclass
meta/classes/toaster.bbclass
scripts/lib/devtool/search.py
scripts/lib/recipetool/append.py
scripts/lib/recipetool/create.py
scripts/lib/recipetool/create_buildsys_python.py
scripts/oe-pkgdata-util

index 810459d4326b8d7cd6f3cd54ae331b97680234cb..b84e6035edb43f36b2d763788fe49d9bbc61b4d5 100644 (file)
@@ -808,11 +808,11 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
                     # For Saving the FILERPROVIDES, RPROVIDES and FILES_INFO
                     rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
                     for key in rdep_data:
-                        if key.startswith("FILERPROVIDES_") or key.startswith("RPROVIDES:"):
+                        if key.startswith("FILERPROVIDES:") or key.startswith("RPROVIDES:"):
                             for subkey in bb.utils.explode_deps(rdep_data[key]):
                                 filerdepends.pop(subkey,None)
                         # Add the files list to the rprovides
-                        if key == "FILES_INFO":
+                        if key.startswith("FILES_INFO:"):
                             # Use eval() to make it as a dict
                             for subkey in eval(rdep_data[key]):
                                 filerdepends.pop(subkey,None)
index a9138ff6becae116fb6a75a280168c8d2bd7c231..fb3c346f692a491f75c323dba938db7e4682d473 100644 (file)
@@ -1652,7 +1652,7 @@ fi
             if fstat.st_ino not in seen:
                 seen.add(fstat.st_ino)
                 total_size += fstat.st_size
-        d.setVar('FILES_INFO', json.dumps(files, sort_keys=True))
+        d.setVar('FILES_INFO:' + pkg , json.dumps(files, sort_keys=True))
 
         process_postinst_on_target(pkg, d.getVar("MLPREFIX"))
         add_set_e_to_scriptlets(pkg)
index 9518ddf7a4eebe8078f54934d155790e953fdca8..dd5c7f224ba825fc84709ff4cdb5b27400c24ed1 100644 (file)
@@ -106,7 +106,7 @@ def _toaster_load_pkgdatafile(dirpath, filepath):
                     pkgdata['OPKGN'] = m.group(1)
                 kn = "_".join([x for x in kn.split("_") if x.isupper()])
                 pkgdata[kn] = kv.strip()
-                if kn == 'FILES_INFO':
+                if kn.startswith('FILES_INFO'):
                     pkgdata[kn] = json.loads(kv)
 
             except ValueError:
index d81cdd876f65711447cf86b4247e99745a69d9f9..70b81cac5e82f7ebc8f7dfa3ab48865bc22dd6d2 100644 (file)
@@ -62,10 +62,11 @@ def search(args, config, basepath, workspace):
                             with open(os.path.join(pkgdata_dir, 'runtime', pkg), 'r') as f:
                                 for line in f:
                                     if ': ' in line:
-                                        splitline = line.split(':', 1)
+                                        splitline = line.split(': ', 1)
                                         key = splitline[0]
                                         value = splitline[1].strip()
-                                    if key in ['PKG:%s' % pkg, 'DESCRIPTION', 'FILES_INFO'] or key.startswith('FILERPROVIDES_'):
+                                    key = key.replace(":" + pkg, "")
+                                    if key in ['PKG', 'DESCRIPTION', 'FILES_INFO', 'FILERPROVIDES']:
                                         if keyword_rc.search(value):
                                             match = True
                                             break
index 5f629c07d8e9c81f2c0adbb29b18c09f95bd1925..88ed8c5f018ddefa1d06b0baf9b6ce6d1023e8b3 100644 (file)
@@ -72,15 +72,15 @@ def find_target_file(targetpath, d, pkglist=None):
                 # This does assume that PN comes before other values, but that's a fairly safe assumption
                 for line in f:
                     if line.startswith('PN:'):
-                        pn = line.split(':', 1)[1].strip()
-                    elif line.startswith('FILES_INFO:'):
-                        val = line.split(':', 1)[1].strip()
+                        pn = line.split(': ', 1)[1].strip()
+                    elif line.startswith('FILES_INFO'):
+                        val = line.split(': ', 1)[1].strip()
                         dictval = json.loads(val)
                         for fullpth in dictval.keys():
                             if fnmatch.fnmatchcase(fullpth, targetpath):
                                 recipes[targetpath].append(pn)
                     elif line.startswith('pkg_preinst:') or line.startswith('pkg_postinst:'):
-                        scriptval = line.split(':', 1)[1].strip().encode('utf-8').decode('unicode_escape')
+                        scriptval = line.split(': ', 1)[1].strip().encode('utf-8').decode('unicode_escape')
                         if 'update-alternatives --install %s ' % targetpath in scriptval:
                             recipes[targetpath].append('?%s' % pn)
                         elif targetpath_re.search(scriptval):
index 0ac97e02e940ad7830ae2b3177c1316bd349d795..5cd72ea0a7dc31af3c5c0c1de7aefff3d97386e2 100644 (file)
@@ -115,8 +115,8 @@ class RecipeHandler(object):
                 for line in f:
                     if line.startswith('PN:'):
                         pn = line.split(':', 1)[-1].strip()
-                    elif line.startswith('FILES_INFO:'):
-                        val = line.split(':', 1)[1].strip()
+                    elif line.startswith('FILES_INFO:%s:' % pkg):
+                        val = line.split(': ', 1)[1].strip()
                         dictval = json.loads(val)
                         for fullpth in sorted(dictval):
                             if fullpth.startswith(includedir) and fullpth.endswith('.h'):
index fdd33660387b7ad01afb6b41091868e9791acc29..8aa44650d33a931b7bd8a0b920f95c87d64806ef 100644 (file)
@@ -545,7 +545,7 @@ class PythonRecipeHandler(RecipeHandler):
             with open(pkgdatafile, 'r') as f:
                 for line in f.readlines():
                     field, value = line.split(': ', 1)
-                    if field == 'FILES_INFO':
+                    if field.startswith('FILES_INFO'):
                         files_info = ast.literal_eval(value)
                         break
                 else:
index 94d44002ab410cfb2c604eadcacc0a7694437ca3..ffa3850b8bc012a139af3c1dd56cce96238be376 100755 (executable)
@@ -431,7 +431,7 @@ def list_pkg_files(args):
             for line in f:
                 if line.startswith('FILES_INFO:'):
                     found = True
-                    val = line.split(':', 1)[1].strip()
+                    val = line.split(': ', 1)[1].strip()
                     dictval = json.loads(val)
                     if long:
                         width = max(map(len, dictval), default=0)
@@ -500,7 +500,7 @@ def find_path(args):
             with open(os.path.join(root,fn)) as f:
                 for line in f:
                     if line.startswith('FILES_INFO:'):
-                        val = line.split(':', 1)[1].strip()
+                        val = line.split(': ', 1)[1].strip()
                         dictval = json.loads(val)
                         for fullpth in dictval.keys():
                             if fnmatch.fnmatchcase(fullpth, args.targetpath):