Commit graph

46 commits

Author SHA1 Message Date
Victor-Nicolae Savu
2fac34aa90 Updated versions for rustc, curl, docopt and regex. 2015-03-06 22:52:55 +01:00
Victor-Nicolae Savu
a1faa7cb14 Updated to rust nightly 2015-03-04 2015-03-05 07:20:58 +01:00
Alex Crichton
a6dad62221 Update to rust master and std::{io, path} 2015-02-27 15:34:13 -08:00
Alex Crichton
b20b0f6bd8 Add git2-curl as a dependency
Due to libgit2 not supporting HTTP proxies, the custom transport API of the
library must be used to reimplement the HTTP transport with proxy support. The
git2-curl crate implements this transport on top of the curl-rust crate. By
using libcurl we gain all sorts of proxy support for free.

This transport is not used by default, however, as it is not well battle tested
and the architecture is not currently ideal (download the entire repo into
memory on a clone). Only when an HTTP proxy is present is the new transport
used.

The other drawback of git2-curl is that it does not currently support
authentication. If a private git repository is cloned or authentication is
required then it will generate an error instead of correctly asking for
credentials.

Closes #636
2015-02-09 21:26:13 -08:00
Gabriel Souza Franco
98854f6f7c Update log crate to v0.2 2015-01-30 16:08:04 -02:00
Peter Atashian
1943978cd5 Add explicit dependency on regex.
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-25 19:59:38 -05:00
Peter Atashian
8bd0572c9c Use external crates for Windows FFI
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-20 11:01:52 -05:00
Alex Crichton
50e00c9712 Augment dylib search paths for rustc/build scripts
Whenever a build script or a plugin depends on a native dynamic library, the
dylib search path will be required to include the path to the generated dynamic
library. Currently Cargo does not augment the search path, causing load errors
or execution errors whenever builds are attempted in this case.

This commit remedies the situation by ensuring that dynamic libraries show up in
dylib search paths. This commit is necessary to fully migrate the remaining
tests from the old build command infrastructure to build scripts.
2015-01-19 15:48:06 -08:00
Alex Crichton
ba2800478d Update to rust master 2015-01-05 11:17:01 -08:00
Alex Crichton
315341368c Update to rust master 2015-01-02 13:39:30 -08:00
Alex Crichton
b9dddc22b1 Update usage of git2-rs 2014-12-31 13:09:21 -08:00
Will Tange
ae5eb85e3d Update rustc-serialize to 0.1.5
This is in response to rust-lang/rust@16f01cc - the change was addressed
in rust-lang/rustc-serialize@1561cca, versioned 0.1.5.

Update dependency to this version.
2014-12-25 04:04:00 +01:00
David Davidović
bb9174de62 Update dependency info
Bump to newest versions of several libraries
2014-12-24 04:53:19 +01:00
David Davidović
b51b3b72fc Bump version numbers
Updated to use the latest 2014-12-23 nightly and newest versions of
crates url and docopt.rs
2014-12-23 23:06:55 +01:00
Alex Crichton
157d639afc Update rust and all deps 2014-12-19 20:55:17 -08:00
Alex Crichton
e8484805d9 Move all deps to the registry 2014-12-19 20:54:59 -08:00
Alex Crichton
15e5aca9bc Bump version number to 0.1.0
Closes #808
2014-11-30 00:07:58 -08:00
Alex Crichton
442de299ae Polish off the LTO branch 2014-11-17 10:17:56 -08:00
Alex Crichton
6f872f56c3 Update curl-rust to fix SSL on windows
Closes #873
2014-11-14 22:20:39 -08:00
Huon Wilson
6e23ead804 Add Alex to the authors. 2014-11-14 10:08:30 +11:00
Alex Crichton
079d90235d Upgrade all deps to using build scripts 2014-11-11 14:31:23 -08:00
Alex Crichton
edc6ebc5c1 Update with breaking changes from tonight's nigthly 2014-11-07 08:29:56 -08:00
Alex Crichton
9fba127e4f Update how cargo talks to the registry
This commit includes a laundry list of updates and tweaks to reflect the current
API of the registry:

* `registry.host` has been renamed to `registry.index`
* New top-level manifest keys are now accepted:
  * `homepage` - url
  * `documentation` - url
  * `repository` - url
  * `description` - a markdown-less blurb
  * `license` - string (verified by the registry on upload)
  * `keywords` - string array
  * `readme` - string pointing at a file
* Authors are now uploaded to the registry
* The upload format to the registry has changed to a body json payload
* Unpacking tarballs respects the executable bit for scripts and such.
* Downloading now follows redirects to go to S3.
* The download URL for a package has changed slightly.
* Verify path dependencies have a version listed when being uploaded
* Rename `upload` to `publish`
* Rename `ops::cargo_upload` to `ops::registry`
* Add a new `registry` package for interoperating with the registry
* Add the ability to modify owners via `cargo owner`
* Add a `readme` key to the manifest, and upload its contents to the registry.
* Add the ability to yank crates and their versions
* When packaging a library, verify that it builds from the packaged source by
  unpacking the tarball and simulate running `cargo build` inside of it.
2014-10-27 12:40:23 -07:00
Alex Crichton
5851827379 Implement resolution of version requirements
This commit extends the support in cargo's resolver to start resolving packages
with multiple versions as well as package requirements. This is a crucial step
forward when impelmenting the cargo registry as multiple versions will be
uploaded to the registry quite quickly!

This implements a fairly naive solution which should at least help cargo get out
the gates initially. This impelments a depth-first-search of the pacakage
dependency graph with a few sorting heuristics along the way to help out
resolution as it goes along.

Resolution errors will likely improve over time, but this commit does make an
effort to try to get some good error messages right off the bat.
2014-10-22 11:29:37 -07:00
Alex Crichton
3512d99749 Remove dependence on various plugins
It's looking more likely like plugins will not make it into the stable channel
of Rust, so this commits removes Cargo's personal dependence on the two
plugin-based pieces of functionality it was using:

1. Uses of the `regex!` macro now go through `Regex::new`.
2. Uses of the `docopt!` macro now go through `deriving(Decodable)` instead.
2014-10-17 15:25:50 -07:00
Alex Crichton
d65325b6d3 Use a different curl-rust for now
Waiting on fixes to be merged upstream
2014-09-16 12:05:21 -07:00
Alex Crichton
18e884d8de Implement a registry source
# cargo upload

The cargo-upload command will take the local package and upload it to the
specified registry. The local package is uploaded as a tarball compressed with
gzip under maximum compression. Most of this is done by just delegating to
`cargo package` The host to upload to is specified, in order of priority, by a
command line `--host` flag, the `registry.host` config key, and then the default
registry. The default registry is still `example.com`

The registry itself is still a work in progress, but the general plumbing for a
command such as this would look like:

1. Ensure the local package has been compressed into an archive.
2. Fetch the relevant registry and login token from config files.
3. Ensure all dependencies for a package are listed as coming from the same
   registry.
4. Upload the archive to the registry with the login token.
5. The registry will verify the package is under 2MB (configurable).
6. The registry will upload the archive to S3, calculating a checksum in the
   process.
7. The registry will add an entry to the registry's index (a git repository).
   The entry will include the name of the package, the version uploaded, the
   checksum of the upload, and then the list of dependencies (name/version req)
8. The local `cargo upload` command will succeed.

# cargo login

Uploading requires a token from the api server, and this token follows the same
config chain for the host except that there is no fallback. To implement login,
the `cargo login` command is used. With 0 arguments, the command will request
that a site be visited for a login token, and with an argument it will set the
argument as the new login token.

The `util::config` module was modified to allow writing configuration as well as
reading it. The support is a little lacking in that comments are blown away, but
the support is there at least.

# RegistrySource

An implementation of `RegistrySource` has been created (deleting the old
`DummyRegistrySource`). This implementation only needs a URL to be constructed,
and it is assumed that the URL is running an instance of the cargo registry.

## RegistrySource::update

Currently this will unconditionally update the registry's index (a git
repository). Tuning is necessary to prevent updating the index each time (more
coming soon).

## RegistrySource::query

This is called in the resolve phase of cargo. This function is given a
dependency to query for, and the source will simply look into the index to see
if any package with the name is present. If found, the package's index file will
be loaded and parsed into a list of summaries.

The main optimization of this function is to not require the entire registry to
ever be resident in memory. Instead, only necessary packages are loaded into
memory and parsed.

## RegistrySource::download

This is also called during the resolve phase of cargo, but only when a package
has been selected to be built (actually resolved). This phase of the source will
actually download and unpack the tarball for the package.

Currently a configuration file is located in the root of a registry's index
describing the root url to download packages from.

This function is optimized for two different metrics:

1. If a tarball is downloaded, it is not downloaded again. It is assumed that
   once a tarball is successfully downloaded it will never change.
2. If the unpacking destination has a `.cargo-ok` file, it is assumed that the
   unpacking has already occurred and does not need to happen again.

With these in place, a rebuild should take almost no time at all.

## RegistrySource::get

This function is simply implemented in terms of a PathSource's `get` function by
creating a `PathSource` for all unpacked tarballs as part of the `download`
stage.

## Filesystem layout

There are a few new directories as part of the `.cargo` home folder:

* `.cargo/registry/index/$hostname-$hash` - This is the directory containing the
  actual index of the registry. `$hostname` comes from its url, and `$hash` is
  the hash of the entire url.

* `.cargo/registry/cache/$hostname-$hash/$pkg-$vers.tar.gz` - This is a
  directory used to cache the downloads of packages from the registry.

* `.cargo/registry/src/$hostname-$hash/$pkg-$vers` - This is the location of the
  unpacked packages. They will be compiled from this location.

# New Dependencies

Cargo has picked up a new dependency on the `curl-rust` package in order to send
HTTP requests to the registry as well as send HTTP requests to download
tarballs.
2014-09-16 12:05:21 -07:00
Alex Crichton
929b61caae Switch the location of the docopt repo 2014-09-09 22:01:39 -07:00
Björn Steinbrink
7372e7911e Fix building with current rust by using rust-lang/glob
The glob crate that comes with rust itself has been deprecated.
2014-08-27 12:49:11 +02:00
Alex Crichton
c64fd71ede Revert "Revert "Use libgit2 for driving git instead of the CLI""
This reverts commit 04440bb035.

Conflicts:
	src/cargo/sources/git/utils.rs
2014-08-26 20:12:44 -07:00
Alex Crichton
69c16fc6c8 Implement cargo-package
This command will assemble the current package into a tarball ready for
uploading to the cargo registry. Currently no further verification is done
beyond packaging the local repository into a tarball, but in the future this
could execute other operations such as api stability tools.
2014-08-26 19:03:12 -07:00
Alex Crichton
8cce8996be Remove all subcommand executables
This commit removes all distributed executables except for `cargo`. All
builtin subcommands are implemented through library calls, and the fallback
methods are retained to maintain extensability through new subcommands.

Closes #393
2014-08-26 18:25:28 -07:00
Alex Crichton
c9e0863137 Revert "Use libgit2 for driving git instead of the CLI"
This reverts commit 3cd82ed7a1.

Conflicts:
	src/cargo/sources/git/utils.rs
2014-08-19 09:10:14 -07:00
bors
9697847935 auto merge of #375 : wycats/cargo/doc-fewer-things, r=alexcrichton 2014-08-19 05:14:53 +00:00
Alex Crichton
ea3d601fe1 Register new snapshots 2014-08-16 15:54:07 -07:00
Alex Crichton
230dbf6a59 Use libgit2 for driving git instead of the CLI
In general relying on external programs is dicey and tricky as they're very
different across systems in both how they're used as well as what versions
you'll find. Instead of binding to the least common denominator of CLI, we can
code against an exact version of libgit2.

This introduces a build-time dependency on cmake which libgit2 requires to build
itself, which is unfortunate, but thankfully it's only a build time dep. The
build process for libgit2 also automatically detects as many system libraries as
possible to use (if available), falling back to bundled versions if not
available. I have currently not figured how to control this, so the link-config
package is used to build libgit2 which requires that pkg-config be installed to
build cargo as well.

Closes #138
2014-08-16 15:54:07 -07:00
Tim Carey-Smith
d8450848fa Remove docs that shouldn't be built 2014-08-14 14:54:56 -07:00
Erick Tryzelaar
92e40c435b wip: Add cargo-bench, which runs benchmarks at --opt-level=3 2014-08-14 08:14:34 -07:00
Alex Crichton
212e7247e2 Register new snapshots
These snapshots have the lockfile plus the per-target fingerprints. This also
additionally adds a lockfile to the repo for all our deps.
2014-08-03 21:33:46 -07:00
Steve Klabnik
67ac412a62 Fix the build.
After an upstream fix in docopt, cargo now builds on rust HEAD. Also,
move to the semver crate rather than the deprecated built-in one.
2014-08-02 00:16:19 -07:00
Alex Crichton
620b2fe1b5 Implement cargo-update 2014-07-31 15:39:52 -07:00
Tim Carey-Smith
e465ace4f1 [WIP] Generate Cargo.lock on successful resolve 2014-07-31 07:09:53 -07:00
Alex Crichton
f664874281 Migrate from liburl to rust-url
The standard url library is soon-to-be deprecated, and now that we're
bootstrapping it's trivial to move over to rust-url.

Closes #204
2014-07-30 09:55:48 -07:00
Alex Crichton
ba273af564 Move from hammer to docopt for option parsing
The hammer library currently has some shortcomings such as the inability to
document individual options. Additionally our handling with hammer of extra
arguments is dodgy at best currently.

This commit moves the repository to BurntSushi's docopt.rs library which seems
to more feature-complete at this time. Additionally, docopt has the great
benefit of a "document once, use everywhere" documentation strategy.

This migration solves two primary issues:

* Comprehensive and useful CLI documentation
* Gracefully handling flavorful combinations of arguments in odd combinations

Closes #218
2014-07-28 13:37:19 -07:00
Alex Crichton
3f110840b3 Add a cargo-doc command 2014-07-27 19:17:26 -07:00
Alex Crichton
4abf27e7b5 Bootstrap cargo with cargo 2014-07-25 21:20:28 -07:00