cblrepo 0.5.0 → 0.6
raw patch · 6 files changed
+43/−22 lines, 6 filesdep ~Unixutils
Dependency ranges changed: Unixutils
Files
- cblrepo.cabal +2/−2
- src/Main.hs +4/−1
- src/PkgDB.hs +1/−1
- src/Updates.hs +10/−1
- src/Util/Misc.hs +21/−13
- src/Util/Translation.hs +5/−4
cblrepo.cabal view
@@ -1,5 +1,5 @@ name: cblrepo-version: 0.5.0+version: 0.6 cabal-version: >= 1.6 license: OtherLicense license-file: LICENSE-2.0@@ -28,7 +28,7 @@ build-depends: base ==4.5.*, cmdargs ==0.9.*, filepath ==1.3.*, directory ==1.1.*, Cabal ==1.14.*, json ==0.5.*, bytestring ==0.9.*, tar ==0.4.*, zlib ==0.5.*, mtl ==2.0.*,- process ==1.1.*, Unixutils ==1.48.*, unix ==2.5.*,+ process ==1.1.*, Unixutils ==1.50.*, unix ==2.5.*, ansi-wl-pprint ==0.6.* Source-Repository head
src/Main.hs view
@@ -73,7 +73,10 @@ , pkgs := def += args += typ "PKG" ] += name "versions" += help "list available versions" -cmdUpdates = record defUpdates [ argAppDir , argDbFile ] += name "updates" += help "check for available updates"+cmdUpdates = record defUpdates+ [ argAppDir, argDbFile+ , idxStyle := False += explicit += name "s" += help "a shorter output suitable for scripting"+ ] += name "updates" += help "check for available updates" cmdListPkgs = record defCmdListPkgs [ argAppDir, argDbFile
src/PkgDB.hs view
@@ -119,7 +119,7 @@ lookupPkg :: CblDB -> String -> Maybe CblPkg lookupPkg db n = maybe Nothing (\ p -> Just (n, p)) (lookup n db) -lookupDependants db n = map pkgName $ filter (\ p -> doesDependOn p n) db+lookupDependants db n = filter (/= n) $ map pkgName $ filter (\ p -> doesDependOn p n) db where doesDependOn p n = n `elem` (map _depName $ pkgDeps p)
src/Updates.hs view
@@ -33,6 +33,7 @@ updates = do db <- cfgGet dbFile >>= liftIO . readDb aD <- cfgGet appDir+ aCS <- cfgGet idxStyle entries <- liftIO $ liftM (Tar.read . GZip.decompress) (BS.readFile $ aD </> "00-index.tar.gz") let nonBasePkgs = filter (not . isBasePkg) db@@ -41,7 +42,10 @@ let outdated = filter (\ (p, v) -> maybe False (> v) (latestVer p availPkgs)) pkgsNVers- liftIO $ mapM_ (flip printOutdated availPkgs) outdated+ let printer = if aCS+ then printOutdatedIdx+ else printOutdated+ liftIO $ mapM_ (flip printer availPkgs) outdated type PkgVer = (String, Version) @@ -68,3 +72,8 @@ l = fromJust $ latestVer p avail in putStrLn $ p ++ ": " ++ (display v) ++ " (" ++ (display l) ++ ")"++printOutdatedIdx (p, v) avail = let+ l = fromJust $ latestVer p avail+ in+ putStrLn $ p ++ "," ++ (display l)
src/Util/Misc.hs view
@@ -30,7 +30,7 @@ import Data.List import Data.Typeable import Distribution.Compiler-import Distribution.Package+import Distribution.Package as P import Distribution.PackageDescription import Distribution.PackageDescription.Configuration import Distribution.PackageDescription.Parse@@ -65,6 +65,9 @@ progName = "cblrepo" dbName = progName ++ ".db" +ghcVersion = (Version [7,4,1] [])+ghcVersionDep = "ghc=" ++ display ghcVersion ++ "-1"+ -- {{{1 command line argument type data Cmds@@ -77,7 +80,7 @@ | Sync { appDir :: FilePath } | Versions { appDir :: FilePath, pkgs :: [String] } | CmdListPkgs { appDir :: FilePath, dbFile :: FilePath, listGhc :: Bool, listDistro :: Bool, noListRepo :: Bool }- | Updates { appDir :: FilePath, dbFile :: FilePath }+ | Updates { appDir :: FilePath, dbFile :: FilePath, idxStyle :: Bool } | Urls { appDir :: FilePath, pkgVers :: [(String, String)] } | PkgBuild { appDir :: FilePath, dbFile :: FilePath, patchDir :: FilePath, pkgs :: [String] } | ConvertDb { appDir :: FilePath, inDbFile :: FilePath, outDbFile :: FilePath }@@ -90,7 +93,7 @@ defSync = Sync "" defVersions = Versions "" [] defCmdListPkgs = CmdListPkgs "" "" False False False-defUpdates = Updates "" ""+defUpdates = Updates "" "" False defUrls = Urls "" [] defPkgBuild = PkgBuild "" "" "" [] defConvertDb = ConvertDb "" "" ""@@ -188,19 +191,24 @@ liftIO $ readPackageDescription silent cblFn -- {{{2 finalising-finalizePkg db = finalizePackageDescription- [] -- no flags- (checkAgainstDb db)- (Platform X86_64 buildOS) -- platform- (CompilerId GHC (Version [7,0,2] [])) -- compiler version- [] -- no additional constraints+finalizePkg db gpd = let+ n = ((\ (P.PackageName n) -> n ) . P.pkgName . package . packageDescription) gpd+ in finalizePackageDescription+ [] -- no flags+ (checkAgainstDb db n)+ (Platform X86_64 buildOS) -- platform+ (CompilerId GHC ghcVersion) -- compiler version+ [] -- no additional constraints+ gpd -checkAgainstDb db dep = let+checkAgainstDb db name dep = let dN = depName dep dVR = depVersionRange dep- in case DB.lookupPkg db dN of- Nothing -> False- Just (_, p) -> withinRange (DB.version p) dVR+ in if dN == name+ then True+ else case DB.lookupPkg db dN of+ Nothing -> False+ Just (_, p) -> withinRange (DB.version p) dVR -- {{{1 Command type type Command a = ReaderT Cmds IO a
src/Util/Translation.hs view
@@ -33,7 +33,7 @@ import Data.Monoid hiding ((<>)) import Data.Version import Distribution.Package as P-import Distribution.PackageDescription+import Distribution.PackageDescription as PD import Distribution.Text import System.Directory import System.Exit@@ -287,8 +287,8 @@ pkgDesc = synopsis pd url = if null (homepage pd) then "http://hackage.haskell.org/package/${_hkgname}" else (homepage pd) lic = display (license pd)- makeDepends = if hasLib then ["haddock"] else ["ghc=7.4.1-1", "haddock"] ++ calcExactDeps db pd- depends = if hasLib then ["ghc=7.4.1-1"] ++ calcExactDeps db pd else []+ makeDepends = if hasLib then ["haddock"] else [ghcVersionDep, "haddock"] ++ calcExactDeps db pd+ depends = if hasLib then [ghcVersionDep] ++ calcExactDeps db pd else [] extraLibDepends = maybe [] (extraLibs . libBuildInfo) (library pd) install = if hasLib then (apShInstall ap) else Nothing in ap@@ -315,7 +315,8 @@ -- • this is most likely too simplistic to create the Arch package names -- correctly for all possible dependencies calcExactDeps db pd = let- remPkgs = (map DB.pkgName (filter isGhcPkg db)) ++ ghcPkgs+ n = (\ (P.PackageName n) -> n ) (P.packageName pd)+ remPkgs = (map DB.pkgName (filter isGhcPkg db)) ++ ghcPkgs ++ [n] deps = filter (not . flip elem remPkgs) (map depName (buildDepends pd)) lookupPkgVer = display . DB.pkgVersion . fromJust . lookupPkg db depString n = let