From 7dc7445e7268a0660395b4989476e8cb2fcff3f8 Mon Sep 17 00:00:00 2001 From: Maximilian Huber Date: Thu, 7 Nov 2024 10:43:00 +0100 Subject: [PATCH] chore: update packageurl-hs package Signed-off-by: Maximilian Huber --- src/Opossum/OpossumDependencyCheckUtils.hs | 12 ++++++------ src/Opossum/OpossumScancodeUtils.hs | 8 ++++---- src/Opossum/OpossumScanossUtils.hs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Opossum/OpossumDependencyCheckUtils.hs b/src/Opossum/OpossumDependencyCheckUtils.hs index 4521dcc..75fd91a 100644 --- a/src/Opossum/OpossumDependencyCheckUtils.hs +++ b/src/Opossum/OpossumDependencyCheckUtils.hs @@ -124,7 +124,7 @@ instance A.FromJSON DependencyCheckEvidence where -} data DependencyCheckPackage = DependencyCheckPackage - { _dcp_id :: Either String PURL + { _dcp_id :: Either String Purl , _dcp_url :: Maybe T.Text , _dcp_description :: Maybe String , _dcp_confidence :: Maybe DependencyCheckConfidence @@ -141,7 +141,7 @@ instance A.FromJSON DependencyCheckPackage where (\case Just purl -> Right purl Nothing -> Left raw) - (parsePURL raw)) + (parsePurl raw)) (v A..: "id") <*> v A..:? "url" <*> v A..:? "description" <*> @@ -438,8 +438,8 @@ dependencyCheckPackageToCoordinates (DependencyCheckPackage {_dcp_id = id}) = Right purl -> purlToCoordinates purl Left raw -> Coordinates (Just (T.pack raw)) Nothing Nothing Nothing Nothing -evidenceToPURLs :: Map.Map String [DependencyCheckEvidence] -> [PURL] -evidenceToPURLs evidence = +evidenceToPurls :: Map.Map String [DependencyCheckEvidence] -> [Purl] +evidenceToPurls evidence = let findBestFromEvidences :: [DependencyCheckEvidence] -> Maybe String findBestFromEvidences [] = Nothing findBestFromEvidences (e:_) = Just $ _dce_value e @@ -451,14 +451,14 @@ evidenceToPURLs evidence = in maybeToList $ fmap (\product' -> - PURL Nothing Nothing vendor product' version Nothing Nothing) + Purl Nothing Nothing vendor product' version Nothing Nothing) product evidenceToPackages :: Map.Map String [DependencyCheckEvidence] -> [DependencyCheckPackage] evidenceToPackages = map (\purl -> DependencyCheckPackage (Right purl) Nothing Nothing Nothing) . - evidenceToPURLs + evidenceToPurls dependencyCheckDependencyToOpossum :: DependencyCheckDependency -> IO Opossum dependencyCheckDependencyToOpossum (dcd@DependencyCheckDependency { _dcd_isVirtual = isVirtual diff --git a/src/Opossum/OpossumScancodeUtils.hs b/src/Opossum/OpossumScancodeUtils.hs index 36bccd0..0a86163 100644 --- a/src/Opossum/OpossumScancodeUtils.hs +++ b/src/Opossum/OpossumScancodeUtils.hs @@ -143,7 +143,7 @@ renderLicense licenses = -} data ScancodePackage = ScancodePackage - { _scp_purl :: Maybe PURL + { _scp_purl :: Maybe Purl , _scp_licenses :: SPDX.MaybeLicenseExpression , _scp_copyright :: Maybe String , _scp_dependencies :: [ScancodePackage] @@ -156,7 +156,7 @@ instance A.FromJSON ScancodePackage where purl <- v A..:? "purl" >>= (\case - Just purl -> return $ parsePURL purl + Just purl -> return $ parsePurl purl Nothing -> return Nothing) dependencies <- (v A..:? "dependencies" >>= @@ -274,12 +274,12 @@ opossumFromScancodePackage scp@(ScancodePackage { _scp_purl = purl }) providedPath = let typeFromPurl = case purl of - Just (PURL {_PURL_type = t}) -> maybe "generic" show t + Just (Purl {_Purl_type = t}) -> maybe "generic" show t _ -> "generic" pathFromPurl = typeFromPurl FP. case purl of - Just (PURL {_PURL_namespace = ns, _PURL_name = n, _PURL_version = v}) -> + Just (Purl {_Purl_namespace = ns, _Purl_name = n, _Purl_version = v}) -> foldl1 (FP.) $ maybeToList ns ++ [intercalate "@" $ n : maybeToList v] _ -> "UNKNOWN" diff --git a/src/Opossum/OpossumScanossUtils.hs b/src/Opossum/OpossumScanossUtils.hs index ad242e0..1a35398 100644 --- a/src/Opossum/OpossumScanossUtils.hs +++ b/src/Opossum/OpossumScanossUtils.hs @@ -177,7 +177,7 @@ data ScanossFinding = ScanossFinding { _ScanossFinding_id :: String , _ScanossFinding_matched :: String - , _ScanossFinding_purl :: [PURL] + , _ScanossFinding_purl :: [Purl] , _ScanossFinding_vendor :: Maybe T.Text , _ScanossFinding_component :: Maybe T.Text , _ScanossFinding_version :: Maybe T.Text @@ -217,7 +217,7 @@ instance A.FromJSON ScanossFinding where AKM.filterWithKey (\key -> const (not (key `elem` keysToFilter)))) v ScanossFinding <$> v A..: "id" <*> v A..: "matched" <*> - (fmap (Maybe.mapMaybe (parsePURL)) $ v A..: "purl") <*> + (fmap (Maybe.mapMaybe (parsePurl)) $ v A..: "purl") <*> v A..:? "vendor" <*> v A..:? "component" <*> v A..:? "version" <*>