hackport 0.2.15 → 0.2.16
raw patch · 4 files changed
+16/−36 lines, 4 files
Files
- Cabal2Ebuild.hs +1/−0
- Merge.hs +7/−32
- Portage/EBuild.hs +7/−3
- hackport.cabal +1/−1
Cabal2Ebuild.hs view
@@ -45,6 +45,7 @@ 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,
Merge.hs view
@@ -9,7 +9,6 @@ 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.Cmd (system) import System.FilePath ((</>))+import System.Exit import qualified Cabal2Ebuild as C2E import qualified Portage.EBuild as E@@ -40,13 +40,11 @@ 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 Debug.Trace ( trace ) -(<->) :: String -> String -> String-a <-> b = a ++ '-':b- (<.>) :: String -> String -> String a <.> b = a ++ '.':b @@ -101,7 +96,7 @@ 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 @@ 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
Portage/EBuild.hs view
@@ -16,6 +16,7 @@ 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 @@ 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 @@ 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 @@ 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
hackport.cabal view
@@ -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