-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PackageManager: Store packages hierarchically, by version #2610
Conversation
Tested locally, will add test, but would prefer to do it with #2603 |
230834c
to
e22e799
Compare
I don't think the rationale is super convincing, in particular a package GC and path based version inference are possible just fine with the flat approach, too. It also increases the iteration overhead by having to open each directory. On the other hand, the nested version scheme does look cleaner when browsing the folder manually. So unless the iteration slowdown is significant, I wouldn't really mind the change either. Implementation wise, everything looked fine, not sure about the failed tests. |
Unfortunately no, the scheme is currently ambiguous.
The biggest overhead is that we have to open those directories at all. The vast majority of invocation are
Good point, will add it to the rationale. |
e22e799
to
0965bd5
Compare
As explained in the changelog, this hierarchy makes much more sense than the current one, and will make it possible to read the version from the directory name.
0965bd5
to
db286f7
Compare
Regarding tests, this is already widely tested as can be seen in the changes. Last thing I'm musing over: Should we just tell people to nuke |
Package names are not allowed to contain ".", so there is no ambiguity here.
Are you sure about that? I'd guess that reading the individual dub.json files is the largest factor, but admittedly I have never measured that. |
This is not enforced by dub though, right ? We only get a warning AFAIK. Is it enforced by the registry ?
Right, "opening those directories" was an abuse of language. The expensive part is the whole "load all packages known to dub on each command". You're right that if we break that down further, reading the dub.json will likely come on top. But if we load packages lazily, which we can do for most cases of |
what happens with the old folder structure? I'm not seeing any migration code or loading code from the old path names |
I asked Atila what we should do with it. He said something to the tune of "Just do it". So no migration, people can just nuke their package folder and re-download. |
Exactly. And since these are just registry packages, those others can't end up there. But I really think we should change the warning to an error here. It shows time again that reserving these characters is very valuable. |
What about
Agreed. |
I don't think this is a good idea and most people won't nuke their package folder, I bet a lot don't even know out of their head where it is. Migration code should also be super easy to do, so telling people to nuke their dub packages would just be wasting bandwidth and is going to introduce a lot of delay to people building projects again. (especially annoying for people who are coding offline / on the go, trying to work on their projects after a D / dub update the previous night. |
There is a solution to this. New directory, if old one hasn't been touched in a month, delete it. |
There's quite a few places that rely on the directory |
I have no idea how they are stored, but if they have their associated version suffixed to the folder, then they will work. If not, they won't work with either scheme. |
Should be "stored and updated". I just didn't follow the implementation here and I'm not sure whether that is actually sound. |
BTW, I'd be with Atila here, as long as the existing packages are still used and will be purged by a future GC mechanism, having an explicit migration code doesn't seem necessary. Also, people might mix different DUB versions (I sometimes do when accessing the same repository from Windows and from WSL, for example), which would lead to constant conflicts. |
hm you are right, that's not a thing I've considered. Also So I guess it might just make more sense to have both in parallel and some time in the future think about migrating to only the new scheme. |
So... Can we merge this ? |
As explained in the changelog, this hierarchy makes much more sense than the current one, and will make it possible to read the version from the directory name.