packages feed

cab 0.2.19 → 0.2.20

raw patch · 9 files changed

+53/−10 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Distribution.Cab: OptAllowNewer :: Option
+ Distribution.Cab.PkgDB: findInternalLibs :: PkgInfo -> [String]

Files

Distribution/Cab/Commands.hs view
@@ -41,6 +41,7 @@             | OptStatic             | OptFuture             | OptDebug+            | OptAllowNewer             deriving (Eq,Show)  ----------------------------------------------------------------@@ -109,18 +110,23 @@         mapM_ (hPutStrLn stderr . fullNameOfPkgInfo) (init sortedPkgs)       else do         unless doit $ putStrLn "The following packages are deleted without the \"-n\" option."-        mapM_ (purge doit opts . pairNameOfPkgInfo) sortedPkgs+        mapM_ (purge doit opts) sortedPkgs   where     onlyOne = OptRecursive `notElem` opts     doit = OptNoharm `notElem` opts -purge :: Bool -> [Option] -> (String,String) -> IO ()-purge doit opts nameVer = do+purge :: Bool -> [Option] -> PkgInfo -> IO ()+purge doit opts pkgInfo = do     sandboxOpts <- (makeOptList . getSandboxOpts2) <$> getSandbox     dirs <- getDirs nameVer sandboxOpts     unregister doit opts nameVer+    mapM_ unregisterInternal $ findInternalLibs pkgInfo     mapM_ (removeDir doit) dirs   where+    unregisterInternal subname = unregister doit opts (nm,ver)+      where+        nm = "z-" ++ name ++ "-z-" ++ subname+    nameVer@(name,ver) = pairNameOfPkgInfo pkgInfo     makeOptList "" = []     makeOptList x  = [x] 
Distribution/Cab/GenPaths.hs view
@@ -7,7 +7,7 @@ import Data.List (isSuffixOf) import Distribution.Cab.Utils (readGenericPackageDescription, unPackageName) import Distribution.Package (pkgName, pkgVersion)-import Distribution.PackageDescription+import Distribution.PackageDescription (package, packageDescription) import Distribution.Verbosity (silent) import Distribution.Version import System.Directory
Distribution/Cab/PkgDB.hs view
@@ -19,6 +19,8 @@   , fullNameOfPkgInfo   , pairNameOfPkgInfo   , verOfPkgInfo+  -- * Find internal libraries+  , findInternalLibs   ) where  import Distribution.Cab.Utils@@ -26,7 +28,7 @@ import Distribution.Cab.Version import Distribution.Cab.VerDB (PkgName) import Distribution.InstalledPackageInfo-    (InstalledPackageInfo, sourcePackageId)+    (InstalledPackageInfo(depends), sourcePackageId) import Distribution.Package (PackageIdentifier(..)) import Distribution.Simple.Compiler (PackageDB(..)) import Distribution.Simple.GHC (configure, getInstalledPackages, getPackageDBContents)@@ -40,7 +42,13 @@ #endif import Distribution.Simple.Program.Db (defaultProgramDb) import Distribution.Verbosity (normal)+import Distribution.Types.UnitId (unUnitId) +import Data.Char+import Data.Maybe++----------------------------------------------------------------+ #if MIN_VERSION_Cabal(1,22,0) type PkgDB = InstalledPackageIndex #else@@ -133,3 +141,22 @@   where     unitids = map installedUnitId     topSort = topologicalOrder . fromList . reverseDependencyClosure db++----------------------------------------------------------------++findInternalLibs :: PkgInfo -> [String]+findInternalLibs pkgInfo =+    catMaybes $ map (getInternalLib . unUnitId) $ depends pkgInfo++getInternalLib :: String -> Maybe String+getInternalLib xs0 = case drop 22 $ skip xs0 of+  _:xs1   -> Just $ take (length xs1) xs1+  _       -> Nothing+  where+    skip ys = case break (== '-') ys of+      (_,'-':b:bs)+        | isDigit b -> case break (== '-') bs of+            (_,'-':ds) -> ds+            _          -> "" -- error+        | otherwise -> skip bs+      _  -> "" -- error
Distribution/Cab/Utils.hs view
@@ -34,7 +34,10 @@ import qualified Distribution.Package as Cabal (PackageName(..)) #endif -#if MIN_VERSION_Cabal(2,2,0)+#if MIN_VERSION_Cabal(3,8,0)+import qualified Distribution.Simple.PackageDescription as Cabal+    (readGenericPackageDescription)+#elif MIN_VERSION_Cabal(2,2,0) import qualified Distribution.PackageDescription.Parsec as Cabal     (readGenericPackageDescription) #elif MIN_VERSION_Cabal(2,0,0)
cab.cabal view
@@ -1,5 +1,5 @@ Name:                   cab-Version:                0.2.19+Version:                0.2.20 Author:                 Kazu Yamamoto <kazu@iij.ad.jp> Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp> License:                BSD3
src/Commands.hs view
@@ -12,7 +12,7 @@          command = Sync        , commandNames = ["sync", "update"]        , document = "Fetch the latest package index"-       , routing = RouteCabal ["v1-update"]+       , routing = RouteCabal ["update"]        , switches = []        , manual = Nothing        }@@ -31,6 +31,7 @@                     ,(SwDebug, Solo "--ghc-options=\"-g\"")                     ,(SwJobs, WithEqArg "--jobs")                     ,(SwStatic, Solo "--disable-shared")+                    ,(SwAllowNewer, Solo "--allow-newer")                     ]        , manual = Just "[<package> [<ver>]]"        }@@ -67,6 +68,7 @@                     ,(SwExecProfile, Solo "--enable-profiling --ghc-options=\"-fprof-auto -fprof-cafs\"")                     ,(SwDebug, Solo "--ghc-options=\"-g\"")                     ,(SwStatic, Solo "--disable-shared")+                    ,(SwAllowNewer, Solo "--allow-newer")                     ]        , manual = Nothing        }@@ -108,7 +110,7 @@          command = Sdist        , commandNames = ["sdist", "pack"]        , document = "Make tar.gz for source distribution"-       , routing = RouteCabal ["v1-sdist"]+       , routing = RouteCabal ["sdist"]        , switches = []        , manual = Nothing        }
src/Options.hs view
@@ -54,10 +54,13 @@   , Option ['u'] ["future"]       (NoArg OptFuture)       "Show packages with versions ahead of Hackage"+  , Option ['x'] ["newer"]+       (NoArg OptAllowNewer)+      "Allow newer versions"   , Option ['h'] ["help"]       (NoArg OptHelp)       "Show help message"   ]  optionDB :: OptionDB-optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwFlag,SwTest,SwBench,SwDepsOnly,SwLibProfile,SwExecProfile,SwDebug,SwJobs,SwImport,SwStatic,SwFuture] getOptDB+optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwFlag,SwTest,SwBench,SwDepsOnly,SwLibProfile,SwExecProfile,SwDebug,SwJobs,SwImport,SwStatic,SwFuture,SwAllowNewer] getOptDB
src/Run.hs view
@@ -30,6 +30,7 @@ toSwitch (OptImport _)  = SwImport toSwitch OptStatic      = SwStatic toSwitch OptFuture      = SwFuture+toSwitch OptAllowNewer  = SwAllowNewer toSwitch _              = error "toSwitch"  ----------------------------------------------------------------
src/Types.hs view
@@ -24,6 +24,7 @@             | SwImport             | SwStatic             | SwFuture+            | SwAllowNewer             deriving (Eq,Show)  ----------------------------------------------------------------