summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeiTrofimovich <>2017-02-25 15:26:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-02-25 15:26:00 (GMT)
commit16f9739517e88ec77fcb2e5bb93dbb224be60ecc (patch)
treeb4c209da2691e84fd13896c68deb32190020dce6
parent9753b8e83c21bd915e09af89a6ada456250c499e (diff)
version 0.5.20.5.2
-rw-r--r--Merge.hs4
-rw-r--r--Merge/Dependencies.hs53
-rw-r--r--Portage/EBuild.hs1
-rw-r--r--Portage/EMeta.hs7
-rw-r--r--hackport.cabal4
5 files changed, 32 insertions, 37 deletions
diff --git a/Merge.hs b/Merge.hs
index 1efbdfb..aa22003 100644
--- a/Merge.hs
+++ b/Merge.hs
@@ -427,15 +427,17 @@ mergeEbuild verbosity existing_meta pkgdir ebuild = do
createDirectoryIfMissing True edir
now <- TC.getCurrentTime
- let (existing_keywords, existing_license) = (EM.keywords existing_meta, EM.license existing_meta)
+ let (existing_keywords, existing_license, existing_description) = (EM.keywords existing_meta, EM.license existing_meta, EM.description existing_meta)
new_keywords = maybe (E.keywords ebuild) (map to_unstable) existing_keywords
new_license = either (\err -> maybe (Left err)
Right
existing_license)
Right
(E.license ebuild)
+ new_description = maybe (E.description ebuild) id existing_description
ebuild' = ebuild { E.keywords = new_keywords
, E.license = new_license
+ , E.description = new_description
}
s_ebuild' = E.showEBuild now ebuild'
diff --git a/Merge/Dependencies.hs b/Merge/Dependencies.hs
index eec3c7a..5eadbb5 100644
--- a/Merge/Dependencies.hs
+++ b/Merge/Dependencies.hs
@@ -5,21 +5,8 @@ module Merge.Dependencies
, resolveDependencies
) where
-import Distribution.PackageDescription ( PackageDescription(..)
- , libBuildInfo
- , buildInfo
- , buildable
- , extraLibs
- , buildTools
- , pkgconfigDepends
- , specVersion
- , TestSuite(..)
- , targetBuildDepends
- )
-
import Data.Maybe ( isJust, isNothing )
import Data.Monoid ( Monoid, mempty, mappend)
-import Data.List ( nub )
import qualified Data.List as L
import qualified Data.Set as S
@@ -68,7 +55,7 @@ instance Monoid EDep where
, dep_e = dep_eA `S.union` dep_eB
}
-resolveDependencies :: Portage.Overlay -> PackageDescription -> Cabal.CompilerInfo
+resolveDependencies :: Portage.Overlay -> Cabal.PackageDescription -> Cabal.CompilerInfo
-> [Cabal.PackageName] -> Cabal.PackageName
-> EDep
resolveDependencies overlay pkg compiler_info ghc_package_names merged_cabal_pkg_name = edeps
@@ -78,7 +65,7 @@ resolveDependencies overlay pkg compiler_info ghc_package_names merged_cabal_pkg
treatAsLibrary = isJust (Cabal.library pkg)
-- without slot business
raw_haskell_deps :: Portage.Dependency
- raw_haskell_deps = PN.normalize_depend $ Portage.DependAllOf $ haskellDependencies overlay (buildDepends pkg)
+ raw_haskell_deps = PN.normalize_depend $ Portage.DependAllOf $ haskellDependencies overlay (Cabal.buildDepends pkg)
test_deps :: Portage.Dependency
test_deps = Portage.mkUseDependency (True, Portage.Use "test") $
Portage.DependAllOf $
@@ -146,9 +133,9 @@ resolveDependencies overlay pkg compiler_info ghc_package_names merged_cabal_pkg
-- TODO: move partitioning part to Merge:mergeGenericPackageDescription
---------------------------------------------------------------
-setupDependencies :: Portage.Overlay -> PackageDescription -> [Cabal.PackageName] -> Cabal.PackageName -> [Portage.Dependency]
+setupDependencies :: Portage.Overlay -> Cabal.PackageDescription -> [Cabal.PackageName] -> Cabal.PackageName -> [Portage.Dependency]
setupDependencies overlay pkg ghc_package_names merged_cabal_pkg_name = deps
- where cabalDeps = maybe [] id $ Cabal.setupDepends `fmap` setupBuildInfo pkg
+ where cabalDeps = maybe [] id $ Cabal.setupDepends `fmap` Cabal.setupBuildInfo pkg
cabalDeps' = fst $ Portage.partition_depends ghc_package_names merged_cabal_pkg_name cabalDeps
deps = C2E.convertDependencies overlay (Portage.Category "dev-haskell") cabalDeps'
@@ -157,9 +144,9 @@ setupDependencies overlay pkg ghc_package_names merged_cabal_pkg_name = deps
-- TODO: move partitioning part to Merge:mergeGenericPackageDescription
---------------------------------------------------------------
-testDependencies :: Portage.Overlay -> PackageDescription -> [Cabal.PackageName] -> Cabal.PackageName -> [Portage.Dependency]
+testDependencies :: Portage.Overlay -> Cabal.PackageDescription -> [Cabal.PackageName] -> Cabal.PackageName -> [Portage.Dependency]
testDependencies overlay pkg ghc_package_names merged_cabal_pkg_name = deps
- where cabalDeps = concat $ map targetBuildDepends $ map testBuildInfo (testSuites pkg)
+ where cabalDeps = concat $ map Cabal.targetBuildDepends $ map Cabal.testBuildInfo (Cabal.testSuites pkg)
cabalDeps' = fst $ Portage.partition_depends ghc_package_names merged_cabal_pkg_name cabalDeps
deps = C2E.convertDependencies overlay (Portage.Category "dev-haskell") cabalDeps'
@@ -177,7 +164,7 @@ haskellDependencies overlay deps =
-- | Select the most restrictive dependency on Cabal, either the .cabal
-- file's descCabalVersion, or the Cabal GHC shipped with.
-cabalDependency :: Portage.Overlay -> PackageDescription -> Cabal.CompilerInfo -> Portage.Dependency
+cabalDependency :: Portage.Overlay -> Cabal.PackageDescription -> Cabal.CompilerInfo -> Portage.Dependency
cabalDependency overlay pkg ~(Cabal.CompilerInfo {
Cabal.compilerInfoId =
Cabal.CompilerId Cabal.GHC cabal_version
@@ -188,7 +175,7 @@ cabalDependency overlay pkg ~(Cabal.CompilerInfo {
finalCabalDep)
where
versionNumbers = Cabal.versionNumbers cabal_version
- userCabalVersion = Cabal.orLaterVersion (specVersion pkg)
+ userCabalVersion = Cabal.orLaterVersion (Cabal.specVersion pkg)
shippedCabalVersion = GHCCore.cabalFromGHC versionNumbers
shippedCabalDep = maybe Cabal.anyVersion Cabal.orLaterVersion shippedCabalVersion
finalCabalDep = Cabal.simplifyVersionRange
@@ -210,16 +197,16 @@ compilerInfoToDependency ~(Cabal.CompilerInfo {
-- C Libraries
---------------------------------------------------------------
-findCLibs :: PackageDescription -> [Portage.Dependency]
-findCLibs (PackageDescription { library = lib, executables = exes }) =
+findCLibs :: Cabal.PackageDescription -> [Portage.Dependency]
+findCLibs (Cabal.PackageDescription { Cabal.library = lib, Cabal.executables = exes }) =
[ trace ("WARNING: This package depends on a C library we don't know the portage name for: " ++ p ++ ". Check the generated ebuild.")
(any_c_p "unknown-c-lib" p)
| p <- notFound
] ++
found
where
- libE = concatMap (extraLibs . libBuildInfo) $ maybe [] return lib
- exeE = concatMap extraLibs (filter buildable (map buildInfo exes))
+ libE = concatMap (Cabal.extraLibs . Cabal.libBuildInfo) $ maybe [] return lib
+ exeE = concatMap Cabal.extraLibs (filter Cabal.buildable (map Cabal.buildInfo exes))
allE = libE ++ exeE
notFound = [ p | p <- allE, isNothing (staticTranslateExtraLib p) ]
@@ -347,8 +334,8 @@ staticTranslateExtraLib lib = lookup lib m
-- Build Tools
---------------------------------------------------------------
-buildToolsDependencies :: PackageDescription -> [Portage.Dependency]
-buildToolsDependencies (PackageDescription { library = lib, executables = exes }) = nub $
+buildToolsDependencies :: Cabal.PackageDescription -> [Portage.Dependency]
+buildToolsDependencies (Cabal.PackageDescription { Cabal.library = lib, Cabal.executables = exes }) = L.nub $
[ case pkg of
Just p -> p
Nothing -> trace ("WARNING: Unknown build tool '" ++ Cabal.display exe ++ "'. Check the generated ebuild.")
@@ -358,8 +345,8 @@ buildToolsDependencies (PackageDescription { library = lib, executables = exes }
]
where
cabalDeps = filter notProvided $ depL ++ depE
- depL = concatMap (buildTools . libBuildInfo) $ maybe [] return lib
- depE = concatMap buildTools (filter buildable (map buildInfo exes))
+ depL = concatMap (Cabal.buildTools . Cabal.libBuildInfo) $ maybe [] return lib
+ depE = concatMap Cabal.buildTools (filter Cabal.buildable (map Cabal.buildInfo exes))
notProvided (Cabal.LegacyExeDependency pn _range) = pn `notElem` buildToolsProvided
buildToolsTable :: [(String, Portage.Dependency)]
@@ -388,12 +375,12 @@ buildToolsProvided = ["hsc2hs"]
-- pkg-config
---------------------------------------------------------------
-pkgConfigDependencies :: Portage.Overlay -> PackageDescription -> [Portage.Dependency]
-pkgConfigDependencies overlay (PackageDescription { library = lib, executables = exes }) = nub $ resolvePkgConfigs overlay cabalDeps
+pkgConfigDependencies :: Portage.Overlay -> Cabal.PackageDescription -> [Portage.Dependency]
+pkgConfigDependencies overlay (Cabal.PackageDescription { Cabal.library = lib, Cabal.executables = exes }) = L.nub $ resolvePkgConfigs overlay cabalDeps
where
cabalDeps = depL ++ depE
- depL = concatMap (pkgconfigDepends . libBuildInfo) $ maybe [] return lib
- depE = concatMap pkgconfigDepends (filter buildable (map buildInfo exes))
+ depL = concatMap (Cabal.pkgconfigDepends . Cabal.libBuildInfo) $ maybe [] return lib
+ depE = concatMap Cabal.pkgconfigDepends (filter Cabal.buildable (map Cabal.buildInfo exes))
resolvePkgConfigs :: Portage.Overlay -> [Cabal.PkgconfigDependency] -> [Portage.Dependency]
resolvePkgConfigs overlay cdeps =
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
index abad20f..de271b7 100644
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -93,7 +93,6 @@ showEBuild :: TC.UTCTime -> EBuild -> String
showEBuild now ebuild =
ss ("# Copyright 1999-" ++ this_year ++ " Gentoo Foundation"). nl.
ss "# Distributed under the terms of the GNU General Public License v2". nl.
- ss "# $Id$". nl.
nl.
ss "EAPI=6". nl.
nl.
diff --git a/Portage/EMeta.hs b/Portage/EMeta.hs
index 3f03d02..3425ad8 100644
--- a/Portage/EMeta.hs
+++ b/Portage/EMeta.hs
@@ -58,10 +58,15 @@ extractCabalFlags :: FilePath -> String -> Maybe String
extractCabalFlags ebuild_path s_ebuild =
extract_hackport_var ebuild_path s_ebuild "flags"
+extractDescription :: FilePath -> String -> Maybe String
+extractDescription ebuild_path s_ebuild =
+ extract_quoted_string ebuild_path s_ebuild "DESCRIPTION"
+
-- aggregated (best inferred) metadata for a new ebuild of package
data EMeta = EMeta { keywords :: Maybe [String]
, license :: Maybe String
, cabal_flags :: Maybe String
+ , description :: Maybe String
}
findExistingMeta :: FilePath -> IO EMeta
@@ -76,10 +81,12 @@ findExistingMeta pkgdir =
return EMeta { keywords = extractKeywords e e_conts
, license = extractLicense e e_conts
, cabal_flags = extractCabalFlags e e_conts
+ , description = extractDescription e e_conts
}
let get_latest candidates = last (Nothing : filter (/= Nothing) candidates)
aggregated_meta = EMeta { keywords = get_latest $ map keywords e_metas
, license = get_latest $ map license e_metas
, cabal_flags = get_latest $ map cabal_flags e_metas
+ , description = get_latest $ map description e_metas
}
return aggregated_meta
diff --git a/hackport.cabal b/hackport.cabal
index 680ade9..490c801 100644
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.5.1
+Version: 0.5.2
License: GPL
License-file: LICENSE
Author: Henning G√ľnther, Duncan Coutts, Lennart Kolmodin
@@ -40,7 +40,7 @@ Executable hackport
old-locale,
regex-compat,
split,
- tar,
+ tar >= 0.5,
time,
zlib,
xml >= 1.3.7,