Skip to content

Cargo upgrade service project

Josh Matthews edited this page Feb 28, 2017 · 13 revisions

Create a tool that automatically upgrades Cargo dependencies

Background information: Servo depends on numerous other Rust libraries that are published on the package manager crates.io. There are no notifications for when packages are updated; it's up to developers to keep track of when they need to upgrade their dependencies. The goal of this project is to build a service similar to Greenkeeper that can automatically upgrade Servo's dependencies whenever new versions are released. It is recommended to use a language like Python, node.js, or Ruby, that is well-supported on systems like Heroku and has libraries that can interact with git, github, and TOML files.

Note: there exists a tool that reports outdated Cargo dependencies, but it has limitations we wish to avoid. It can be used for inspiration/guidance, however!

Tracking issue: https://github.com/servo/servo/issues/15600 (please ask questions here)

Initial steps:

  • email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions
  • write code that takes a Cargo.lock file (example) file as input and determines the list of crate names and versions that are dependencies
  • write code that takes a list of crates and versions as input, compares them against a local git clone of the crates.io index, and reports which crates can be updated

Subsequent steps:

  • ensure the code that processes Cargo.lock files can process Servo's Cargo.lock (warning: stress test!)
  • write code that upgrades crates in a local clone
    • accept a list of crate names that require updates
    • using a local clone of https://github.com/servo/servo/, rewrite all Cargo.toml files that contain the matching crate name to use the new verison
    • run ./mach cargo-update -p [name] for each crate name
  • write code that can interact with a local git clone
    • change to the master branch
    • pull from the upstream repository
    • commit changes with a meaningful message
    • push to a remote repository (see some sample python code)
  • write code that can open a pull request against Servo's github repository from a particular branch on a fork
  • put all the pieces together as part of a single operation
    • update a local git repository
    • read its Cargo.lock
    • update the crates.io index
    • determine the crates that can be updated
    • make a new branch in the local repository
    • update the crates
    • commit the changes
    • push the branch to github
    • open a pull request
Clone this wiki locally