Skip to content

Commit

Permalink
package_manager.py: Add PACKAGE_ENABLE_FILELIST option to OpkgIndexer
Browse files Browse the repository at this point in the history
Setting PACKAGE_ENABLE_FILELIST option generates Packages.filelist on
`bitbake package-index`, which is index of files provided by each
IPK package in the feed. It's useful for figuring out which package
provides a particular file/program/library/etc.

Disabled by default since generating a filelist involves reading the
payload of every package in the feed, a time and IO intensive operation
many users won't want to run. Those who do may flip this switch.

Testing:
 * Built an opkg index with PACKAGE_ENABLE_FILELIST unset and verified
   no Packages.filelist are generated.
 * Built with PACKAGE_ENABLE_FILELIST="1" and verified each subfeed
   has Packages.filelist; took ~3min longer for 8,200 IPKs.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>

Rebased-by: Alex Stewart <alex.stewart@ni.com>
* Move `package_manager.py` opkg contents to its new, upstream
  namespaced location.
* Fixup index_cmd value to accommodate changes that have gone into
  upstream since this patch was authored.
  • Loading branch information
harisokanovic authored and amstewart committed Aug 10, 2021
1 parent 4191e39 commit 6b91cf9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions meta/lib/oe/package_manager/ipk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def write_index(self):
else:
signer = None

enable_filelist = bb.utils.to_boolean(self.d.getVar('PACKAGE_ENABLE_FILELIST', True) or "False")

if not os.path.exists(os.path.join(self.deploy_dir, "Packages")):
open(os.path.join(self.deploy_dir, "Packages"), "w").close()

Expand All @@ -33,14 +35,18 @@ def write_index(self):
pkgs_dir = os.path.join(self.deploy_dir, arch)
pkgs_file = os.path.join(pkgs_dir, "Packages")

filelist_cmd = ""
if enable_filelist:
filelist_cmd = '-l %s.filelist' % (pkgs_file)

if not os.path.isdir(pkgs_dir):
continue

if not os.path.exists(pkgs_file):
open(pkgs_file, "w").close()

index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s' %
(opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir))
index_cmds.add('%s --checksum md5 --checksum sha256 -r %s -p %s -m %s %s' %
(opkg_index_cmd, pkgs_file, pkgs_file, filelist_cmd, pkgs_dir))

index_sign_files.add(pkgs_file)

Expand Down

0 comments on commit 6b91cf9

Please sign in to comment.