All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] package/scripts: Fix FILES_INFO handling
@ 2021-08-16 22:27 Richard Purdie
  2021-08-16 22:27 ` [PATCH 2/2] package: Fix overrides converion issue with PKGSIZE Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2021-08-16 22:27 UTC (permalink / raw)
  To: openembedded-core

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                      | 4 ++--
 meta/classes/package.bbclass                     | 2 +-
 meta/classes/toaster.bbclass                     | 2 +-
 scripts/lib/devtool/search.py                    | 5 +++--
 scripts/lib/recipetool/append.py                 | 8 ++++----
 scripts/lib/recipetool/create.py                 | 4 ++--
 scripts/lib/recipetool/create_buildsys_python.py | 2 +-
 scripts/oe-pkgdata-util                          | 4 ++--
 8 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 810459d4326..b84e6035edb 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -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)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index a9138ff6bec..fb3c346f692 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -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)
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 9518ddf7a4e..dd5c7f224ba 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -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:
diff --git a/scripts/lib/devtool/search.py b/scripts/lib/devtool/search.py
index d81cdd876f6..70b81cac5e8 100644
--- a/scripts/lib/devtool/search.py
+++ b/scripts/lib/devtool/search.py
@@ -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
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py
index 5f629c07d8e..88ed8c5f018 100644
--- a/scripts/lib/recipetool/append.py
+++ b/scripts/lib/recipetool/append.py
@@ -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):
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 0ac97e02e94..5cd72ea0a7d 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -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'):
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index fdd33660387..8aa44650d33 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -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:
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 94d44002ab4..ffa3850b8bc 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -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):
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] package: Fix overrides converion issue with PKGSIZE
  2021-08-16 22:27 [PATCH 1/2] package/scripts: Fix FILES_INFO handling Richard Purdie
@ 2021-08-16 22:27 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2021-08-16 22:27 UTC (permalink / raw)
  To: openembedded-core

This fixes pkgdata PKGSIZE info after the overrides change.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/license_image.bbclass | 2 +-
 meta/classes/package.bbclass       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 5cec7a07fa2..5490d121f17 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -87,7 +87,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                 # If the package doesn't contain any file, that is, its size is 0, the license
                 # isn't relevant as far as the final image is concerned. So doing license check
                 # doesn't make much sense, skip it.
-                if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
+                if pkg_dic[pkg]["PKGSIZE:%s" % pkg] == "0":
                     continue
             else:
                 # Image manifest
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index fb3c346f692..e17f0c797e3 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1670,7 +1670,7 @@ fi
             for dfile in (d.getVar('FILERDEPENDSFLIST:' + pkg) or "").split():
                 write_if_exists(sf, pkg, 'FILERDEPENDS:' + dfile)
 
-            sf.write('%s_%s: %d\n' % ('PKGSIZE', pkg, total_size))
+            sf.write('%s:%s: %d\n' % ('PKGSIZE', pkg, total_size))
 
         # Symlinks needed for rprovides lookup
         rprov = d.getVar('RPROVIDES:%s' % pkg) or d.getVar('RPROVIDES')
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-16 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 22:27 [PATCH 1/2] package/scripts: Fix FILES_INFO handling Richard Purdie
2021-08-16 22:27 ` [PATCH 2/2] package: Fix overrides converion issue with PKGSIZE Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.