Skip to content

Improve support for source based Linux distros #2861

Closed

Description

Currently I am trying to support cargo based packages on two source based distros. I will caveat this issue saying that my approach might be wrong but its a use case that I need a solution for. I've run into two main issues:

  • reproducible builds - cargo currently might use a newer dependency at a later point for a package
  • limited networking - cargo reaches out to the internet when networking might not be available

For source based distros they separate out building of packages into different stages. Roughly they are separated into:

  • fetch
  • unpack
  • build
  • install

The unpack, build, and install phases are run without networking available. This means that the traditional cargo model of download a crate and then pull down the dependencies and build them does not work. The issue is that the source for the crate has not yet been unpacked before I need to fetch down the remaining dependencies.

To work around this I have implemented native fetchers for Yocto and Gentoo similar to how npm packages are handled in those distros. I considered npm to be analogous to cargo but for JavaScript in this case. The fetchers grab a package, its dependencies and a copy of the cargo registry index at a specific point in time and create a $CARGO_HOME that matches the layout that cargo expects. Unfortunately this on disk format changes from time to time which makes this method fragile.

In an effort to make packaging of these crates easier I've started https://github.com/cardoe/cargo-bitbake and https://github.com/cardoe/cargo-ebuild which aims to eventually produce recipes for Yocto and Gentoo respectively that do everything necessary to package a crate for those distros.

For an example of distro recipes see:

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions