Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ci/src/Foreign/Licensee.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Foreign.Licensee where
import Registry.Prelude

import Control.Parallel as Parallel
import Foreign.JsonRepair as JsonRepair
import Data.Array as Array
import Foreign.Tmp as Tmp
import Node.ChildProcess as NodeProcess
import Node.FS.Aff as FS
Expand Down Expand Up @@ -33,7 +33,7 @@ detect directory = do
NodeProcess.Normally n | n == 0 || n == 1 -> do
let
parse :: String -> Either String (Array String)
parse str = Json.parseJson (JsonRepair.tryRepair str) >>= \json -> do
parse str = Json.parseJson str >>= \json -> do
obj <- Json.decode json
licenses <- obj .: "licenses"
spdxIds <- traverse (_ .: "spdx_id") licenses
Expand All @@ -46,7 +46,11 @@ detect directory = do
log "arising from the result: "
log result.stdout
pure $ Left error
Right out ->
pure $ Right out
_ ->
Right out -> do
-- A NOASSERTION result means that a LICENSE file could not be parsed.
-- For the purposes of the registry we disregard this result, since
-- we retrieve the license via the package manifest(s) as well.
pure $ Right $ Array.filter (_ /= "NOASSERTION") out
_ -> do
log $ "Licensee process exited unexpectedly: " <> result.stderr
pure $ Left result.stderr
2 changes: 1 addition & 1 deletion ci/src/Registry/Scripts/LegacyImport/Manifest.purs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ constructManifestFields package version address = do
let
spagoLicenses = maybe [] NEA.toArray $ _.license =<< hush spagoManifest
bowerLicenses = maybe [] NEA.toArray $ _.license =<< hush bowerManifest
licenseeLicenses = Array.catMaybes $ map NES.fromString licenseeOutput
licenseeLicenses = Array.mapMaybe NES.fromString licenseeOutput
license = NEA.fromArray $ Array.nub $ Array.concat [ licenseeLicenses, spagoLicenses, bowerLicenses ]
description = join (_.description <$> hush bowerManifest)

Expand Down