File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Registry/Scripts/LegacyImport Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module Foreign.Licensee where
33import Registry.Prelude
44
55import Control.Parallel as Parallel
6- import Foreign.JsonRepair as JsonRepair
6+ import Data.Array as Array
77import Foreign.Tmp as Tmp
88import Node.ChildProcess as NodeProcess
99import 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments