summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeiTrofimovich <>2020-01-04 11:33:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-01-04 11:33:00 (GMT)
commitc119b2bdf7ac30795c293a34b4aa4c8b90f6af0e (patch)
tree694d092dea48a3549079be010ae6e73184b3a880
parent7971f44fa29ccd339721fa16e7fdc1ff85d83539 (diff)
version 0.6.20.6.2
-rw-r--r--Error.hs4
-rw-r--r--Portage/EBuild.hs7
-rw-r--r--Portage/Host.hs34
-rw-r--r--hackport.cabal2
4 files changed, 26 insertions, 21 deletions
diff --git a/Error.hs b/Error.hs
index 2e540c9..4529005 100644
--- a/Error.hs
+++ b/Error.hs
@@ -51,9 +51,9 @@ hackPortShowError err = case err of
ExtractionFailed tarball file code -> "Extracting '"++file++"' from '"++tarball++"' failed with '"++show code++"'"
CabalParseFailed file reason -> "Error while parsing cabal file '"++file++"': "++reason
BashNotFound -> "The 'bash' executable was not found. It is required to figure out your portage-overlay. If you don't want to install bash, use '-p path-to-overlay'"
- BashError str -> "Error while guessing your portage-overlay. Either set PORTDIR_OVERLAY in /etc/make.conf or use '-p path-to-overlay'.\nThe error was: \""++str++"\""
+ BashError str -> "Error while guessing your repository's location. Either set a repository 'haskell' in '/etc/portage/repos.conf' or use '-p path-to-overlay'.\nThe error was: \""++str++"\""
MultipleOverlays overlays -> "You have the following overlays available: '"++unwords overlays++"'. Please choose one by using 'hackport -p path-to-overlay' <command>"
- NoOverlay -> "You don't have PORTDIR_OVERLAY set in '/etc/make.conf'. Please set it or use '-p path-to-overlay'"
+ NoOverlay -> "Unable to find a repository 'haskell'. Consider defining it in '/etc/portage/repos.conf' and verify '~/.hackport/repositories' (in overlay_list) or use '-p path-to-overlay'"
UnknownVerbosityLevel str -> "The verbosity level '"++str++"' is invalid. Please use debug,normal or silent"
InvalidServer srv -> "Invalid server address, could not parse: " ++ srv
--WrongCacheVersion -> "The version of the cache is too old. Please update the cache using 'hackport update'"
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
index 0f81cbe..5e8a7be 100644
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -84,10 +84,10 @@ src_uri e =
case my_pn e of
-- use standard address given that the package name has no upper
-- characters
- Nothing -> "http://hackage.haskell.org/packages/archive/${PN}/${PV}/${P}.tar.gz"
+ Nothing -> "https://hackage.haskell.org/package/${P}/${P}.tar.gz"
-- use MY_X variables (defined in showEBuild) as we've renamed the
-- package
- Just _ -> "http://hackage.haskell.org/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
+ Just _ -> "https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"
showEBuild :: TC.UTCTime -> EBuild -> String
showEBuild now ebuild =
@@ -108,7 +108,7 @@ showEBuild now ebuild =
ss "MY_P=". quote "${MY_PN}-${PV}". nl. nl).
ss "DESCRIPTION=". quote (drop_tdot $ description ebuild). nl.
ss "HOMEPAGE=". quote (toHttps $ expandVars (homepage ebuild)). nl.
- ss "SRC_URI=". quote (toMirror $ src_uri ebuild). nl.
+ ss "SRC_URI=". quote (src_uri ebuild). nl.
nl.
ss "LICENSE=". (either (\err -> quote "" . ss ("\t# FIXME: " ++ err))
quote
@@ -136,7 +136,6 @@ showEBuild now ebuild =
expandVars = replaceMultiVars [ ( name ebuild, "${PN}")
, (hackage_name ebuild, "${HACKAGE_N}")
]
- toMirror = replace "http://hackage.haskell.org/" "mirror://hackage/"
-- TODO: this needs to be more generic
toHttps = replace "http://github.com/" "https://github.com/"
this_year :: String
diff --git a/Portage/Host.hs b/Portage/Host.hs
index 3b23033..f151535 100644
--- a/Portage/Host.hs
+++ b/Portage/Host.hs
@@ -30,7 +30,7 @@ getInfo :: IO LocalInfo
getInfo = fromJust `fmap`
performMaybes [ readConfig
, performMaybes [ getPaludisInfo
- , fmap parse_emerge_output <$> (run_cmd "emerge --info")
+ , askPortageq
, return (Just defaultInfo)
] >>= showAnnoyingWarning
]
@@ -103,16 +103,22 @@ parsePaludisInfo text =
-- Emerge
---------
-parse_emerge_output :: String -> LocalInfo
-parse_emerge_output raw_data =
- foldl updateInfo defaultInfo $ lines raw_data
- where updateInfo info str =
- case (break (== '=') str) of
- ("DISTDIR", '=':value)
- -> info{distfiles_dir = unquote value}
- ("PORTDIR", '=':value)
- -> info{portage_dir = unquote value}
- ("PORTDIR_OVERLAY", '=':value)
- -> info{overlay_list = words $ unquote value}
- _ -> info
- unquote = init . tail
+askPortageq :: IO (Maybe LocalInfo)
+askPortageq = do
+ distdir <- run_cmd "portageq distdir"
+ portdir <- run_cmd "portageq get_repo_path / gentoo"
+ hsRepo <- run_cmd "portageq get_repo_path / haskell"
+ --There really ought to be both distdir and portdir,
+ --but maybe no hsRepo defined yet.
+ let info = if any (==Nothing) [distdir,portdir]
+ then Nothing
+ else Just LocalInfo
+ { distfiles_dir = grab distdir
+ , portage_dir = grab portdir
+ , overlay_list = iffy hsRepo
+ }
+ --init: kill newline char
+ where grab = init . fromJust
+ iffy Nothing = []
+ iffy (Just repo) = [init repo]
+ return info
diff --git a/hackport.cabal b/hackport.cabal
index c80c7d2..8ffc636 100644
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.6.1
+Version: 0.6.2
License: GPL
License-file: LICENSE
Author: Henning G√ľnther, Duncan Coutts, Lennart Kolmodin