Skip to content

Document best practices for hooks #696

@tiran

Description

@tiran

Fromager's documentation does not explain well how package hooks should deal with sources. In downstream we have some plugins that do not follow the best practices, because the developers were not aware of the hidden rules.

  • only download_source and prepare_source shall retrieve the primary sources of a dependency (download, git clone, ...)
  • only prepare_source shall be used to fetch additional sources (git clone or download dependencies)
  • a custom prepare_source should use sources.default_prepare_source() if possible. If is_new is False, a custom hook shall not modify the source tree
  • all sources shall bundled in the sdist. Additional dependency shall not get stored outside source_root_dir.
  • sdists should be variant-agnostic if possible. Variant-specific changes should be avoided unless they are absolutely necessary.

The rules ensure that sdists are self-contained and enable hermetically sealed build sequence jobs. The bootstrap phase downloads, prepares, and stashes all sdists. The build phase can use the stashed sdists and does not need any internet connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions