Closed KeithScheiwiller closed 5 years ago
In what way do you mean
However this does not seem to fit well into astrality's persistence model.
It is worth looking into options to allow for symlinking of whole directories.
As for your implementation, I cannot think of anything wrong with it but it doesn't seem ideal to start getting so specific with the conditions in directory globs. We should explore whole dir symlinking options first (maybe starting off from what you experimented with). If that fails, we can fallback on this option
Totals | |
---|---|
Change from base Build 791: | 0.0009% |
Covered Lines: | 4407 |
Relevant Lines: | 4502 |
@sshashank124 As far as I could tell, the persistence model doesn't support directories at all. In fact it looks like it leaves behind directories created as part of symlinking a hierarchy. Correct me if I'm wrong.
One approach would be to also track directories, using the checksum on the tar
of the directory. However, that would most probably introduce some other inconsistencies. Let's see what @JakobGM has to say
(Not sure I remember closing this, weird) @sshashank124 Ya, that's something else I tried. I decided to implement it a little more cleanly here if you want to maybe use it as a starting point.
I noticed that the SymlinkAction doesn't support nested symlinks, since it skips over any directories in
resolve_targets()
and it seems python's pathlibglob()
will not follow symlinks.The motivation for supporting this is because I like to have a "shared" directory for an application's dotfiles, then each separate host directory can symlink to the shared directory. As-is, this would not work with astrality. I initially tried to add logic to support "single" symlinks, i.e. where the content dir gets symlinked to target dir without recursively creating symlinks. However this does not seem to fit well into astrality's persistence model.
So in order to get this working I had to:
resolve_targets()
if said directory is also a symlink. A single dir->dir symlink will therefore get created.Let me know what you think, and if there are any issues you forsee with this! Really loving astrality's functionality!