Skip to content

Commit 33d7a09

Browse files
committed
cleanup based on comments about outstanding work
1 parent 973cdd8 commit 33d7a09

File tree

4 files changed

+12
-305
lines changed

4 files changed

+12
-305
lines changed

src/Distribution/Server/Features/PackageCandidates.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ candidatesFeature ServerEnv{serverBlobStore = store}
222222
resourceDesc = [(GET, "Candidate tarball")]
223223
, resourceGet = [("tarball", serveCandidateTarball)]
224224
}
225+
-- dummy null resource for revisions, since candidates don't have revisions
226+
, coreCabalFileRev = (resourceAt "/package/:package/candidate/revisions/") {
227+
resourceDesc = []
228+
, resourceGet = []
229+
}
225230
, indexPackageUri = \format ->
226231
renderResource (corePackagesPage r) [format]
227232
, corePackageIdUri = \format pkgid ->

src/Distribution/Server/Packages/Unpack.hs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import qualified Codec.Archive.Tar.Entry as Tar
1818
import qualified Codec.Archive.Tar.Check as Tar
1919

2020
import Distribution.CabalSpecVersion
21-
( CabalSpecVersion(..), showCabalSpecVersion )
21+
( CabalSpecVersion(..) )
2222
import Distribution.Version
2323
( nullVersion )
2424
import Distribution.Types.PackageName
@@ -209,24 +209,8 @@ specVersionChecks specVerOk specVer = do
209209
throwError "'cabal-version' must be at least 1.2"
210210

211211
-- Safeguard; should already be caught by parser
212-
unless (specVer <= CabalSpecV2_4) $
213-
throwError "'cabal-version' must be at most 2.4"
214-
215-
-- Check whether a known spec version had been used
216-
-- TODO: move this into lib:Cabal
217-
let knownSpecVersions =
218-
[ CabalSpecV1_18
219-
, CabalSpecV1_20
220-
, CabalSpecV1_22
221-
, CabalSpecV1_24
222-
, CabalSpecV2_0
223-
, CabalSpecV2_2
224-
, CabalSpecV2_4
225-
]
226-
when (specVer >= CabalSpecV1_18 && (specVer `notElem` knownSpecVersions)) $
227-
throwError ("'cabal-version' refers to an unreleased/unknown cabal specification version "
228-
++ showCabalSpecVersion specVer ++ "; for a list of valid specification versions please consult "
229-
++ "https://www.haskell.org/cabal/users-guide/file-format-changelog.html")
212+
unless (specVer <= CabalSpecV3_0) $
213+
throwError "'cabal-version' must be at most 3.0"
230214

231215
-- | The issue is that browsers can upload the file name using either unix
232216
-- or windows convention, so we need to take the basename using either

0 commit comments

Comments
 (0)