@@ -1253,40 +1253,6 @@ checkCabalVersion pkg =
1253
1253
++ " the 'other-extensions' field lists extensions that are used in "
1254
1254
++ " some modules, e.g. via the {-# LANGUAGE #-} pragma."
1255
1255
1256
- -- check use of "foo (>= 1.0 && < 1.4) || >=1.8 " version-range syntax
1257
- , checkVersion [1 ,8 ] (not (null versionRangeExpressions)) $
1258
- PackageDistInexcusable $
1259
- " The package uses full version-range expressions "
1260
- ++ " in a 'build-depends' field: "
1261
- ++ commaSep (map displayRawDependency versionRangeExpressions)
1262
- ++ " . To use this new syntax the package needs to specify at least "
1263
- ++ " 'cabal-version: >= 1.8'. Alternatively, if broader compatibility "
1264
- ++ " is important, then convert to conjunctive normal form, and use "
1265
- ++ " multiple 'build-depends:' lines, one conjunct per line."
1266
-
1267
- -- check use of "build-depends: foo == 1.*" syntax
1268
- , checkVersion [1 ,6 ] (not (null depsUsingWildcardSyntax)) $
1269
- PackageDistInexcusable $
1270
- " The package uses wildcard syntax in the 'build-depends' field: "
1271
- ++ commaSep (map prettyShow depsUsingWildcardSyntax)
1272
- ++ " . To use this new syntax the package need to specify at least "
1273
- ++ " 'cabal-version: >= 1.6'. Alternatively, if broader compatibility "
1274
- ++ " is important then use: " ++ commaSep
1275
- [ prettyShow (Dependency name (eliminateWildcardSyntax versionRange) Set. empty)
1276
- | Dependency name versionRange _ <- depsUsingWildcardSyntax ]
1277
-
1278
- -- check use of "build-depends: foo ^>= 1.2.3" syntax
1279
- , checkVersion [2 ,0 ] (not (null depsUsingMajorBoundSyntax)) $
1280
- PackageDistInexcusable $
1281
- " The package uses major bounded version syntax in the "
1282
- ++ " 'build-depends' field: "
1283
- ++ commaSep (map prettyShow depsUsingMajorBoundSyntax)
1284
- ++ " . To use this new syntax the package need to specify at least "
1285
- ++ " 'cabal-version: 2.0'. Alternatively, if broader compatibility "
1286
- ++ " is important then use: " ++ commaSep
1287
- [ prettyShow (Dependency name (eliminateMajorBoundSyntax versionRange) Set. empty)
1288
- | Dependency name versionRange _ <- depsUsingMajorBoundSyntax ]
1289
-
1290
1256
, checkVersion [3 ,0 ] (any (not . null )
1291
1257
(concatMap buildInfoField
1292
1258
[ asmSources
@@ -1312,26 +1278,6 @@ checkCabalVersion pkg =
1312
1278
" The use of 'virtual-modules' requires the package "
1313
1279
++ " to specify at least 'cabal-version: >= 2.1'."
1314
1280
1315
- -- check use of "tested-with: GHC (>= 1.0 && < 1.4) || >=1.8 " syntax
1316
- , checkVersion [1 ,8 ] (not (null testedWithVersionRangeExpressions)) $
1317
- PackageDistInexcusable $
1318
- " The package uses full version-range expressions "
1319
- ++ " in a 'tested-with' field: "
1320
- ++ commaSep (map displayRawDependency testedWithVersionRangeExpressions)
1321
- ++ " . To use this new syntax the package needs to specify at least "
1322
- ++ " 'cabal-version: >= 1.8'."
1323
-
1324
- -- check use of "tested-with: GHC == 6.12.*" syntax
1325
- , checkVersion [1 ,6 ] (not (null testedWithUsingWildcardSyntax)) $
1326
- PackageDistInexcusable $
1327
- " The package uses wildcard syntax in the 'tested-with' field: "
1328
- ++ commaSep (map prettyShow testedWithUsingWildcardSyntax)
1329
- ++ " . To use this new syntax the package need to specify at least "
1330
- ++ " 'cabal-version: >= 1.6'. Alternatively, if broader compatibility "
1331
- ++ " is important then use: " ++ commaSep
1332
- [ prettyShow (Dependency name (eliminateWildcardSyntax versionRange) Set. empty)
1333
- | Dependency name versionRange _ <- testedWithUsingWildcardSyntax ]
1334
-
1335
1281
-- check use of "source-repository" section
1336
1282
, checkVersion [1 ,6 ] (not (null (sourceRepos pkg))) $
1337
1283
PackageDistInexcusable $
@@ -1403,15 +1349,6 @@ checkCabalVersion pkg =
1403
1349
1404
1350
buildInfoField field = map field (allBuildInfo pkg)
1405
1351
1406
- versionRangeExpressions =
1407
- [ dep | dep@ (Dependency _ vr _) <- allBuildDepends pkg
1408
- , usesNewVersionRangeSyntax vr ]
1409
-
1410
- testedWithVersionRangeExpressions =
1411
- [ Dependency (mkPackageName (prettyShow compiler)) vr Set. empty
1412
- | (compiler, vr) <- testedWith pkg
1413
- , usesNewVersionRangeSyntax vr ]
1414
-
1415
1352
simpleSpecVersionRangeSyntax =
1416
1353
either (const True ) (cataVersionRange alg) (specVersionRaw pkg)
1417
1354
where
@@ -1422,63 +1359,8 @@ checkCabalVersion pkg =
1422
1359
simpleSpecVersionSyntax =
1423
1360
either (const True ) (const False ) (specVersionRaw pkg)
1424
1361
1425
- usesNewVersionRangeSyntax :: VersionRange -> Bool
1426
- usesNewVersionRangeSyntax
1427
- = (> 2 ) -- uses the new syntax if depth is more than 2
1428
- . cataVersionRange alg
1429
- where
1430
- alg (UnionVersionRangesF a b) = a + b
1431
- alg (IntersectVersionRangesF a b) = a + b
1432
- alg (VersionRangeParensF _) = 3
1433
- alg _ = 1 :: Int
1434
-
1435
- depsUsingWildcardSyntax = [ dep | dep@ (Dependency _ vr _) <- allBuildDepends pkg
1436
- , usesWildcardSyntax vr ]
1437
-
1438
- depsUsingMajorBoundSyntax = [ dep | dep@ (Dependency _ vr _) <- allBuildDepends pkg
1439
- , usesMajorBoundSyntax vr ]
1440
-
1441
1362
usesBackpackIncludes = any (not . null . mixins) (allBuildInfo pkg)
1442
1363
1443
- testedWithUsingWildcardSyntax =
1444
- [ Dependency (mkPackageName (prettyShow compiler)) vr Set. empty
1445
- | (compiler, vr) <- testedWith pkg
1446
- , usesWildcardSyntax vr ]
1447
-
1448
- usesWildcardSyntax :: VersionRange -> Bool
1449
- usesWildcardSyntax = cataVersionRange alg
1450
- where
1451
- alg (WildcardVersionF _) = True
1452
- alg (UnionVersionRangesF a b) = a || b
1453
- alg (IntersectVersionRangesF a b) = a || b
1454
- alg (VersionRangeParensF a) = a
1455
- alg _ = False
1456
-
1457
- -- NB: this eliminates both, WildcardVersion and MajorBoundVersion
1458
- -- because when WildcardVersion is not support, neither is MajorBoundVersion
1459
- eliminateWildcardSyntax = hyloVersionRange embed projectVersionRange
1460
- where
1461
- embed (WildcardVersionF v) = intersectVersionRanges
1462
- (orLaterVersion v) (earlierVersion (wildcardUpperBound v))
1463
- embed (MajorBoundVersionF v) = intersectVersionRanges
1464
- (orLaterVersion v) (earlierVersion (majorUpperBound v))
1465
- embed vr = embedVersionRange vr
1466
-
1467
- usesMajorBoundSyntax :: VersionRange -> Bool
1468
- usesMajorBoundSyntax = cataVersionRange alg
1469
- where
1470
- alg (MajorBoundVersionF _) = True
1471
- alg (UnionVersionRangesF a b) = a || b
1472
- alg (IntersectVersionRangesF a b) = a || b
1473
- alg (VersionRangeParensF a) = a
1474
- alg _ = False
1475
-
1476
- eliminateMajorBoundSyntax = hyloVersionRange embed projectVersionRange
1477
- where
1478
- embed (MajorBoundVersionF v) = intersectVersionRanges
1479
- (orLaterVersion v) (earlierVersion (majorUpperBound v))
1480
- embed vr = embedVersionRange vr
1481
-
1482
1364
mentionedExtensions = [ ext | bi <- allBuildInfo pkg
1483
1365
, ext <- allExtensions bi ]
1484
1366
mentionedExtensionsThatNeedCabal12 =
@@ -1529,11 +1411,6 @@ checkCabalVersion pkg =
1529
1411
1530
1412
allModuleNamesAutogen = concatMap autogenModules (allBuildInfo pkg)
1531
1413
1532
- displayRawDependency :: Dependency -> String
1533
- displayRawDependency (Dependency pkg vr _sublibs) =
1534
- prettyShow pkg ++ " " ++ prettyShow vr
1535
-
1536
-
1537
1414
-- ------------------------------------------------------------
1538
1415
-- * Checks on the GenericPackageDescription
1539
1416
-- ------------------------------------------------------------
0 commit comments