Skip to content

meson: make zip container support optional - #299

Draft
igoropaniuk wants to merge 1 commit into
linux-msm:masterfrom
igoropaniuk:feature/optional-zip-container
Draft

meson: make zip container support optional#299
igoropaniuk wants to merge 1 commit into
linux-msm:masterfrom
igoropaniuk:feature/optional-zip-container

Conversation

@igoropaniuk

Copy link
Copy Markdown
Contributor

qdl unconditionally links against libzip, although zip archives are just one of the supported input formats: both the flash-from-zip path and the create-zip subcommand are conveniences on top of the plain contents.xml / flashmap.json flows.

That unconditional dependency gets in the way of integrating qdl into minimal embedded distributions. In Yocto, for example, libzip lives in meta-openembedded rather than oe-core, so packaging qdl means pulling in a whole extra layer for a feature many products never use.

Introduce a zip-container feature option (default auto) and gate all libzip-backed code on it:

  • move the libzip implementation out of file.c into file_zip.c, which is only compiled when the feature is enabled; file.c keeps the plain POSIX file handling and dispatches through small helpers that turn into inert stubs in file.h otherwise
  • provide no-zip fallbacks of qdl_zip_open/get/put where open reports "not a zip archive", so the contents.xml and flashmap.json flows work unchanged; these remain real symbols rather than inline stubs because the unit tests replace them with mock definitions
  • build zipper.c only with the feature and stub out zipper_write(), with create-zip and a failed flash of a zip archive reporting that this qdl was built without zip-container support

qdl unconditionally links against libzip, although zip archives are
just one of the supported input formats: both the flash-from-zip path
and the create-zip subcommand are conveniences on top of the plain
contents.xml / flashmap.json flows.

That unconditional dependency gets in the way of integrating qdl into
minimal embedded distributions. In Yocto, for example, libzip lives in
meta-openembedded rather than oe-core, so packaging qdl means pulling
in a whole extra layer for a feature many products never use.

Introduce a zip-container feature option (default auto) and gate all
libzip-backed code on it:

- move the libzip implementation out of file.c into file_zip.c, which
  is only compiled when the feature is enabled; file.c keeps the plain
  POSIX file handling and dispatches through small helpers that turn
  into inert stubs in file.h otherwise
- provide no-zip fallbacks of qdl_zip_open/get/put where open reports
  "not a zip archive", so the contents.xml and flashmap.json flows
  work unchanged; these remain real symbols rather than inline stubs
  because the unit tests replace them with mock definitions
- build zipper.c only with the feature and stub out zipper_write(),
  with create-zip and a failed flash of a zip archive reporting that
  this qdl was built without zip-container support

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
@konradybcio

Copy link
Copy Markdown
Member

Can we make this an explicit opt-out instead of relying on library autodetection? I fear this may be easily overlooked and lead to not-fully-featured builds landing in distros

@igoropaniuk

Copy link
Copy Markdown
Contributor Author

Can we make this an explicit opt-out instead of relying on library autodetection? I fear this may be easily overlooked and lead to not-fully-featured builds landing in distros

Makes sense, will fix, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants