Skip to content
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

Fix path-based dependencies in sub-packages from path-based dependencies #2588

Merged
merged 3 commits into from Feb 12, 2023

Conversation

WebFreak001
Copy link
Member

Fix #2587

@@ -864,7 +864,7 @@ class Dub {
if (options & FetchOptions.printOnly) {
if (existing && existing.version_ != ver)
logInfo("A new version for %s is available (%s -> %s). Run \"%s\" to switch.",
packageId.color(Mode.bold), existing.version_, ver,
packageId.color(Mode.bold), existing, ver,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version_ crashes with non-version-range dependency specifications, so for logging we just dump the Dependency directly

@WebFreak001 WebFreak001 changed the title fix verbose logging crashing because of asserts Fix path-based dependencies in sub-packages from path-based dependencies Feb 12, 2023
WebFreak001 referenced this pull request Feb 12, 2023
A major issue when dealing with the 'Dependency' type is that it evolved from a simple type,
which stored a version range and perhaps one or two boolean,
to one that stores 4 kinds of dependencies: version range (including exact version),
branches, repository + hash, and path.
Instead of using a discrete type (e.g. a tagged union), the type is a mix of style,
and repository and branch are piggybacking on the field used for the version range.

Switching to std.sumtype makes interaction between fields more obvious.
Most importantly, it forces the programmer to answer the hard questions,
such as how do we compare completely different dependency (version vs repository).

Hopefully this will make the code easier to understand, and in the future,
make it easier to add a new kind of dependency.
@ibuclaw
Copy link
Member

ibuclaw commented Feb 12, 2023

Does windows always fail?

@WebFreak001
Copy link
Member Author

WebFreak001 commented Feb 12, 2023

yes (it's a long path bug, that we should really try to make shorter to avoid this kind of thing)

fix is here: #2589

@ibuclaw
Copy link
Member

ibuclaw commented Feb 12, 2023

Is anything going to be done about it? I'd hate to promote normalizing the behaviour of ignoring test results.

@WebFreak001
Copy link
Member Author

I'll try starting by first just using a smaller cache string (e.g. replace the long sha string with a truncated base64 one) in a separate PR

@dlang-bot dlang-bot merged commit 5780259 into dlang:stable Feb 12, 2023
@WebFreak001 WebFreak001 deleted the fix-regression-2587 branch February 12, 2023 22:46
@ibuclaw
Copy link
Member

ibuclaw commented Feb 12, 2023

Merging for now, so can get on with tagging beta for point release. If there's still any issues, there's a few days to fix them.

@@ -1631,7 +1631,7 @@ private class DependencyVersionResolver : DependencyResolver!(Dependency, Depend
protected override Dependency[] getSpecificConfigs(string pack, TreeNodes nodes)
{
if (!nodes.configs.path.empty || !nodes.configs.repository.empty) {
if (getPackage(pack, nodes.configs)) return [nodes.configs];
if (getPackage(nodes.pack, nodes.configs)) return [nodes.configs];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh, glad to see it was a dumb typo in the end.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, no idea how the hashOf removal broke this though, can only guess that it was missing checks further inside, because path based dependencies used to always equal to true whenever comparing with any other path based dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants