Commits on Source (45)
-
SamwiseFilmore authored
It looks like sodiumoxide only depends on std for serializing with serde, disabling default features should preserve no-std for the library. As I more or less don't know what I'm doing with crypto stuff, there's probably some bits of code in here that are super naive. Also it hasn't gone through much testing, so I don't know what the value is there either. I'd like to integrate `pkgar-keys` at some point (little project I've been working on to store keys for packaging and verification), but I'd appreciate some guidance on how those should be formatted. More discussion should probably happen in the repo: https://gitlab.redox-os.org/MggMuggins/pkgar-keys
-
SamwiseFilmore authored
-
Jeremy Soller authored
Port to libsodium See merge request !4
-
SamwiseFilmore authored
I clearly never ran the tests... In addition to running the tests over my code... I updated the test script to allow debug builds when stuff panics and you need a backtrace, release builds optimize out the line numbers.
-
Jeremy Soller authored
Libsodium fix See merge request !5
-
SamwiseFilmore authored
- Uses pkgar-keys to read and write keyfiles instead of just binary keys. - I implemented a couple of `From`s for Error, and removed many map_err calls around the lib. I'm sure there's plenty I missed. Note that the integration tests are failing at this point, I'm going to fix them separately from this branch and merge over.
-
SamwiseFilmore authored
-
SamwiseFilmore authored
pkgar-keys is imported from https://gitlab.redox-os.org/MggMuggins/pkgar-keys
-
SamwiseFilmore authored
-
SamwiseFilmore authored
- Use --pkey and --skey in both crates. - Remove single bin target for pkgar; use main.rs - Clean up mentions of rand in pkgar
-
SamwiseFilmore authored
This compiles, but the tests fail due to an off by one or similar issue hiding someplace. Debugging is going to require a significant set of improvements to the error handling in the crate, the messages are crap atm. I also added the thiserror crate to make generating error impls easier, so it should be fairly straightforward from that side of things to improve the errors. Note that thiserror isn't no_std right now, so it's only used in pkgar, pkgar_core implements all the froms without the help of a macro.
-
SamwiseFilmore authored
Everything appears to be functional. I assumed that two functions that were called the same thing with approximately the same contents had the same behavior... not a safe assumption to make. That function is now reimplemented, among with several other small fixes. I also added a call to `pkgar list` in the tests to make sure it doesn't panic or do something else equally dumb. I also added a dependency on UserFacingError... I'm not sure how much value it will add, but I can see it being more useful as pkgar matures and good error reporting becomes more critical. Many improvements on that front soon I hope. In terms of the refactoring that happened last commit: There are some critical issues with implementing PackageSrc as a trait, namely needing to call read_at (which should be considered expensive) in order to read the header, something that most of the functions have to do. read_at could conceiveably cross network boundaries in the future, so it's important not to call it unessesarily. More design work needs to be done there.
-
SamwiseFilmore authored
I'm not super happy with this design because it makes for a reasonable amount of ugly boilerplate for implementors of PackageSrc. Works though, and it's faster. TODO: Implement new type for buffers of u8s instead of impl PackageSrc for AsRef<[u8]>
-
SamwiseFilmore authored
-
Jeremy Soller authored
Keys lib See merge request !6
-
SamwiseFilmore authored
Fixed two little bugs: - Private key files now use 600 instead of 644 - Fixed default key file paths Pulled in the same error deps as the main library, - UFE for easy pretty-printing of errors - thiserror for deriving std::error::Error for error types pkgar-keys now uses two error types, one that includes a file path for context and an ErrorKind for passing around internally and containing other error types. I'm still not happy with the sheer volume of boilerplate needed to create Error, so more work is needed, but error reporting is much better with these changes, and is probably more maintainable even given the boilerplate.
-
SamwiseFilmore authored
- SecKey took a lower-level approach for its 0.11 API, so I refactored passwords to include a new type to make sure everything gets zeroed. - Bunch of documentation work, I'm happy with the state of the rustdoc and error handling, at least enough to release 1.0 soon.
-
SamwiseFilmore authored
-
SamwiseFilmore authored
-
SamwiseFilmore authored
Just a couple of extra keys in Cargo.toml
-
SamwiseFilmore authored
No more nasty handwritten debug impls.
-
Jeremy Soller authored
pkgar-keys errors See merge request !7
-
Jeremy Soller authored
pkgar-core: Use min_const_generics See merge request !8
-
SamwiseFilmore authored
The tests fail with this commit, but I want to be able to branch to do the error refactoring to print out filesystem contents. Might end up amending this. Essentially the vec that was internal to the extract function is the backbone of a new type, Transaction, which provides semi-atomic package operations against the filesystem. Currently it's basically a refactor of extract, but it provides a more flexible place to add ugrades and removes (function headers implemented). This also entails a large amount of error refactoring to provide helpful context for various errors. More work to do here.
-
SamwiseFilmore authored
The tests failed because I accidentally dropped an fs::create_dir_all during my refactor. But in order to determine why my tests failed, I added a significant amount of code to add context to IO errors, as error reporting for pkgar is pretty critical. This needs a lot more work, but need to add features first.
-
SamwiseFilmore authored
Added remove as a transaction based on a PackageSrc; All it does is iterate the entries for a given package src and remove them. It checks the hashes to make sure that it's removing the file that was in the package.
-
SamwiseFilmore authored
A naive basic upgrade implementation is done now. It iterates a lot and is currently requesting the entries from the new package once more than it needs to (Transaction::install is used directly after and calls read_entries() again). However, it does appear to work, as... I wrote some tests in rust! The API now has a test case running on it, so I'll know if I break API or some such. I designed it to be thread-safe, so parallel testing is possible (unique temp files for each thread, cleaned up automatically on drop). This commit also refactors the basic functions in the crate to use AsRef<Path> instead of &str, and reorganizes the imports in the crate to make everything look nicer in the rustdoc.
-
SamwiseFilmore authored
This needs some further changes to make the generic stuff a bit more sane and actually usable, but this ensures that there's no code duplication in this function. Involved changes to the PackageSrcExt trait to better provide a reading interface for entries: should be helpful in future
-
SamwiseFilmore authored
Hashing a file should just pass it io::sink() and that'll probably be optimized away at compile. Significantly simplifies every call site too.
-
SamwiseFilmore authored
This does a similar thing as pkgar_keys, by splitting up the errors into ErrorKind (which stores the immediate context of the error, for example, the entry name) and the real Error, which _can_ also have a reason or filename associated. Error includes a builder pattern for adding context which can be shorter and is obviously more elegant than what I was doing before. Error is also a struct with a private enum member, this is to keep users from interacting with the error's state, all of which should be accessible using std::error::Error.
-
SamwiseFilmore authored
PackageSrcExt will probably change, but the typing should be significantly more lenient
-
SamwiseFilmore authored
Trying to leverage the type system a bit more for Entry and Header attributes and refactor transaction code to make it more readable and concise. More coming here.
-
SamwiseFilmore authored
I think this cleans up the code for matching on modes a little bit. At least most of it is now type checked so it'll be harder to break stuff with the mode defines.
-
SamwiseFilmore authored
Instead of creating one transaction for all operations and calling a method on that transaction to add installs or removes, the operation methods are constructors for transactions, and a transaction represents the temprorary state on the filesystem of an operation on an individual package or pair of packages. Probably some convenience methods should be implemented for Vec<Transaction> for easy comitting, but the idea is to expose the stateful nature of the transactions to library users so that they can do all the expensive parts of a large operation and commit all package changes at once.
-
SamwiseFilmore authored
Convenience function
-
SamwiseFilmore authored
-
Jeremy Soller authored
Transactions See merge request !9
-
SamwiseFilmore authored
There are still a couple of pain points here (EntryReader, for example), but the general layout works pretty well. With error chain and one or two handwritten impls I can pass a bare &Path to chain_err and it will construct the correct error variant and add it to the chain. This is a significant reduction in boilerplate. I still need to do some manual testing to generate some error conditions, but I think this setup will be more robust in the long term.
-
SamwiseFilmore authored
Most of this is just allowing "implicit" conversions between Path/PathBuf and ErrorKind, enabling `.chain_err(|| path )` syntax as opposed to `.chain_err(|| ErrorKind::Path(path.to_path_buf()) )`. Reduced verbosity should help with readability, since that pattern is used throughout the codebase. Also took care of a couple TODOs
-
Jeremy Soller authored
Error chain See merge request !10
-
Jeremy Soller authored
-
Jeremy Soller authored
-
Jeremy Soller authored
-
Jeremy Soller authored
-
Jeremy Soller authored
Showing
- Cargo.toml 6 additions, 36 deletionsCargo.toml
- README.md 7 additions, 64 deletionsREADME.md
- pkgar-core/Cargo.toml 14 additions, 0 deletionspkgar-core/Cargo.toml
- pkgar-core/src/entry.rs 23 additions, 3 deletionspkgar-core/src/entry.rs
- pkgar-core/src/error.rs 46 additions, 0 deletionspkgar-core/src/error.rs
- pkgar-core/src/header.rs 27 additions, 17 deletionspkgar-core/src/header.rs
- pkgar-core/src/lib.rs 60 additions, 0 deletionspkgar-core/src/lib.rs
- pkgar-core/src/package.rs 102 additions, 0 deletionspkgar-core/src/package.rs
- pkgar-keys/Cargo.toml 23 additions, 0 deletionspkgar-keys/Cargo.toml
- pkgar-keys/README.md 7 additions, 0 deletionspkgar-keys/README.md
- pkgar-keys/src/error.rs 62 additions, 0 deletionspkgar-keys/src/error.rs
- pkgar-keys/src/lib.rs 403 additions, 0 deletionspkgar-keys/src/lib.rs
- pkgar-keys/src/main.rs 110 additions, 0 deletionspkgar-keys/src/main.rs
- pkgar/Cargo.toml 34 additions, 0 deletionspkgar/Cargo.toml
- pkgar/README.md 75 additions, 0 deletionspkgar/README.md
- pkgar/fuzz/.gitignore 0 additions, 0 deletionspkgar/fuzz/.gitignore
- pkgar/fuzz/Cargo.toml 0 additions, 0 deletionspkgar/fuzz/Cargo.toml
- pkgar/fuzz/fuzz_targets/header.rs 0 additions, 0 deletionspkgar/fuzz/fuzz_targets/header.rs
- pkgar/src/bin.rs 318 additions, 0 deletionspkgar/src/bin.rs
- pkgar/src/ext.rs 118 additions, 0 deletionspkgar/src/ext.rs
[package] | ||
name = "pkgar" | ||
version = "0.1.6" | ||
description = "Redox Package Archive" | ||
license = "MIT" | ||
authors = ["Jeremy Soller <jackpot51@gmail.com>"] | ||
repository = "https://gitlab.redox-os.org/redox-os/pkgar" | ||
edition = "2018" | ||
[workspace] | ||
members = [ | ||
"pkgar", | ||
"pkgar-core", | ||
"pkgar-keys", | ||
] | ||
[[bin]] | ||
name = "pkgar" | ||
required-features = ["clap", "rand", "std"] | ||
[dependencies] | ||
plain = "0.2.3" | ||
sodalite = "0.3.0" | ||
[dependencies.clap] | ||
version = "2.33.0" | ||
optional = true | ||
[dependencies.rand] | ||
version = "0.7.2" | ||
optional = true | ||
[dependencies.rand_core] | ||
version = "0.5.1" | ||
default-features = false | ||
[dependencies.blake3] | ||
version = "0.2.1" | ||
default-features = false | ||
features = ["rayon"] | ||
[features] | ||
default = ["clap", "rand", "std"] | ||
std = [] |
pkgar-core/Cargo.toml
0 → 100644
pkgar-core/src/error.rs
0 → 100644
pkgar-core/src/package.rs
0 → 100644
pkgar-keys/Cargo.toml
0 → 100644
pkgar-keys/README.md
0 → 100644
pkgar-keys/src/error.rs
0 → 100644
pkgar-keys/src/lib.rs
0 → 100644
pkgar-keys/src/main.rs
0 → 100644
pkgar/Cargo.toml
0 → 100644
pkgar/README.md
0 → 100644
File moved
File moved
pkgar/src/ext.rs
0 → 100644