Skip to content

Commit 18b558c

Browse files
committed
Minor package display improvements
Displayed package names (stdout, log directory names) now use a hyphen e.g. aeson-1.2.3, rather than reusing the default delimiter == e.g. aeson ==1.2.3.
1 parent 22be54e commit 18b558c

File tree

10 files changed

+24
-18
lines changed

10 files changed

+24
-18
lines changed

src/builder/CLC/Stackage/Builder/Process.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ buildProject env idx pkgs = do
115115
mconcat
116116
[ T.pack $ show idx,
117117
": ",
118-
T.intercalate ", " (Package.toTextInstalled <$> pkgsList)
118+
T.intercalate ", " (Package.toDisplayName <$> pkgsList)
119119
]
120120
pkgsList = NE.toList pkgs.unPackageGroup
121121
pkgsSet = Set.fromList pkgsList

src/parser/CLC/Stackage/Parser.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ printPackageList mOs = do
5757
-- | Retrieves the package list formatted to text.
5858
getPackageListByOsFmt :: Os -> IO [Text]
5959
getPackageListByOsFmt =
60-
(fmap . fmap) Package.toTextInstalled
60+
(fmap . fmap) Package.toDisplayName
6161
. getPackageListByOs Logging.mkDefaultLogger Nothing
6262

6363
-- | Helper in case we want to see what the package set for a given OS is.

src/parser/CLC/Stackage/Parser/API/CabalConfig.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ parseCabalConfigLine txt = do
8282
let s = case T.stripPrefix "constraints:" txt' of
8383
Nothing -> txt'
8484
Just rest -> T.stripStart rest
85-
Package.packageParser s
85+
Package.fromCabalConstraintsText s
8686
where
8787
txt' = T.stripStart txt

src/utils/CLC/Stackage/Utils/Package.hs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ module CLC.Stackage.Utils.Package
1212
toCabalDepText,
1313
toCabalConstraintsText,
1414
toDirName,
15-
toTextInstalled,
15+
toDisplayName,
1616

1717
-- * Version
1818
PackageVersion (..),
19-
20-
-- * Parsers
21-
packageParser,
2219
)
2320
where
2421

@@ -89,7 +86,16 @@ toCabalConstraintsText = (<> ",") . toTextInstalled
8986
-- representation of 'toText'. Used when naming an error directory for a
9087
-- package that fails.
9188
toDirName :: Package -> IO OsPath
92-
toDirName = Paths.encodeUtf . T.unpack . toTextInstalled
89+
toDirName = Paths.encodeUtf . T.unpack . toDisplayName
90+
91+
-- | Slightly nicer display name e.g. "mtl-installed", "aeson-1.2.3".
92+
toDisplayName :: Package -> Text
93+
toDisplayName (MkPackage name vers) = txt
94+
where
95+
txt = name <> "-" <> v
96+
v = case vers of
97+
PackageVersionText t -> t
98+
PackageVersionInstalled -> "installed"
9399

94100
-- | Text representation of the package respecting "installed" versions e.g.
95101
--

test/functional/goldens/testSmallBatch_posix.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[2020-05-31 12:00:00][Info] Cached results do not exist: output/cache.json
2-
[2020-05-31 12:00:00][Success] 3: cborg ==0.2.10.0, clock ==0.8.4
3-
[2020-05-31 12:00:00][Success] 2: mtl ==2.3.1, optics-core ==0.4.1.1
4-
[2020-05-31 12:00:00][Success] 1: profunctors ==5.6.2
2+
[2020-05-31 12:00:00][Success] 3: cborg-0.2.10.0, clock-0.8.4
3+
[2020-05-31 12:00:00][Success] 2: mtl-2.3.1, optics-core-0.4.1.1
4+
[2020-05-31 12:00:00][Success] 1: profunctors-5.6.2
55

66

77
- Successes: 5 (100%)

test/functional/goldens/testSmallBatch_windows.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[2020-05-31 12:00:00][Info] Cached results do not exist: output\cache.json
2-
[2020-05-31 12:00:00][Success] 3: cborg ==0.2.10.0, clock ==0.8.4
3-
[2020-05-31 12:00:00][Success] 2: mtl ==2.3.1, optics-core ==0.4.1.1
4-
[2020-05-31 12:00:00][Success] 1: profunctors ==5.6.2
2+
[2020-05-31 12:00:00][Success] 3: cborg-0.2.10.0, clock-0.8.4
3+
[2020-05-31 12:00:00][Success] 2: mtl-2.3.1, optics-core-0.4.1.1
4+
[2020-05-31 12:00:00][Success] 1: profunctors-5.6.2
55

66

77
- Successes: 5 (100%)

test/functional/goldens/testSmallSnapshotPath_posix.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[2020-05-31 12:00:00][Info] Cached results do not exist: output/cache.json
22
[2020-05-31 12:00:00][Warn] Only found 8 packages. Is that right?
3-
[2020-05-31 12:00:00][Success] 1: cborg ==0.2.10.0, clock ==0.8.4, mtl insta...
3+
[2020-05-31 12:00:00][Success] 1: cborg-0.2.10.0, clock-0.8.4, mtl-installed...
44

55

66
- Successes: 5 (100%)

test/functional/goldens/testSmallSnapshotPath_windows.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[2020-05-31 12:00:00][Info] Cached results do not exist: output\cache.json
22
[2020-05-31 12:00:00][Warn] Only found 8 packages. Is that right?
3-
[2020-05-31 12:00:00][Success] 1: cborg ==0.2.10.0, clock ==0.8.4, mtl insta...
3+
[2020-05-31 12:00:00][Success] 1: cborg-0.2.10.0, clock-0.8.4, mtl-installed...
44

55

66
- Successes: 5 (100%)

test/functional/goldens/testSmall_posix.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[2020-05-31 12:00:00][Info] Cached results do not exist: output/cache.json
2-
[2020-05-31 12:00:00][Success] 1: cborg ==0.2.10.0, clock ==0.8.4, mtl ==2.3...
2+
[2020-05-31 12:00:00][Success] 1: cborg-0.2.10.0, clock-0.8.4, mtl-2.3.1, op...
33

44

55
- Successes: 5 (100%)

test/functional/goldens/testSmall_windows.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[2020-05-31 12:00:00][Info] Cached results do not exist: output\cache.json
2-
[2020-05-31 12:00:00][Success] 1: cborg ==0.2.10.0, clock ==0.8.4, mtl ==2.3...
2+
[2020-05-31 12:00:00][Success] 1: cborg-0.2.10.0, clock-0.8.4, mtl-2.3.1, op...
33

44

55
- Successes: 5 (100%)

0 commit comments

Comments
 (0)