Skip to content

Commit 48f8d54

Browse files
Remove NOASSERTION license (#323)
1 parent 5f9ef30 commit 48f8d54

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ci/src/Foreign/Licensee.purs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Foreign.Licensee where
33
import Registry.Prelude
44

55
import Control.Parallel as Parallel
6-
import Foreign.JsonRepair as JsonRepair
6+
import Data.Array as Array
77
import Foreign.Tmp as Tmp
88
import Node.ChildProcess as NodeProcess
99
import Node.FS.Aff as FS
@@ -33,7 +33,7 @@ detect directory = do
3333
NodeProcess.Normally n | n == 0 || n == 1 -> do
3434
let
3535
parse :: String -> Either String (Array String)
36-
parse str = Json.parseJson (JsonRepair.tryRepair str) >>= \json -> do
36+
parse str = Json.parseJson str >>= \json -> do
3737
obj <- Json.decode json
3838
licenses <- obj .: "licenses"
3939
spdxIds <- traverse (_ .: "spdx_id") licenses
@@ -46,7 +46,11 @@ detect directory = do
4646
log "arising from the result: "
4747
log result.stdout
4848
pure $ Left error
49-
Right out ->
50-
pure $ Right out
51-
_ ->
49+
Right out -> do
50+
-- A NOASSERTION result means that a LICENSE file could not be parsed.
51+
-- For the purposes of the registry we disregard this result, since
52+
-- we retrieve the license via the package manifest(s) as well.
53+
pure $ Right $ Array.filter (_ /= "NOASSERTION") out
54+
_ -> do
55+
log $ "Licensee process exited unexpectedly: " <> result.stderr
5256
pure $ Left result.stderr

ci/src/Registry/Scripts/LegacyImport/Manifest.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ constructManifestFields package version address = do
108108
let
109109
spagoLicenses = maybe [] NEA.toArray $ _.license =<< hush spagoManifest
110110
bowerLicenses = maybe [] NEA.toArray $ _.license =<< hush bowerManifest
111-
licenseeLicenses = Array.catMaybes $ map NES.fromString licenseeOutput
111+
licenseeLicenses = Array.mapMaybe NES.fromString licenseeOutput
112112
license = NEA.fromArray $ Array.nub $ Array.concat [ licenseeLicenses, spagoLicenses, bowerLicenses ]
113113
description = join (_.description <$> hush bowerManifest)
114114

0 commit comments

Comments
 (0)