-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #725 : alexcrichton/cargo/registry-fixes, r=brson
This PR contains a laundry list of improvements when using the registry as a source, and should be one of the last steps necessary for whipping cargo into shape to using the registry. Some of the highlights include: * All APIs have been updated to the registry's current interface * Lockfiles are now respected with registry sources * Conservatively updating dependencies should work * The network shouldn't be touched unless absolutely necessary * Lockfiles actually keep versions locked when using a newer registry with more versions * A new standalone lib was added for interoperating with the registry (HTTP-request-wise) * Packages are now verified before being published to the registry (this can be opted out of) * `cargo upload` was renamed to `cargo publish` The commit series is intended to be individually reviewable and each commit should compile and pass all tests independently (but still needs to be applied in order).
- Loading branch information
Showing
48 changed files
with
2,184 additions
and
805 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use cargo::ops; | ||
use cargo::core::MultiShell; | ||
use cargo::util::{CliResult, CliError}; | ||
use cargo::util::important_paths::find_root_manifest_for_cwd; | ||
|
||
#[deriving(Decodable)] | ||
struct Options { | ||
arg_crate: Option<String>, | ||
flag_token: Option<String>, | ||
flag_add: Option<Vec<String>>, | ||
flag_remove: Option<Vec<String>>, | ||
flag_index: Option<String>, | ||
flag_verbose: bool, | ||
} | ||
|
||
pub const USAGE: &'static str = " | ||
Manage the owners of a crate on the registry | ||
Usage: | ||
cargo owner [options] [<crate>] | ||
Options: | ||
-h, --help Print this message | ||
-a, --add LOGIN Login of a user to add as an owner | ||
-r, --remove LOGIN Login of a user to remove as an owner | ||
--index INDEX Registry index to modify owners for | ||
--token TOKEN API token to use when authenticating | ||
-v, --verbose Use verbose output | ||
This command will modify the owners for a package on the specified registry (or | ||
default). Note that owners of a package can upload new versions, yank old | ||
versions, and also modify the set of owners, so take caution! | ||
"; | ||
|
||
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> { | ||
shell.set_verbose(options.flag_verbose); | ||
let root = try!(find_root_manifest_for_cwd(None)); | ||
try!(ops::modify_owners(&root, shell, | ||
options.arg_crate, | ||
options.flag_token, | ||
options.flag_index, | ||
options.flag_add, | ||
options.flag_remove).map_err(|e| { | ||
CliError::from_boxed(e, 101) | ||
})); | ||
Ok(None) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use cargo::ops; | ||
use cargo::core::MultiShell; | ||
use cargo::util::{CliResult, CliError}; | ||
use cargo::util::important_paths::find_root_manifest_for_cwd; | ||
|
||
#[deriving(Decodable)] | ||
struct Options { | ||
arg_crate: Option<String>, | ||
flag_token: Option<String>, | ||
flag_vers: Option<String>, | ||
flag_index: Option<String>, | ||
flag_verbose: bool, | ||
flag_undo: bool, | ||
} | ||
|
||
pub static USAGE: &'static str = " | ||
Remove a pushed crate from the index | ||
Usage: | ||
cargo yank [options] [<crate>] | ||
Options: | ||
-h, --help Print this message | ||
--vers VERSION The version to yank or un-yank | ||
--undo Undo a yank, putting a version back into the index | ||
--index INDEX Registry index to yank from | ||
--token TOKEN API token to use when authenticating | ||
-v, --verbose Use verbose output | ||
The yank command removes a previously pushed crate's version from the server's | ||
index. This command does not delete any data, and the crate will still be | ||
available for download via the registry's download link. | ||
Note that existing crates locked to a yanked version will still be able to | ||
download the yanked version to use it. Cargo will, however, not allow any new | ||
crates to be locked to any yanked version. | ||
"; | ||
|
||
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> { | ||
shell.set_verbose(options.flag_verbose); | ||
let root = try!(find_root_manifest_for_cwd(None)); | ||
try!(ops::yank(&root, shell, | ||
options.arg_crate, | ||
options.flag_vers, | ||
options.flag_token, | ||
options.flag_index, | ||
options.flag_undo).map_err(|e| { | ||
CliError::from_boxed(e, 101) | ||
})); | ||
Ok(None) | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.