about summary refs log tree commit diff
path: root/src/librustpkg/path_util.rs
AgeCommit message (Collapse)AuthorLines
2013-08-09rustpkg: Simplify the PkgId structTim Chevalier-12/+9
Get rid of special cases for names beginning with "rust-" or containing hyphens, and just store a Path in a package ID. The Rust-identifier for the crate is none of rustpkg's business.
2013-08-09std/rustc/rustpkg/syntax: Support the `extern mod = ...` formTim Chevalier-75/+28
This commit allows you to write: extern mod x = "a/b/c"; which means rustc will search in the RUST_PATH for a package with ID a/b/c, and bind it to the name `x` if it's found. Incidentally, move get_relative_to from back::rpath into std::path
2013-08-08rustpkg: Eliminate a copyTim Chevalier-8/+5
2013-08-03remove obsolete `foreach` keywordDaniel Micay-6/+6
this has been replaced by `for`
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-6/+6
2013-07-24rustpkg: Handle non-numeric versions; some cleanupTim Chevalier-1/+7
Package IDs can now be of the form a/b/c#FOO, where (if a/b/c is a git repository) FOO is any tag in the repository. Non-numeric tags only match against package IDs with the same tag, and aren't compared linearly like numeric versions. While I was at it, refactored the code that calls `git clone`, and segregated build output properly for different packages.
2013-07-24fix fmt! usageDaniel Micay-1/+1
2013-07-18rustpkg: Make rustpkg commands work without a package IDTim Chevalier-2/+8
`rustpkg build`, if executed in a package source directory inside a workspace, will now build that package. By "inside a workspace" I mean that the parent directory has to be called `src`, and rustpkg will create a `build` directory in .. if there isn't already one. Same goes for `rustpkg install` and `rustpkg clean`. For the time being, `rustpkg build` (etc.) will still error out if you run it inside a directory whose parent isn't called `src`. I'm not sure whether or not it's desirable to have it do something in a non-workspace directory.
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-9/+12
2013-07-15rustpkg: Handle local git repositoriesTim Chevalier-0/+17
rustpkg can now build code from a local git repository. In the case where the local repo is in a directory not in the RUST_PATH, it checks out the repository into a directory in the first workspace in the RUST_PATH. The tests no longer try to connect to github.com, which should solve some of the sporadic failures we've been seeing.
2013-07-13rustpkg: Implement `uninstall` and `list` commandsTim Chevalier-1/+26
2013-07-08Patch up some new errors from rustpkgNiko Matsakis-6/+6
2013-07-01rustc: add a lint to enforce uppercase statics.Huon Wilson-7/+7
2013-06-29Great renaming: propagate throughout the rest of the codebaseCorey Richardson-5/+4
2013-06-29Remove unused variableJordi Boggiano-1/+0
2013-06-27rustpkg: Implement RUST_PATHTim Chevalier-3/+32
Unfortunately, the main test for this is ignored due to #7071. Closes #5682
2013-06-23vec: remove BaseIter implementationDaniel Micay-3/+4
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
2013-06-14rustpkg: Write more automated testsTim Chevalier-22/+67
Automate more tests described in the commands.txt file, and add infrastructure for running them. Right now, tests shell out to call rustpkg. This is not ideal.
2013-06-14add IteratorUtil to the preludeDaniel Micay-1/+0
2013-06-10std: replace str::each_split* with an iteratorHuon Wilson-1/+2
2013-06-09rustpkg: Accept package IDs like github.com/foo/bar#0.3Tim Chevalier-5/+11
If the package ID is of the form s#v, where v is a valid version string, fetch tag v of that package.
2013-06-01rustc/rusti/rustpkg: Infer packages from `extern mod` directivesTim Chevalier-42/+94
This commit won't be quite as useful until I implement RUST_PATH and until we change `extern mod` to take a general string instead of an identifier (#5682 and #6407). With that said, now if you're using rustpkg and a program contains: extern mod foo; rustpkg will attempt to search for `foo`, so that you don't have to provide a -L directory explicitly. In addition, rustpkg will actually try to build and install `foo`, unless it's already installed (specifically, I tested that `extern mod extra;` would not cause it to try to find source for `extra` and compile it again). This is as per #5681. Incidentally, I changed some driver code to infer the link name from the crate link_meta attributes. If that change isn't ok, say something. Also, I changed the addl_lib_search_paths field in the session options to be an @mut ~[Path] so that it can be modified after expansion but before later phases.
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-1/+3
2013-05-22libextra: Rename the actual metadata names of libcore to libstd and libstd ↵Patrick Walton-0/+1
to libextra
2013-05-14rustpkg: Tests for well-formed and ill-formed package IDs...Tim Chevalier-15/+16
...and cleanup, making how we handle version numbers more rational (specifically, not passing in a versioned name to rustc with the -o flag), and removing unused code.
2013-05-14rustpkg: Implement URL-like package IDsTim Chevalier-48/+59
This patch implements package IDs like github.com/catamorphism/test-pkg. To support such package IDs, I changed the PkgId struct to contain a LocalPath and a RemotePath field, where the RemotePath reflects the actual URL and the LocalPath reflects the file name of the cached copy. Right now, the only difference is that the local path doesn't contain dashes, but this will change when we implement #6407. Also, PkgIds now have a short_name field -- though the short name can be derived from the LocalPath, I thought it was cleaner not to call option::get() wantonly.
2013-05-14rustpkg: Remove #[allow(vecs_implicitly_copyable)]Alex Crichton-12/+13
2013-05-03rustpkg: Handle sysroot more correctlyTim Chevalier-5/+1
In rustpkg, pass around sysroot; in rustpkg tests, set the sysroot manually so that tests can find libcore and such. With bonus metadata::filesearch refactoring to avoid copies.
2013-05-03rustpkg: Implement install commandTim Chevalier-11/+119
The install command should work now, though it only installs in-place (anything else has to wait until I implement RUST_PATH). Also including: core: Add remove_directory_recursive, change copy_file Make copy_file preserve permissions, and add a remove_directory_recursive function.
2013-04-27only use #[no_core] in libcoreDaniel Micay-3/+0
2013-04-26core: Move mkdir_recursive from rustpkg into core::osTim Chevalier-39/+5
mkdir_recursive creates a directory as well as any of its parent directories that don't exist already. Seems like a useful thing to have in core.
2013-04-24rustpkg: Make path searching work as described in the rustpkg docTim Chevalier-52/+116
rustpkg now searches for package directories in ./src rather than in . . I also added a rudimentary RUST_PATH that's currently hard-wired to the current directory. rustpkg now uses src/, lib/, and build/ directories as described in the manual. Most of the existing test scenarios build now; the README file (in a separate commit) explains which ones.
2013-04-24libcore: unify `gen_<type>` methods on `rand::RngUtil` into the generic `gen`.Huon Wilson-1/+1
This moves all the basic random value generation into the Rand instances for each type and then removes the `gen_int`, `gen_char` (etc) methods on RngUtil, leaving only the generic `gen` and the more specialised methods. Also, removes some imports that are redundant due to a `use core::prelude::*` statement.
2013-04-24libcore: remove @Rng from rand, and use traits instead.Huon Wilson-1/+1
Also, rename RandRes -> IsaacRng, and make the constructors static methods.
2013-04-17rustpkg: Fail when crate inference fails; inject link attributesTim Chevalier-1/+20
1. Fail when there's no package script and no crates named main.rs, lib.rs, bench.rs, or test.rs. 2. Inject the crate link_meta "name" and "vers" attributes, so that the output file gets named correctly in the library case. 3. Normalize '-' to '_' in package names.
2013-04-15TidyTim Chevalier-2/+2
2013-04-12rustpkg: Factor out tests; use a condition instead of returning an optionTim Chevalier-0/+83
Pulled out tests into their own modules inside the files they test, as per the draft style guidelines. Started a new module, path_util, for utility functions to do with paths and directories. Changed default_dest_dir to use a condition and return Path instead of Option<Path>.