1. 17 Mar, 2022 1 commit
  2. 03 Aug, 2021 1 commit
  3. 10 Jan, 2021 1 commit
  4. 07 Jan, 2021 1 commit
    • SamwiseFilmore's avatar
      Error cleanup · 9caccb76
      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
  5. 06 Jan, 2021 2 commits
    • SamwiseFilmore's avatar
      Use error-chain for error handling · 0723ce95
      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.
    • Jeremy Soller's avatar
      Merge branch 'transaction' into 'master' · d8de5f9f
      Jeremy Soller authored
      See merge request !9
  6. 02 Jan, 2021 1 commit
  7. 27 Aug, 2020 1 commit
  8. 26 Aug, 2020 1 commit
    • SamwiseFilmore's avatar
      Refactor transactions · 1151de44
      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.
  9. 22 Aug, 2020 12 commits
    • SamwiseFilmore's avatar
      Use bitflags! for mode defines · c0ff5505
      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's avatar
      Refactoring Transaction; Docs · 802dc824
      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's avatar
      Fix typing for crate::ext; Rename upgrade to replace · 53990857
      SamwiseFilmore authored
      PackageSrcExt will probably change, but the typing should be
      significantly more lenient
    • SamwiseFilmore's avatar
      Major Error Refactor · 0e2d0cae
      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
      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's avatar
      Simplify copy_and_hash to take any writer; · 53bd3d56
      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's avatar
      Refactor copy_and_hash · 1a9d144c
      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's avatar
      Implement upgrade; Refactoring; Tests in Rust! · 84937445
      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's avatar
      Implement remove · e78fded8
      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
    • SamwiseFilmore's avatar
      Error handling "improvements"; Fix tests · 1bf25d2f
      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
    • SamwiseFilmore's avatar
      WIP: Refactor extraction into transaction API · 5cf2327c
      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.
    • Jeremy Soller's avatar
      Merge branch 'min_const_generics' into 'master' · e7130b2b
      Jeremy Soller authored
      pkgar-core: Use min_const_generics
      See merge request !8
    • Jeremy Soller's avatar
      Merge branch 'keys-errors' into 'master' · 081ecf8a
      Jeremy Soller authored
      pkgar-keys errors
      See merge request !7
  10. 21 Aug, 2020 1 commit
  11. 16 Aug, 2020 5 commits
    • SamwiseFilmore's avatar
      pkgar-keys: Prep for release · b36b0647
      SamwiseFilmore authored
      Just a couple of extra keys in Cargo.toml
    • SamwiseFilmore's avatar
      Update README · fdc7a322
      SamwiseFilmore authored
    • SamwiseFilmore's avatar
      Bump crates; remote dbg line in keys · aa196402
      SamwiseFilmore authored
    • SamwiseFilmore's avatar
      pkgar-keys: Update seckey + refactor passwd; Docs and cleanup · 1a0408dd
      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's avatar
      pkgar-keys: Refactor Errors · faaf1c88
      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.
  12. 14 Aug, 2020 1 commit
  13. 04 Aug, 2020 2 commits
  14. 03 Aug, 2020 1 commit
    • SamwiseFilmore's avatar
      Small Error improvements; Passes tests · 48dac371
      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
  15. 30 Jul, 2020 1 commit
    • SamwiseFilmore's avatar
      WIP: Refactor pkgar into two crates · 421aeae9
      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
      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.
  16. 26 Jul, 2020 3 commits
  17. 25 Jul, 2020 2 commits
  18. 19 Jul, 2020 2 commits
  19. 18 Jul, 2020 1 commit