Skip to content

Split raw locations - #4479

Merged
mihaimaruseac merged 12 commits into
commercialhaskell:masterfrom
psibi:split-raw-locations
Jan 23, 2019
Merged

mihaimaruseac merged 12 commits into
commercialhaskell:masterfrom
psibi:split-raw-locations

Conversation

@psibi

@psibi psibi commented Jan 1, 2019

Copy link
Copy Markdown
Member

Supersedes #4422

@@ -1116,20 +1233,49 @@ instance Store OptionalSubdirs
-- has the expected information.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@qrilka In the above comment, which config file does it refer to ? Also, why is rpmName and rpmVersion has Maybe in it. The nearby comment indicate that it refers to a package name in the cabal file. So when do you think it will have Nothing in it ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not the author here but as far as I get it "config" here means either stack.yaml or snapshot.yaml. As for the package name field in it I don't know a good example when metadata could exist without a package name in it, maybe @snoyberg could explain it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you include a package as an archive or Git repo, you are not required to specify the name or version in the config, those are derived after parsing the cabal file.

-- package identifiers. We also want to ensure we only update once at a
-- time. Start at @True@.
, pcParsedCabalFilesImmutable :: !(IORef (Map PackageLocationImmutable GenericPackageDescription))
, pcParsedCabalFilesRawImmutable :: !(IORef (Map RawPackageLocationImmutable GenericPackageDescription))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@qrilka Is there any specific reason we are having Raw here ? If we have the full info, why not just use it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's needed for loadCabalFileRawImmutable which is currently used in Stack, if (or when) Stack.Snapshot will be remove we could get rid of "Raw" here. But if you have some suggestions how to handle it already now - please show

@snoyberg snoyberg mentioned this pull request Jan 7, 2019
2 tasks
@NorfairKing

Copy link
Copy Markdown
Contributor

Wauw this is a huge refactor. I'll only sniff-test it.

-- @since 0.1.0.0
data PackageLocationImmutable
= PLIHackage !PackageIdentifierRevision !(Maybe TreeKey)
= PLIHackage !PackageIdentifier !BlobKey !TreeKey

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@qrilka Any reason why this is changed to PackageIdentifier from PackageIdentifierRevision. I see that in the Raw version it is PackageIdentifierRevision.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for exact locations we don't need CabalFileInfo, , TreeKey is enough and e.g. CFILatest is not an exact revision :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, I see. Thanks.

@NorfairKing NorfairKing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sniff test done, LGTM.

Comment thread src/Stack/Build/ConstructPlan.hs Outdated
let version = installedVersion installed
mrev <- liftRIO $ getLatestHackageRevision name version
case mrev of
Nothing -> return () -- FIXME:qrilka report an error?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I think an error is in order here. Otherwise the dependency will just not be added, I think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Completely missed this, @psibi will you take care of it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure.

-- @since 0.1.0.0
toRawPL :: PackageLocation -> RawPackageLocation
toRawPL (PLImmutable im) = RPLImmutable (toRawPLI im)
toRawPL (PLMutable m) = RPLMutable m

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's worth notice that the corresponding roundtrip loses info.
So if you start from a RawPackageLocation, then make it into a PackageLocation and then back, you'll lose information and that could make the error messages a bit annoying.
For error messages we should use RawPackageLocation if possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nah, that opens up an interesting situation: if for a package in extra-deps you don't set a concrete revision Stack is supposed to resolve it and work with that resolved exact location (maybe from a lock file which is to appear soon). If we won't keep a corresponding raw location then error message could be misleading: e.g. after Stack lock file was created package author could have created a new revision fixing dependency problem but Stack will complain about that previous resolved revision if there will be no measures against such a situation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Aha! Thanks

@qrilka

qrilka commented Jan 23, 2019

Copy link
Copy Markdown
Contributor

I think it's not quite correct to approve code which is mostly of my authorship but still overall I don't see any obvious issues with this PR
@psibi will you resolve the conflict?

@mihaimaruseac mihaimaruseac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me too

@psibi

psibi commented Jan 23, 2019

Copy link
Copy Markdown
Member Author

@qrilka Sure, I will fix that by tomorrow.

@psibi

psibi commented Jan 23, 2019

Copy link
Copy Markdown
Member Author

@qrilka Resolved the conflicts and the CI is green too.

@mihaimaruseac
mihaimaruseac merged commit 8b5d0ec into commercialhaskell:master Jan 23, 2019
@mihaimaruseac

Copy link
Copy Markdown
Member

Thanks to both @psibi and @qrilka for this

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants