summary refs log tree commit diff
path: root/src/librustpkg/path_util.rs
AgeCommit message (Collapse)AuthorLines
2014-01-02Inject std libs with versionsFlorian Hahn-3/+22
2013-12-29Rename uses of PkgId to CrateId in librustpkgLuis de Bethencourt-53/+54
2013-12-24std: Stop reexporting the contents of 'mod consts'Alex Crichton-1/+1
This prevents usage of the win32 utf-16 helper functions from outside of libstd. Closes #9053
2013-12-12Use libdir() instead of hard coded string. Fixes #10903Jan Niklas Hasse-3/+4
2013-12-10librustpkg: Make `io::ignore_io_error()` use RAII; remove a few morePatrick Walton-1/+4
cells.
2013-12-08Remove dead codesKiet Tran-0/+2
2013-11-26librustc: Remove non-procedure uses of `do` from librustc, librustdoc,Patrick Walton-14/+9
and librustpkg.
2013-11-26librustc: Remove remaining uses of `&fn()` in favor of `||`.Patrick Walton-1/+1
2013-11-26rustc: Update obsolete attribute listklutzy-2/+0
2013-11-12rustpkg: Eliminate the spurious ↵Tim Chevalier-0/+2
`os::path_exists(&pkg_src.start_dir.join(p))` assertion failure This addresses the problem reported in #10253 and possibly elsewhere. Closes #10253
2013-11-11Move std::rt::io to std::ioAlex Crichton-2/+2
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-2/+0
These two attributes are no longer useful now that Rust has decided to leave segmented stacks behind. It is assumed that the rust task's stack is always large enough to make an FFI call (due to the stack being very large). There's always the case of stack overflow, however, to consider. This does not change the behavior of stack overflow in Rust. This is still normally triggered by the __morestack function and aborts the whole process. C stack overflow will continue to corrupt the stack, however (as it did before this commit as well). The future improvement of a guard page at the end of every rust stack is still unimplemented and is intended to be the mechanism through which we attempt to detect C stack overflow. Closes #8822 Closes #10155
2013-11-04Move io::file to io::fs and fns out of FileAlex Crichton-11/+10
This renames the `file` module to `fs` because that more accurately describes its current purpose (manipulating the filesystem, not just files). Additionally, this adds an UnstableFileStat structure as a nested structure of FileStat to signify that the fields should not be depended on. The structure is currently flagged with #[unstable], but it's unlikely that it has much meaning. Closes #10241
2013-11-03Fill out the remaining functionality in io::fileAlex Crichton-7/+7
This adds bindings to the remaining functions provided by libuv, all of which are useful operations on files which need to get exposed somehow. Some highlights: * Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type * Moved all file-related methods to be static methods under `File` * All directory related methods are still top-level functions * Created `io::FilePermission` types (backed by u32) that are what you'd expect * Created `io::FileType` and refactored `FileStat` to use FileType and FilePermission * Removed the expanding matrix of `FileMode` operations. The mode of reading a file will not have the O_CREAT flag, but a write mode will always have the O_CREAT flag. Closes #10130 Closes #10131 Closes #10121
2013-11-03Remove all blocking std::os blocking functionsAlex Crichton-26/+26
This commit moves all thread-blocking I/O functions from the std::os module. Their replacements can be found in either std::rt::io::file or in a hidden "old_os" module inside of native::file. I didn't want to outright delete these functions because they have a lot of special casing learned over time for each OS/platform, and I imagine that these will someday get integrated into a blocking implementation of IoFactory. For now, they're moved to a private module to prevent bitrot and still have tests to ensure that they work. I've also expanded the extensions to a few more methods defined on Path, most of which were previously defined in std::os but now have non-thread-blocking implementations as part of using the current IoFactory. The api of io::file is in flux, but I plan on changing it in the next commit as well. Closes #10057
2013-10-22rustpkg: Support arbitrary dependencies in the install APITim Chevalier-1/+3
api::install_pkg now accepts an argument that's a list of (kind, path) dependency pairs. This allows custom package scripts to declare C dependencies, as is demonstrated in rustpkg::tests::test_c_dependency_ok. Closes #6403
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-23/+23
Who doesn't like a massive renaming?
2013-10-21rustpkg: Search for crates in the current directoryTim Chevalier-2/+6
As per #8520, find crates in the current working directory even if it's not a workspace. Closes #8520
2013-10-16path2: Update for latest masterKevin Ballard-2/+2
Also fix some issues that crept into earlier commits during the conflict resoution for the rebase.
2013-10-16path2: Remove some API functionsKevin Ballard-2/+2
Delete the following API functions: - set_dirname() - with_dirname() - set_filestem() - with_filestem() - add_extension() - file_path() Also change pop() to return a boolean instead of an owned copy of the old filename.
2013-10-16path2: Update based on more review feedbackKevin Ballard-7/+7
Standardize the is_sep() functions to be the same in both posix and windows, and re-export from path. Update extra::glob to use this. Remove the usage of either, as it's going away. Move the WindowsPath-specific methods out of WindowsPath and make them top-level functions of path::windows instead. This way you cannot accidentally write code that will fail to compile on non-windows architectures without typing ::windows anywhere. Remove GenericPath::from_c_str() and just impl BytesContainer for CString instead. Remove .join_path() and .push_path() and just implement BytesContainer for Path instead. Remove FilenameDisplay and add a boolean flag to Display instead. Remove .each_parent(). It only had one caller, so just inline its definition there.
2013-10-15path2: Adjust the API to remove all the _str mutation methodsKevin Ballard-10/+10
Add a new trait BytesContainer that is implemented for both byte vectors and strings. Convert Path::from_vec and ::from_str to one function, Path::new(). Remove all the _str-suffixed mutation methods (push, join, with_*, set_*) and modify the non-suffixed versions to use BytesContainer.
2013-10-15path2: Replace the path module outrightKevin Ballard-51/+55
Remove the old path. Rename path2 to path. Update all clients for the new path. Also make some miscellaneous changes to the Path APIs to help the adoption process.
2013-10-10rustpkg: Make checked-out source files read-only, and overhaul where ↵Tim Chevalier-1/+23
temporary files are stored rustpkg now makes source files that it checks out automatically read-only, and stores them under build/. Also, refactored the `PkgSrc` type to keep track of separate source and destination workspaces, as well as to have a `build_workspace` method that returns the workspace to put temporary files in (usually the source, sometimes the destination -- see comments for more details). Closes #6480
2013-10-09option: rewrite the API to use compositionDaniel Micay-1/+1
2013-10-01Migrate users of 'loop' to 'continue'Alex Crichton-1/+1
Closes #9467
2013-09-30rustpkg: Remove uses of fmt!Alex Crichton-35/+35
2013-09-25rustpkg: Search for packages correctly when using the rust_path_hackTim Chevalier-5/+18
Previously, any package would match any other package ID when searching using the rust_path_hack, so long as the directory had one or more crate files in it. Now, rustpkg checks that the parent directory matches the package ID. Closes #9273
2013-09-18rustpkg: Register correct dependencies for built and installed filesTim Chevalier-1/+0
as per #9112 Closes #9112
2013-09-13rustc/rustpkg: Use a target-specific subdirectory in build/ and lib/Tim Chevalier-11/+42
As per rustpkg.md, rustpkg now builds in a target-specific subdirectory of build/, and installs libraries into a target-specific subdirectory of lib. Closes #8672
2013-09-13auto merge of #9148 : jakub-/rust/rustpkg-install-mkdir-p, r=catamorphismbors-0/+2
Testing this is a little tricky as an intermediate temporary directory is only used for remote git repositories and therefore that path cannot be reliably exercised in the tests.
2013-09-12rustpkg: Install to RUST_PATHTim Chevalier-0/+9
Install to the first directory in the RUST_PATH if the user set a RUST_PATH. In the case where RUST_PATH isn't set, the behavior remains unchanged. Closes #7402
2013-09-12rustpkg: Search RUST_PATH properly for dependencies, and add a test for ↵Tim Chevalier-0/+4
recursive dependencies Closes #8524
2013-09-12Fix rustpkg install for git repositoriesJakub-0/+2
2013-09-12rustpkg: Support sub-package-IDsTim Chevalier-4/+10
Package IDs can now refer to a subdirectory of a particular source tree, and not just a top-level directory with a src/ directory as its parent. For example, referring to the package ID a/b/c/d , in workspace W, if W/src/a is a package, will build the sources for the package in a/b/c/d (and not other crates in W/src/a). Closes #6408
2013-09-08rustpkg: Address review comments from JackTim Chevalier-2/+1
2013-09-08rustpkg: Use workcacheTim Chevalier-35/+7
rustpkg now uses the workcache library to avoid recompilation. Hooray!
2013-09-04Update clients of path.rs to use new API.Felix S. Klock II-2/+2
In most cases this involved removing a ~str allocations or clones (yay), or coercing a ~str to a slice. In a few places, I had to bind an intermediate Path (e.g. path.pop() return values), so that it would live long enough to support the borrowed &str. And in a few places, where the code was actively using the property that the old API returned ~str's, I had to put in to_owned() or clone(); but in those cases, we're trading an allocation within the path.rs code for one in the client code, so they neutralize each other.
2013-08-30rustpkg: Allow package directories to appear in the RUST_PATHTim Chevalier-14/+40
This commit adds a rustpkg flag, --rust-path-hack, that allows rustpkg to *search* inside package directories if they appear in the RUST_PATH, while *building* libraries and executables into a different target directory. This behavior is hidden behind a flag because I believe we only want to support it temporarily, to make it easier to port servo to rustpkg. This commit also includes a fix for how rustpkg fetches sources from git repositories -- it uses a temporary directory as the target when invoking `git clone`, then moves that directory into the workspace if the clone was successful. (The old behavior was that when the `git clone` failed, the empty target directory would be left lying around anyway.)
2013-08-26rustpkg: Test that different copies of the same package ID can exist in ↵Tim Chevalier-0/+6
multiple workspaces The test checks that rustpkg uses the first one, rather than complaining about multiple matches. Closes #7241
2013-08-19rustpkg: Un-ignore most of the remaining testsTim Chevalier-35/+34
This necessitated some cleanup to how we parse library filenames when searching for libraries, since rustpkg may now create filenames that contain '-' characters. Also cleaned up how rustpkg passes the sysroot to a custom build script.
2013-08-11Cleanup librustpkg a little bit.Steven Stewart-Gallus-44/+49
Mostly I did simple transformations from imperative style loops to more functional iterator based transformations.
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.