Package Musings From the Core…

So, it seems that I’m destined to blog a lot today! šŸ˜‰

pkgcore
I’ve started working on pkgcore this (fine, sunny) afternoon, and I’ll be working on supporting binpkgs completely in pkgcore – hopefully! šŸ˜‰ Thus far, I have a minimal doc (which will appear in my overlay shortly) with some random musings about, essentially, how we tac metadata onto a binpkg .tbz2 archive. Since binpkg code will be easy to do – it’s mainly just keeping the metadata packed on the end of a binpkg up-to-date and reading/writing said metadata; basically, being able to introspect metadata for a binpkg easily… šŸ™‚

I currently have a following “not all all pseudo” code:

  1. mmap() open binpkg fd;
  2. cast base + offset to a struct containing metadata;
  3. … manipulate data …;
  4. write-out data (if write operation) with a memcpy and msync();
  5. munmap() binpkg fd.

Once this is done, we essentially do the following for all write operations:

  1. fsync() all fds;
  2. fsync all binpkg directory fds (to ensure sync!);
  3. … wait for disk for flush …;
  4. report status to user.

Pretty simple, fast, and effective. šŸ™‚ Note that this is just for the “update all binpkgs” case, not a single inspect/change binpkg metadata… Time to put this to the test! :>