Skip to content

Commit cf18703

Browse files
committed
Revert "init: check pkg name and .cabal file name match"
This reverts commit 63c7f48. @harendra-kumar The reverted commit seems to break the 1336-1337-new-package-names integration test on Mac OS X. I did a bit of debugging and it appears that, somewhere along the way, some unicode characters are changing (they look the same when rendered, but the UTF-8 bytes are different) and that is causing the comparison to fail. For example: ``` $ stack new ば日本-4本 [...] Package name as defined in the .cabal file must match the .cabal file name. Please fix the following packages and try again: - ば日本-4本/ば日本-4本.cabal ``` `show (FP.takeBaseName $ toFilePath fp,show $ gpdPackageName gpd)` in this case gives me `("\12399\12441\26085\26412-4\26412","\12400\26085\26412-4\26412")`; note the first two bytes in the fst are different than the first byte in the snd.
1 parent d71b34e commit cf18703

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/Stack/Solver.hs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -515,23 +515,15 @@ cabalPackagesCheck cabalfps noPkgMsg dupErrMsg = do
515515
(warnings, gpds) <- fmap unzip (mapM readPackageUnresolved cabalfps)
516516
zipWithM_ (mapM_ . printCabalFileWarning) cabalfps warnings
517517

518-
-- package name cannot be empty or missing otherwise
519-
-- it will result in cabal solver failure.
520-
-- stack requires packages name to match the cabal file name
521-
-- Just the latter check is enough to cover both the cases
522-
523518
let packages = zip cabalfps gpds
524-
getNameMismatchPkg (fp, gpd)
525-
| (show . gpdPackageName) gpd /= (FP.takeBaseName . toFilePath) fp
526-
= Just fp
519+
getEmptyNamePkg (fp, gpd)
520+
| ((show . gpdPackageName) gpd) == "" = Just fp
527521
| otherwise = Nothing
528-
nameMismatchPkgs = mapMaybe getNameMismatchPkg packages
522+
emptyNamePkgs = mapMaybe getEmptyNamePkg packages
529523

530-
when (nameMismatchPkgs /= []) $ do
531-
rels <- mapM makeRelativeToCurrentDir nameMismatchPkgs
532-
error $ "Package name as defined in the .cabal file must match the \
533-
\.cabal file name.\n\
534-
\Please fix the following packages and try again:\n"
524+
when (emptyNamePkgs /= []) $ do
525+
rels <- mapM makeRelativeToCurrentDir emptyNamePkgs
526+
error $ "Please assign a name to the following package(s):\n"
535527
<> (formatGroup rels)
536528

537529
let dupGroups = filter ((> 1) . length)

0 commit comments

Comments
 (0)