Skip to content

Commit

Permalink
image: Move package manifest generator to hook
Browse files Browse the repository at this point in the history
Now that the package manifest generator is independent of the `/var`
mount, it can be run from an image hook like the flatpak and ostree
manifest generators.

https://phabricator.endlessm.com/T35244
  • Loading branch information
dbnicholson committed Mar 5, 2024
1 parent 0f96a2b commit 05b858b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ hooks_add =
70-flatpak-appstream-catalog
70-flatpak-manifest
70-ostree-manifest
70-packages-manifest
80-ldconfig-aux-cache.chroot

# Gzip compression by default (valid choices: gz or xz)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@ for pkg in sorted(cache):
'size': pkg.installed.installed_size,
}

# Print out the json
print(json.dumps(data, sort_keys=True))
# Now write out the json to a fragment
manifestdir = os.environ['EIB_MANIFESTDIR']
manifest_path = os.path.join(manifestdir, 'packages.json')
print('Writing packages manifest info to', manifest_path)
with open(manifest_path, 'w') as manifest:
json.dump(data, manifest, sort_keys=True)
6 changes: 0 additions & 6 deletions stages/eib_image
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ dpkgdir="${OSTREE_DEPLOYMENT}"/usr/share/dpkg/database
packageinfo="${EIB_TMPDIR}"/packages.txt
dpkg-query -W --admindir="${dpkgdir}" > "${packageinfo}"

# Add package info to manifest using helper. This needs to be run here
# rather than in an image hook because the dpkg database will be masked
# by the OS /var mount.
pkg_manifest="${EIB_MANIFESTDIR}"/packages.json
"${EIB_HELPERSDIR}"/packages-manifest > "${pkg_manifest}"

run_hooks content "${OSTREE_DEPLOYMENT}"

create_image() {
Expand Down

0 comments on commit 05b858b

Please sign in to comment.