packages feed

arch-hs 0.7.1.0 → 0.8.0.0

raw patch · 11 files changed

+159/−148 lines, 11 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -3,6 +3,16 @@ `arch-hs` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 0.8.0.0++* Fix the bug that unable to run with dependency-free packages++* Do not generate PKGBUILDs for missing dependencies of the target++* Support resolving sub-libraries in `arch-hs-diff`++* Remove `falseList`, which `arch-hs-submit` no longer uses+ ## 0.7.1.0  * Bump ghc version to 8.10.4
app/Main.hs view
@@ -34,6 +34,7 @@ import qualified Distribution.ArchHs.PkgBuild as N import Distribution.ArchHs.Types import Distribution.ArchHs.Utils+import GHC.IO.Encoding (setLocaleEncoding, utf8) import Json import Network.HTTP.Client (Manager) import Network.HTTP.Client.TLS (newTlsManager)@@ -84,6 +85,8 @@               pkgs -> Just (x ^. pkgName, pkgs)           )           providedPackages+      -- all missing transitive dependencies, excluding direct dependencies of the target+      missingChildren = mconcat $ snd <$> filter (\x -> fst x /= target) abnormalDependencies    embed $     forM_ abnormalDependencies $ \(T.pack . unPackageName -> parent, children) -> do@@ -111,7 +114,8 @@   embed $ T.putStrLn . prettySolvedPkgs $ filledByBoth    printInfo "Recommended package order:"-  let vertexesToBeRemoved = filledByBoth ^.. each . filtered isProvided ^.. each . pkgName+  -- remove missingChildren from the graph, so that we don't need package them if they are not our target+  let vertexesToBeRemoved = missingChildren <> filledByBoth ^.. each . filtered isProvided ^.. each . pkgName       removeSelfCycle g = foldr (\n acc -> GL.removeEdge n n acc) g $ toBePacked2 ^.. each . pkgName       newGraph = GL.induce (`notElem` vertexesToBeRemoved) deps   flattened <- case G.topSort . GL.skeleton $ removeSelfCycle newGraph of@@ -279,6 +283,7 @@ main :: IO () main = printHandledIOException $   do+    setLocaleEncoding utf8     Options {..} <- runArgsParser      unless (null optFileTrace) $ do
arch-hs.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               arch-hs-version:            0.7.1.0+version:            0.8.0.0 synopsis:           Distribute hackage packages to archlinux description:   @arch-hs@ is a command-line program, which simplifies the process of producing
data/NAME_PRESET.json view
@@ -1,105 +1,101 @@ {-  "falseList": [-    "haskell-ghc-heap",-    "haskell-libiserv",-    "haskell-tamarin-prover-sapic"-  ],-  "preset": {-    "agda": "Agda",-    "alex": "alex",-    "arch-hs": "arch-hs",-    "bnfc": "BNFC",-    "c2hs": "c2hs",-    "haskell-cabal": "Cabal",-    "cabal-install": "cabal-install",-    "cgrep": "cgrep",-    "cryptol": "cryptol",-    "darcs": "darcs",-    "dhall": "dhall",-    "dhall-bash": "dhall-bash",-    "dhall-json": "dhall-json",-    "dhall-lsp-server": "dhall-lsp-server",-    "dhall-yaml": "dhall-yaml",-    "git-annex": "git-annex",-    "git-repair": "git-repair",-    "happy": "happy",-    "haskell-chasingbottoms": "ChasingBottoms",-    "haskell-ci": "haskell-ci",-    "haskell-configfile": "ConfigFile",-    "haskell-cracknum": "crackNum",-    "haskell-dav": "DAV",-    "haskell-decimal": "Decimal",-    "haskell-diff": "Diff",-    "haskell-drbg": "DRBG",-    "haskell-edisonapi": "EdisonAPI",-    "haskell-edisoncore": "EdisonCore",-    "haskell-findbin": "FindBin",-    "haskell-floatinghex": "FloatingHex",-    "haskell-gi": "haskell-gi",-    "haskell-gi-base": "haskell-gi-base",-    "haskell-gi-overloading": "haskell-gi-overloading",-    "haskell-glob": "Glob",-    "haskell-gtk": "gtk3",-    "haskell-graphscc": "GraphSCC",-    "haskell-hopenpgp": "hOpenPGP",-    "haskell-http": "HTTP",-    "haskell-hunit": "HUnit",-    "haskell-ifelse": "IfElse",-    "haskell-juicypixels": "JuicyPixels",-    "haskell-lexer": "haskell-lexer",-    "haskell-listlike": "ListLike",-    "haskell-missingh": "MissingH",-    "haskell-monadlib": "monadLib",-    "haskell-monadrandom": "MonadRandom",-    "haskell-only": "Only",-    "haskell-hsopenssl": "HsOpenSSL",-    "haskell-hsyaml": "HsYAML",-    "haskell-hsyaml-aeson": "HsYAML-aeson",-    "haskell-libbf": "libBF",-    "haskell-lsp": "haskell-lsp",-    "haskell-lsp-types": "haskell-lsp-types",-    "haskell-memotrie": "MemoTrie",-    "haskell-monadprompt": "MonadPrompt",-    "haskell-rsa": "RSA",-    "haskell-puremd5": "pureMD5",-    "haskell-quickcheck": "QuickCheck",-    "haskell-ranged-sets": "Ranged-sets",-    "haskell-safesemaphore": "SafeSemaphore",-    "haskell-sha": "SHA",-    "haskell-smtlib": "smtLib",-    "haskell-src-exts": "haskell-src-exts",-    "haskell-src-exts-util": "haskell-src-exts-util",-    "haskell-src-meta": "haskell-src-meta",-    "haskell-statevar": "StateVar",-    "haskell-stmonadtrans": "STMonadTrans",-    "haskell-unixutils": "Unixutils",-    "haskell-x11": "X11",-    "haskell-x11-xft": "X11-xft",-    "hasktags": "hasktags",-    "hledger": "hledger",-    "hledger-api": "hledger-api",-    "hledger-ui": "hledger-ui",-    "hledger-web": "hledger-web",-    "hlint": "hlint",-    "hoogle": "hoogle",-    "hopenpgp-tools": "hopenpgp-tools",-    "idris": "idris",-    "misfortune": "misfortune",-    "pandoc": "pandoc",-    "pandoc-citeproc": "pandoc-citeproc",-    "pandoc-crossref": "pandoc-crossref",-    "postgrest": "postgrest",-    "shellcheck": "ShellCheck",-    "stack": "stack",-    "stylish-haskell": "stylish-haskell",-    "tamarin-prover": "tamarin-prover",-    "taskell": "taskell",-    "tidalcycles": "tidal",-    "unlambda": "unlambda",-    "uusi": "uusi",-    "xmobar": "xmobar",-    "xmonad": "xmonad",-    "xmonad-contrib": "xmonad-contrib",-    "xmonad-utils": "xmonad-utils"-  }+  "agda": "Agda",+  "alex": "alex",+  "arch-hs": "arch-hs",+  "bnfc": "BNFC",+  "c2hs": "c2hs",+  "haskell-cabal": "Cabal",+  "cabal-install": "cabal-install",+  "cgrep": "cgrep",+  "clash-ghc": "clash-ghc",+  "cryptol": "cryptol",+  "darcs": "darcs",+  "dhall": "dhall",+  "dhall-bash": "dhall-bash",+  "dhall-json": "dhall-json",+  "dhall-lsp-server": "dhall-lsp-server",+  "dhall-yaml": "dhall-yaml",+  "git-annex": "git-annex",+  "git-repair": "git-repair",+  "happy": "happy",+  "haskell-chasingbottoms": "ChasingBottoms",+  "haskell-ci": "haskell-ci",+  "haskell-configfile": "ConfigFile",+  "haskell-cracknum": "crackNum",+  "haskell-dav": "DAV",+  "haskell-decimal": "Decimal",+  "haskell-diff": "Diff",+  "haskell-drbg": "DRBG",+  "haskell-edisonapi": "EdisonAPI",+  "haskell-edisoncore": "EdisonCore",+  "haskell-findbin": "FindBin",+  "haskell-floatinghex": "FloatingHex",+  "haskell-gi": "haskell-gi",+  "haskell-gi-base": "haskell-gi-base",+  "haskell-gi-overloading": "haskell-gi-overloading",+  "haskell-glob": "Glob",+  "haskell-gtk": "gtk3",+  "haskell-graphscc": "GraphSCC",+  "haskell-hopenpgp": "hOpenPGP",+  "haskell-http": "HTTP",+  "haskell-hunit": "HUnit",+  "haskell-ifelse": "IfElse",+  "haskell-juicypixels": "JuicyPixels",+  "haskell-language-server": "haskell-language-server",+  "haskell-lexer": "haskell-lexer",+  "haskell-listlike": "ListLike",+  "haskell-lsp0": "haskell-lsp",+  "haskell-missingh": "MissingH",+  "haskell-monadlib": "monadLib",+  "haskell-monadrandom": "MonadRandom",+  "haskell-only": "Only",+  "haskell-hsopenssl": "HsOpenSSL",+  "haskell-hsyaml": "HsYAML",+  "haskell-hsyaml-aeson": "HsYAML-aeson",+  "haskell-libbf": "libBF",+  "haskell-lsp": "haskell-lsp",+  "haskell-lsp-types": "haskell-lsp-types",+  "haskell-memotrie": "MemoTrie",+  "haskell-monadprompt": "MonadPrompt",+  "haskell-rsa": "RSA",+  "haskell-puremd5": "pureMD5",+  "haskell-quickcheck": "QuickCheck",+  "haskell-ranged-sets": "Ranged-sets",+  "haskell-safesemaphore": "SafeSemaphore",+  "haskell-sha": "SHA",+  "haskell-smtlib": "smtLib",+  "haskell-src-exts": "haskell-src-exts",+  "haskell-src-exts-util": "haskell-src-exts-util",+  "haskell-src-meta": "haskell-src-meta",+  "haskell-statevar": "StateVar",+  "haskell-stmonadtrans": "STMonadTrans",+  "haskell-unixutils": "Unixutils",+  "haskell-x11": "X11",+  "haskell-x11-xft": "X11-xft",+  "hasktags": "hasktags",+  "hledger": "hledger",+  "hledger-iadd": "hledger-iadd",+  "hledger-ui": "hledger-ui",+  "hledger-web": "hledger-web",+  "hlint": "hlint",+  "hoogle": "hoogle",+  "hopenpgp-tools": "hopenpgp-tools",+  "idris": "idris",+  "misfortune": "misfortune",+  "pandoc": "pandoc",+  "pandoc-citeproc": "pandoc-citeproc",+  "pandoc-crossref": "pandoc-crossref",+  "postgrest": "postgrest",+  "shellcheck": "ShellCheck",+  "stack": "stack",+  "stylish-haskell": "stylish-haskell",+  "tamarin-prover": "tamarin-prover",+  "taskell": "taskell",+  "tidalcycles": "tidal",+  "unlambda": "unlambda",+  "uusi": "uusi",+  "xmobar": "xmobar",+  "xmonad": "xmonad",+  "xmonad-contrib": "xmonad-contrib",+  "xmonad-utils": "xmonad-utils" }
diff/Diff.hs view
@@ -105,13 +105,13 @@       return (libDeps, toolDeps)     Nothing -> return ([], []) -collectRunnableDeps ::+collectComponentialDeps ::   (Semigroup k, L.HasBuildInfo k, Members [FlagAssignmentsEnv, Trace, DependencyRecord] r) =>   (GenericPackageDescription -> [(UnqualComponentName, CondTree ConfVar [Dependency] k)]) ->   GenericPackageDescription ->   [UnqualComponentName] ->   Sem r (VersionedComponentList, VersionedComponentList)-collectRunnableDeps f cabal skip = do+collectComponentialDeps f cabal skip = do   let exes = cabal & f   bInfo <- filter (not . (`elem` skip) . fst) . zip (exes <&> fst) <$> mapM (evalConditionTree cabal . snd) exes   let deps = bInfo <&> _2 %~ (fmap unDepV . buildDependsIfBuild)@@ -121,11 +121,14 @@   return (deps, toolDeps)  collectExeDeps :: Members [FlagAssignmentsEnv, Trace, DependencyRecord] r => GenericPackageDescription -> [UnqualComponentName] -> Sem r (VersionedComponentList, VersionedComponentList)-collectExeDeps = collectRunnableDeps condExecutables+collectExeDeps = collectComponentialDeps condExecutables  collectTestDeps :: Members [FlagAssignmentsEnv, Trace, DependencyRecord] r => GenericPackageDescription -> [UnqualComponentName] -> Sem r (VersionedComponentList, VersionedComponentList)-collectTestDeps = collectRunnableDeps condTestSuites+collectTestDeps = collectComponentialDeps condTestSuites +collectSubLibDeps :: Members [FlagAssignmentsEnv,Trace, DependencyRecord] r => GenericPackageDescription -> [UnqualComponentName] -> Sem r (VersionedComponentList, VersionedComponentList)+collectSubLibDeps = collectComponentialDeps condSubLibraries+ collectSetupDeps :: Member Trace r => GenericPackageDescription -> Sem r VersionedList collectSetupDeps cabal = do   let name = getPkgName' cabal@@ -160,20 +163,23 @@   Sem r (VersionedList, VersionedList) directDependencies cabal = do   (libDeps, libToolsDeps) <- collectLibDeps cabal+  (subLibDeps, subLibToolsDeps) <- collectSubLibDeps cabal []   (exeDeps, exeToolsDeps) <- collectExeDeps cabal []   (testDeps, testToolsDeps) <- collectTestDeps cabal []   setupDeps <- collectSetupDeps cabal   let flatten = mconcat . fmap snd       l = libDeps       lt = libToolsDeps+      sl = flatten subLibDeps+      slt = flatten subLibToolsDeps       e = flatten exeDeps       et = flatten exeToolsDeps       t = flatten testDeps       tt = flatten testToolsDeps       notMyself = (/= getPkgName' cabal)       distinct = filter (notMyself . fst) . nub-      depends = distinct $ l <> e-      makedepends = distinct (lt <> et <> t <> tt <> setupDeps) \\ depends+      depends = distinct $ l <> sl <> e+      makedepends = distinct (lt <> slt <> et <> t <> tt <> setupDeps) \\ depends       sort' = sortBy (\x y -> uncurry compare $ getTwo _1 x y)   return (sort' depends, sort' makedepends) 
diff/Main.hs view
@@ -13,12 +13,14 @@ import Distribution.ArchHs.Internal.Prelude import Distribution.ArchHs.PP import Distribution.ArchHs.Types+import GHC.IO.Encoding (setLocaleEncoding, utf8) import Network.HTTP.Client (Manager) import Network.HTTP.Client.TLS (newTlsManager)  main :: IO () main = printHandledIOException $   do+    setLocaleEncoding utf8     Options {..} <- runArgsParser     let isFlagEmpty = Map.null optFlags 
src/Distribution/ArchHs/Internal/NamePresetLoader.hs view
@@ -1,5 +1,4 @@-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE TypeApplications #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-} @@ -9,30 +8,20 @@ import qualified Data.ByteString as BS import Data.Map.Strict (Map, fromList, keys, toList) import Data.Tuple (swap)-import GHC.Generics (Generic) import Language.Haskell.TH import System.Directory (getCurrentDirectory) import System.FilePath ((</>)) -data NamePreset = NamePreset-  { falseList :: [String],-    preset :: Map String String-  }-  deriving stock (Generic)--instance FromJSON NamePreset- loadNamePreset :: DecsQ loadNamePreset = do   txt <- runIO $ getCurrentDirectory >>= \dot -> BS.readFile $ dot </> "data" </> "NAME_PRESET.json"-  let NamePreset {..} = case decodeStrict txt of+  let preset = case decodeStrict @(Map String String) txt of         Just x -> x         _ -> error "Failed to parse json"   a <- genFunc "communityToHackageP" preset   b <- genFunc "hackageToCommunityP" $ fromList . fmap swap . toList $ preset-  c <- genArray "falseListP" falseList   d <- genArray "communityListP" $ keys preset-  return [a, b, c, d]+  return [a, b, d]  genFunc :: String -> Map String String -> DecQ genFunc name src = do
src/Distribution/ArchHs/Local.hs view
@@ -27,12 +27,13 @@           "old-time",           "integer",           "unsupported-ghc-version",-          "base",+          "rts",           "ghc-prim",           "ghc-bignum",           "hans",           "Win32",           "ghc-heap",+          "ghc-byteorder",           -- a build-tools of "zip-archive", which is not haskell package           "unzip"         ]
src/Distribution/ArchHs/Name.hs view
@@ -74,11 +74,6 @@ -- This function is generated from @NAME_PRESET.json@ hackageToCommunityP :: MyName 'HackageRep -> Maybe (MyName 'ArchLinuxRep) --- | Special haskell packages in community repo, which should be ignored in the process.------ This function is generated from @NAME_PRESET.json@-falseListP :: [MyName 'ArchLinuxRep]- -- | Community haskell packages of in the name preset. -- -- This function is generated from @NAME_PRESET.json@@@ -158,8 +153,9 @@  -- | Judge if a package in archlinux community repo is haskell package. ----- i.e. it is in @preset@ or have @haskell-@ prefix, and is not present in @falseList@ of @NAME_PRESET.json@.+-- i.e. it is in @preset@ or has @haskell-@ prefix.+-- Attention: There is no guarantee that the package exists in hackage. isHaskellPackage :: ArchLinuxName -> Bool isHaskellPackage name =   let rep = toArchLinuxRep name-   in (rep `elem` communityListP || "haskell-" `isPrefixOf` unsafeUnMyName rep) && rep `notElem` falseListP+   in (rep `elem` communityListP || "haskell-" `isPrefixOf` unsafeUnMyName rep)
submit/Main.hs view
@@ -11,6 +11,7 @@ import Distribution.ArchHs.Internal.Prelude import Distribution.ArchHs.PP import Distribution.ArchHs.Types+import GHC.IO.Encoding (setLocaleEncoding, utf8) import Network.HTTP.Client (Manager) import Network.HTTP.Client.TLS (newTlsManager) import Submit@@ -20,6 +21,7 @@ main :: IO () main = printHandledIOException $   do+    setLocaleEncoding utf8     Options {..} <- runArgsParser      token <- lookupEnv "HACKAGE_API_TOKEN"
submit/Submit.hs view
@@ -14,7 +14,7 @@ import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy as LBS import qualified Data.Map.Strict as Map-import Data.Maybe (catMaybes, fromJust)+import Data.Maybe (fromJust) import qualified Data.Text as T import Data.Void (Void) import Distribution.ArchHs.Exception@@ -119,15 +119,17 @@   Left err -> fail $ M.errorBundlePretty err   Right x -> x -genCSV :: Member CommunityEnv r => Sem r DistroCSV+genCSV :: Members [CommunityEnv, HackageEnv, Embed IO] r => Sem r DistroCSV genCSV = do-  db <- ask @CommunityDB+  communityDb <- ask @CommunityDB+  notLinked <- getAndPrintNotLinked -  let communityPackages = Map.toList db+  let communityPackages = Map.toList communityDb+      inHackage = (`notElem` notLinked)       fields =         communityPackages           ^.. each-            . filtered (isHaskellPackage . (^. _1))+            . filtered (((&&) <$> inHackage <*> isHaskellPackage) . (^. _1))           <&> (_1 <<%~ toHackageName)           & sortBy (\x y -> (x ^. _2 . _1) `compare` (y ^. _2 . _1))       prefix = "https://www.archlinux.org/packages/community/x86_64/"@@ -171,16 +173,6 @@ check community = do   printInfo "Checking generated csv file..." -  let hackageNames = fmap (\(a, _, _) -> a) community-      f = fmap (\case Left (PkgNotFound x) -> Just (unArchLinuxName $ toArchLinuxName x); _ -> Nothing)--  failed <- catMaybes . f <$> mapM (\x -> try @MyException (getLatestCabal $ mkPackageName x)) hackageNames--  unless (null failed) $-    printWarn $ "Following packages in" <+> ppCommunity <+> "are not linked to hackage:"--  embed . putStr . unlines $ failed-   req <- interceptHttpException $ parseRequest "https://hackage.haskell.org/distro/Arch/packages.csv"   printInfo "Downloading csv from hackage..."   manager <- ask@@ -212,3 +204,15 @@       <+> ppCommunity       <> dot       <> line++getAndPrintNotLinked :: Members [CommunityEnv, HackageEnv, Embed IO] r => Sem r [ArchLinuxName]+getAndPrintNotLinked = do+  communityHaskellPackages <- filter isHaskellPackage . Map.keys <$> ask @CommunityDB+  hackagePackages <- Map.keys <$> ask @HackageDB+  let result = filter (\x -> toHackageName x `notElem` hackagePackages) communityHaskellPackages++  unless (null result) $+    printWarn $ "Following packages in" <+> ppCommunity <+> "are not linked to hackage:"++  embed . putStr . unlines $ unArchLinuxName <$> result+  return result