Commit graph

29 commits

Author SHA1 Message Date
Ed Page
e70e310ce0 fix: Report more detailed semver errors
For `cargo install` we'll now show a more specific parse error for
semver, much like other parts of cargo.

This came out of my work on #12801.  I was looking at what might be
appropriate to put in a `cargo-util-semver` crate and realized we have
the `ToSemver` trait that exists but doesn't do much, so I dropped it.
2023-11-06 15:24:32 -06:00
Ed Page
c88137cd62 fix(pkgid): More consistently refer to SemVer 2023-08-29 10:49:09 -05:00
Ed Page
4238f689f5 fix(install): More consistently refer to SemVer 2023-08-29 10:49:02 -05:00
Ed Page
937932520b refactor(install): Move version parsing to the CLI 2023-08-23 16:22:31 -05:00
Ed Page
6007f05a85 chore: Update to toml v0.6, toml_edit v0.18
`toml` replaces `toml_edit::easy`, using `toml_edit` as its parser.
2023-01-19 15:26:28 -06:00
Ed Page
2313edd4b2 fix(yank): Use '--version' like install
During the design conversations on cargo-add, we noticed that
`cargo-install` has a public flag `--version` and an invisible alias
`--vers` while `cargo-yank` has a public flag `--vers`.  This switches
`cargo-yank` to publicly use `--version` and have an invisible alias
`--vers`, making them consistent.

Completions are a best guess.
2022-04-19 16:45:13 -05:00
Ed Page
320c279f43 Port cargo from toml-rs to toml_edit
Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`
2022-01-13 09:27:27 -06:00
hi-rustin
774ccc39a5 Make windows CI happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-31 16:54:16 +08:00
hi-rustin
5da9bed1e5 print the full destination path when no track duplicates
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-31 15:30:48 +08:00
Nipunn Koorapati
f9c2d04592 Factor into struct InstallablePackage 2021-08-19 09:57:53 -07:00
Weihang Lo
8c75e2ffa0
Update tests to use registry names 2021-07-22 00:50:30 +08:00
Eric Huss
340656e29d Add RegistryBuilder to help initializing test registries.
The intent here is to make it more flexible to create different registry
setups, and to reuse code a little more easily.
2021-02-02 15:48:48 -08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
bishtpawan
3952fdb223 Refactor code and resolve PR comments 2020-08-05 17:46:33 +05:30
bishtpawan
dd654d5576 Add pattern match for yank check and updated corresponding test cases 2020-08-05 17:31:56 +05:30
Daniel Wagner-Hall
556c236f9a Bump to semver 0.10 for VersionReq::is_exact
This stops using `to_string` as a proxy for this now-provided precise API.

This reverts commit b71927224f and bupms the
dependency version in Cargo.toml.
2020-05-25 11:11:45 +01:00
Daniel Wagner-Hall
b71927224f Switch to using existing is_locked implementation
semver hasn't merged the upstream PR (yet)
2020-05-20 20:38:23 +01:00
Daniel Wagner-Hall
1e2c233116 Fix up updating logic for multiple installs 2020-03-21 00:47:08 +00:00
Daniel Wagner-Hall
137e518d98 Explicitly check whether installed first instead 2020-03-21 00:04:17 +00:00
Daniel Wagner-Hall
a721e62781 Try installing exact versions before updating
When an exact version is being installed, if we already have that
version from the index, we don't need to update the index before
installing it. Don't do this if it's not an exact version, because the
update may find us a newer version.

This is particularly useful for scripts which unconditionally run
`cargo install some-crate --version=1.2.3`. Before install-update, I
wrote a crate to do this
(https://crates.io/crates/cargo-ensure-installed) which I'm trying to
replace with just `cargo install`, but the extra latency of updating the
index for a no-op is noticeable.

This introduces an interesting edge-case around yanked crates; the
yanked-ness of crates will no longer change on install for exact version
matches which were already downloaded. This feels niche enough to
hopefully not matter...
2020-03-20 14:36:23 +00:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Eric Huss
f7b29716ed Stabilize install-upgrade. 2019-11-11 14:47:48 -08:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
bors
f42275c30e Auto merge of #7246 - ehuss:install-remove-orphan, r=alexcrichton
`cargo install`: Remove orphaned executables.

When a new version of a package is installed that no longer contains an executable from a previous version, this change causes those orphaned executables to also be removed.

I can place this new behavior behind the `install-upgrade` feature gate if anyone is uncomfortable with changing the behavior now.

cc #6797
2019-08-19 16:03:35 +00:00
Eric Huss
3c20a24335 Clean up some git test support functions. 2019-08-12 22:25:36 -07:00
Eric Huss
5a59b80966 cargo install: Remove orphaned executables. 2019-08-12 21:44:14 -07:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Eric Huss
9ecdfe0475 install-upgrade: Fix bugs, more comments, review updates. 2019-04-03 18:05:55 -07:00
Eric Huss
e023a6672b Add install-upgrade. 2019-04-02 08:40:34 -07:00