Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nabijaczleweli/cargo-update
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.0
Choose a base ref
...
head repository: nabijaczleweli/cargo-update
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
patreon: nabijaczleweli
custom: https://www.paypal.me/nabijaczleweli
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@
!cargo-install-update.exe.manifest
!*.sublime-project
!*.md
!.github
!.github/**
!src
!src/**
!man
32 changes: 8 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
sudo: false
language: generic
cache:
cargo: true
directories:
- /tmp/tools

env:
global:
- PATH="$HOME/bin:$PATH"
- CMAKE_VERSION_PREFIX=3.8
- CMAKE_VERSION_FULL=3.8.1
cache: cargo

matrix:
include:
@@ -22,6 +13,9 @@ matrix:
- env: LANGUAGE=Rust CLIPPY=true
language: rust
rust: nightly
- env: LANGUAGE=Rust DEPLOY=false
language: rust
rust: 1.35.0 # pre-NLL, see https://github.com/nabijaczleweli/cargo-update/issues/116
- env: LANGUAGE=Ruby DEPLOY=true DEPLOY_FILE="$TRAVIS_BUILD_DIR/../cargo-install-update-man-$TRAVIS_TAG.tbz2"
language: ruby
rust: []
@@ -40,24 +34,14 @@ before_install:

install:
- if [ "$LANGUAGE" == "Ruby" ]; then gem install ronn; fi
-
- mkdir -p /tmp/tools
- pushd /tmp/tools
- if [[ ! -f "cmake-$CMAKE_VERSION_FULL-Linux-x86_64.sh" ]]; then
curl -SOL "https://cmake.org/files/v$CMAKE_VERSION_PREFIX/cmake-$CMAKE_VERSION_FULL-Linux-x86_64.sh";
chmod +x "cmake-$CMAKE_VERSION_FULL-Linux-x86_64.sh";
- if [ "$LANGUAGE" == "Rust" ] && [ "$CLIPPY" ]; then
rustup component add clippy-preview || cargo install --git https://github.com/rust-lang/rust-clippy clippy -f;
fi
- ./"cmake-$CMAKE_VERSION_FULL-Linux-x86_64.sh" --prefix="$HOME" --exclude-subdir --skip-license
- popd

script:
- if [ "$LANGUAGE" == "Rust" ]; then cargo build --verbose; fi
- if [ "$LANGUAGE" == "Rust" ]; then cargo test --verbose; fi
- if [ "$LANGUAGE" == "Rust" ] && [ "$CLIPPY" ]; then
cargo install clippy;
target/debug/cargo-install-update install-update -a;
cargo clippy;
fi
- if [ "$LANGUAGE" == "Rust" ] && [ "$CLIPPY" ]; then cargo clippy; fi
- if [ "$LANGUAGE" == "Rust" ] && [ "$DEPLOY" ] && [ "$TRAVIS_TAG" ] && [ "$TRAVIS_SECURE_ENV_VARS" == "true" ]; then cargo build --verbose --release; fi
-
- if [ "$LANGUAGE" == "Ruby" ]; then
@@ -113,7 +97,7 @@ after_success:
deploy:
provider: releases
api_key:
secure: "HnXKg3YC2Oo1/M6CaoRfePjGYNrz/dVlU/fEI2pohc1X0UQSuf+cl7/avkyuklSeBX/x2E/gwgUAbOwNDMevDxmK+YOyzS6s9vpewPgTxi5tSj3zP300iMnz8M//yZCSeyaD0wFzySnzB2yiJyYBk/fO2jbOm6oUyo65iw61JlvepX0IMKy2GXAlxjddvn8elkzbBftCdalcHEW6Zf8ZXg6vrsWGmJSTWQhc88CVUuZSP6mUY551RN8emTUsH8ClGf+Zpfkzix0PxcORxsLnIQg1HC/EzAM2bR7dszBGQczPTF0LRys9hZap1ph7OvxYCjrA/mzuQ3RAhhKQDVCPDy8NwnFRkE/49v+gIHzOZB+Osed+MEZWojBFNOI3l2M5OSo0NG4JLTzeY6M6W3Xv9CKWbmmgnMNb3J4pO33d9iTMkzCjmVJwDPQyIfjeThvPYDdWFAjSyez43EeVlkAPoKcF8Q6P+ee7HaWKRgL78TFg+WYvO/0IuVsHdBb3Qt/85ND1musOOPbyN1M8R0nunvry1766ipEEsYBnE7TiIVF8WeSis1izXGeM2XR7osV1Ut/EFSNmkPjBWO1kAFV7+I4Mi36jmqEHsPWuJXOjeMybghYx9hQ42hvGyLM8z9AxW4QubmzeW9E1Hjm0PecxfcPd/4bvK7es/NcI2/PPhsA="
secure: "CmjHTjddTh53L7H7kz4MxdNd/ERChExT2uuK0+YCpB25f3OBbUDQ7B2N1xg/c+CxqOOgKbHpS8bI4uGYiJhXVfAyYJiNb8Zk8kul410wdi9wPUlOoigQ3brIP1Em+8JZ8w3SU9HoneDB8f9LwN9PoiJLpGaqKkUM0LTPm2FfhfHfclgSGZIJVxQn5lBfPYukcCel9DpsLc6cXMUhB0+r+KsqpDpVO+RC239qXnHEearFgyKm5mnnOvmrXM5es7RGJ9Wlb8/iy27JZB4iyRsGMjqBrPSmPpJg1OxdNp1OxNfIlfrOCDQsAPnD6SB/utnS20DSm9J6AfgxZQZry5WZB2Ge4Vc2IXO7XZvZUGSzTyMY0yPGCWs5R0Qgh8hbEuNsiCN/2NFsr67XxMG3LPwgHkCyr2X1uW7i6lkMtwWkUxbRlXHQVnufeH6G/X/P3Ah101tZdpvFhQPEJRHda49WG0pnt2H6wjUuwTXDuKBO6eiN7gUaYieAomMSGAqA7tQSKCuOP/CH00rJ8mYJNVSKFnh3R/v9K1FDdJnxQKqdSNxFRg+x4dYI3IElzwdCcFNphxppZOtbMj97LZ2jMjA7qT3P6+xyX1HxVNnhTjCC6wi0MHH/flyN1J9cJc4guIeuaXlZUVxH7kp7/0LcvGgrsbY3YNi5f8B9tJJdMlhWuuo="
file: "$DEPLOY_FILE"
skip_cleanup: true
on:
70 changes: 55 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,85 @@
[package]
name = "cargo-update"
description = "A cargo subcommand for checking and applying updates to installed executables"
documentation = "https://cdn.rawgit.com/nabijaczleweli/cargo-update/doc/cargo_update/index.html"
documentation = "https://rawcdn.githack.com/nabijaczleweli/cargo-update/doc/cargo_update/index.html"
repository = "https://github.com/nabijaczleweli/cargo-update"
readme = "README.md"
keywords = ["cargo", "update", "plugin", "subcommand"]
categories = ["development-tools::cargo-plugins"]
license = "MIT"
build = "build.rs"
# Remember to also update in appveyor.yml
version = "1.2.0"
version = "16.2.0"
# Remember to also update in man/*.md
authors = ["nabijaczleweli <nabijaczleweli@gmail.com>",
authors = ["наб <nabijaczleweli@nabijaczleweli.xyz>",
"Yann Simon <yann.simon.fr@gmail.com>",
"ven <vendethiel@hotmail.fr>",
"Cat Plus Plus <piotrlegnica@piotrl.pl>",
"Liigo <liigo@qq.com>",
"azyobuzin <azyobuzin@users.sourceforge.jp>",
"Tatsuyuki Ishi <ishitatsuyuki@gmail.com>",
"Tom Prince <tom.prince@twistedmatrix.com>",
"Mateusz Mikuła <mati865@gmail.com>"]
"Mateusz Mikuła <mati865@gmail.com>",
"sinkuu <sinkuupump@gmail.com>",
"Alex Burka <aburka@seas.upenn.edu>",
"Matthias Krüger <matthias.krueger@famsik.de>",
"Daniel Holbert <dholbert@cs.stanford.edu>",
"Jonas Bushart <jonas@bushart.org>",
"Harrison Metzger <harrisonmetz@gmail.com>",
"Benjamin Bannier <bbannier@gmail.com>",
"Dimitris Apostolou <dimitris.apostolou@icloud.com>",
"Corbin Uselton <corbinu@decimal.io>",
"QuarticCat <QuarticCat@protonmail.com>",
"Artur Sinila <freesoftware@logarithmus.dev>",
"qthree <qthree3@gmail.com>",
"tranzystorekk <tranzystorek.io@protonmail.com>",
"Paul Barker <paul@pbarker.dev>",
"Benoît CORTIER <bcortier@proton.me>",
"Biswapriyo Nath <nathbappai@gmail.com>",
"Shiraz <smcclennon@protonmail.com>",
"Victor Song <vms2@rice.edu>",
"chrisalcantara <chris@chrisalcantara.com>",
"Utkarsh Gupta <utkarshgupta137@gmail.com>",
"nevsal",
"Rui Chen <https://chenrui.dev>",
"Lynnesbian <https://fedi.lynnesbian.space/@lynnesbian>"]
exclude = ["*.enc"]
edition = '2015'
rust-version = "1.71.1"


[dependencies]
json-deserializer = "0.4"
serde_derive = "1.0"
lazy_static = "0.2"
array_tool = "0.4"
tabwriter = "1.0"
lazysort = "0.1"
semver = "0.8"
regex = "0.2"
array_tool = "1.0"
tabwriter = "1.2"
serde = "1.0"
git2 = "0.6"
clap = "2.26"
json = "0.11"
toml = "0.4"
git2 = "0.20"
home = "=0.5.9"
toml = "0.8"
hex = "0.4"
url = "2.3"

[dependencies.semver]
version = "1.0"
features = ["serde"]

[dependencies.clap]
version = "3.2"
features = ["cargo", "env", "wrap_help"]

[dependencies.curl]
version = "0.4"
features = ["http2"]

[build-dependencies]
embed-resource = "1.1"
embed-resource = "2.4"

[features]
default = []
vendored-openssl = ["git2/vendored-openssl", "curl/static-ssl"]
vendored-libgit2 = ["git2/vendored-libgit2"]
vendored-libcurl = ["curl/static-curl"]

[[bin]]
name = "cargo-install-update"
114 changes: 107 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
# cargo-update [![TravisCI build status](https://travis-ci.org/nabijaczleweli/cargo-update.svg?branch=master)](https://travis-ci.org/nabijaczleweli/cargo-update) [![AppVeyorCI build status](https://ci.appveyor.com/api/projects/status/cspjknvfow5gfro0/branch/master?svg=true)](https://ci.appveyor.com/project/nabijaczleweli/cargo-update/branch/master) [![Licence](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) [![Crates.io version](http://meritbadge.herokuapp.com/cargo-update)](https://crates.io/crates/cargo-update)
# cargo-update [![AppVeyorCI build status](https://ci.appveyor.com/api/projects/status/cspjknvfow5gfro0/branch/master?svg=true)](https://ci.appveyor.com/project/nabijaczleweli/cargo-update/branch/master) [![Licence](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) [![Crates.io version](https://img.shields.io/crates/v/cargo-update)](https://crates.io/crates/cargo-update)
A [`cargo` subcommand](https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands) for checking and applying updates to installed executables

## [Documentation](https://cdn.rawgit.com/nabijaczleweli/cargo-update/doc/cargo_update/index.html)
## [Manpage](https://cdn.rawgit.com/nabijaczleweli/cargo-update/man/cargo-install-update.1.html)
## [Documentation](https://rawcdn.githack.com/nabijaczleweli/cargo-update/doc/cargo_update/index.html)
## [Manual](https://rawcdn.githack.com/nabijaczleweli/cargo-update/man/cargo-install-update.1.html)

### Installation

Firstly, ensure you have [CMake](https://cmake.org), be it from your package manager, or from the [download page](https://cmake.org/download).
Firstly, ensure you have [CMake](https://cmake.org) and the [Required Libraries™](#dependencies).

Then proceed as usual:

```shell
cargo install cargo-update
```

If that doesn't work:
* [re-try with `PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig`](https://github.com/rust-lang/git2-rs/issues/257),
* [re-try with `LIBSSH2_SYS_USE_PKG_CONFIG=whatever`](https://github.com/nabijaczleweli/cargo-update/issues/129#issuecomment-599269219),
* [install OpenSSL via `brew`, and re-try with `LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"`](https://github.com/nabijaczleweli/cargo-update/issues/123),
* [verify that you don't `openssl` installed twice via `brew`](https://github.com/nabijaczleweli/cargo-update/issues/121#issuecomment-570673813),
* [re-try with `--features vendored-openssl`](https://docs.rs/openssl/0.10.30/openssl/#building),
* re-try with `--features vendored-libgit2`.
* re-try with `--features vendored-libcurl`.

If it still doesn't work, [slam open an issue](https://github.com/nabijaczleweli/cargo-update/issues) or [comment on one of the existing relevant ones](https://github.com/nabijaczleweli/cargo-update/issues?q=is%3Aissue+is%3Aopen+label%3Aexternal).

#### Dependencies

| Dependency | Debian package | Fedora package | MSYS2 package |
|--------------------------------------------------|------------------|------------------|-------------------------------|
| [`libgit2`](https://libgit2.github.com) | `libgit2-dev` | `libgit2-devel` | `mingw-w64-x86_64-libgit2` |
| [`libcurl`](https://curl.se/libcurl/) | `libcurl4-*-dev` | `libcurl-devel ` | `libcurl-devel` |
| [`libssh2`](https://libssh2.org) | `libssh-dev` | `libssh2-devel` | `mingw-w64-x86_64-libssh2` |
| [`openssl`](https://openssl.org) | `libssl-dev` | `openssl-devel` | `mingw-w64-x86_64-openssl` |
| [`pkgconf`](http://pkgconf.org) (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 -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.
`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 [manpage](https://cdn.rawgit.com/nabijaczleweli/cargo-update/man/cargo-install-update.1.html).
For more information and examples see the [manual](https://rawcdn.githack.com/nabijaczleweli/cargo-update/man/cargo-install-update.1.html).

`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](https://rawcdn.githack.com/nabijaczleweli/cargo-update/man/cargo-install-update-config.1.html).

#### Self-update

@@ -30,3 +55,78 @@ 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](https://github.com/nabijaczleweli/cargo-update/issues/118) 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 `cargo`s

Since [`0.42.0`](https://github.com/rust-lang/cargo/commit/fb4415090f600bae51b0747bef2e7049070cd6ee),
`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](https://doc.rust-lang.org/cargo/reference/source-replacement.html).

For example, this stanza in `~/.cargo/config` will replace the default crates.io registry with the Shanghai Jiao Tong Universty's mirror:
```toml
[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:
```toml
[registries.sjtu]
index = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
```

Confer the [initial implementation](https://github.com/nabijaczleweli/cargo-update/issues/107), [rewrite](https://github.com/nabijaczleweli/cargo-update/issues/128),
[final broken testcase](https://github.com/nabijaczleweli/cargo-update/issues/137) and
[final debug implementation](https://github.com/nabijaczleweli/cargo-update/pull/138) threads
(h/t [@DCJanus](https://github.com/DCjanus) for help debugging and testcases, also
dealing with me as I slowly [spiraled](https://lfs.nabijaczleweli.xyz/0017-twitter-export#1288559898763157511) into insanity).

## Special thanks

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

* ThePhD
* Embark Studios
* Lars Strojny
* EvModder
39 changes: 27 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
version: 1.2.0-{build}
image:
- Visual Studio 2022

version: 16.2.0-{build}

skip_tags: false

@@ -7,32 +10,44 @@ configuration: Release

clone_folder: C:\cargo-update

environment:
matrix:
- TOOLCHAIN: stable
- TOOLCHAIN: 1.81.0

install:
- set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%;C:\Users\appveyor\.cargo\bin
- bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
- bash -lc "pacman --noconfirm -Sy"
- bash -lc "pacman --noconfirm -S mingw-w64-x86_64-toolchain"
- bash -lc "pacman --noconfirm -Syyu"
- bash -lc "pacman --noconfirm -Syyu"
- bash -lc "pacman --noconfirm -S mingw-w64-x86_64-toolchain zip"
-
- mkdir target\release\deps
- cp C:\Windows\System32\ntdll.dll target\release\deps
-
- curl -SL https://win.rustup.rs/ -oC:\rustup-init.exe
- C:\rustup-init.exe -y --default-host="x86_64-pc-windows-gnu"
- C:\rustup-init.exe -y --default-host="x86_64-pc-windows-gnu" --default-toolchain="%TOOLCHAIN%"

build: off
build_script:
- git submodule update --init --recursive
- cargo build --release
- cp target\release\cargo-install-update.exe cargo-install-update-v1.2.0.exe
- strip --strip-all --remove-section=.comment --remove-section=.note cargo-install-update-v1.2.0.exe
- cargo build --verbose --release
-
- mkdir cargo-update-v16.2.0
- cp target\release\cargo-install-update.exe target\release\cargo-install-update-config.exe cargo-update-v16.2.0\
- strip --strip-all --remove-section=.comment --remove-section=.note cargo-update-v16.2.0/cargo-install-update.exe cargo-update-v16.2.0/cargo-install-update-config.exe
- zip -9r cargo-update-v16.2.0.zip cargo-update-v16.2.0

test: off
test_script:
- cargo test --verbose --release

artifacts:
- path: cargo-install-update-v1.2.0.exe
- path: cargo-update-v16.2.0.zip

deploy:
provider: GitHub
artifact: cargo-install-update-v1.2.0.exe
artifact: cargo-update-v16.2.0.zip
auth_token:
secure: 8dP4MwLtHqrSNKYKeSGSt8vm/QIc+0LHdSoI2ReFPAWEL9VrU8+88YcjQNcF6Wzn
secure: FNqRpbXgjNh7VrtHCIGadt7Pwv9HGq4kyUCQFueRLJvQCCWWWgko3PwiZvYlaAEG
on:
appveyor_repo_tag: true

2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@ extern crate embed_resource;


fn main() {
embed_resource::compile("cargo-install-update-manifest.rc");
embed_resource::compile("cargo-install-update-manifest.rc", embed_resource::NONE);
}
Loading