cabal-debian 3.4.3 → 3.5
raw patch · 8 files changed
+79/−52 lines, 8 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Debian.Debianize.Atoms: buildDeps :: Lens Atoms (Set Relation)
+ Debian.Debianize.Atoms: buildDeps :: Lens Atoms (Set Relations)
- Debian.Debianize.Atoms: buildDepsIndep :: Lens Atoms (Set Relation)
+ Debian.Debianize.Atoms: buildDepsIndep :: Lens Atoms (Set Relations)
- Debian.Debianize.Atoms: execMap :: Lens Atoms (Map String BinPkgName)
+ Debian.Debianize.Atoms: execMap :: Lens Atoms (Map String Relations)
- Debian.Debianize.Atoms: extraLibMap :: Lens Atoms (Map String (Set BinPkgName))
+ Debian.Debianize.Atoms: extraLibMap :: Lens Atoms (Map String (Set Relations))
Files
- cabal-debian.cabal +1/−1
- debian/changelog +7/−0
- src/Debian/Debianize/Atoms.hs +14/−11
- src/Debian/Debianize/Debianize.hs +7/−6
- src/Debian/Debianize/Dependencies.hs +13/−14
- src/Debian/Debianize/Options.hs +27/−10
- src/Debian/Debianize/Tests.hs +3/−3
- src/Debian/Policy.hs +7/−7
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name: cabal-debian-Version: 3.4.3+Version: 3.5 License: BSD3 License-File: debian/copyright Author: David Fox <dsf@seereason.com>
debian/changelog view
@@ -1,3 +1,10 @@+haskell-cabal-debian (3.5) unstable; urgency=low++ * Allow full lists of debian relations to be passed to the --build-dep+ argument, not just a single package name.++ -- David Fox <dsf@seereason.com> Sun, 01 Sep 2013 07:08:37 -0700+ haskell-cabal-debian (3.4.3) unstable; urgency=low * Fix the repository location in the cabal file.
src/Debian/Debianize/Atoms.hs view
@@ -92,7 +92,7 @@ import Debian.Debianize.Types.VersionSplits (VersionSplits) import Debian.Orphans () import Debian.Policy (PackageArchitectures, SourceFormat, PackagePriority, Section, StandardsVersion)-import Debian.Relation (SrcPkgName, BinPkgName, Relation(..))+import Debian.Relation (SrcPkgName, BinPkgName, Relations, Relation(..)) import Debian.Version (DebianVersion) import Distribution.License (License) import Distribution.Package (PackageName(PackageName), PackageIdentifier(..))@@ -182,15 +182,15 @@ -- the name is constructed from the cabal package name. Note that -- DebianNameMap could encode this information if we already knew -- the cabal package name, but we can't assume that.- | BuildDep Relation -- ^ Add a build dependency- | BuildDepIndep Relation -- ^ Add an arch independent build dependency+ | BuildDep Relations -- ^ Add build dependencies+ | BuildDepIndep Relations -- ^ Add arch independent build dependencies | MissingDependency BinPkgName -- ^ Lets cabal-debian know that a package it might expect to exist -- actually does not, so omit all uses in resulting debianization.- | ExtraLibMapping String BinPkgName -- ^ Map a cabal Extra-Library name to a debian binary package name,+ | ExtraLibMapping String Relations -- ^ Map a cabal Extra-Library name to a debian binary package name, -- e.g. @ExtraLibMapping extraLibMap "cryptopp" "libcrypto-dev"@ adds a- -- build dependency on @libcrypto-dev@ to any package that has @cryptopp@- -- in its cabal Extra-Library list.- | ExecMapping String BinPkgName -- ^ Map a cabal Build-Tool name to a debian binary package name,+ -- build dependency *and* a regular dependency on @libcrypto-dev@ to+ -- any package that has @cryptopp@ in its cabal Extra-Library list.+ | ExecMapping String Relations -- ^ Map a cabal Build-Tool name to a debian binary package name, -- e.g. @ExecMapping "trhsx" "haskell-hsx-utils"@ adds a build -- dependency on @haskell-hsx-utils@ to any package that has @trhsx@ in its -- cabal build-tool list.@@ -394,7 +394,7 @@ f _ _ = Nothing -- | Map from cabal Extra-Lib names to debian binary package names.-extraLibMap :: Lens Atoms (Map String (Set BinPkgName))+extraLibMap :: Lens Atoms (Map String (Set Relations)) extraLibMap = lens g s where g atoms = foldAtoms from Map.empty atoms@@ -407,13 +407,16 @@ p _ _ = False -- | Map from cabal Build-Tool names to debian binary package names.-execMap :: Lens Atoms (Map String BinPkgName)+execMap :: Lens Atoms (Map String Relations) execMap = lens g s where+ g :: Atoms -> Map String Relations g atoms = foldAtoms from Map.empty atoms where+ from :: DebAtomKey -> DebAtom -> Map String Relations -> Map String Relations from Source (ExecMapping cabal debian) x = Map.insertWith (error "Conflict in execMap") cabal debian x from _ _ x = x+ s :: Map String Relations -> Atoms -> Atoms s x atoms = Map.foldWithKey (\ cabal debian atoms' -> insertAtom Source (ExecMapping cabal debian) atoms') (deleteAtoms p atoms) x where p Source (ExecMapping _ _) = True@@ -783,7 +786,7 @@ -- | Build dependencies. FIXME: This should be a Set (Set Relation) -- so we can build or relations, right now we just assume that each -- Relation is a singleton set.-buildDeps :: Lens Atoms (Set Relation)+buildDeps :: Lens Atoms (Set Relations) buildDeps = lens g s where g atoms = foldAtoms from Set.empty atoms@@ -796,7 +799,7 @@ p _ _ = False -- | Architecture independent-buildDepsIndep :: Lens Atoms (Set Relation)+buildDepsIndep :: Lens Atoms (Set Relations) buildDepsIndep = lens g s where g atoms = foldAtoms from Set.empty atoms
src/Debian/Debianize/Debianize.hs view
@@ -250,13 +250,14 @@ = bin { relations = g (relations bin) } f bin = bin g :: Debian.PackageRelations -> Debian.PackageRelations- g rels = rels { Debian.depends = Debian.depends rels ++- map anyrel' (concatMap (\ cab -> maybe [BinPkgName ("lib" ++ cab ++ "-dev")] Set.toList (Map.lookup cab (getL extraLibMap deb)))- (nub $ concatMap Cabal.extraLibs $ Cabal.allBuildInfo $ pkgDesc)) }+ g rels = rels { Debian.depends =+ concat $+ [Debian.depends rels] +++ concatMap (\ cab -> maybe [[[Rel (BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing]]]+ Set.toList+ (Map.lookup cab (getL extraLibMap deb)))+ (nub $ concatMap Cabal.extraLibs $ Cabal.allBuildInfo $ pkgDesc) } pkgDesc = fromMaybe (error "addExtraLibDependencies: no PackageDescription") $ getL packageDescription deb--anyrel' :: BinPkgName -> [Relation]-anyrel' x = [Rel x Nothing Nothing] -- | Write the files of the debianization @d@ to the directory @top@. writeDebianization :: Top -> Atoms -> IO ()
src/Debian/Debianize/Dependencies.hs view
@@ -56,7 +56,7 @@ = BuildDepends Dependency | BuildTools Dependency | PkgConfigDepends Dependency- | ExtraLibs D.BinPkgName+ | ExtraLibs Relations deriving (Eq, Show) -- | In cabal a self dependency probably means the library is needed@@ -109,8 +109,10 @@ map PkgConfigDepends pkgconfigDepends ++ map ExtraLibs (fixDeps extraLibs) where- fixDeps :: [String] -> [D.BinPkgName]- fixDeps xs = concatMap (\ cab -> maybe [D.BinPkgName ("lib" ++ cab ++ "-dev")] Set.toList (Map.lookup cab (getL extraLibMap atoms))) xs+ fixDeps :: [String] -> [Relations]+ fixDeps xs = concatMap (\ cab -> maybe [[[D.Rel (D.BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing]]]+ Set.toList+ (Map.lookup cab (getL extraLibMap atoms))) xs putBuildDeps :: Atoms -> Atoms putBuildDeps deb =@@ -125,7 +127,7 @@ [D.Rel (D.BinPkgName "haskell-devscripts") (Just (D.GRE (parseDebianVersion ("0.8" :: String)))) Nothing], anyrel "cdbs", anyrel "ghc"] ++- (map (: []) (Set.toList (getL buildDeps deb))) +++ concat (Set.toList (getL buildDeps deb)) ++ (if getL noProfilingLibrary deb then [] else [anyrel "ghc-prof"]) ++ cabalDeps (getL packageDescription deb) where@@ -144,7 +146,7 @@ if getL noDocumentationLibrary deb then [] else nub $ [anyrel "ghc-doc"] ++- (map (: []) (Set.toList (getL buildDepsIndep deb))) +++ concat (Set.toList (getL buildDepsIndep deb)) ++ cabalDeps (getL packageDescription deb) where cabalDeps Nothing = []@@ -171,24 +173,21 @@ dependencies atoms Development name ranges ++ dependencies atoms Profiling name ranges buildDependencies atoms dep@(ExtraLibs _) =- concat (map dependency $ adapt (getL execMap atoms) dep)+ concat (adapt (getL execMap atoms) dep) buildDependencies atoms dep = case unboxDependency dep of Just (Dependency _name _ranges) ->- concat (map dependency $ adapt (getL execMap atoms) dep)+ concat (adapt (getL execMap atoms) dep) Nothing -> [] -dependency :: D.BinPkgName -> D.Relations-dependency name = [[D.Rel name Nothing Nothing]]--adapt :: Map.Map String D.BinPkgName -> Dependency_ -> [D.BinPkgName]+adapt :: Map.Map String Relations -> Dependency_ -> [Relations] adapt execMap (PkgConfigDepends (Dependency (PackageName pkg) _)) = maybe (aptFile pkg) (: []) (Map.lookup pkg execMap) adapt execMap (BuildTools (Dependency (PackageName pkg) _)) = maybe (aptFile pkg) (: []) (Map.lookup pkg execMap) adapt _flags (ExtraLibs x) = [x]-adapt _flags (BuildDepends (Dependency (PackageName pkg) _)) = [D.BinPkgName pkg]+adapt _flags (BuildDepends (Dependency (PackageName pkg) _)) = [[[D.Rel (D.BinPkgName pkg) Nothing Nothing]]] -- There are two reasons this may not work, or may work -- incorrectly: (1) the build environment may be a different@@ -197,7 +196,7 @@ -- environment might have different names, and (2) the package -- we are looking for may not be installed in the parent -- environment.-aptFile :: String -> [D.BinPkgName] -- Maybe would probably be more correct+aptFile :: String -> [Relations] -- Maybe would probably be more correct aptFile pkg = unsafePerformIO $ do ret <- readProcessWithExitCode "apt-file" ["-l", "search", pkg ++ ".pc"] ""@@ -205,7 +204,7 @@ (ExitSuccess, out, _) -> case takeWhile (not . isSpace) out of "" -> error $ "Unable to locate a package containing " ++ pkg ++ ", try using --exec-map " ++ pkg ++ "=<debname> or modL execMap (Map.insert (PackageName " ++ show pkg ++ ") (BinPkgName \"<debname>\")"- s -> [D.BinPkgName s]+ s -> [[[D.Rel (D.BinPkgName s) Nothing Nothing]]] _ -> [] anyrel :: String -> [D.Relation]
src/Debian/Debianize/Options.hs view
@@ -14,7 +14,8 @@ import Debian.Debianize.Utility (read') import Debian.Orphans () import Debian.Policy (SourceFormat(Quilt3), parseMaintainer)-import Debian.Relation (BinPkgName(..), SrcPkgName(..), Relation(..))+import Debian.Relation (BinPkgName(..), SrcPkgName(..), Relations, Relation(..))+import Debian.Relation.String (parseRelations) import Debian.Version (parseDebianVersion) import Distribution.PackageDescription (FlagName(..)) import Distribution.Package (PackageName(..))@@ -35,7 +36,7 @@ -- | Options that modify other atoms. options :: [OptDescr (Atoms -> Atoms)] options =- [ Option "v" ["verbose"] (ReqArg (\ s atoms -> setL verbosity (read' (\ s -> error $ "verbose: " ++ show s) s) atoms) "n")+ [ Option "v" ["verbose"] (ReqArg (\ s atoms -> setL verbosity (read' (\ s' -> error $ "verbose: " ++ show s') s) atoms) "n") "Change build verbosity", Option "n" ["dry-run", "compare"] (NoArg (\ atoms -> setL dryRun True atoms)) "Just compare the existing debianization to the one we would generate.",@@ -62,10 +63,20 @@ "Set given flags in Cabal conditionals", Option "" ["maintainer"] (ReqArg (\ maint x -> setL maintainer (either (error ("Invalid maintainer string: " ++ show maint)) Just (parseMaintainer maint)) x) "Maintainer Name <email addr>") "Override the Maintainer name and email in $DEBEMAIL/$EMAIL/$DEBFULLNAME/$FULLNAME",- Option "" ["build-dep"] (ReqArg (\ name atoms -> modL buildDeps (Set.insert (Rel (BinPkgName name) Nothing Nothing)) atoms) "Debian binary package name")- "Specify a package to add to the build dependency list for this source package, e.g. '--build-dep libglib2.0-dev'.",- Option "" ["build-dep-indep"] (ReqArg (\ name atoms -> modL buildDepsIndep (Set.insert (Rel (BinPkgName name) Nothing Nothing)) atoms) "Debian binary package name")- "Specify a package to add to the architecture independent build dependency list for this source package, e.g. '--build-dep-indep perl'.",+ Option "" ["build-dep"]+ (ReqArg (\ name atoms ->+ modL buildDeps+ (case parseRelations name of+ Right rss -> Set.insert rss+ Left err -> error ("cabal-debian option --build-dep " ++ show name ++ ": " ++ show err)) atoms) "Debian package relations")+ "Specify a package to add to the build dependency list for this source package, e.g. '--build-dep libglib2.0-dev'.",+ Option "" ["build-dep-indep"]+ (ReqArg (\ name atoms ->+ modL buildDepsIndep+ (case parseRelations name of+ Right rss -> Set.insert rss+ Left err -> error ("cabal-debian option --build-dep-indep " ++ show name ++ ": " ++ show err)) atoms) "Debian binary package name")+ "Specify a package to add to the architecture independent build dependency list for this source package, e.g. '--build-dep-indep perl'.", Option "" ["dev-dep"] (ReqArg (\ name atoms -> modL extraDevDeps (Set.insert (Rel (BinPkgName name) Nothing Nothing)) atoms) "Debian binary package name") "Specify a package to add to the Depends: list of the -dev package, e.g. '--dev-dep libncurses5-dev'. It might be good if this implied --build-dep.", Option "" ["depends"] (ReqArg (\ arg atoms -> foldr (\ (p, r) atoms' -> modL depends (Map.insertWith union p (singleton r)) atoms') atoms (parseDeps arg)) "deb:deb,deb:deb,...")@@ -77,8 +88,8 @@ Option "" ["provides"] (ReqArg (\ arg atoms -> foldr (\ (p, r) atoms' -> modL provides (Map.insertWith union p (singleton r)) atoms') atoms (parseDeps arg)) "deb:deb,deb:deb,...") "Specify pairs A:B of debian binary package names, each A gets a Provides: B. Note that B can have debian style version relations", Option "" ["map-dep"] (ReqArg (\ pair atoms -> case break (== '=') pair of- (cab, (_ : deb)) -> modL extraLibMap (Map.insertWith Set.union cab (singleton (b deb))) atoms- (_, "") -> error "usage: --map-dep CABALNAME=DEBIANNAME") "CABALNAME=DEBIANNAME")+ (cab, (_ : deb)) -> modL extraLibMap (Map.insertWith Set.union cab (singleton (rels deb))) atoms+ (_, "") -> error "usage: --map-dep CABALNAME=RELATIONS") "CABALNAME=RELATIONS") "Specify a mapping from the name appearing in the Extra-Library field of the cabal file to a debian binary package name, e.g. --dep-map cryptopp=libcrypto-dev", Option "" ["deb-version"] (ReqArg (\ version atoms -> setL debVersion (Just (parseDebianVersion version)) atoms) "VERSION") "Specify the version number for the debian package. This will pin the version and should be considered dangerous.",@@ -90,8 +101,8 @@ _ -> error "usage: --epoch-map CABALNAME=DIGIT") "CABALNAME=DIGIT") "Specify a mapping from the cabal package name to a digit to use as the debian package epoch number, e.g. --epoch-map HTTP=1", Option "" ["exec-map"] (ReqArg (\ s atoms -> case break (== '=') s of- (cab, (_ : deb)) -> modL execMap (Map.insertWith (flip const) cab (b deb)) atoms- _ -> error "usage: --exec-map CABALNAME=DEBNAME") "EXECNAME=DEBIANNAME")+ (cab, (_ : deb)) -> modL execMap (Map.insertWith (flip const) cab (rels deb)) atoms+ _ -> error "usage: --exec-map EXECNAME=RELATIONS") "EXECNAME=RELATIONS") "Specify a mapping from the name appearing in the Build-Tool field of the cabal file to a debian binary package name, e.g. --exec-map trhsx=haskell-hsx-utils", Option "" ["omit-lt-deps"] (NoArg (setL omitLTDeps True)) "Don't generate the << dependency when we see a cabal equals dependency.",@@ -138,3 +149,9 @@ b :: String -> BinPkgName b = BinPkgName++rels :: String -> Relations+rels s =+ case parseRelations s of+ Right relss -> relss+ _ -> error $ "Parse error in debian relations: " ++ show s
src/Debian/Debianize/Tests.hs view
@@ -358,7 +358,7 @@ , " Install this somewhere other than creativeprompts.com to run automated" , " backups of the database."])) . modL Atoms.depends (Map.insertWith union (BinPkgName "creativeprompts-server") (singleton (anyrel (BinPkgName "markdown")))) .- modL execMap (Map.insertWith (error "Conflict in execMap") "trhsx" (BinPkgName "haskell-hsx-utils")) .+ modL execMap (Map.insertWith (error "Conflict in execMap") "trhsx" [[Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing]]) . doBackups (BinPkgName "creativeprompts-backups") "creativeprompts-backups" . doServer (BinPkgName "creativeprompts-development") (theServer (BinPkgName "creativeprompts-development")) . doWebsite (BinPkgName "creativeprompts-production") (theSite (BinPkgName "creativeprompts-production")) .@@ -439,7 +439,7 @@ log <- inputChangeLog (Top "test-data/artvaluereport-data/input") new <- debianization (Top "test-data/artvaluereport-data/input") (return .- modL buildDeps (Set.insert (Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing)) .+ modL buildDeps (Set.insert [[Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing]]) . modL control (\ y -> y {homepage = Just "http://artvaluereportonline.com"}) . setL sourceFormat (Just Native3) . setL changelog (Just log) .@@ -454,7 +454,7 @@ TestCase ( do old <- inputDebianization (Top "test-data/alex/output") new <- debianization (Top "test-data/alex/input") (return .- modL buildDeps (Set.insert (Rel (BinPkgName "alex") Nothing Nothing)) .+ modL buildDeps (Set.insert [[Rel (BinPkgName "alex") Nothing Nothing]]) . doExecutable (BinPkgName "alex") (InstallFile {execName = "alex", destName = "alex", sourceDir = Nothing, destDir = Nothing}) . setL debVersion (Just (parseDebianVersion ("3.0.2-1~hackage1" :: String))) . setL sourceFormat (Just Native3) .
src/Debian/Policy.hs view
@@ -111,13 +111,13 @@ parseStandardsVersion :: String -> StandardsVersion parseStandardsVersion s = case filter (/= ".") (groupBy (\ a b -> (a == '.') == (b == '.')) s) of- (a : b : c : d : _) -> StandardsVersion (read' (\ s -> error $ "StandardsVersion" ++ show s) a)- (read' (\ s -> error $ "StandardsVersion" ++ show s) b)- (read' (\ s -> error $ "StandardsVersion" ++ show s) c)- (Just (read' (\ s -> error $ "StandardsVersion" ++ show s) d))- (a : b : c : _) -> StandardsVersion (read' (\ s -> error $ "StandardsVersion" ++ show s) a)- (read' (\ s -> error $ "StandardsVersion" ++ show s) b)- (read' (\ s -> error $ "StandardsVersion" ++ show s) c) Nothing+ (a : b : c : d : _) -> StandardsVersion (read' (error . ("StandardsVersion" ++) . show) a)+ (read' (error . ("StandardsVersion" ++) . show) b)+ (read' (error . ("StandardsVersion" ++) . show) c)+ (Just (read' (error . ("StandardsVersion" ++) . show) d))+ (a : b : c : _) -> StandardsVersion (read' (error . ("StandardsVersion" ++) . show) a)+ (read' (error . ("StandardsVersion" ++) . show) b)+ (read' (error . ("StandardsVersion" ++) . show) c) Nothing _ -> error $ "Invalid Standards-Version string: " ++ show s data SourceFormat