Commit graph

2758 commits

Author SHA1 Message Date
bors abdc756cc1 Auto merge of #2523 - srinivasreddy:issue-2504, r=alexcrichton
expose cargo package name as CARGO_PKG_NAME
2016-03-29 09:48:28 -07:00
srinivasreddy 3a654e4e2f implemented cargo package name as CARGO_PKG_NAME; And package description and home page are exposed as CARGO_PKG_DESCRIPTION and CARGO_PKG_HOMEPAGE respectively. And add a test case - for CARGO_PKG_NAME, CARGO_PKR_DESCRIPTION, CARGO_HOMEPAGE. 2016-03-29 09:22:02 +05:30
bors 25e1301a4b Auto merge of #2519 - alexcrichton:update-curl, r=alexcrichton
Update curl-sys

Picks up a fix to hopefully and correctly configure OpenSSL to be enabled in
cross-compiled situations where OpenSSL comes from a different location
(currently specified by the `OPENSSL_ROOT_DIR` environment variable that libssh2
also reads).
2016-03-25 09:26:34 -07:00
Alex Crichton ea8de0a0d0 Update curl-sys
Picks up a fix to hopefully and correctly configure OpenSSL to be enabled in
cross-compiled situations where OpenSSL comes from a different location
(currently specified by the `OPENSSL_ROOT_DIR` environment variable that libssh2
also reads).
2016-03-25 09:24:35 -07:00
bors 4e6434dab9 Auto merge of #2513 - alexcrichton:xcompile, r=alexcrichton
Fix nightly dist builds

* When downloading rustc, also download a number of cross-std libraries so we
  can cross compile with that compiler.
* Only build OpenSSL on some --enable-nightly builds, not all. For example
  Windows and OSX don't want to link statically to OpenSSL.
2016-03-24 09:15:04 -07:00
Alex Crichton 8caf4f52e5 Fix nightly dist builds
* When downloading rustc, also download a number of cross-std libraries so we
  can cross compile with that compiler.
* Only build OpenSSL on some --enable-nightly builds, not all. For example
  Windows and OSX don't want to link statically to OpenSSL.
2016-03-23 21:47:32 -07:00
bors e43adeb760 Auto merge of #2510 - alexcrichton:xcompile, r=brson
Prepare for ARM/FreeBSD/NetBSD nightlies

This commit beefs up Cargo's makefiles to support nightly builds of Cargo for
multiple platforms. This primarily involves vendoring the logic of how to build
OpenSSL for statically linking against Cargo into the Makefiles directly. We'll
have to update the version of OpenSSL as releases are made, but we essentially
already do that with the normal docker container.

The Linux nightlies will still run in the normal dist docker container (a really
old CentOS build) and builds for new platforms will happen in the standard
linux-cross container we use for other cross builds. The nightly versions of
these will produce Cargo tarballs for a whole bunch of platforms to get
uploaded.

This has been tested in the `alexcrichton/rust-slave-linux-cross:2016-03-17b`
docker container for the 3 ARM targets and FreeBSD target. NetBSD will come once
rust-lang/rust#32407 lands.
2016-03-23 09:36:36 -07:00
Alex Crichton 83b4f39c44 Prepare for ARM/FreeBSD/NetBSD nightlies
This commit beefs up Cargo's makefiles to support nightly builds of Cargo for
multiple platforms. This primarily involves vendoring the logic of how to build
OpenSSL for statically linking against Cargo into the Makefiles directly. We'll
have to update the version of OpenSSL as releases are made, but we essentially
already do that with the normal docker container.

The Linux nightlies will still run in the normal dist docker container (a really
old CentOS build) and builds for new platforms will happen in the standard
linux-cross container we use for other cross builds. The nightly versions of
these will produce Cargo tarballs for a whole bunch of platforms to get
uploaded.

This has been tested in the `alexcrichton/rust-slave-linux-cross:2016-03-17b`
docker container for the 3 ARM targets and FreeBSD target. NetBSD will come once
rust-lang/rust#32407 lands.
2016-03-22 16:19:35 -07:00
bors 61ad6a06df Auto merge of #2440 - ThinTim:master, r=alexcrichton
Prevent the use of "test" as a crate name

Fixes #2432

?r @alexcrichton
2016-03-22 09:52:21 -07:00
Tim Erwich d30e963ce6 Prevent the use of "test" as a crate name. Fixes #2432. 2016-03-22 09:45:48 +01:00
bors 132b82d75f Auto merge of #2502 - IvanUkhov:doc, r=alexcrichton
doc: make the pages’ titles consistent

The titles of some of the pages end with “Cargo Documentation” (_e.g._, [Frequently Asked Questions](http://doc.crates.io/faq.html)) whereas the titles of some other pages do not (_e.g._, [Environment Variables](http://doc.crates.io/environment-variables.html)), which is a bit inconsistent. Perhaps one should either add that ending to all the titles or eliminate it from all of them. This pull request does the latter, which can be changed if needed. I personally think that such long titles are reasonable for the `title` HTML tag but a bit too verbose when displayed on the page.
2016-03-19 11:39:35 -07:00
Ivan Ukhov 95b46c8921 doc: make the pages’ titles consistent 2016-03-19 07:43:49 +01:00
bors ff02b156f0 Auto merge of #2499 - IvanUkhov:typography, r=alexcrichton
doc/manifest: turn the list in Rules into an unordered one

Please see the comments in #2493.
2016-03-18 15:02:02 -07:00
Ivan Ukhov 8513dc5da0 doc/manifest: turn the list in Rules into an unordered one 2016-03-18 19:28:45 +01:00
bors 018dc95683 Auto merge of #2496 - alexcrichton:fix-concurrent, r=alexcrichton
Relax an assertion in the concurrent tests

The output may also have information about blocking, we just want the successful
part.
2016-03-18 11:07:20 -07:00
bors fe24df275e Auto merge of #2482 - ryanq:issue2266, r=alexcrichton
Suggest the best matching target for cargo run

Targets passed to cargo compile are validated against the package. If
the target exists, it is compiled. If not, cargo will bail and offer a
suggested target name if there is a close match.

The tests create and build/run binaries and examples using filenames
that are close (or not so close) to the target names to verify that
close matching names are suggested to the user.

Sample output attached.
<img width="838" alt="screen shot 2016-03-14 at 12 32 59 pm" src="https://cloud.githubusercontent.com/assets/124247/13754913/28490e42-e9ef-11e5-9617-8d3c01106527.png">

Closes #2266
2016-03-18 10:49:04 -07:00
Alex Crichton 2b9bbba5d7 Relax an assertion in the concurrent tests
The output may also have information about blocking, we just want the successful
part.
2016-03-18 09:49:24 -07:00
bors 75ef4d883d Auto merge of #2493 - IvanUkhov:typography, r=alexcrichton
doc/manifest: polish typography

The pull request makes a number of stylistic adjustments to The Manifest Format page. There are two commits. The first is a preliminary reflowing of paragraphs, and the second bears the actual changes. If any of the changes seems dubious, please let me know; I’ll try to motivate (and revert if needed).
2016-03-18 09:47:42 -07:00
Ryan Quattlebaum 68f993a74a Fixing line length error in make test 2016-03-18 12:39:14 -04:00
Ryan Quattlebaum 1750307c11 Bring in changes from master 2016-03-18 12:20:36 -04:00
Ryan Quattlebaum fe53e05dbf Move suggestion logic into generate_targets() 2016-03-18 12:00:22 -04:00
Ivan Ukhov 5e85c6ecb2 doc/manifest: polish typography 2016-03-18 13:35:35 +01:00
Ivan Ukhov 7f8a3fcc48 doc/manifest: respect 80 characters 2016-03-18 11:06:01 +01:00
bors ece4e963a3 Auto merge of #2467 - tshepang:rustfmt, r=alexcrichton
run rustfmt on core/source.rs
2016-03-17 00:01:44 -07:00
bors 834b834db5 Auto merge of #2480 - alexcrichton:ui, r=alexcrichton
Tweak UI for warnings and errors

Right now Cargo prints out errors justified like all other status messages, but
this can look odd without coloration:

```
   error some error message
```

Instead, this commit changes both warnings and errors to use the same style of:

```
error: some error message
warning: some warning message
```

Additionally, warnings now only print out "warning" in yellow instead of the
entire message (like errors do)
2016-03-16 23:43:11 -07:00
Alex Crichton 8b35fbdcf6 Tweak UI for warnings and errors
Right now Cargo prints out errors justified like all other status messages, but
this can look odd without coloration:

```
   error some error message
```

Instead, this commit changes both warnings and errors to use the same style of:

```
error: some error message
warning: some warning message
```

Additionally, warnings now only print out "warning" in yellow instead of the
entire message (like errors do)
2016-03-16 23:42:49 -07:00
Tshepang Lekhonkhobe 76fb87e2ba run rustfmt on core/source.rs
Includes manual adjustments
2016-03-17 08:04:06 +02:00
bors c5360c4d0f Auto merge of #2486 - alexcrichton:flock, r=brson
Fix running Cargo concurrently

Cargo has historically had no protections against running it concurrently. This
is pretty unfortunate, however, as it essentially just means that you can only
run one instance of Cargo at a time **globally on a system**.

An "easy solution" to this would be the use of file locks, except they need to
be applied judiciously. It'd be a pretty bad experience to just lock the entire
system globally for Cargo (although it would work), but otherwise Cargo must be
principled how it accesses the filesystem to ensure that locks are properly
held. This commit intends to solve all of these problems.

A new utility module is added to cargo, `util::flock`, which contains two types:

* `FileLock` - a locked version of a `File`. This RAII guard will unlock the
  lock on `Drop` and I/O can be performed through this object. The actual
  underlying `Path` can be read from this object as well.
* `Filesystem` - an unlocked representation of a `Path`. There is no "safe"
  method to access the underlying path without locking a file on the filesystem
  first.

Built on the [fs2] library, these locks use the `flock` system call on Unix and
`LockFileEx` on Windows. Although file locking on Unix is [documented as not so
great][unix-bad], but largely only because of NFS, these are just advisory, and
there's no byte-range locking. These issues don't necessarily plague Cargo,
however, so we should try to leverage them. On both Windows and Unix the file
locks are released when the underlying OS handle is closed, which means that
if the process dies the locks are released.

Cargo has a number of global resources which it now needs to lock, and the
strategy is done in a fairly straightforward way:

* Each registry's index contains one lock (a dotfile in the index). Updating the
  index requires a read/write lock while reading the index requires a shared
  lock. This should allow each process to ensure a registry update happens while
  not blocking out others for an unnecessarily long time. Additionally any
  number of processes can read the index.
* When downloading crates, each downloaded crate is individually locked. A lock
  for the downloaded crate implies a lock on the output directory as well.
  Because downloaded crates are immutable, once the downloaded directory exists
  the lock is no longer needed as it won't be modified, so it can be released.
  This granularity of locking allows multiple Cargo instances to download
  dependencies in parallel.
* Git repositories have separate locks for the database and for the project
  checkout. The datbase and checkout are locked for read/write access when an
  update is performed, and the lock of the checkout is held for the entire
  lifetime of the git source. This is done to ensure that any other Cargo
  processes must wait while we use the git repository. Unfortunately there's
  just not that much parallelism here.
* Binaries managed by `cargo install` are locked by the local metadata file that
  Cargo manages. This is relatively straightforward.
* The actual artifact output directory is just globally locked for the entire
  build. It's hypothesized that running Cargo concurrently in *one directory* is
  less of a feature needed rather than running multiple instances of Cargo
  globally (for now at least). It would be possible to have finer grained
  locking here, but that can likely be deferred to a future PR.

So with all of this infrastructure in place, Cargo is now ready to grab some
locks and ensure that you can call it concurrently anywhere at any time and
everything always works out as one might expect.

One interesting question, however, is what does Cargo do on contention? On one
hand Cargo could immediately abort, but this would lead to a pretty poor UI as
any Cargo process on the system could kick out any other. Instead this PR takes
a more nuanced approach.

* First, all locks are attempted to be acquired (a "try lock"). If this
  succeeds, we're done.
* Next, Cargo prints a message to the console that it's going to block waiting
  for a lock. This is done because it's indeterminate how long Cargo will wait
  for the lock to become available, and most long-lasting operations in Cargo
  have a message printed for them.
* Finally, a blocking acquisition of the lock is issued and we wait for it to
  become available.

So all in all this should help Cargo fix any future concurrency bugs with file
locking in a principled fashion while also allowing concurrent Cargo processes
to proceed reasonably across the system.

[fs2]: https://github.com/danburkert/fs2-rs
[unix-bad]: http://0pointer.de/blog/projects/locking.html

Closes #354
2016-03-16 22:14:36 -07:00
Alex Crichton 8eac1d62d8 Fix running Cargo concurrently
Cargo has historically had no protections against running it concurrently. This
is pretty unfortunate, however, as it essentially just means that you can only
run one instance of Cargo at a time **globally on a system**.

An "easy solution" to this would be the use of file locks, except they need to
be applied judiciously. It'd be a pretty bad experience to just lock the entire
system globally for Cargo (although it would work), but otherwise Cargo must be
principled how it accesses the filesystem to ensure that locks are properly
held. This commit intends to solve all of these problems.

A new utility module is added to cargo, `util::flock`, which contains two types:

* `FileLock` - a locked version of a `File`. This RAII guard will unlock the
  lock on `Drop` and I/O can be performed through this object. The actual
  underlying `Path` can be read from this object as well.
* `Filesystem` - an unlocked representation of a `Path`. There is no "safe"
  method to access the underlying path without locking a file on the filesystem
  first.

Built on the [fs2] library, these locks use the `flock` system call on Unix and
`LockFileEx` on Windows. Although file locking on Unix is [documented as not so
great][unix-bad], but largely only because of NFS, these are just advisory, and
there's no byte-range locking. These issues don't necessarily plague Cargo,
however, so we should try to leverage them. On both Windows and Unix the file
locks are released when the underlying OS handle is closed, which means that
if the process dies the locks are released.

Cargo has a number of global resources which it now needs to lock, and the
strategy is done in a fairly straightforward way:

* Each registry's index contains one lock (a dotfile in the index). Updating the
  index requires a read/write lock while reading the index requires a shared
  lock. This should allow each process to ensure a registry update happens while
  not blocking out others for an unnecessarily long time. Additionally any
  number of processes can read the index.
* When downloading crates, each downloaded crate is individually locked. A lock
  for the downloaded crate implies a lock on the output directory as well.
  Because downloaded crates are immutable, once the downloaded directory exists
  the lock is no longer needed as it won't be modified, so it can be released.
  This granularity of locking allows multiple Cargo instances to download
  dependencies in parallel.
* Git repositories have separate locks for the database and for the project
  checkout. The datbase and checkout are locked for read/write access when an
  update is performed, and the lock of the checkout is held for the entire
  lifetime of the git source. This is done to ensure that any other Cargo
  processes must wait while we use the git repository. Unfortunately there's
  just not that much parallelism here.
* Binaries managed by `cargo install` are locked by the local metadata file that
  Cargo manages. This is relatively straightforward.
* The actual artifact output directory is just globally locked for the entire
  build. It's hypothesized that running Cargo concurrently in *one directory* is
  less of a feature needed rather than running multiple instances of Cargo
  globally (for now at least). It would be possible to have finer grained
  locking here, but that can likely be deferred to a future PR.

So with all of this infrastructure in place, Cargo is now ready to grab some
locks and ensure that you can call it concurrently anywhere at any time and
everything always works out as one might expect.

One interesting question, however, is what does Cargo do on contention? On one
hand Cargo could immediately abort, but this would lead to a pretty poor UI as
any Cargo process on the system could kick out any other. Instead this PR takes
a more nuanced approach.

* First, all locks are attempted to be acquired (a "try lock"). If this
  succeeds, we're done.
* Next, Cargo prints a message to the console that it's going to block waiting
  for a lock. This is done because it's indeterminate how long Cargo will wait
  for the lock to become available, and most long-lasting operations in Cargo
  have a message printed for them.
* Finally, a blocking acquisition of the lock is issued and we wait for it to
  become available.

So all in all this should help Cargo fix any future concurrency bugs with file
locking in a principled fashion while also allowing concurrent Cargo processes
to proceed reasonably across the system.

[fs2]: https://github.com/danburkert/fs2-rs
[unix-bad]: http://0pointer.de/blog/projects/locking.html

Closes #354
2016-03-16 22:14:26 -07:00
bors 4576ae2b67 Auto merge of #2490 - alexcrichton:rustflags-docs, r=alexcrichton
Add docs for RUSTFLAGS and build.rustflags
2016-03-16 18:12:32 -07:00
bors 0493b49546 Auto merge of #2484 - alexcrichton:fix-bad-backtrack, r=brson
Fix caching features across backtracking

In the local loop during resolution all variables need to be reset whenever we
backtrack up a frame, but currently the `method` and `features` set are
accidentally not reset whenever we backtrack. Calculate the `method` later and
cache `features` in each frame so we can properly backtrack.

Closes #2472
2016-03-16 17:50:37 -07:00
Alex Crichton cada8e6bbe Add docs for RUSTFLAGS and build.rustflags 2016-03-16 17:46:08 -07:00
bors 8c60ada194 Auto merge of #2241 - brson:rustflags, r=alexcrichton
Apply RUSTFLAGS arguments to rustc builds

Cargo will use RUSTFLAGS for building everything that is not a build script
or plugin. It does not apply to these targets because they may be for
a different platform that 'normal' builds.

Closes #2112
2016-03-16 17:18:53 -07:00
Alex Crichton e3b7f2f57d Fix caching features across backtracking
In the local loop during resolution all variables need to be reset whenever we
backtrack up a frame, but currently the `method` and `features` set are
accidentally not reset whenever we backtrack. Calculate the `method` later and
cache `features` in each frame so we can properly backtrack.

Closes #2472
2016-03-16 14:20:52 -07:00
Brian Anderson 2f01868a94 Add rustflags support to config files
`build.rustflags` is treated exactly like `RUSTFLAGS`.

It is a list, so argument lists with spaces work.

`RUSTFLAGS` takes precedent, then `build.rustflags`.
2016-03-16 17:32:00 +00:00
Brian Anderson e4baac0ac2 Recompile when RUSTFLAGS changes 2016-03-16 16:49:22 +00:00
Brian Anderson e17933ec7f Apply RUSTFLAGS env var to rustc builds
This passes RUSTFLAGS to rustc builds for the target architecture.

We don't want to pass the RUSTFLAGS args to multiple architectures because
they may contain architecture-specific flags. Ideally, the scheme
we would use would treat plugins and build scripts - which may not
be for the target architecture - consistently. Unfortunately it's
quite difficult in the current Cargo architecture to seperately
identify build scripts, plugins and their dependencies from
code used by the target.

So the scheme here is very simple:

1) If --target is not specified, RUSTFLAGS applies to all builds.
2) If --target is specified, RUSTFLAGS only applies to builds
   with the Kind::Target target kind, which indicates build units
   derived from the requested --target.

Closes #2112
2016-03-16 16:49:21 +00:00
bors c3b571f393 Auto merge of #2485 - japaric:no-cross-doctests, r=alexcrichton
don't build/run doctests when target != host

fixes rust-lang/rust#31907

r? @alexcrichton
2016-03-15 09:57:46 -07:00
Jorge Aparicio ac46a1be90 remove unused format argument 2016-03-15 10:35:52 -05:00
Jorge Aparicio d37d38c874 update output of cross_tests 2016-03-15 07:55:01 -05:00
Jorge Aparicio fa34134253 don't build/run doctests when target != host
fixes rust-lang/rust#31907
2016-03-14 19:01:56 -05:00
bors 61b457892b Auto merge of #2483 - srinivasreddy:docs, r=alexcrichton
corrected statement regarding constraint graph solving problem type
2016-03-14 13:13:04 -07:00
srinivasreddy 42e2ab13d4 corrected statement regarding constraintgraph solving problem type 2016-03-15 00:56:26 +05:30
Ryan Quattlebaum 00b5389ece Fix bug in target lookup
The target lookup used to only look for bin targets, but now looks for
targets with the correct type.
2016-03-14 15:00:58 -04:00
Ryan Quattlebaum 089dafc20f Suggest the best matching target for cargo run
Targets passed to cargo compile are validated against the package. If
the target exists, it is compiled. If not, cargo will bail and offer a
suggested target name if there is a close match.

The tests create and build/run binaries and examples using filenames
that are close (or not so close) to the target names to verify that
close matching names are suggested to the user.
2016-03-14 13:26:29 -04:00
bors 276208535d Auto merge of #2481 - jespino:add-favicon-to-doc, r=alexcrichton
Add favicon to doc.crates.io

This fix the issue rust-lang/crates.io#245
2016-03-14 10:26:19 -07:00
bors b29b17f850 Auto merge of #2468 - TheNeikos:add-warning_if_no_browser, r=alexcrichton
Add warning if no browser

Closes #2371

I am unsure if `println!` is the correct way to print warnings at this stage, since it is not a hard error thus returning `Err` seems a bit too strong.
2016-03-14 10:08:12 -07:00
Jesús Espino ea41edf3c3 Add favicon to doc.crates.io 2016-03-14 09:00:49 +01:00
Marcel Müller 53dd5ab502
Don't include env in windows/macos 2016-03-14 03:05:49 +01:00
bors fb52825a51 Auto merge of #2474 - sbeckeriv:add-some-flair, r=alexcrichton
Add build flair

Dearest Reviewer

I have add the travis-ci build badge to the README. I pushed the image down towards the bottom. I was thinking that most people reading the readme do not care about the build status. I have seen the badge done in different locations and with different titles. I am easy on where it goes. I added it because I found that I was looking for the status when my branch was failing. I have since learned the travis interface.

<3 Becker

<img width="415" alt="screen shot 2016-03-12 at 10 51 43 am" src="https://cloud.githubusercontent.com/assets/12170/13724615/7fe41e36-e840-11e5-8815-3ac1f13dc2fd.png">
2016-03-12 12:34:58 -08:00