summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennartKolmodin <>2010-07-27 21:19:38 (GMT)
committerLuite Stegeman <luite@luite.com>2010-07-27 21:19:38 (GMT)
commit4c0e40feb90d7ba5e57e0d64a07098eabae1185f (patch)
treed30cd2269ac507fa8a0757f9b74dd9284ac2908a
parent0c9047b28b9350a4d74d490c5252d50d1fa9e5f4 (diff)
version 0.2.80.2.8
-rw-r--r--Cabal2Ebuild.hs13
-rw-r--r--DistroMap.hs5
-rw-r--r--Main.hs4
-rw-r--r--Merge/Dependencies.hs1
-rw-r--r--Portage/EBuild.hs20
-rw-r--r--cabal2ebuild.hs17
-rw-r--r--hackport.cabal3
7 files changed, 30 insertions, 33 deletions
diff --git a/Cabal2Ebuild.hs b/Cabal2Ebuild.hs
index cd697c9..0d1ca5e 100644
--- a/Cabal2Ebuild.hs
+++ b/Cabal2Ebuild.hs
@@ -32,8 +32,7 @@ import qualified Distribution.PackageDescription as Cabal
import qualified Distribution.Package as Cabal (PackageIdentifier(..)
, Dependency(..)
, PackageName(..))
-import qualified Distribution.Version as Cabal (VersionRange, foldVersionRange', versionBranch, Version)
-import qualified Distribution.License as Cabal (License(..))
+import qualified Distribution.Version as Cabal (VersionRange, foldVersionRange')
import Distribution.Text (display)
import Data.Char (toLower,isUpper)
@@ -53,8 +52,8 @@ cabal2ebuild pkg = Portage.ebuildTemplate {
E.version = display (Cabal.pkgVersion (Cabal.package pkg)),
E.description = if null (Cabal.synopsis pkg) then Cabal.description pkg
else Cabal.synopsis pkg,
- E.homepage = Cabal.homepage pkg,
- E.src_uri = Cabal.pkgUrl pkg,
+ E.homepage = thisHomepage,
+ E.src_uri = thisSRC_URI,
E.license = Cabal.license pkg,
E.my_pn = if any isUpper cabalPkgName then Just cabalPkgName else Nothing,
E.features = E.features E.ebuildTemplate
@@ -65,6 +64,12 @@ cabal2ebuild pkg = Portage.ebuildTemplate {
} where
cabalPkgName = display $ Cabal.pkgName (Cabal.package pkg)
hasExe = (not . null) (Cabal.executables pkg)
+ thisHomepage = if (null $ Cabal.homepage pkg)
+ then E.homepage E.ebuildTemplate
+ else Cabal.homepage pkg
+ thisSRC_URI = if (null $ Cabal.pkgUrl pkg)
+ then E.src_uri E.ebuildTemplate
+ else Cabal.pkgUrl pkg
convertDependencies :: Portage.Category -> [Cabal.Dependency] -> [Dependency]
convertDependencies category = concatMap (convertDependency category)
diff --git a/DistroMap.hs b/DistroMap.hs
index 47e69b5..64a72ab 100644
--- a/DistroMap.hs
+++ b/DistroMap.hs
@@ -47,20 +47,19 @@ import Data.Maybe ( fromJust )
import Distribution.Verbosity
import Distribution.Text ( display )
import Distribution.Client.Types ( Repo, AvailablePackageDb(..), AvailablePackage(..) )
-import Distribution.Simple.Utils ( warn, notice, info )
+import Distribution.Simple.Utils ( info )
import qualified Data.Version as Cabal
import qualified Distribution.Package as Cabal
import qualified Distribution.Client.PackageIndex as CabalInstall
import qualified Distribution.Client.IndexUtils as CabalInstall
-import Portage.Overlay ( Overlay(..), readOverlayByPackage, getDirectoryTree, DirectoryTree )
+import Portage.Overlay ( readOverlayByPackage, getDirectoryTree )
import qualified Portage.PackageId as Portage
import qualified Portage.Version as Portage
type PVU = (Cabal.PackageName, Cabal.Version, Maybe String)
type PVU_Map = Map Portage.PackageName [(Cabal.Version, Maybe String)]
-type PVU_Item = (Portage.PackageName, [(Cabal.Version, Maybe String)])
distroMap :: Verbosity -> Repo -> FilePath -> FilePath -> [String] -> IO ()
distroMap verbosity repo portagePath overlayPath args = do
diff --git a/Main.hs b/Main.hs
index 0a77907..9af1b58 100644
--- a/Main.hs
+++ b/Main.hs
@@ -11,7 +11,7 @@ import Data.Monoid
import Distribution.Simple.Setup
( Flag(..), fromFlag
, trueArg
- , flagToMaybe, flagToList
+ , flagToList
, optionVerbosity
)
import Distribution.PackageDescription.Configuration
@@ -34,7 +34,7 @@ import Portage.Overlay as Overlay ( loadLazy, inOverlay )
import Portage.Host as Host ( getInfo, portage_dir )
import Portage.PackageId ( normalizeCabalPackageId )
-import Network.URI
+import Network.URI ( URI(..), URIAuth(..), parseURI )
import System.Environment ( getArgs, getProgName )
import System.Directory ( doesDirectoryExist )
import System.Exit ( exitFailure )
diff --git a/Merge/Dependencies.hs b/Merge/Dependencies.hs
index 361f551..c33d21b 100644
--- a/Merge/Dependencies.hs
+++ b/Merge/Dependencies.hs
@@ -176,6 +176,7 @@ staticTranslateExtraLib lib = lookup lib m
, ("mysqlclient", Portage.LaterVersionOf (Portage.Version [4,0] Nothing [] 0) (Portage.mkPackageName "virtual" "mysql"))
, ("pq", Portage.LaterVersionOf (Portage.Version [7] Nothing [] 0) (Portage.mkPackageName "virtual" "postgresql-base"))
, ("ev", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "libev"))
+ , ("expat", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "expat"))
]
---------------------------------------------------------------
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
index 417fa36..f908e7f 100644
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -10,9 +10,13 @@ import Portage.Dependency
import Distribution.License as Cabal
+import Data.Version(Version(..))
+import qualified Paths_hackport(version)
+
data EBuild = EBuild {
name :: String,
version :: String,
+ hackportVersion :: String,
description :: String,
homepage :: String,
src_uri :: String,
@@ -28,13 +32,18 @@ data EBuild = EBuild {
my_pn :: Maybe String --If the package's name contains upper-case
}
+getHackportVersion :: Version -> String
+getHackportVersion Version {versionBranch=(x:s)} = foldl (\y z -> y ++ "." ++ (show z)) (show x) s
+getHackportVersion Version {versionBranch=[]} = ""
+
ebuildTemplate :: EBuild
ebuildTemplate = EBuild {
name = "foobar",
version = "0.1",
+ hackportVersion = getHackportVersion Paths_hackport.version,
description = "",
- homepage = "",
- src_uri = "",
+ homepage = "http://hackage.haskell.org/package/${PN}",
+ src_uri = "http://hackage.haskell.org/packages/archive/${PN}/${PV}/${P}.tar.gz",
license = Cabal.UnknownLicense "xxx UNKNOWN xxx",
slot = "0",
keywords = ["~amd64","~x86"],
@@ -56,6 +65,8 @@ showEBuild ebuild =
ss "# Distributed under the terms of the GNU General Public License v2". nl.
ss "# $Header: $". nl.
nl.
+ ss ("# ebuild generated by hackport " ++ hackportVersion ebuild). nl.
+ nl.
ss "CABAL_FEATURES=". quote' (sepBy " " $ features ebuild). nl.
ss "inherit haskell-cabal". nl.
nl.
@@ -65,9 +76,7 @@ showEBuild ebuild =
ss "MY_P=". quote "${MY_PN}-${PV}". nl. nl).
ss "DESCRIPTION=". quote (description ebuild). nl.
ss "HOMEPAGE=". quote (homepage ebuild). nl.
- ss "SRC_URI=". quote (replaceVars (src_uri ebuild)).
- (if null (src_uri ebuild) then ss "\t#Fixme: please fill in manually"
- else id). nl.
+ ss "SRC_URI=". quote (replaceVars (src_uri ebuild)). nl.
nl.
ss "LICENSE=". quote (convertLicense . license $ ebuild).
(if null (licenseComment . license $ ebuild) then id
@@ -78,7 +87,6 @@ showEBuild ebuild =
nl.
dep_str "RDEPEND" (rdepend_extra ebuild) (rdepend ebuild).
dep_str "DEPEND" ( depend_extra ebuild) ( depend ebuild).
- nl.
(case my_pn ebuild of
Nothing -> id
Just _ -> nl. ss "S=". quote ("${WORKDIR}/${MY_P}"). nl)
diff --git a/cabal2ebuild.hs b/cabal2ebuild.hs
deleted file mode 100644
index 2ef95a4..0000000
--- a/cabal2ebuild.hs
+++ /dev/null
@@ -1,17 +0,0 @@
-module Main where
-
-import System.Environment
-import qualified Distribution.PackageDescription as Cabal
-import Distribution.Verbosity (normal)
-import Cabal2Ebuild
-
-main :: IO ()
-main = do
- args <- getArgs
- case args of
- [cabalFileName] -> do
- pkg <- Cabal.readPackageDescription normal cabalFileName
- let ebuild = cabal2ebuild (Cabal.flattenPackageDescription pkg)
- let ebuildFileName = name ebuild ++ "-" ++ version ebuild ++ ".ebuild"
- writeFile ebuildFileName (showEBuild ebuild)
- _ -> putStrLn "usage: cabal2ebuild package.cabal"
diff --git a/hackport.cabal b/hackport.cabal
index 455a7e9..973c55a 100644
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.2.7
+Version: 0.2.8
License: GPL
License-file: LICENSE
Author: Henning G√ľnther, Duncan Coutts, Lennart Kolmodin
@@ -56,6 +56,7 @@ Executable hackport
CacheFile
Diff
Error
+ Paths_hackport
Main
MaybeRead
Overlays