Repository navigation
Split raw locations - #4479
Split raw locations#4479
Conversation
| @@ -1116,20 +1233,49 @@ instance Store OptionalSubdirs | |||
| -- has the expected information. | |||
There was a problem hiding this comment.
@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 ?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
@qrilka Is there any specific reason we are having Raw here ? If we have the full info, why not just use it.
There was a problem hiding this comment.
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
|
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 |
There was a problem hiding this comment.
@qrilka Any reason why this is changed to PackageIdentifier from PackageIdentifierRevision. I see that in the Raw version it is PackageIdentifierRevision.
There was a problem hiding this comment.
for exact locations we don't need CabalFileInfo, , TreeKey is enough and e.g. CFILatest is not an exact revision :)
NorfairKing
left a comment
There was a problem hiding this comment.
Sniff test done, LGTM.
| let version = installedVersion installed | ||
| mrev <- liftRIO $ getLatestHackageRevision name version | ||
| case mrev of | ||
| Nothing -> return () -- FIXME:qrilka report an error? |
There was a problem hiding this comment.
Yes, I think an error is in order here. Otherwise the dependency will just not be added, I think.
There was a problem hiding this comment.
Completely missed this, @psibi will you take care of it?
| -- @since 0.1.0.0 | ||
| toRawPL :: PackageLocation -> RawPackageLocation | ||
| toRawPL (PLImmutable im) = RPLImmutable (toRawPLI im) | ||
| toRawPL (PLMutable m) = RPLMutable m |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
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 |
|
@qrilka Sure, I will fix that by tomorrow. |
|
@qrilka Resolved the conflicts and the CI is green too. |
Supersedes #4422