-
Notifications
You must be signed in to change notification settings - Fork 198
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
Update Hackage to use Cabal 3 #862
Conversation
<*> uniqueField "arch" archL | ||
<*> uniqueField "compiler" compilerL | ||
<*> uniqueField "client" clientL | ||
<*> undefined --monoidalFieldAla "flags" (alaList CommaFSep) flagAssignmentL TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this undefined resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope; still needs resolving...
UPDATE: resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to check the derived instances and run some tests on a snapshot of hackage.
@@ -235,30 +217,13 @@ basicChecks pkgid tarIndex = do | |||
throwError "'cabal-version' must be lower than 2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be bumped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true; but that's gonna happen outside this PR
@@ -27,7 +27,7 @@ import Distribution.Package | |||
import Distribution.Version (nullVersion) | |||
|
|||
import Control.Arrow (second) | |||
import Data.ByteString.Lazy.Char8 (unpack) -- Build reports are ASCII | |||
import Data.ByteString.Lazy (toStrict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this subsystem will have issues with multi-library packages but I do not think that is a blocking problem.
Attached here due to limitations in github's review system.
@@ -378,7 +379,7 @@ versionsFeature ServerEnv{ serverVerbosity = verbosity } | |||
|
|||
formatSinglePreferredVersions :: PackageName -> PreferredInfo -> Maybe String | |||
formatSinglePreferredVersions pkgname pref = | |||
display . Dependency pkgname <$> sumRange pref | |||
display . (\vr -> Dependency pkgname vr Set.empty) <$> sumRange pref -- XXX: ok? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct because PreferedVersions should operate at the package level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually.... see b6fbd24
@@ -117,7 +116,7 @@ instance SafeCopy VersionRange where | |||
6 -> withinVersion <$> safeGet | |||
7 -> unionVersionRanges <$> getVR <*> getVR | |||
8 -> intersectVersionRanges <$> getVR <*> getVR | |||
9 -> VersionRangeParens <$> getVR | |||
9 -> stripParensVersionRange <$> getVR -- XXX: correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reading of Cabal says this is correct.
(withComponentName' CLibName <$> libsA) | ||
(withComponentName' CLibName <$> libsB) | ||
(withComponentName' (CLibName LMainLibName) <$> libsA) | ||
(withComponentName' (CLibName LMainLibName) <$> libsB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone else check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was due to haskell/cabal@898b284
(withComponentName CSubLibName <$> sublibsA) | ||
(withComponentName CSubLibName <$> sublibsB) | ||
(withComponentName (CLibName . LSubLibName) <$> sublibsA) | ||
(withComponentName (CLibName . LSubLibName) <$> sublibsB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone else check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was due to haskell/cabal@898b284
where | ||
-- these names are reserved for the time being, as they have | ||
-- special meaning in cabal's UI | ||
reservedPkgNames = map mkPackageName ["all","any","none","setup","lib","exe","test"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does "bench" also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, because back then when I added those blacklisted names there was already: http://hackage.haskell.org/package/bench-1.0.0
I think Distribution/Server/Packages/Render.hs could be improved after the merge. |
… On 12. Mar 2020, at 5.16, davean ***@***.***> wrote:
@davean commented on this pull request.
I still need to check the derived instances and run some tests on a snapshot of hackage.
In Distribution/Server/Packages/Unpack.hs:
> @@ -235,30 +217,13 @@ basicChecks pkgid tarIndex = do
throwError "'cabal-version' must be lower than 2.5"
Needs to be bumped.
In Distribution/Server/Features/BuildReports.hs:
> @@ -27,7 +27,7 @@ import Distribution.Package
import Distribution.Version (nullVersion)
import Control.Arrow (second)
-import Data.ByteString.Lazy.Char8 (unpack) -- Build reports are ASCII
+import Data.ByteString.Lazy (toStrict)
I believe this subsystem will have issues with multi-library packages but I do not think that is a blocking problem.
Attached here due to limitations in github's review system.
In Distribution/Server/Features/PreferredVersions.hs:
> @@ -378,7 +379,7 @@ versionsFeature ServerEnv{ serverVerbosity = verbosity }
formatSinglePreferredVersions :: PackageName -> PreferredInfo -> Maybe String
formatSinglePreferredVersions pkgname pref =
- display . Dependency pkgname <$> sumRange pref
+ display . (\vr -> Dependency pkgname vr Set.empty) <$> sumRange pref -- XXX: ok?
I think this is correct because PreferedVersions should operate at the package level.
In Distribution/Server/Framework/Instances.hs:
> @@ -117,7 +116,7 @@ instance SafeCopy VersionRange where
6 -> withinVersion <$> safeGet
7 -> unionVersionRanges <$> getVR <*> getVR
8 -> intersectVersionRanges <$> getVR <*> getVR
- 9 -> VersionRangeParens <$> getVR
+ 9 -> stripParensVersionRange <$> getVR -- XXX: correct?
My reading of Cabal says this is correct.
In Distribution/Server/Util/CabalRevisions.hs:
> @@ -168,13 +180,13 @@ checkGenericPackageDescription
checkMaybe "Cannot add or remove library sections"
(checkCondTree checkLibrary)
- (withComponentName' CLibName <$> libsA)
- (withComponentName' CLibName <$> libsB)
+ (withComponentName' (CLibName LMainLibName) <$> libsA)
+ (withComponentName' (CLibName LMainLibName) <$> libsB)
Can someone else check?
In Distribution/Server/Util/CabalRevisions.hs:
>
checkListAssoc "Cannot add or remove sub-library sections"
(checkCondTree checkLibrary)
- (withComponentName CSubLibName <$> sublibsA)
- (withComponentName CSubLibName <$> sublibsB)
+ (withComponentName (CLibName . LSubLibName) <$> sublibsA)
+ (withComponentName (CLibName . LSubLibName) <$> sublibsB)
Can someone else check?
In Distribution/Server/Packages/Unpack.hs:
> + -- Check that the name and version in Cabal file match
+ when (packageName pkgDesc /= packageName pkgid) $
+ throwError "Package name in the cabal file does not match the file name."
+ when (packageVersion pkgDesc /= packageVersion pkgid) $
+ throwError "Package version in the cabal file does not match the file name."
+
+ -- check for reserved/magic package names
+ when (packageName pkgid `elem` reservedPkgNames) $
+ throwError "Package name is reserved."
+
+ return (pkgDesc, warnings, cabalEntry)
+
+ where
+ -- these names are reserved for the time being, as they have
+ -- special meaning in cabal's UI
+ reservedPkgNames = map mkPackageName ["all","any","none","setup","lib","exe","test"]
Does "bench" also?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Thank you for doing this, @alexbiehl, @hvr, and @phadej! |
Revision checking doesn't work correctly if there are public multi-lib dependencies.
Co-authored-by: Ben Gamari <[email protected]>
NB: This doesn't work as intended as the `cabalSpecFromVersionDigits` function is too lax; Cabal 3.4 however will provide a new function for helping to converting CabalSpecVersion to a Version (`cabalSpecToVersionDigits`) This reverts commit 0bfe698.
The open TODOs were related to the BuildReport fields for the "time" and the "flags" field. This change only does the bare minimum and in the future somebody will have to clean-up the technical debt incurred here.
I've merged this PR in order to prevent it from bitrotting again as well as to have basic CI enabled again. Some more testing is still required to get better confidence we don't have obvious regressions. |
Thanks @hvr! |
NB: `Dependency pkgname vr Set.empty` renders as a package with an empty set of sub-libs, i.e. as pkgname:{} >= 1.2.3 && ... instead of pkgname >= 1.2.3 && ...
See #852.
The patches in this PR are coming from @dwijnand, @hvr and @phadej. Unfortunately I can't push to the
wip/cabal-3.0
branch.