cabal-debian 4.30.2 → 4.31
raw patch · 16 files changed
+293/−57 lines, 16 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Debian.Debianize.BasicInfo: _roundtrip :: Flags -> Bool
+ Debian.Debianize.BasicInfo: _upgrade :: Flags -> Bool
+ Debian.Debianize.BasicInfo: roundtrip :: Lens' Flags Bool
+ Debian.Debianize.BasicInfo: upgrade :: Lens' Flags Bool
+ Debian.Debianize.BinaryDebDescription: multiArch :: Lens' BinaryDebDescription (Maybe MultiArch)
+ Debian.Debianize.CopyrightDescription: _filesLicenseText :: FilesOrLicenseDescription -> Maybe Text
+ Debian.Debianize.CopyrightDescription: _licenseText :: FilesOrLicenseDescription -> Maybe Text
+ Debian.Debianize.CopyrightDescription: filesLicenseText :: Traversal' FilesOrLicenseDescription (Maybe Text)
+ Debian.Debianize.CopyrightDescription: licenseText :: Traversal' FilesOrLicenseDescription (Maybe Text)
+ Debian.Debianize.Optparse: _roundtrip :: Flags -> Bool
+ Debian.Debianize.Optparse: _upgrade :: Flags -> Bool
+ Debian.Policy: MAAllowed :: MultiArch
+ Debian.Policy: MAForeign :: MultiArch
+ Debian.Policy: MANo :: MultiArch
+ Debian.Policy: MASame :: MultiArch
+ Debian.Policy: data MultiArch
+ Debian.Policy: instance Data MultiArch
+ Debian.Policy: instance Eq MultiArch
+ Debian.Policy: instance Ord MultiArch
+ Debian.Policy: instance Pretty (PP MultiArch)
+ Debian.Policy: instance Read MultiArch
+ Debian.Policy: instance Show MultiArch
+ Debian.Policy: instance Typeable MultiArch
+ Debian.Policy: readMultiArch :: String -> MultiArch
- Debian.Debianize.BasicInfo: Flags :: Int -> Bool -> Bool -> CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags
+ Debian.Debianize.BasicInfo: Flags :: Int -> Bool -> Bool -> Bool -> Bool -> CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags
- Debian.Debianize.CopyrightDescription: CopyrightDescription :: URI -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe License -> Maybe Text -> [FilesOrLicenseDescription] -> CopyrightDescription
+ Debian.Debianize.CopyrightDescription: CopyrightDescription :: URI -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe (License, Maybe Text) -> Maybe Text -> [FilesOrLicenseDescription] -> CopyrightDescription
- Debian.Debianize.CopyrightDescription: FilesDescription :: FilePath -> Text -> License -> Maybe Text -> FilesOrLicenseDescription
+ Debian.Debianize.CopyrightDescription: FilesDescription :: FilePath -> Text -> License -> Maybe Text -> Maybe Text -> FilesOrLicenseDescription
- Debian.Debianize.CopyrightDescription: LicenseDescription :: License -> Maybe Text -> FilesOrLicenseDescription
+ Debian.Debianize.CopyrightDescription: LicenseDescription :: License -> Maybe Text -> Maybe Text -> FilesOrLicenseDescription
- Debian.Debianize.CopyrightDescription: _summaryLicense :: CopyrightDescription -> Maybe License
+ Debian.Debianize.CopyrightDescription: _summaryLicense :: CopyrightDescription -> Maybe (License, Maybe Text)
- Debian.Debianize.CopyrightDescription: summaryLicense :: Lens' CopyrightDescription (Maybe License)
+ Debian.Debianize.CopyrightDescription: summaryLicense :: Lens' CopyrightDescription (Maybe (License, Maybe Text))
- Debian.Debianize.Optparse: Flags :: Int -> Bool -> Bool -> CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags
+ Debian.Debianize.Optparse: Flags :: Int -> Bool -> Bool -> Bool -> Bool -> CompilerFlavor -> Set (FlagName, Bool) -> EnvSet -> Flags
Files
- cabal-debian.cabal +1/−1
- changelog +95/−0
- debian-haskell/Debian/Control/Text.hs +3/−2
- debian/changelog +6/−0
- src/Debian/Debianize.hs +1/−1
- src/Debian/Debianize/BasicInfo.hs +10/−0
- src/Debian/Debianize/BinaryDebDescription.hs +4/−1
- src/Debian/Debianize/BuildDependencies.hs +44/−21
- src/Debian/Debianize/CopyrightDescription.hs +45/−16
- src/Debian/Debianize/Details.hs +6/−4
- src/Debian/Debianize/Files.hs +2/−1
- src/Debian/Debianize/Finalize.hs +5/−2
- src/Debian/Debianize/InputDebian.hs +5/−3
- src/Debian/Debianize/Optparse.hs +19/−0
- src/Debian/Debianize/Output.hs +26/−3
- src/Debian/Policy.hs +21/−2
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name: cabal-debian-Version: 4.30.2+Version: 4.31 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw License: BSD3 License-File: LICENSE
changelog view
@@ -1,3 +1,98 @@+haskell-cabal-debian (4.30.2) unstable; urgency=low++ * have runDebianizeScript look for source in src/ as well as ./++ -- David Fox <dsf@seereason.com> Sat, 08 Aug 2015 08:04:02 -0700++haskell-cabal-debian (4.30.1) unstable; urgency=low++ * Make sure apache configuration files end with .conf++ -- David Fox <dsf@seereason.com> Mon, 29 Jun 2015 10:27:47 -0700++haskell-cabal-debian (4.30) unstable; urgency=low++ * Remove mechanism to pass arguments via the CABALDEBIAN environment+ variable.+ * Make compareDebianization a pure function.+ * Remove MonadIO superclass from some functions++ -- David Fox <dsf@seereason.com> Thu, 18 Jun 2015 09:12:59 -0700++haskell-cabal-debian (4.29.3) unstable; urgency=low++ * Fix escaping of wildcard characters that are not meaningful in cabal (i.e. square brackets)+ * Fix generation of argument list when running an external debian/Debianization.hs script+ (the whole thing was being repeated.)+ * Make sure the enable tests and run tests options are handled correctly (not sure they were+ wrong, but pretty sure they're now right.)+ * Export Dmitry's performDebianization function instead of debianize in Debian.Debianize.++ -- David Fox <dsf@seereason.com> Sat, 13 Jun 2015 05:24:03 -0700++haskell-cabal-debian (4.29) unstable; urgency=low++ * Restore the --epoch-map, --cabal-flag, --ghcjs, and --buildenvdir options+ * Export parseProgramArguments' for parsing internally constructed+ argument lists.++ -- David Fox <dsf@seereason.com> Mon, 08 Jun 2015 06:37:25 -0700++haskell-cabal-debian (4.28) unstable; urgency=low++ * New command line parsing code from Dmitry Bogatov+ * Drop support for old package old package formats+ * Bug fixes and typos, API simplification, more++ -- David Fox <dsf@seereason.com> Wed, 13 May 2015 06:49:04 -0700++haskell-cabal-debian (4.27.2) unstable; urgency=low++ * Change to the contents of the init.d file created for server packages.+ In Debian.Debianize.Goodies.serverAtoms, insert a line into the init.d+ script to set the datadir environment variable to /usr/share/cabalname+ before startup.++ -- David Fox <dsf@seereason.com> Wed, 22 Apr 2015 10:25:52 -0700++haskell-cabal-debian (4.27.1) unstable; urgency=low++ * Fix spurious "Just" in debian/copyright file.++ -- David Fox <dsf@seereason.com> Tue, 21 Apr 2015 07:01:35 -0700++haskell-cabal-debian (4.27) unstable; urgency=low++ * Remove all vestiges of the old data-lens package. Thanks to+ Dmitry Bogatov for help with this.++ -- David Fox <dsf@seereason.com> Fri, 17 Apr 2015 15:01:27 -0700++haskell-cabal-debian (4.26) unstable; urgency=low++ * Revamp the way the final debian version number is computed in+ Debian.Debianize.Finalize.debianVersion.++ -- David Fox <dsf@seereason.com> Sun, 05 Apr 2015 10:49:33 -0700++haskell-cabal-debian (4.25) unstable; urgency=low++ * Make sure /proc is mounted when we run ghc to determine its version+ number. This is only a concern when running in a build root.+ * Fix whitespace handling bugs in copyright file parser and renderer.++ -- David Fox <dsf@seereason.com> Sun, 05 Apr 2015 08:14:09 -0700++haskell-cabal-debian (4.24.9) unstable; urgency=low++ * Make debian/Debianize.hs a standard debianization script+ * Make the test executable into a cabal test suite+ * Make ghc-7.10 support official+ * Simplify main in CabalDebian.hs+ * Get rid of old --substvars option++ -- David Fox <dsf@seereason.com> Wed, 01 Apr 2015 10:00:45 -0700+ haskell-cabal-debian (4.24.8) unstable; urgency=low * use ghcjs --numeric-ghc-version to set the compilerInfoCompat field
debian-haskell/Debian/Control/Text.hs view
@@ -29,7 +29,7 @@ import qualified Data.ByteString.Char8 as B import Data.Char (toLower, chr) import Data.List (find)-import qualified Data.Text as T (Text, pack, unpack, map, strip, reverse)+import qualified Data.Text as T (Text, pack, unpack, map, dropAround, reverse) import Data.Text.Encoding (decodeUtf8With, encodeUtf8) --import Data.Text.IO as T (readFile) import qualified Debian.Control.ByteString as B@@ -92,7 +92,8 @@ where hasFieldName :: String -> Field' T.Text -> Bool hasFieldName name (Field (fieldName',_)) = T.pack name == T.map toLower fieldName' hasFieldName _ _ = False- stripWS = T.strip+ stripWS = T.dropAround (`elem` (" \t" :: String))+ -- T.strip would also strip newlines protectFieldText = protectFieldText' asString = T.unpack
debian/changelog view
@@ -1,3 +1,9 @@+haskell-cabal-debian (4.30.2) unstable; urgency=low++ * have runDebianizeScript look for source in src/ as well as ./++ -- David Fox <dsf@seereason.com> Sat, 08 Aug 2015 08:04:02 -0700+ haskell-cabal-debian (4.30.1) unstable; urgency=low * Make sure apache configuration files end with .conf
src/Debian/Debianize.hs view
@@ -112,4 +112,4 @@ import Debian.Debianize.Prelude (buildDebVersionMap, debOfFile, dpkgFileMap, withCurrentDirectory, (.?=)) import Debian.Debianize.SourceDebDescription import Debian.Debianize.VersionSplits (DebBase(DebBase))-import Debian.Policy (accessLogBaseName, apacheAccessLog, apacheErrorLog, apacheLogDirectory, appLogBaseName, Area(..), databaseDirectory, debianPackageVersion, errorLogBaseName, fromCabalLicense, getCurrentDebianUser, getDebhelperCompatLevel, getDebianStandardsVersion, haskellMaintainer, License(..), PackageArchitectures(..), PackagePriority(..), parseMaintainer, parsePackageArchitectures, parseStandardsVersion, parseUploaders, readLicense, readPriority, readSection, readSourceFormat, Section(..), serverAccessLog, serverAppLog, serverLogDirectory, SourceFormat(..), StandardsVersion(..), toCabalLicense)+import Debian.Policy (accessLogBaseName, apacheAccessLog, apacheErrorLog, apacheLogDirectory, appLogBaseName, Area(..), databaseDirectory, debianPackageVersion, errorLogBaseName, fromCabalLicense, getCurrentDebianUser, getDebhelperCompatLevel, getDebianStandardsVersion, haskellMaintainer, License(..), PackageArchitectures(..), PackagePriority(..), MultiArch(..), parseMaintainer, parsePackageArchitectures, parseStandardsVersion, parseUploaders, readLicense, readPriority, readSection, readMultiArch, readSourceFormat, Section(..), serverAccessLog, serverAppLog, serverLogDirectory, SourceFormat(..), StandardsVersion(..), toCabalLicense)
src/Debian/Debianize/BasicInfo.hs view
@@ -8,6 +8,8 @@ -- * Lenses , verbosity , dryRun+ , upgrade+ , roundtrip , validate , compilerFlavor , cabalFlagAssignments@@ -40,6 +42,10 @@ , _dryRun :: Bool -- ^ Don't write any files or create any directories, just explain -- what would have been done.+ , _upgrade :: Bool+ -- ^ Carefully upgrade the packaging+ , _roundtrip :: Bool+ -- ^ Normalize a debianization (field order, whitespace) by round-tripping it. , _validate :: Bool -- ^ Fail if the debianization already present doesn't match the -- one we are going to generate closely enough that it is safe to@@ -86,6 +92,10 @@ "Change the amount of progress messages generated", Option "n" ["dry-run", "compare"] (NoArg (dryRun .= True)) "Just compare the existing debianization to the one we would generate.",+ Option "" ["upgrade"] (NoArg (upgrade .= True))+ "Carefully upgrade an existing debianization",+ Option "" ["roundtrip"] (NoArg (roundtrip .= True))+ "Rountrip a debianization to normalize it", Option "" ["ghc"] (NoArg (compilerFlavor .= GHC)) "Generate packages for GHC - same as --with-compiler GHC", #if MIN_VERSION_Cabal(1,22,0) Option "" ["ghcjs"] (NoArg (compilerFlavor .= GHCJS)) "Generate packages for GHCJS - same as --with-compiler GHCJS",
src/Debian/Debianize/BinaryDebDescription.hs view
@@ -5,6 +5,7 @@ , BinaryDebDescription , newBinaryDebDescription , package+ , multiArch , description , packageType , architecture@@ -34,7 +35,7 @@ import Data.List (sort, sortBy) import Data.Monoid (Monoid(..)) import Data.Text (Text)-import Debian.Policy (PackageArchitectures, PackagePriority, Section)+import Debian.Policy (PackageArchitectures, PackagePriority, Section, MultiArch) import Debian.Relation (BinPkgName, Relations) import Prelude hiding ((.)) @@ -53,6 +54,7 @@ -- ^ <http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Architecture> , _binarySection :: Maybe Section , _binaryPriority :: Maybe PackagePriority+ , _multiArch :: Maybe MultiArch , _essential :: Maybe Bool -- ^ <http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Essential> , _description :: Maybe Text@@ -118,6 +120,7 @@ { _package = name , _packageType = Nothing , _architecture = Nothing+ , _multiArch = Nothing , _binarySection = Nothing , _binaryPriority = Nothing , _essential = Nothing
src/Debian/Debianize/BuildDependencies.hs view
@@ -33,8 +33,8 @@ import Distribution.Compiler (CompilerFlavor(..)) import Distribution.Package (Dependency(..), PackageName(PackageName)) import Distribution.PackageDescription (PackageDescription)-import Distribution.PackageDescription as Cabal (allBuildInfo, BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Executable(..), TestSuite(..))-import qualified Distribution.PackageDescription as Cabal (PackageDescription(buildDepends, executables, testSuites))+import Distribution.PackageDescription as Cabal (BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Library(..), Executable(..), TestSuite(..))+import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites)) import Distribution.Version (anyVersion, asVersionIntervals, earlierVersion, foldVersionRange', fromVersionIntervals, intersectVersionRanges, isNoVersion, laterVersion, orEarlierVersion, orLaterVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion) import Distribution.Version.Invert (invertVersionRange) import Prelude hiding (init, log, map, unlines, unlines, writeFile)@@ -72,17 +72,13 @@ -- |Debian packages don't have per binary package build dependencies, -- so we just gather them all up here.-allBuildDepends :: Monad m => PackageDescription -> CabalT m [Dependency_]-allBuildDepends pkgDesc =- use (A.debInfo . D.testsStatus) >>= \ testsStatus ->+allBuildDepends :: Monad m => [BuildInfo] -> CabalT m [Dependency_]+allBuildDepends buildInfos = allBuildDepends'- (mergeCabalDependencies $- Cabal.buildDepends pkgDesc ++- concatMap (Cabal.targetBuildDepends . Cabal.buildInfo) (Cabal.executables pkgDesc) ++- (if testsStatus /= D.TestsDisable then concatMap (Cabal.targetBuildDepends . Cabal.testBuildInfo) $ {-filter Cabal.testEnabled-} (Cabal.testSuites pkgDesc) else []))- (mergeCabalDependencies $ concatMap buildTools $ allBuildInfo pkgDesc)- (mergeCabalDependencies $ concatMap pkgconfigDepends $ allBuildInfo pkgDesc)- (concatMap extraLibs . allBuildInfo $ pkgDesc) >>=+ (mergeCabalDependencies $ concatMap Cabal.targetBuildDepends buildInfos)+ (mergeCabalDependencies $ concatMap buildTools buildInfos)+ (mergeCabalDependencies $ concatMap pkgconfigDepends buildInfos)+ (concatMap extraLibs buildInfos) >>= return {- . List.filter (not . selfDependency (Cabal.package pkgDesc)) -} where allBuildDepends' :: Monad m => [Dependency] -> [Dependency] -> [Dependency] -> [String] -> CabalT m [Dependency_]@@ -111,10 +107,28 @@ debianBuildDeps pkgDesc = do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial- let hcTypePairs =+ let hcTypePairsLibs = fold union empty $- Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypes hc') hcs- cDeps <- allBuildDepends pkgDesc >>= mapM (buildDependencies hcTypePairs) >>= return . {-nub .-} concat+ Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypesLibs hc') hcs+ let hcTypePairsBins =+ fold union empty $+ Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypesBins hc') hcs+ let hcTypePairsTests =+ fold union empty $+ Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypesTests hc') hcs++ libDeps <- allBuildDepends (maybe [] (return . libBuildInfo) (Cabal.library pkgDesc))+ binDeps <- allBuildDepends (List.map buildInfo (Cabal.executables pkgDesc))+ testDeps <- allBuildDepends (List.map testBuildInfo (Cabal.testSuites pkgDesc))++ testsStatus <- use (A.debInfo . D.testsStatus)++ cDeps <- nub . concat . concat <$> sequence+ [ mapM (buildDependencies hcTypePairsLibs) libDeps+ , mapM (buildDependencies hcTypePairsBins) binDeps+ , mapM (buildDependencies hcTypePairsTests) (if testsStatus /= D.TestsDisable then testDeps else [])+ ]+ bDeps <- use (A.debInfo . D.control . S.buildDepends) prof <- not <$> use (A.debInfo . D.noProfilingLibrary) official <- use (A.debInfo . D.official)@@ -132,22 +146,31 @@ cDeps filterMissing xs where- hcPackageTypes :: CompilerFlavor -> Set B.PackageType- hcPackageTypes GHC = fromList [B.Development, B.Profiling]+ hcPackageTypesLibs :: CompilerFlavor -> Set B.PackageType+ hcPackageTypesLibs GHC = fromList [B.Development, B.Profiling] #if MIN_VERSION_Cabal(1,22,0)- hcPackageTypes GHCJS = fromList [B.Development]+ hcPackageTypesLibs GHCJS = fromList [B.Development] #endif- hcPackageTypes hc = error $ "Unsupported compiler flavor: " ++ show hc+ hcPackageTypesLibs hc = error $ "Unsupported compiler flavor: " ++ show hc + -- No point in installing profiling packages for the dependencies+ -- of binaries and test suites+ hcPackageTypesBins :: CompilerFlavor -> Set B.PackageType+ hcPackageTypesBins _ = singleton B.Development + hcPackageTypesTests :: CompilerFlavor -> Set B.PackageType+ hcPackageTypesTests _ = singleton B.Development++ debianBuildDepsIndep :: (Monad m, Functor m) => PackageDescription -> CabalT m D.Relations debianBuildDepsIndep pkgDesc = do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial doc <- not <$> use (A.debInfo . D.noDocumentationLibrary) bDeps <- use (A.debInfo . D.control . S.buildDependsIndep)- cDeps <- allBuildDepends pkgDesc >>= mapM docDependencies- let xs = nub $ if doc+ libDeps <- allBuildDepends (maybe [] (return . libBuildInfo) (Cabal.library pkgDesc))+ cDeps <- mapM docDependencies libDeps+ let xs = nub $ if doc && isJust (Cabal.library pkgDesc) then (if member GHC hcs then [anyrel' (compilerPackageName GHC B.Documentation)] else []) ++ #if MIN_VERSION_Cabal(1,22,0) (if member GHCJS hcs then [anyrel "ghcjs"] else []) ++
src/Debian/Debianize/CopyrightDescription.hs view
@@ -16,8 +16,10 @@ , filesPattern , filesCopyright , filesLicense+ , filesLicenseText , filesComment , license+ , licenseText , comment -- * Builders , readCopyrightDescription@@ -67,7 +69,7 @@ , _upstreamSource :: Maybe Text , _disclaimer :: Maybe Text , _summaryComment :: Maybe Text- , _summaryLicense :: Maybe License+ , _summaryLicense :: Maybe (License, Maybe Text) , _summaryCopyright :: Maybe Text , _filesAndLicenses :: [FilesOrLicenseDescription] } deriving (Eq, Ord, Show, Data, Typeable)@@ -77,10 +79,12 @@ { _filesPattern :: FilePath , _filesCopyright :: Text , _filesLicense :: License+ , _filesLicenseText :: Maybe Text , _filesComment :: Maybe Text } | LicenseDescription { _license :: License+ , _licenseText :: Maybe Text , _comment :: Maybe Text } deriving (Eq, Ord, Show, Data, Typeable) @@ -124,29 +128,44 @@ , _upstreamSource = fieldValue "Source" hd , _disclaimer = fieldValue "Disclaimer" hd , _summaryComment = fieldValue "Comment" hd- , _summaryLicense = fmap readLicense (fieldValue "License" hd)+ , _summaryLicense = fmap readLicenseField (fieldValue "License" hd) , _summaryCopyright = Nothing -- fieldValue "Copyright" hd , _filesAndLicenses = rights fnls } (_, fnls) -> trace ("Not a parsable copyright file: " ++ show (lefts [muri] ++ lefts fnls)) Nothing parseCopyrightDescription [] = Nothing +readLicenseField :: Text -> (License, Maybe Text)+readLicenseField v+ | length lns > 1+ = (readLicense firstLine, Just otherLines)+ | otherwise+ = (readLicense v, Nothing)+ where+ lns = Text.lines v+ firstLine = head lns+ otherLines = Text.unlines (tail lns)+ parseFilesOrLicense :: Paragraph' Text -> Either (Paragraph' Text) (FilesOrLicenseDescription) parseFilesOrLicense p = case (fieldValue "Files" p, fieldValue "Copyright" p, fieldValue "License" p) of (Just files, Just copyright, Just license) ->- Right $ FilesDescription+ let (l,t) = readLicenseField license+ in Right $ FilesDescription { _filesPattern = unpack files , _filesCopyright = copyright- , _filesLicense = readLicense license+ , _filesLicense = l+ , _filesLicenseText = t , _filesComment = fieldValue "Comment" p } (Nothing, Nothing, Just license) ->- Right $ LicenseDescription- { _license = readLicense license+ let (l,t) = readLicenseField license+ in Right $ LicenseDescription+ { _license = l+ , _licenseText = t , _comment = fieldValue "Comment" p } _ -> Left p @@ -159,7 +178,7 @@ maybe [] (\x -> [Field ("Upstream-Contact", " " <> x)]) (_upstreamContact d) ++ maybe [] (\x -> [Field ("Source", " " <> x)]) (_upstreamSource d) ++ maybe [] (\x -> [Field ("Disclaimer", " " <> x)]) (_disclaimer d) ++- maybe [] (\x -> [Field ("License", " " <> prettyText x)]) (_summaryLicense d) +++ maybe [] (\(x,t) -> [toLicenseField x t]) (_summaryLicense d) ++ maybe [] (\x -> [Field ("Copyright", " " <> x)]) (_summaryCopyright d) ++ maybe [] (\x -> [Field ("Comment", " " <> x)]) (_summaryComment d)) : map toParagraph (_filesAndLicenses d) )@@ -169,20 +188,27 @@ Paragraph $ [ Field ("Files", " " <> pack (_filesPattern fd)) , Field ("Copyright", " " <> _filesCopyright fd)- , Field ("License", " " <> prettyText (_filesLicense fd)) ] +++ , toLicenseField (_filesLicense fd) (_filesLicenseText fd)+ ] ++ maybe [] (\ t -> [Field ("Comment", " " <> t)]) (_filesComment fd) toParagraph ld@LicenseDescription {} = Paragraph $- [ Field ("License", " " <> prettyText (_license ld)) ] +++ [ toLicenseField (_license ld) (_licenseText ld)+ ] ++ maybe [] (\ t -> [Field ("Comment", " " <> t)]) (_comment ld) +toLicenseField :: License -> Maybe Text -> Field' Text+toLicenseField l t =+ Field ("License", " " <> prettyText l <> maybe mempty (Text.pack "\n" <>) t) + sourceDefaultFilesDescription :: Maybe Text -> License -> FilesOrLicenseDescription sourceDefaultFilesDescription copyrt license = FilesDescription { _filesPattern = "*" , _filesCopyright = fromMaybe "(No copyright field in cabal file)" copyrt , _filesLicense = license+ , _filesLicenseText = mempty , _filesComment = mempty } @@ -194,19 +220,22 @@ _filesPattern = "debian/*" , _filesCopyright = "held by the contributors mentioned in debian/changelog" , _filesLicense = license+ , _filesLicenseText = mempty , _filesComment = mempty } -defaultLicenseDescriptions :: License -> [(FilePath, Maybe Text)]- -> [FilesOrLicenseDescription]+defaultLicenseDescriptions ::+ License -> [(FilePath, Maybe Text)] -> [FilesOrLicenseDescription] defaultLicenseDescriptions license = \case- [] -> []- [(_, comment)] -> [LicenseDescription license comment]- pairs -> map mkLicenseDescription pairs where- mkLicenseDescription (path, comment) =+ [] -> []+ [(_, txt)] -> [LicenseDescription license txt Nothing]+ pairs -> map mkLicenseDescription pairs+ where+ mkLicenseDescription (path, txt) = LicenseDescription { _license = fromCabalLicense (Cabal.UnknownLicense path)- , _comment = comment+ , _licenseText = txt+ , _comment = mempty } -- | Infer a 'CopyrightDescription' from a Cabal package description.
src/Debian/Debianize/Details.hs view
@@ -25,17 +25,19 @@ do -- These are the two epoch names I know about in the debian repo A.epochMap %= Map.insert (PackageName "HaXml") 1 A.epochMap %= Map.insert (PackageName "HTTP") 1- -- The hsx2hs build tool is in an an eponymous deb- (A.debInfo . D.execMap) %= Map.insert "hsx2hs" [[Rel (BinPkgName "hsx2hs") Nothing Nothing]]+ -- 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]])+ ["ghc", "happy", "alex", "hsx2hs"] -- The parsec debs are suffixed with either "2" or "3" mapCabal (PackageName "parsec") (DebBase "parsec3")- splitCabal (PackageName "parsec") (DebBase "parsec2") (Version [3] []) -- Similar split for quickcheck mapCabal (PackageName "QuickCheck") (DebBase "quickcheck2")- splitCabal (PackageName "QuickCheck") (DebBase "quickcheck1") (Version [2] []) -- Something was required for this package at one time - it -- looks like a no-op now mapCabal (PackageName "gtk2hs-buildtools") (DebBase "gtk2hs-buildtools") -- Upgrade transformers to 0.4 - no don't! -- remapCabal (PackageName "transformers") (DebBase "transformers4") -- remapCabal (PackageName "haskeline") (DebBase "haskeline0713")+ mapCabal (PackageName "haskell-src-exts") (DebBase "src-exts")+ mapCabal (PackageName "haskell-src-meta") (DebBase "src-meta")
src/Debian/Debianize/Files.hs view
@@ -23,7 +23,7 @@ import qualified Debian.Debianize.DebInfo as D (Atom(Install, InstallDir, Link), atomSet, changelog, compat, control, copyright, installInit, intermediateFiles, logrotateStanza, postInst, postRm, preInst, preRm, rulesFragments, rulesHead, rulesIncludes, rulesSettings, sourceFormat, watch) import Debian.Debianize.Monad (DebianT) import Debian.Debianize.Prelude (escapeDebianWildcards, showDeps')-import qualified Debian.Debianize.BinaryDebDescription as B (architecture, BinaryDebDescription, binaryPriority, binarySection, breaks, builtUsing, conflicts, depends, description, essential, package, PackageRelations, preDepends, provides, recommends, relations, replaces, suggests)+import qualified Debian.Debianize.BinaryDebDescription as B (architecture, BinaryDebDescription, binaryPriority, multiArch, binarySection, breaks, builtUsing, conflicts, depends, description, essential, package, PackageRelations, preDepends, provides, recommends, relations, replaces, suggests) import Debian.Debianize.CopyrightDescription (CopyrightDescription) import qualified Debian.Debianize.SourceDebDescription as S (binaryPackages, buildConflicts, buildConflictsIndep, buildDepends, buildDependsIndep, dmUploadAllowed, homepage, maintainer, priority, section, source, SourceDebDescription, standardsVersion, uploaders, vcsFields, VersionControlSpec(VCSArch, VCSBrowser, VCSBzr, VCSCvs, VCSDarcs, VCSGit, VCSHg, VCSMtn, VCSSvn), xDescription, XField(XField), XFieldDest(B, C, S), xFields) import Debian.Policy (maintainerOfLastResort)@@ -200,6 +200,7 @@ Paragraph ([Field ("Package", " " ++ (show . ppPrint . view B.package $ bin)), Field ("Architecture", " " ++ (show . maybe empty ppPrint . view B.architecture $ bin))] +++ mField "Multi-Arch" (view B.multiArch bin) ++ mField "Section" (view B.binarySection bin) ++ mField "Priority" (view B.binaryPriority bin) ++ mField "Essential" (view B.essential bin) ++
src/Debian/Debianize/Finalize.hs view
@@ -289,12 +289,15 @@ do finalizeMaintainer currentUser ver <- debianVersion src <- use (A.debInfo . D.sourcePackageName)+ debianUploaders <- use (A.debInfo . D.control . S.uploaders) debianMaintainer <- use (A.debInfo . D.control . S.maintainer)+ let nameToUse | (n:_) <- debianUploaders = Right n+ | otherwise = debianMaintainer -- pkgDesc <- use T.packageDescription >>= return . maybe Nothing (either Nothing Just . parseMaintainer . Cabal.maintainer) cmts <- use (A.debInfo . D.comments) (A.debInfo . D.changelog) %= fmap (dropFutureEntries ver)- let msg = "Initial release (Closes: #nnnn)"- (A.debInfo . D.changelog) %= fixLog src ver cmts debianMaintainer msg+ let msg = "Initial release"+ (A.debInfo . D.changelog) %= fixLog src ver cmts nameToUse msg where fixLog :: Maybe SrcPkgName -> V.DebianVersion -> Maybe [[Text]] -> Either String NameAddr -> Text -> Maybe ChangeLog -> Maybe ChangeLog -- Ensure that the package name is correct in the first log entry.
src/Debian/Debianize/InputDebian.hs view
@@ -28,12 +28,12 @@ import Debian.Debianize.Monad (CabalT, DebianT) import Debian.Debianize.CabalInfo (packageDescription) import Debian.Debianize.BinaryDebDescription (BinaryDebDescription, newBinaryDebDescription)-import qualified Debian.Debianize.BinaryDebDescription as B (architecture, binaryPriority, binarySection, breaks, builtUsing, conflicts, depends, description, essential, package, preDepends, provides, recommends, relations, replaces, suggests)+import qualified Debian.Debianize.BinaryDebDescription as B (architecture, binaryPriority, multiArch, binarySection, breaks, builtUsing, conflicts, depends, description, essential, package, preDepends, provides, recommends, relations, replaces, suggests) import Debian.Debianize.CopyrightDescription (readCopyrightDescription) import Debian.Debianize.Prelude (getDirectoryContents', read', readFileMaybe, (.?=))-import qualified Debian.Debianize.SourceDebDescription as S (binaryPackages, buildConflicts, buildConflictsIndep, buildDepends, buildDependsIndep, dmUploadAllowed, homepage, newSourceDebDescription', priority, section, SourceDebDescription, standardsVersion, uploaders, vcsFields, VersionControlSpec(VCSArch, VCSBrowser, VCSBzr, VCSCvs, VCSDarcs, VCSGit, VCSHg, VCSMtn, VCSSvn), XField(XField), xFields)+import qualified Debian.Debianize.SourceDebDescription as S (binaryPackages, buildConflicts, buildConflictsIndep, buildDepends, buildDependsIndep, dmUploadAllowed, homepage, newSourceDebDescription', priority, section, SourceDebDescription, standardsVersion, uploaders, xDescription, vcsFields, VersionControlSpec(VCSArch, VCSBrowser, VCSBzr, VCSCvs, VCSDarcs, VCSGit, VCSHg, VCSMtn, VCSSvn), XField(XField), xFields) import Debian.Orphans ()-import Debian.Policy (parseMaintainer, parsePackageArchitectures, parseStandardsVersion, parseUploaders, readPriority, readSection, readSourceFormat, Section(..))+import Debian.Policy (parseMaintainer, parsePackageArchitectures, parseStandardsVersion, parseUploaders, readPriority, readSection, readMultiArch, readSourceFormat, Section(..)) import Debian.Relation (BinPkgName(..), parseRelations, Relations, SrcPkgName(..)) import Debug.Trace (trace) import Distribution.Package (PackageIdentifier(..), PackageName(..))@@ -108,6 +108,7 @@ readField (Field ("Vcs-Hg", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSHg (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Mtn", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSMtn (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Svn", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSSvn (pack s)) vcsFields) desc, unrecognized)+ readField (Field ("X-Description", value)) (desc, unrecognized) = (set S.xDescription (Just (pack value)) desc, unrecognized) readField field@(Field ('X' : fld, value)) (desc, unrecognized) = case span (`elem` "BCS") fld of (xs, '-' : more) -> (over S.xFields (\ xFields -> Set.insert (S.XField (fromList (map (read' (\ s -> error $ "parseSourceDebDescription: " ++ show s) . (: [])) xs)) (pack more) (pack value)) xFields) desc, unrecognized)@@ -133,6 +134,7 @@ readField :: Field -> (BinaryDebDescription, [Field]) -> (BinaryDebDescription, [Field]) readField (Field ("Package", x)) (desc, unrecognized) = (set B.package (BinPkgName x) desc, unrecognized) readField (Field ("Architecture", x)) (desc, unrecognized) = (set B.architecture (Just (parsePackageArchitectures x)) desc, unrecognized)+ readField (Field ("Multi-Arch", x)) (desc, unrecognized) = (set B.multiArch (Just (readMultiArch x)) desc, unrecognized) readField (Field ("Section", x)) (desc, unrecognized) = (set B.binarySection (Just (readSection x)) desc, unrecognized) readField (Field ("Priority", x)) (desc, unrecognized) = (set B.binaryPriority (Just (readPriority x)) desc, unrecognized) readField (Field ("Essential", x)) (desc, unrecognized) = (set B.essential (Just (yes x)) desc, unrecognized)
src/Debian/Debianize/Optparse.hs view
@@ -513,6 +513,8 @@ flagsP :: O.Parser Flags flagsP = Flags <$> verbosityP <*> dryRunP+ <*> upgradeP+ <*> roundtripP <*> pure False -- validate <*> ghcjsP -- CompilerFlavor <*> (flagSet <$> cabalFlagsP) -- cabalFlagAssignments@@ -538,6 +540,23 @@ helpMsg = unlines [ "Just compare the existing debianization", "to the one we would generate."+ ]++upgradeP :: O.Parser Bool+upgradeP = O.switch m where+ m = O.help helpMsg+ <> O.long "upgrade"+ helpMsg = unlines [+ "Upgrade an existing debianization carefully",+ "preserving fields that are commonly hand-edited."+ ]++roundtripP :: O.Parser Bool+roundtripP = O.switch m where+ m = O.help helpMsg+ <> O.long "roundtrip"+ helpMsg = unlines [+ "Roundtrip a debianization to normalize it." ] ghcjsP :: O.Parser CompilerFlavor
src/Debian/Debianize/Output.hs view
@@ -2,7 +2,7 @@ -- tasks - output, describe, validate a debianization, run an external -- script to produce a debianization. {-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE FlexibleInstances, OverloadedStrings, ScopedTypeVariables, StandaloneDeriving, TupleSections, TypeSynonymInstances #-}+{-# LANGUAGE FlexibleInstances, OverloadedStrings, ScopedTypeVariables, StandaloneDeriving, TupleSections, TypeSynonymInstances, RankNTypes #-} {-# OPTIONS -Wall -fno-warn-name-shadowing -fno-warn-orphans #-} module Debian.Debianize.Output@@ -17,7 +17,7 @@ import Control.Exception as E (throw) import Control.Lens-import Control.Monad.State (get, StateT)+import Control.Monad.State (get, put, StateT) import Control.Monad.Trans (liftIO, MonadIO) import Data.Algorithm.DiffContext (getContextDiff, prettyContextDiff) import Data.Map as Map (elems, toList)@@ -25,7 +25,7 @@ import Data.Text as Text (split, Text, unpack) import Debian.Debianize.CabalInfo (newCabalInfo) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..))-import Debian.Debianize.BasicInfo (dryRun, validate)+import Debian.Debianize.BasicInfo (dryRun, validate, upgrade, roundtrip) import Debian.Debianize.CabalInfo (CabalInfo, debInfo) import qualified Debian.Debianize.DebInfo as D import Debian.Debianize.Files (debianizationFileMap)@@ -96,6 +96,15 @@ old <- get let diff = compareDebianization old new liftIO $ putStrLn ("Debianization (dry run):\n" ++ if null diff then " No changes\n" else show diff)+ _ | view (D.flags . upgrade) new ->+ do inputDebianization+ old <- get+ let merged = mergeDebianization old new+ put merged+ writeDebianization+ _ | view (D.flags . roundtrip) new ->+ do inputDebianization+ writeDebianization _ -> writeDebianization @@ -115,6 +124,20 @@ describeDebianization :: (MonadIO m, Functor m) => DebianT m String describeDebianization = debianizationFileMap >>= return . concatMap (\ (path, text) -> path ++ ": " ++ indent " > " (unpack text)) . Map.toList++-- | Do only the usual maintenance changes when upgrading to a new version+-- and avoid changing anything that is usually manually maintained.+mergeDebianization :: D.DebInfo -> D.DebInfo -> D.DebInfo+mergeDebianization old new =+ override (D.control . S.buildDepends) .+ override (D.control . S.buildDependsIndep) .+ override (D.control . S.homepage) .+ override (D.control . S.vcsFields) $+ old+ where+ override :: forall b. Lens' D.DebInfo b -> (D.DebInfo -> D.DebInfo)+ override lens = set lens (new ^. lens)+ -- | Compare the old and new debianizations, returning a string -- describing the differences.
src/Debian/Policy.hs view
@@ -29,6 +29,8 @@ , parsePackageArchitectures , Section(..) , readSection+ , MultiArch(..)+ , readMultiArch , Area(..) , parseUploaders , parseMaintainer@@ -216,6 +218,24 @@ pPrint (PP (MainSection sec)) = text sec pPrint (PP (AreaSection area sec)) = pPrint (PP area) <> text "/" <> text sec +data MultiArch = MANo | MASame | MAForeign | MAAllowed+ deriving (Read, Eq, Ord, Show, Data, Typeable)++readMultiArch :: String -> MultiArch+readMultiArch s =+ case unpack (strip (pack s)) of+ "no" -> MANo+ "same" -> MASame+ "foreign" -> MAForeign+ "allowed" -> MAAllowed+ x -> error $ "Invalid Multi-Arch string: " ++ show x++instance Pretty (PP MultiArch) where+ pPrint (PP MANo) = text "no"+ pPrint (PP MASame) = text "same"+ pPrint (PP MAForeign) = text "foreign"+ pPrint (PP MAAllowed) = text "allowed"+ -- Is this really all that is allowed here? Doesn't Ubuntu have different areas? data Area = Main@@ -333,8 +353,7 @@ | Zlib -- ^ zlib/libpng license. | Zope -- ^ Zope Public License 1.0, 1.1, 2.0, 2.1. | OtherLicense String- -- ^ A license name associated with the subsequent text of the License: field or in- -- a Files paragraph of the same debian/copyright file, or in a License: paragraph.+ -- ^ Any other license name deriving (Read, Show, Eq, Ord, Data, Typeable) -- We need a license parse function that converts these strings back