packages feed

cabal-debian 5.0 → 5.0.1

raw patch · 8 files changed

+251/−302 lines, 8 filesdep ~Cabal

Dependency ranges changed: Cabal

Files

cabal-debian.cabal view
@@ -1,6 +1,6 @@ Name:           cabal-debian-Version:        5.0-Copyright:      Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2019 Clint Adams+Version:        5.0.1+Copyright:      Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2020 Clint Adams License:        BSD3 License-File:   LICENSE Author:         David Fox <dsf@seereason.com>@@ -157,7 +157,7 @@   Build-Depends:     base < 5,     bifunctors,-    Cabal >= 1.18,+    Cabal >= 2.2,     containers,     data-default,     deepseq,@@ -226,7 +226,7 @@   Build-Depends:     base,     cabal-debian,-    Cabal >= 1.18,+    Cabal >= 2.2,     debian >= 3.95,     lens,     mtl,@@ -242,7 +242,7 @@   Build-Depends:     base < 5,     cabal-debian,-    Cabal >= 1.16,+    Cabal >= 2.2,     containers,     debian >= 3.95,     Diff >= 0.3.1,
debian/cabal-debian.1 view
@@ -1,120 +1,199 @@-.\"Original page generated by txt2man and then hacked extensively.-.TH CABAL-DEBIAN 1  "May 10, 2010"-+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.11.+.TH CABAL-DEBIAN "1" "November 2019" "cabal-debian 5.0" "User Commands" .SH NAME-cabal-debian \- create Debian package meta data from a Haskell cabal file.-+cabal-debian \- manual page for cabal-debian 5.0 .SH SYNOPSIS .B cabal-debian-.RI [flags]-+[\fI\,-v|--verbose\/\fR] [\fI\,-n|--dry-run\/\fR] [\fI\,--upgrade\/\fR] [\fI\,--roundtrip\/\fR] .SH DESCRIPTION-cabal-debian will generated the Debian meta data for a Debian package from the-cabal file of a Haskell package. The program expects to find the package's-<pkgname>.cabal file in the directory from which it was run.-+cabal\-debian \fB\-\-\fR create debianization of cabal package .TP-.B-\fB--prefix=PATH\fP-Pass this prefix if we need to configure the package-+[\-\-ghcjs]+[\-\-cabal\-flag|\-\-cabal\-flags CABALFLAG or \fB\-CABALFLAG]\fR+[\-\-buildenvdir DIR] [\-m|\-\-maintainer 'NAME <EMAIL>']+[\-u|\-\-uploader 'NAME <EMAIL>']+[\-e|\-\-executable SOURCEPATH[:DESTDIR]]+[\-d|\-\-default\-package PKGNAME] [\-\-missing\-dependency DEB]+[\-b|\-\-debian\-name\-base NAME] [\-\-deb\-version DEBIANVERSION]+[\-\-revision DEBIANREVISION]+[\-s|\-\-source\-package\-name DEBIANNAME]+[\-S|\-\-source\-section SECTION]+[\-\-standards\-version CABALVERSION]+[\-\-build\-dep DEBIANRELATIONS]+[\-\-build\-dep\-indep DEBIANRELATIONS] [\-\-dev\-dep RELATION]+[\-\-depends DEB:RELATION] [\-\-conflicts DEB:RELATION]+[\-\-provides DEB:RELATION] [\-\-replaces DEB:RELATION]+[\-\-recommends DEB:RELATION] [\-\-suggests DEB:RELATION]+[\-\-dep\-map CABAL:DEBIANBINARYPACKAGE]+[\-\-epoch\-map CABALPACKAGE=DIGIT]+[\-\-exec\-map CABAL:DEBIANBINARYPACKAGE] [\-\-disable\-profiling]+[\-\-disable\-haddock] [\-\-official] [\-\-native]+([\-\-disable\-running\-tests|\-\-no\-run\-tests] |+[\-\-disable\-tests|\-\-no\-tests])+.IP+Typical usage is run in unpacked source root directory+.IP+\f(CW% cabal-debian  --maintainer 'Maintainer Name <maintainer@email>'\fR+.IP+This will read the package's cabal file and any existing debian/changelog file and+.IP+deduce what it can about the debianization, then it will create or modify files in+the debian subdirectory.  Note that it will not remove any files in debian, and+these could affect the operation of the debianization in unknown ways.  For this+reason it is recommended either using a pristine unpacked directory each time, or else+using a revision control system to revert the package to a known state before running.+.IP+Arguments: cabal\-debian \fB\-\-help\fR+.SS "Available options:" .TP-.B-\fB--ghc\fP-Compile with GHC.-+\fB\-h\fR,\-\-help+Show this help text .TP-.B-\fB--hugs\fP-Compile with HUGS.-+\fB\-v\fR,\-\-verbose+Every instance of this flag increases amount of+progress messages generated .TP-.B-\fB--jhc\fP-Compile with JHC.-+\fB\-n\fR,\-\-dry\-run+Just compare the existing debianization to the one we+would generate. .TP-.B-\fB--nhc\fP-Compile with NHC.-+\fB\-\-upgrade\fR+Upgrade an existing debianization carefully+preserving fields that are commonly hand\-edited. .TP-.B-\fB-h, -?, \-\-help\fP-Show this help text.-+\fB\-\-roundtrip\fR+Roundtrip a debianization to normalize it. .TP-.B-\fB--name\fP=NAME-Override the default package name.+\fB\-\-ghcjs\fR+Set compiler flavor to GHCJS. .TP-.B-\fB--disable-haddock\fP-Don't generate API docs.+\fB\-\-cabal\-flag\fR,\-\-cabal\-flags CABALFLAG or \fB\-CABALFLAG\fR+Flags to pass to cabal configure with the \fB\-\-flags=\fR+option .TP-.B-\fB--disable-library-profiling\fP-Don't generate profiling libraries.+\fB\-\-buildenvdir\fR DIR+Directory containing the three build environments,+clean, depend, and build. .TP-.B-\fB--disable-optimization\fP-Don't generate optimised code.-+\fB\-m\fR,\-\-maintainer 'NAME <EMAIL>'+Set the `Maintainer' field in debian/control file. .TP-.B-\fB--disable-split-objs\fP-Don't split object files to save space.-+\fB\-u\fR,\-\-uploader 'NAME <EMAIL>'+Add entry to `Uploaders' field in debian/control+file. .TP-.B-\fB-f\fP FLAGS, \fB--flags\fP=FLAGS-Set given flags in Cabal conditionals.-+\fB\-e\fR,\-\-executable SOURCEPATH[:DESTDIR]+Create an individual binary package to hold this+executable. Other executables and data files are+gathered into a single package named+`haskell\-PACKAGENAME\-utils' .TP-.B-\fB--release\fP=RELEASE-Override the default package release.-+\fB\-d\fR,\-\-default\-package PKGNAME+Set the name of the catch\-all package that receives+all the files not included in a library package or+some other executable package. By default this is+`haskell\-PACKAGENAME\-utils' .TP-.B-\fB--debdir\fP=DEBDIR-Override the default output directory ("./debian").-+\fB\-\-missing\-dependency\fR DEB This is the counterpart to \fB\-\-disable\-haddock\fR. It+prevents a package from being added to the build+dependencies. This is necessary, for example, when a+dependency package was built with the+\fB\-\-disable\-haddock\fR option, because normally+cabal\-debian assumes that the \fB\-doc\fR package exists and+adds it as a build dependency. .TP-.B-\fB-v n,q \fB--verbose=n\fP-Change build verbosity.-+\fB\-b\fR,\-\-debian\-name\-base NAME+Use this name for the base of the debian binary+packages \- the string between 'libghc\-' and '\-dev'.+Normally this is derived from the hackage package+name. .TP-.B-\fB--version\fP=VERSION-Override the default package version.-+\fB\-\-deb\-version\fR DEBIANVERSION+Specify the version number for the debian package.+This will pin the version and should be considered+dangerous. .TP-.B-\fB--maintainer\fP=Maintainer Name <email addr>-Override the Maintainer name and email in $DEBEMAIL/$EMAIL/$DEBFULLNAME/$FULLNAME.-+\fB\-\-revision\fR DEBIANREVISION+Add this string to the cabal version to get the+debian version number. Debian policy says this must+either be empty (\fB\-\-revision\fR '') or begin with a dash. .TP-.B-\fB--debianize\fP-Generate a new debianization, replacing any existing one.  One of-\fB--debianize\fP, \fB--substvar\fP, or \fB--update-debianization\fP is-required.-+\fB\-s\fR,\-\-source\-package\-name DEBIANNAME+Use this name for the debian source package, the name+in the Source field at the top of the debian/control+file, and also at the very beginning of the+debian/changelog file. By default it is+haskell\-<cabalname>, where the cabal package name is+downcased. .TP-.B-\fB--substvar\fP=Doc, Prof, or Dev-Write out the list of dependencies required for the dev, prof or doc package-depending on the argument. This value can be added to the appropriate substvars-file.-+\fB\-S\fR,\-\-source\-section SECTION+Set the `Section' field in debian/control file. .TP-.B-\fB--update-debianization\fP-Update an existing debianization.--.SH AUTHOR-This manual page was originally written by Erik de Castro Lopo -<erikd@mega-nerd.com> for the Debian GNU/Linux system (but may be used by -others).+\fB\-\-standards\-version\fR CABALVERSION+Claim compatibility to this version of the Debian+policy (i.e. the value of the Standards\-Version+field)+.TP+\fB\-\-build\-dep\fR DEBIANRELATIONS+Add a dependency relation to the `Build\-Depends'+field for this source package.+.TP+\fB\-\-build\-dep\-indep\fR DEBIANRELATIONS+Add a dependency relation to the+`Build\-Depends\-Indep' field for this source package.+.TP+\fB\-\-dev\-dep\fR RELATION+Add an entry to the `Depends' field of the \fB\-dev\fR+package+.TP+\fB\-\-depends\fR DEB:RELATION+Add extry to 'Depends 'field of DEB binary package+.HP+\fB\-\-conflicts\fR DEB:RELATION Add extry to 'Conflicts 'field of DEB binary package+.TP+\fB\-\-provides\fR DEB:RELATION+Add extry to 'Provides 'field of DEB binary package+.TP+\fB\-\-replaces\fR DEB:RELATION+Add extry to 'Replaces 'field of DEB binary package+.TP+\fB\-\-recommends\fR DEB:RELATION+Add extry to 'Recommends 'field of DEB binary package+.TP+\fB\-\-suggests\fR DEB:RELATION+Add extry to 'Suggests 'field of DEB binary package+.TP+\fB\-\-dep\-map\fR CABAL:DEBIANBINARYPACKAGE+Specify what debian package name corresponds with a+name that appears in the Extra\-Library field of a+cabal file, e.g. \fB\-\-map\-dep\fR cryptopp:libcrypto\-dev.+.TP+\fB\-\-epoch\-map\fR CABALPACKAGE=DIGIT+Specify a mapping from the cabal package name to a+digit to use as the debian package epoch number, e.g.+\fB\-\-epoch\-map\fR HTTP=1+.TP+\fB\-\-exec\-map\fR CABAL:DEBIANBINARYPACKAGE+Specify a mapping from the name appearing in the+Build\-Tool field of the cabal file to a debian binary+package name, e.g. \fB\-\-exec\-map\fR trhsx:haskell\-hsx\-utils+.TP+\fB\-\-disable\-profiling\fR+Do not generate profiling (\fB\-prof\fR) library package, do+not add \fB\-prof\fR packages to the build dependency list.+.TP+\fB\-\-disable\-haddock\fR+Do not create a \fB\-doc\fR package+.TP+\fB\-\-official\fR+Follow guidelines of Debian Haskell Group+.TP+\fB\-\-native\fR+Package has an no upstream tarball, write '3.0+(native)' into source/format.+.TP+\fB\-\-disable\-running\-tests\fR,\-\-no\-run\-tests+build, but do not run test suite+.TP+\fB\-\-disable\-tests\fR,\-\-no\-tests+disable test suite
src/Debian/Debianize/BuildDependencies.hs view
@@ -18,7 +18,7 @@ import Data.Function (on) import Data.List as List (filter, groupBy, map, minimumBy, nub, sortBy) import Data.Map as Map (lookup, Map)-import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe, mapMaybe)+import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe, mapMaybe, maybeToList) import Data.Monoid ((<>)) import Data.Set as Set (empty, fold, fromList, map, member, Set, singleton, toList, union) import Debian.Debianize.Prelude@@ -38,15 +38,14 @@ import Debian.Version (DebianVersion, parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..)) import Distribution.Package (Dependency(..), PackageIdentifier(pkgName, pkgVersion), PackageName)-import Distribution.PackageDescription as Cabal (BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Library(..), Executable(..), TestSuite(..))-import Distribution.PackageDescription (PackageDescription)+import Distribution.PackageDescription as Cabal (BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Library(..), Executable(..), TestSuite(..), SetupBuildInfo(..), PackageDescription(setupBuildInfo)) import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites)) import Distribution.Pretty (prettyShow) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Types.LegacyExeDependency (LegacyExeDependency(..)) import Distribution.Types.PkgconfigDependency (PkgconfigDependency(..)) #endif-import Distribution.Version (anyVersion, asVersionIntervals, earlierVersion, foldVersionRange', fromVersionIntervals, intersectVersionRanges, isNoVersion, laterVersion, orEarlierVersion, orLaterVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion)+import Distribution.Version (anyVersion, asVersionIntervals, fromVersionIntervals, intersectVersionRanges, isNoVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion) import Distribution.Version.Invert (invertVersionRange) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (findExecutable)@@ -91,15 +90,10 @@       (mergeCabalDependencies $ mapMaybe convertPkgconfig $  concatMap pkgconfigDepends buildInfos)       (concatMap extraLibs buildInfos)     where-#if MIN_VERSION_Cabal(2,0,0)       convertLegacy :: LegacyExeDependency -> Maybe Dependency       convertLegacy = const Nothing       convertPkgconfig :: PkgconfigDependency -> Maybe Dependency       convertPkgconfig = const Nothing-#else-      convertLegacy = Just-      convertPkgconfig = Just-#endif       allBuildDepends' :: Monad m => [Dependency] -> [Dependency] -> [Dependency] -> [String] -> CabalT m [Dependency_]       allBuildDepends' buildDepends' buildTools' pkgconfigDepends' extraLibs' =           do atoms <- get@@ -113,6 +107,9 @@           concatMap (\ cab -> fromMaybe [[D.Rel (D.BinPkgName ("lib" ++ List.map toLower cab ++ "-dev")) Nothing Nothing]]                                         (Map.lookup cab (view (A.debInfo . D.extraLibMap) atoms))) +setupBuildDepends :: SetupBuildInfo -> [Dependency_]+setupBuildDepends = List.map BuildDepends . setupDepends+ -- | Take the intersection of all the dependencies on a given package name mergeCabalDependencies :: [Dependency] -> [Dependency] mergeCabalDependencies =@@ -120,7 +117,7 @@     where       dependencyPackage (Dependency x _) = x --- The haskell-cdbs package contains the hlibrary.mk file with+-- The haskell-devscripts-minimal package contains the hlibrary.mk file with -- the rules for building haskell packages. debianBuildDeps :: (MonadIO m) => PackageDescription -> CabalT m D.Relations debianBuildDeps pkgDesc =@@ -128,30 +125,24 @@        prof <- not <$> use (A.debInfo . D.noProfilingLibrary)        let hcPackageTypes :: CompilerFlavor -> Set B.PackageType            hcPackageTypes GHC = fromList ([B.Development] <> if prof then [B.Profiling] else [])-#if MIN_VERSION_Cabal(1,22,0)            hcPackageTypes GHCJS = fromList [B.Development]-#endif            hcPackageTypes hc = error $ "Unsupported compiler flavor: " ++ show hc         let hcs = singleton hflavor -- vestigial-       let hcTypePairs =+           hcTypePairs =                fold union empty $                   Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypes hc') hcs+           setupDeps = concat . maybeToList . fmap setupBuildDepends . setupBuildInfo $ pkgDesc         libDeps <- allBuildDepends (maybe [] (filter isBuildable . return . libBuildInfo) (Cabal.library pkgDesc))        binDeps <- allBuildDepends (List.map buildInfo (filter isBuildable (Cabal.executables pkgDesc)))        testDeps <- allBuildDepends (List.map testBuildInfo (filter isBuildable (Cabal.testSuites pkgDesc)))--       -- liftIO (putStrLn ("library dependencies: " ++ show libDeps))-       -- liftIO (putStrLn ("executable dependencies: " ++ show binDeps))-       -- liftIO (putStrLn (intercalate "\n  " ("executables:" :  fmap show (Cabal.executables pkgDesc))))-       -- liftIO (putStrLn ("test suite dependencies: " ++ show testDeps))-        testsStatus <- use (A.debInfo . D.testsStatus)         cDeps <- nub . concat . concat <$> sequence             [ mapM (buildDependencies hcTypePairs) libDeps             , mapM (buildDependencies hcTypePairs) binDeps+            , mapM (buildDependencies hcTypePairs) setupDeps             , mapM (buildDependencies hcTypePairs) (if testsStatus /= D.TestsDisable then testDeps else [])             ] @@ -166,11 +157,6 @@                         D.Rel (D.BinPkgName "haskell-devscripts") (Just $ D.GRE $ parseDebianVersion' ("0.13" :: String)) Nothing],                        anyrel "cdbs"] ++                       (ghcrel ++ ghcrelprof) ++-{--#if MIN_VERSION_Cabal(1,22,0)-                      (if member GHCJS (Set.map _hcFlavor hcs) then [anyrel (compilerPackageName hflavor B.Development)] else []) ++-#endif--}                        bDeps ++                        cDeps        filterMissing xs@@ -305,28 +291,25 @@           case isNoVersion range''' of             True -> return Nothing             False ->-                Just <$> foldVersionRange'-                          (return $ Rel' (D.Rel dname Nothing Nothing))-                          (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.EEQ dv)) Nothing))-                          (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.SGR dv)) Nothing))-                          (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.SLT dv)) Nothing))-                          (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.GRE dv)) Nothing))-                          (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.LTE dv)) Nothing))-#if MIN_VERSION_Cabal(2,0,0)-                          (\ x y -> debianVersion' name x >>= \ dvx ->+                Just <$> (cataVersionRange rangeToRange . normaliseVersionRange) range'''+          where+            rangeToRange AnyVersionF                     = return $ Rel' (D.Rel dname Nothing Nothing)+            rangeToRange (ThisVersionF v)                = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.EEQ dv)) Nothing)) v+            rangeToRange (LaterVersionF v)               = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.SGR dv)) Nothing)) v+            rangeToRange (EarlierVersionF v)             = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.SLT dv)) Nothing)) v+            rangeToRange (OrLaterVersionF v)             = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.GRE dv)) Nothing)) v+            rangeToRange (OrEarlierVersionF v)           = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.LTE dv)) Nothing)) v+            rangeToRange (WildcardVersionF v)            = (\ x y -> debianVersion' name x >>= \ dvx ->                                     debianVersion' name y >>= \ dvy ->                                     return $ And [Rel' (D.Rel dname (Just (D.GRE dvx)) Nothing),-                                                  Rel' (D.Rel dname (Just (D.SLT dvy)) Nothing)])-#endif-                          (\ x y -> debianVersion' name x >>= \ dvx ->+                                                  Rel' (D.Rel dname (Just (D.SLT dvy)) Nothing)]) v (wildcardUpperBound v)+            rangeToRange (MajorBoundVersionF v)          = (\ x y -> debianVersion' name x >>= \ dvx ->                                     debianVersion' name y >>= \ dvy ->                                     return $ And [Rel' (D.Rel dname (Just (D.GRE dvx)) Nothing),-                                                  Rel' (D.Rel dname (Just (D.SLT dvy)) Nothing)])-                          (\ x y -> x >>= \ x' -> y >>= \ y' -> return $ Or [x', y'])-                          (\ x y -> x >>= \ x' -> y >>= \ y' -> return $ And [x', y'])-                          id-                          range'''-          where+                                                  Rel' (D.Rel dname (Just (D.SLT dvy)) Nothing)]) v (majorUpperBound v)+            rangeToRange (UnionVersionRangesF v1 v2)     = (\ x y -> x >>= \ x' -> y >>= \ y' -> return $ Or [x', y']) v1 v2+            rangeToRange (IntersectVersionRangesF v1 v2) = (\ x y -> x >>= \ x' -> y >>= \ y' -> return $ And [x', y']) v1 v2+            rangeToRange (VersionRangeParensF v)         = v             -- Choose the simpler of the two             range''' = canon (simpler range' range'')             -- Unrestrict the range for versions that we know don't exist for this debian package@@ -337,21 +320,9 @@             -- a wildcard because the resulting debian version numbers have             -- various suffixes added.       cabalRange' | typ `elem` noVersionPackageType = anyVersion-                  | otherwise = foldVersionRange'-            anyVersion-            withinVersion  -- <- Here we are turning equals into wildcard-            laterVersion-            earlierVersion-            orLaterVersion-            orEarlierVersion-            (\ lb ub -> intersectVersionRanges (orLaterVersion lb) (earlierVersion ub))-#if MIN_VERSION_Cabal(2,0,0)-            (\ lb ub -> intersectVersionRanges (orLaterVersion lb) (earlierVersion ub))-#endif-            unionVersionRanges-            intersectVersionRanges-            id-            cabalRange+                  | otherwise = (hyloVersionRange tweak projectVersionRange . normaliseVersionRange) cabalRange+      tweak (ThisVersionF v) = withinVersion v+      tweak vr = embedVersionRange vr       noVersionPackageType = (if omitProfVersionDeps then [B.Profiling] else []) ++ [B.Documentation]       simpler v1 v2 = minimumBy (compare `on` (length . asVersionIntervals)) [v1, v2]       -- Simplify a VersionRange
src/Debian/Debianize/Details.hs view
@@ -29,13 +29,8 @@ debianDefaults :: Monad m => CabalT m () debianDefaults =     do -- These are the two epoch names I know about in the debian repo-#if MIN_VERSION_Cabal(2,0,0)        A.epochMap %= Map.insert (mkPackageName "HaXml") 1        A.epochMap %= Map.insert (mkPackageName "HTTP") 1-#else-       A.epochMap %= Map.insert (PackageName "HaXml") 1-       A.epochMap %= Map.insert (PackageName "HTTP") 1-#endif        -- Associate some build tools and their corresponding        -- (eponymous) debian package names        mapM_ (\name -> (A.debInfo . D.execMap) %= Map.insert name [[Rel (BinPkgName name) Nothing Nothing]])@@ -43,40 +38,20 @@        -- The parsec debs are suffixed with either "2" or "3" #if !MIN_VERSION_base(4,11,1) -- The deb of ghc-8.4.3 changes the libghc-parsec3-dev name to libghc-parsec-deb-#if MIN_VERSION_Cabal(2,0,0)        mapCabal (mkPackageName "parsec") (DebBase "parsec3")-#else-       mapCabal (PackageName "parsec") (DebBase "parsec3") #endif-#endif        -- Similar split for quickcheck-#if MIN_VERSION_Cabal(2,0,0)        mapCabal (mkPackageName "QuickCheck") (DebBase "quickcheck2")-#else-       mapCabal (PackageName "QuickCheck") (DebBase "quickcheck2")-#endif        -- Something was required for this package at one time - it        -- looks like a no-op now-#if MIN_VERSION_Cabal(2,0,0)        mapCabal (mkPackageName "gtk2hs-buildtools") (DebBase "gtk2hs-buildtools")-#else-       mapCabal (PackageName "gtk2hs-buildtools") (DebBase "gtk2hs-buildtools")-#endif        -- Upgrade transformers to 0.4 - no don't!        -- remapCabal (PackageName "transformers") (DebBase "transformers4")        -- remapCabal (PackageName "haskeline") (DebBase "haskeline0713")-#if MIN_VERSION_Cabal(2,0,0)        mapCabal (mkPackageName "haskell-src-exts") (DebBase "src-exts")+       mapCabal (mkPackageName "haskell-src-exts-simple") (DebBase "src-exts-simple")        mapCabal (mkPackageName "haskell-src-meta") (DebBase "src-meta")        mapCabal (mkPackageName "Cabal") (DebBase "cabal")         mapCabal (mkPackageName "happstack-authenticate") (DebBase "happstack-authenticate")        splitCabal (mkPackageName "happstack-authenticate") (DebBase "happstack-authenticate-0") (mkVersion [2])-#else-       mapCabal (PackageName "haskell-src-exts") (DebBase "src-exts")-       mapCabal (PackageName "haskell-src-meta") (DebBase "src-meta")-       mapCabal (PackageName "Cabal") (DebBase "cabal")--       mapCabal (PackageName "happstack-authenticate") (DebBase "happstack-authenticate")-       splitCabal (PackageName "happstack-authenticate") (DebBase "happstack-authenticate-0") (Version [2] [])-#endif
src/Debian/Debianize/Finalize.hs view
@@ -477,7 +477,7 @@          let packagesURI = "https://salsa.debian.org/haskell-team/DHG_packages/tree/master/p/" <> pack src         zoom D.control $ do-           S.standardsVersion .?= Just (parseStandardsVersion "4.4.0")+           S.standardsVersion .?= Just (parseStandardsVersion "4.5.0") #if MIN_VERSION_Cabal(2,0,0)            S.homepage .?= Just ("https://hackage.haskell.org/package/" <> pack (unPackageName cabal)) #else
src/Debian/Debianize/Optparse.hs view
@@ -380,7 +380,7 @@ standardsVersionP = O.option (parseStandardsVersion <$> O.str) m where   m = O.help helpMsg       <> O.long "standards-version"-      <> O.value (parseStandardsVersion "4.4.0")+      <> O.value (parseStandardsVersion "4.5.0")       <> O.metavar "CABALVERSION"   helpMsg = unlines [     "Claim compatibility to this version of the Debian policy",
src/Debian/Debianize/Prelude.hs view
@@ -38,19 +38,8 @@     , fromSingleton     , (.?=)     , escapeDebianWildcards-#if MIN_VERSION_Cabal(2,0,0)-    -- Cabal has its own Version type starting in 2.0.0.0     , module Distribution.Version     , module Distribution.Package-#else-    , module Data.Version-    , mkFlagName-    , mkPackageName-    , mkVersion-    , mkVersion'-    , versionNumbers-    , unPackageName-#endif     ) where  @@ -61,37 +50,32 @@ import Control.Monad.Reader (ask, ReaderT) import Control.Monad.State (get, MonadState, StateT, put) import Data.Char (isSpace)-import Data.List as List (dropWhileEnd, intersperse, isSuffixOf, lines, map)-import Data.Map as Map (empty, findWithDefault, foldrWithKey, fromList, insert, lookup, map, Map)-import Data.Maybe (catMaybes, fromJust, fromMaybe, listToMaybe, mapMaybe)+import Data.List as List (dropWhileEnd, intersperse, lines, map)+import Data.Map (Map)+import qualified Data.Map as Map+import Data.Maybe (fromJust, fromMaybe, listToMaybe, mapMaybe) import Data.Monoid ((<>), mconcat) import Data.Set as Set (Set, toList) import qualified Data.Set as Set (findMin, fromList, null, size)-import Data.Text as Text (lines, Text, unpack)+import Data.Text as Text (Text, unpack) import Data.Text.IO (hGetContents)-import Debian.Control (Field'(Field), lookupP, parseControl, stripWS, unControl)+import Debian.Control (stripWS) import Debian.Orphans () import Debian.Pretty (PP(PP))-import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relations)+import qualified Debian.Relation as D (BinPkgName(..), Relations) import Debian.Relation.Common () import Debian.Version (DebianVersion, parseDebianVersion', prettyDebianVersion)-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageIdentifier(..), PackageName, mkPackageName, unPackageName) import Distribution.Version-#else-import Distribution.Package (PackageIdentifier(..), PackageName(..))-import Distribution.PackageDescription (FlagName(..))-import Data.Version-#endif import Distribution.Pretty (Pretty(pretty)) import Distribution.Verbosity (intToVerbosity, Verbosity) import GHC.IO.Exception (ExitCode(ExitFailure, ExitSuccess), IOErrorType(InappropriateType, NoSuchThing), IOException(IOError, ioe_description, ioe_type))-import Prelude hiding (lookup, map)+import Prelude hiding (map) import System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory, getDirectoryContents, removeDirectory, removeFile, renameFile, setCurrentDirectory)-import System.FilePath ((</>), dropExtension)+import System.FilePath ((</>)) import System.IO (hSetBinaryMode, IOMode(ReadMode), openFile, withFile) import System.IO.Error (catchIOError, isDoesNotExistError)-import System.Process (readProcessWithExitCode, showCommandForUser)+import System.Process (readProcess, readProcessWithExitCode, showCommandForUser) import Text.PrettyPrint.HughesPJClass as PP (text)  curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d@@ -99,16 +83,12 @@  type DebMap = Map D.BinPkgName (Maybe DebianVersion) --- | Read and parse the status file for installed debian packages: @/var/lib/dpkg/status@+-- | Query versions of installed packages buildDebVersionMap :: IO DebMap buildDebVersionMap =-    readFile "/var/lib/dpkg/status" >>=-    return . either (const []) unControl . parseControl "/var/lib/dpkg/status" >>=-    mapM (\ p -> case (lookupP "Package" p, lookupP "Version" p) of-                   (Just (Field (_, name)), Just (Field (_, version))) ->-                       return (Just (D.BinPkgName (stripWS name), Just (parseDebianVersion' (stripWS version))))-                   _ -> return Nothing) >>=-    return . Map.fromList . catMaybes+    Map.fromList . List.map lineToKV . Prelude.lines <$> readProcess "dpkg-query" ["--showformat", "${Package}\\t${Version}\\n"] ""+    where+        lineToKV = bimap (D.BinPkgName . stripWS) (Just . parseDebianVersion' . stripWS) . span (/= '\t')  (!) :: DebMap -> D.BinPkgName -> DebianVersion m ! k = maybe (error ("No version number for " ++ (show . pretty . PP $ k) ++ " in " ++ show (Map.map (maybe Nothing (Just . prettyDebianVersion)) m))) id (Map.findWithDefault Nothing k m)@@ -171,19 +151,18 @@ dpkgFileMap :: IO (Map FilePath (Set D.BinPkgName)) dpkgFileMap =     do-      let fp = "/var/lib/dpkg/info"-      names <- getDirectoryContents fp >>= return . filter (isSuffixOf ".list")-      let paths = List.map (fp </>) names-      -- Read strictly to make sure we consume all the files and don't-      -- hold tons of open file descriptors.-      files <- mapM (strictReadF Text.lines) paths-      return $ Map.fromList $ zip (List.map dropExtension names) (List.map (Set.fromList . List.map (D.BinPkgName . unpack)) $ files)+      installedPackages <- Map.keys <$> buildDebVersionMap +      files <- mapM (listFiles . D.unBinPkgName) installedPackages+      return $ Map.fromList $ zip (List.map D.unBinPkgName installedPackages) (List.map (Set.fromList . List.map D.BinPkgName) $ files)+    where+        listFiles pkg = Prelude.lines <$> readProcess "dpkg-query" ["--listfiles", pkg] ""+ -- |Given a path, return the name of the package that owns it. debOfFile :: FilePath -> ReaderT (Map FilePath (Set D.BinPkgName)) IO (Maybe D.BinPkgName) debOfFile path =     do mp <- ask-       return $ testPath (lookup path mp)+       return $ testPath (Map.lookup path mp)     where       -- testPath :: Maybe (Set FilePath) -> Maybe FilePath       testPath Nothing = Nothing@@ -267,12 +246,12 @@  zipMaps :: Ord k => (k -> Maybe a -> Maybe b -> Maybe c) -> Map k a -> Map k b -> Map k c zipMaps f m n =-    foldrWithKey h (foldrWithKey g Map.empty m) n+    Map.foldrWithKey h (Map.foldrWithKey g Map.empty m) n     where-      g k a r = case f k (Just a) (lookup k n) of+      g k a r = case f k (Just a) (Map.lookup k n) of                   Just c -> Map.insert k c r              -- Both m and n have entries for k                   Nothing -> r                            -- Only m has an entry for k-      h k b r = case lookup k m of+      h k b r = case Map.lookup k m of                   Nothing -> case f k Nothing (Just b) of                                Just c -> Map.insert k c r -- Only n has an entry for k                                Nothing -> r@@ -349,11 +328,7 @@     pretty (PP p) = pretty (PP (pkgName p)) <> text "-" <> pretty (PP (pkgVersion p))  instance Pretty (PP PackageName) where-#if MIN_VERSION_Cabal(2,0,0)     pretty (PP p) = text (unPackageName p)-#else-    pretty (PP (PackageName s)) = text s-#endif  -- | Set @b@ if it currently isNothing and the argument isJust, that is --  1. Nothing happens if the argument isNothing@@ -366,20 +341,3 @@ escapeDebianWildcards (c : more) | elem c "[]" = '\\' : c : escapeDebianWildcards more escapeDebianWildcards (c : more) = c : escapeDebianWildcards more escapeDebianWildcards "" = ""--#if !MIN_VERSION_Cabal(2,0,0)-mkFlagName :: String -> FlagName-mkFlagName = FlagName-mkPackageName :: String -> PackageName-mkPackageName = PackageName-mkVersion :: [Int] -> Version-mkVersion ns = Version ns []-mkVersion' :: Version -> Version-mkVersion' = id-versionNumbers :: Version -> [Int]-versionNumbers (Version ns _) = ns-#if !MIN_VERSION_Cabal(1,22,0)-unPackageName :: PackageName -> String-unPackageName (PackageName x) = x-#endif-#endif
src/Debian/Orphans.hs view
@@ -11,61 +11,38 @@ import Debian.Pretty (PP(PP, unPP)) import Debian.Relation (ArchitectureReq(..), Relation(..), VersionReq(..)) import Distribution.Compiler (CompilerId(..))-#if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (AbiTag(..))-#endif-#if !MIN_VERSION_Cabal(1,18,0)-import Distribution.Compiler (CompilerFlavor(..))-#endif import Distribution.License (License(..)) import Distribution.PackageDescription (Executable(..), PackageDescription(package)) import Distribution.Pretty (prettyShow) import Distribution.Simple.Compiler (Compiler(..))-import Distribution.Version (foldVersionRange', VersionRange(..))-#if MIN_VERSION_Cabal(2,0,0)+import Distribution.Version (cataVersionRange, normaliseVersionRange, VersionRange(..), VersionRangeF(..)) import Distribution.Version (Version)-#else-import Data.Version (showVersion, Version(..))-#endif import Language.Haskell.Extension (Language(..))-#if !MIN_VERSION_Cabal(1,21,0)-import Language.Haskell.Extension (Extension(..), KnownExtension(..))-#endif import Network.URI (URI) #if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr(..)) #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) #endif+import Text.PrettyPrint.HughesPJ (Doc) import Text.PrettyPrint.HughesPJClass (hcat, text) import Distribution.Pretty (Pretty(pretty))  deriving instance Typeable Compiler deriving instance Typeable CompilerId -#if MIN_VERSION_Cabal(1,22,0) deriving instance Typeable AbiTag deriving instance Data AbiTag-#if !MIN_VERSION_Cabal(1,24,0)-deriving instance Eq AbiTag-#endif deriving instance Ord AbiTag-#endif  deriving instance Data Compiler deriving instance Data CompilerId  deriving instance Ord Language-#if !MIN_VERSION_Cabal(1,24,0)-deriving instance Eq Compiler-#endif deriving instance Ord Compiler deriving instance Ord NameAddr deriving instance Ord License-#if !MIN_VERSION_Cabal(1,21,1)-deriving instance Ord KnownExtension-deriving instance Ord Extension-#endif  instance Ord Executable where     compare = compare `on` exeName@@ -91,15 +68,6 @@ deriving instance Ord ChangeLog deriving instance Ord ChangeLogEntry -#if !MIN_VERSION_Cabal(1,18,0)-deriving instance Data CompilerFlavor-deriving instance Data Language-deriving instance Data Version-deriving instance Typeable CompilerFlavor-deriving instance Typeable Extension-deriving instance Typeable Language-#endif- -- Convert from license to RPM-friendly description.  The strings are -- taken from TagsCheck.py in the rpmlint distribution. instance Pretty (PP License) where@@ -129,22 +97,20 @@     pretty = hcat . intersperse (text ", ") . map (pretty . PP) . unPP  instance Pretty (PP VersionRange) where-    pretty (PP range) =-        foldVersionRange'-          (text "*")-          (\ v -> text "=" <> pretty (PP v))-          (\ v -> text ">" <> pretty (PP v))-          (\ v -> text "<" <> pretty (PP v))-          (\ v -> text ">=" <> pretty (PP v))-          (\ v -> text "<=" <> pretty (PP v))-          (\ x _ -> text "=" <> pretty (PP x) <> text ".*") -- not exactly right-#if MIN_VERSION_Cabal(2,0,0)-          (\ v _ -> text " >= " <> pretty (PP v)) -- maybe this will do?-#endif-          (\ x y -> text "(" <> x <> text " || " <> y <> text ")")-          (\ x y -> text "(" <> x <> text " && " <> y <> text ")")-          (\ x -> text "(" <> x <> text ")")-          range+    pretty (PP range) = (cataVersionRange prettyRange . normaliseVersionRange) range++prettyRange :: VersionRangeF Text.PrettyPrint.HughesPJ.Doc -> Text.PrettyPrint.HughesPJ.Doc+prettyRange AnyVersionF                     = (text "*")+prettyRange (ThisVersionF v)                = text "=" <> pretty (PP v)+prettyRange (LaterVersionF v)               = text ">" <> pretty (PP v)+prettyRange (EarlierVersionF v)             = text "<" <> pretty (PP v)+prettyRange (OrLaterVersionF v)             = text ">=" <> pretty (PP v)+prettyRange (OrEarlierVersionF v)           = text "<=" <> pretty (PP v)+prettyRange (WildcardVersionF v)            = text "=" <> pretty (PP v) <> text ".*" -- not exactly right+prettyRange (MajorBoundVersionF v)          = text " >= " <> pretty (PP v) -- maybe this will do?+prettyRange (UnionVersionRangesF v1 v2)     = text "(" <> v1 <> text " || " <> v2 <> text ")"+prettyRange (IntersectVersionRangesF v1 v2) = text "(" <> v1 <> text " && " <> v2 <> text ")"+prettyRange (VersionRangeParensF v)         = text "(" <> v <> text ")"  instance Pretty (PP Version) where     pretty = text . prettyShow . unPP