summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeiTrofimovich <>2012-02-16 19:31:31 (GMT)
committerhdiff <hdiff@luite.com>2012-02-16 19:31:31 (GMT)
commit861ae5a115119dadff99971785d5d18cf9f5d835 (patch)
treeae5c26fe110d00d8020707b0aa365e0d20a52640
parentc5fdbffe6d7678363784ea6dd826b7f40ab12049 (diff)
version 0.2.160.2.16
-rw-r--r--Cabal2Ebuild.hs1
-rw-r--r--Merge.hs39
-rw-r--r--Portage/EBuild.hs10
-rw-r--r--hackport.cabal2
4 files changed, 16 insertions, 36 deletions
diff --git a/Cabal2Ebuild.hs b/Cabal2Ebuild.hs
index b5ede28..53f3c11 100644
--- a/Cabal2Ebuild.hs
+++ b/Cabal2Ebuild.hs
@@ -45,6 +45,7 @@ import Portage.Version
cabal2ebuild :: Cabal.PackageDescription -> Portage.EBuild
cabal2ebuild pkg = Portage.ebuildTemplate {
E.name = map toLower cabalPkgName,
+ E.hackage_name= cabalPkgName,
E.version = display (Cabal.pkgVersion (Cabal.package pkg)),
E.description = if null (Cabal.synopsis pkg) then Cabal.description pkg
else Cabal.synopsis pkg,
diff --git a/Merge.hs b/Merge.hs
index 69a8f2c..413c4ab 100644
--- a/Merge.hs
+++ b/Merge.hs
@@ -9,7 +9,6 @@ import Control.Exception
import Data.Maybe
import Data.List
import Distribution.Package
--- import Distribution.Compiler (CompilerId(..), CompilerFlavor(GHC))
import Distribution.PackageDescription ( PackageDescription(..)
, FlagName(..)
, GenericPackageDescription
@@ -25,6 +24,7 @@ import System.Directory ( getCurrentDirectory
)
import System.Cmd (system)
import System.FilePath ((</>))
+import System.Exit
import qualified Cabal2Ebuild as C2E
import qualified Portage.EBuild as E
@@ -40,13 +40,11 @@ import Distribution.Simple.Utils
import Network.URI
import Distribution.Client.IndexUtils ( getSourcePackages )
-import Distribution.Client.HttpUtils ( downloadURI )
import qualified Distribution.Client.PackageIndex as Index
import Distribution.Client.Types
import qualified Portage.PackageId as Portage
import qualified Portage.Version as Portage
-import qualified Portage.Host as Host
import qualified Portage.Metadata as Portage
import qualified Portage.Overlay as Overlay
import qualified Portage.Resolve as Portage
@@ -57,9 +55,6 @@ import qualified Merge.Dependencies as Merge
import Debug.Trace ( trace )
-(<->) :: String -> String -> String
-a <-> b = a ++ '-':b
-
(<.>) :: String -> String -> String
a <.> b = a ++ '.':b
@@ -101,7 +96,7 @@ resolveVersion avails (Just ver) = listToMaybe (filter match avails)
match avail = ver == pkgVersion (packageInfoId avail)
merge :: Verbosity -> Repo -> URI -> [String] -> FilePath -> IO ()
-merge verbosity repo serverURI args overlayPath = do
+merge verbosity repo _serverURI args overlayPath = do
(m_category, user_pName, m_version) <-
case readPackageString args of
Left err -> throwEx err
@@ -192,36 +187,16 @@ mergeGenericPackageDescription verbosity overlayPath cat pkgGenericDesc fetch =
fetchAndDigest
verbosity
(overlayPath </> display cat </> display norm_pkgName)
- (display cabal_pkgId <.> "tar.gz")
- (mkUri cabal_pkgId)
-
-mkUri :: Cabal.PackageIdentifier -> URI
-mkUri pid =
- -- example:
- -- http://hackage.haskell.org/packages/archive/Cabal/1.4.0.2/Cabal-1.4.0.2.tar.gz
- fromJust $ parseURI $
- "http://hackage.haskell.org/packages/archive/"
- </> p_name </> p_ver </> p_name <-> p_ver <.> "tar.gz"
- where
- p_ver = display (packageVersion pid)
- p_name = display (packageName pid)
fetchAndDigest :: Verbosity
-> FilePath -- ^ directory of ebuild
- -> String -- ^ tarball name
- -> URI -- ^ tarball uri
-> IO ()
-fetchAndDigest verbosity ebuildDir tarballName tarballURI =
+fetchAndDigest verbosity ebuildDir =
withWorkingDirectory ebuildDir $ do
- repo_info <- Host.getInfo
- let tarDestination = (Host.distfiles_dir repo_info) </> tarballName
- downloadURI verbosity tarballURI tarDestination
- -- Just err -> throwEx (Portage.DownloadFailed (show tarballURI) (show err))
- -- TODO: downloadURI will throw a non-hackport exception if the
- -- download fails
- notice verbosity $ "Saved to " ++ tarDestination
- notice verbosity "Recalculating digests..."
- _ <- system "repoman manifest"
+ notice verbosity "Recalculating digests (repoman manifest)..."
+ r <- system "repoman manifest"
+ when (r /= ExitSuccess) $
+ notice verbosity "repoman manifest failed horribly. Do something about it!"
return ()
withWorkingDirectory :: FilePath -> IO a -> IO a
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
index 0817d22..67202ea 100644
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -16,6 +16,7 @@ import qualified Paths_hackport(version)
data EBuild = EBuild {
name :: String,
+ hackage_name :: String, -- might differ a bit (we mangle case)
version :: String,
hackportVersion :: String,
description :: String,
@@ -40,11 +41,12 @@ getHackportVersion Version {versionBranch=[]} = ""
ebuildTemplate :: EBuild
ebuildTemplate = EBuild {
name = "foobar",
+ hackage_name = "FooBar",
version = "0.1",
hackportVersion = getHackportVersion Paths_hackport.version,
description = "",
long_desc = "",
- homepage = "http://hackage.haskell.org/package/${PN}",
+ homepage = "http://hackage.haskell.org/package/${HACKAGE_N}",
license = Cabal.UnknownLicense "xxx UNKNOWN xxx",
slot = "0",
keywords = ["~amd64","~x86"],
@@ -74,7 +76,7 @@ src_uri e =
showEBuild :: EBuild -> String
showEBuild ebuild =
- ss "# Copyright 1999-2011 Gentoo Foundation". nl.
+ ss "# Copyright 1999-2012 Gentoo Foundation". nl.
ss "# Distributed under the terms of the GNU General Public License v2". nl.
ss "# $Header: $". nl.
nl.
@@ -106,7 +108,9 @@ showEBuild ebuild =
Nothing -> id
Just _ -> nl. ss "S=". quote ("${WORKDIR}/${MY_P}"). nl)
$ []
- where expandVars = replaceMultiVars [(name ebuild, "${PN}")]
+ where expandVars = replaceMultiVars [ ( name ebuild, "${PN}")
+ , (hackage_name ebuild, "${HACKAGE_N}")
+ ]
ss :: String -> String -> String
ss = showString
diff --git a/hackport.cabal b/hackport.cabal
index 06f7da4..b111abc 100644
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.2.15
+Version: 0.2.16
License: GPL
License-file: LICENSE
Author: Henning G√ľnther, Duncan Coutts, Lennart Kolmodin