Coder Social home page Coder Social logo

cargo-update's Introduction

cargo-update TravisCI build status AppVeyorCI build status Licence Crates.io version

A cargo subcommand for checking and applying updates to installed executables

Installation

Firstly, ensure you have CMake and the Required Libraries™.

Then proceed as usual:

cargo install cargo-update

If that doesn't work:

If it still doesn't work, slam open an issue or comment on one of the existing relevant ones.

Dependencies

Dependency Debian package Fedora package MSYS2 package
libgit2 libgit2-dev libgit2-devel mingw-w64-x86_64-libgit2
libcurl libcurl4-*-dev libcurl-devel libcurl-devel
libssh2 libssh-dev libssh2-devel mingw-w64-x86_64-libssh2
openssl libssl-dev openssl-devel mingw-w64-x86_64-openssl
pkgconf (some platforms) pkgconf pkgconf mingw-w64-x86_64-pkgconf

Usage

cargo install-update -a — check for newer versions and update all installed packages.

cargo install-update crate1 crate2 ... — check for newer versions and update selected packages, will not install new packages.

For more information and examples see the manual.

cargo install-update-config -t unstable -f feature1 -d false crate — when building crate, do so with the unstable toolchain with feature1 and no default features.

For more information and examples see the manual.

Self-update

cargo-update will update itself seamlessly on Linux and Windows.

On Windows the following strategy is applied:

  • Check for old versions, remove them
  • Add the current version to the current executable's extension
  • Create an empty file in place of the just-renamed file (this way cargo install will "replace" it and not duplicate the entry in .crates.toml)

Troubleshooting

Some crates, like clippy and rustfmt, have moved from Crates.io to being a rustup component. If you'd installed them beforehand, then added them via rustup component, they might not have been removed from the list of crates installed via cargo install, and you might come across errors such as

$ cargo install-update -a
Updating registry 'https://github.com/rust-lang/crates.io-index'

Package          Installed  Latest    Needs update
clippy           v0.0.179   v0.0.302  Yes
.....

Updating clippy
    Updating crates.io index
  Installing clippy v0.0.302
   Compiling clippy v0.0.302
error: failed to compile `clippy v0.0.302`, intermediate artifacts can be found at `/tmp/cargo-installxHfj2y`

Caused by:
  failed to run custom build command for `clippy v0.0.302`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installxHfj2y/release/build/clippy-ffeedc2f188020a4/build-script-build` (exit code: 1)
--- stderr

error: Clippy is no longer available via crates.io

help: please run `rustup component add clippy-preview` instead

In that case, run cargo install --list to verify that they're still there and cargo uninstall them, which will deregister the cargo versions and leave you with the rustup ones.

Bleeding-edge cargos

Since 0.42.0, cargo install cratename checks for newer versions and installs them if they exist, instead of erroring out like it does usually.

Source Replacement vs custom registries

Cargo allows replacing entire registries at a time.

For example, this stanza in ~/.cargo/config will replace the default crates.io registry with the Shanghai Jiao Tong Universty's mirror:

[source.crates-io]
replace-with = "sjtu"

[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"

cargo-update resolves this to the deepest registry, and passes --registry sjtu to cargo install. This worked until roughly nightly-2019-08-10, but since nightly-2019-09-10 due to a Cargo regression (or feature, but it's breaking without a major version bump, so) --registry looks into a different key, requiring this additional stanza to ensure correct updates:

[registries.sjtu]
index = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"

Confer the initial implementation, rewrite, final broken testcase and final debug implementation threads (h/t @DCJanus for help debugging and testcases, also dealing with me as I slowly spiraled into insanity).

Special thanks

To all who support further development on Patreon, in particular:

  • ThePhD
  • Embark Studios
  • Lars Strojny
  • EvModder

cargo-update's People

Contributors

azyobuzin avatar bbannier avatar biswa96 avatar cbenoit avatar chrisalcantara avatar dholbert avatar durka avatar harrisonmetz avatar ishitatsuyuki avatar jonasbb avatar liigo avatar logarithmus avatar mati865 avatar matthiaskrgr avatar nabijaczleweli avatar nevsal avatar pbrkr avatar qthree avatar quarticcat avatar rex4539 avatar sinkuu avatar smcclennon avatar tomprince avatar tranzystorekk avatar tyrubias avatar utkarshgupta137 avatar vendethiel avatar yanns avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.