cabal-debian-5.0/0000755000000000000000000000000013530623213012024 5ustar0000000000000000cabal-debian-5.0/CabalDebian.hs0000644000000000000000000000026313530623213014466 0ustar0000000000000000import Debian.Debianize.Details (debianDefaults) import Debian.Debianize.Output (performDebianizationOfWebsite) main :: IO () main = performDebianizationOfWebsite debianDefaults cabal-debian-5.0/Setup.hs0000644000000000000000000000013713530623213013461 0ustar0000000000000000#!/usr/bin/runhaskell import Distribution.Simple main = defaultMainWithHooks simpleUserHooks cabal-debian-5.0/LICENSE0000644000000000000000000000310613530623213013031 0ustar0000000000000000The packageing was adjusted to Debian conventions by Joachim Breitner on Sat, 01 May 2010 21:16:18 +0200, and is licenced under the same terms as the package itself. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cabal-debian-5.0/Tests.hs0000644000000000000000000015075513530623213013477 0ustar0000000000000000{-# LANGUAGE CPP, OverloadedStrings, RankNTypes, ScopedTypeVariables, StandaloneDeriving #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Main where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) import Data.Monoid (mconcat, mempty) #endif import Debian.Debianize.Optparse(_flags, parseProgramArguments) import Control.Lens import Data.Algorithm.DiffContext (getContextDiff, prettyContextDiff) import Data.Bool (bool) import Data.Function (on) import Data.List (sortBy) import Data.Map as Map (differenceWithKey, insert, intersectionWithKey) import qualified Data.Map as Map (elems, Map, toList) import Data.Maybe (fromMaybe) import Data.Monoid ((<>)) import Data.Set as Set (fromList, union, insert) import Data.Text as Text (intercalate, split, Text, unlines, unpack) import Data.Version (Version(Version)) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..), parseEntry) import Debian.Debianize.BasicInfo (compilerFlavor, Flags, verbosity) import qualified Debian.Debianize.Bundled as Bundled (tests) import qualified Debian.Debianize.BinaryDebDescription as B import Debian.Debianize.CabalInfo as A (CabalInfo, debInfo, epochMap, newCabalInfo) import Debian.Debianize.CopyrightDescription import Debian.Debianize.DebianName (mapCabal, splitCabal) import qualified Debian.Debianize.DebInfo as D import Debian.Debianize.Details (debianDefaults) import Debian.Debianize.Files (debianizationFileMap) import Debian.Debianize.Finalize (debianize {-, finalizeDebianization-}) import Debian.Debianize.Goodies (doBackups, doExecutable, doServer, doWebsite, tightDependencyFixup) import Debian.Debianize.InputDebian (inputDebianization) import Debian.Debianize.Monad (CabalT, evalCabalT, execCabalM, execCabalT, liftCabal, execDebianT, DebianT, evalDebianT) import Debian.Debianize.Output (performDebianization) import Debian.Debianize.Prelude (withCurrentDirectory) import qualified Debian.Debianize.SourceDebDescription as S import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.GHC (hvrCompilerPATH, withModifiedPATH) import Debian.Pretty (ppShow) import Debian.Policy (databaseDirectory, PackageArchitectures(All), PackagePriority(Extra), parseMaintainer, Section(MainSection), SourceFormat(Native3), StandardsVersion(..) {-, getDebhelperCompatLevel, getDebianStandardsVersion, License(..)-}) import Debian.Relation (BinPkgName(..), Relation(..), SrcPkgName(..), VersionReq(..)) import Debian.Release (ReleaseName(ReleaseName, relName)) import Debian.Version (parseDebianVersion'{-, buildDebianVersion-}) import Distribution.Compiler (CompilerFlavor({-GHC,-} GHCJS)) import Distribution.Package (PackageName(PackageName)) import Prelude hiding (log) import System.Directory (doesDirectoryExist) import System.Exit (exitWith, ExitCode(..)) import System.FilePath (()) import System.Git (gitResetSubdir) import System.Process (readProcessWithExitCode) import Test.HUnit import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) import Text.PrettyPrint.HughesPJClass (pPrint, text, Doc) -- | Backward compatibility. Should be fixed. newFlags :: IO Flags newFlags = _flags <$> parseProgramArguments -- | A suitable defaultAtoms value for the debian repository. defaultAtoms :: Monad m => CabalT m () defaultAtoms = do A.epochMap %= Map.insert (PackageName "HaXml") 1 A.epochMap %= Map.insert (PackageName "HTTP") 1 mapCabal (PackageName "parsec") (DebBase "parsec3") splitCabal (PackageName "parsec") (DebBase "parsec2") (Version [3] []) mapCabal (PackageName "QuickCheck") (DebBase "quickcheck2") splitCabal (PackageName "QuickCheck") (DebBase "quickcheck1") (Version [2] []) mapCabal (PackageName "gtk2hs-buildtools") (DebBase "gtk2hs-buildtools") -- | Force the compiler version to 7.6 to get predictable outputs testAtoms :: IO CabalInfo testAtoms = ghc763 <$> (newFlags >>= newCabalInfo) where ghc763 :: Either String CabalInfo -> CabalInfo ghc763 (Left s) = error $ "testAtoms - failed to build CabalInfo: " ++ s ghc763 (Right atoms) = {-set (A.debInfo . D.flags . compilerFlavor) GHC-} atoms -- | Create a Debianization based on a changelog entry and a license -- value. Uses the currently installed versions of debhelper and -- debian-policy to set the compatibility levels. newDebianization :: Monad m => ChangeLog -> Maybe Int -> Maybe StandardsVersion -> CabalT m () newDebianization (ChangeLog (WhiteSpace {} : _)) _ _ = error "defaultDebianization: Invalid changelog entry" newDebianization (log@(ChangeLog (entry : _))) level standards = do (A.debInfo . D.changelog) .= Just log (A.debInfo . D.compat) .= level (A.debInfo . D.control . S.source) .= Just (SrcPkgName (logPackage entry)) (A.debInfo . D.control . S.maintainer) .= either error Right (parseMaintainer (logWho entry)) (A.debInfo . D.control . S.standardsVersion) .= standards newDebianization _ _ _ = error "Invalid changelog" newDebianization' :: Monad m => Maybe Int -> Maybe StandardsVersion -> CabalT m () newDebianization' level standards = do (A.debInfo . D.compat) .= level (A.debInfo . D.control . S.standardsVersion) .= standards tests :: Test tests = TestLabel "Debianization Tests" (TestList [Bundled.tests, -- 1 and 2 do not input a cabal package - we're not ready to -- debianize without a cabal package. {- test1 "test1", test2 "test2", -} -- test3 "test3", -- not a cabal package test4 "test4 - test-data/clckwrks-dot-com", test5 "test5 - test-data/creativeprompts", test6 "test6 - test-data/artvaluereport2", -- test7 "test7 - debian/Debianize.hs", test8 "test8 - test-data/artvaluereport-data", test9 "test9 - test-data/alex", test10 "test10 - test-data/archive" {-, -- This works, but it adds a dependency on ghcjs to the test suite -- test11 "test11 - test-data/diff", -- And this requires ghc-8.0.1 from the hvr compiler repo -- test12 "test12 - test-data/diff", issue23 "issue23" -}]) issue23 :: String -> Test issue23 label = TestLabel label $ TestCase (withCurrentDirectory "test-data/alex/input" $ do atoms <- testAtoms actual <- evalCabalT (do (A.debInfo . D.changelog) .= Just (ChangeLog [testEntry]) (A.debInfo . D.compat) .= Just 9 (A.debInfo . D.official) .= True Map.toList <$> liftCabal debianizationFileMap) atoms assertEqual label [] actual) #if 0 test1 :: String -> Test test1 label = TestLabel label $ TestCase (do level <- getDebhelperCompatLevel standards <- getDebianStandardsVersion :: IO (Maybe StandardsVersion) atoms <- testAtoms deb <- execCabalT (do -- let top = Top "." defaultAtoms newDebianization (ChangeLog [testEntry]) level standards (D.copyright . debInfo) %= (\ f -> (\ pkgDesc -> f pkgDesc >>= \ c -> return $ c { _summaryLicense = Just BSD_3_Clause })) -- inputCabalization top finalizeDebianization) atoms diff <- diffDebianizations (view debInfo (testDeb1 atoms)) (view debInfo deb) assertEqual label [] diff) where testDeb1 :: CabalInfo -> CabalInfo testDeb1 atoms = execCabalM (do defaultAtoms newDebianization log (Just 9) (Just (StandardsVersion 3 9 3 (Just 1))) (D.rulesHead . debInfo) %= (const (Just (Text.unlines $ [ "#!/usr/bin/make -f" , "" , "include /usr/share/cdbs/1/rules/debhelper.mk" , "include /usr/share/cdbs/1/class/hlibrary.mk" ]))) (D.compat . debInfo) .= Just 9 -- This will change as new version of debhelper are released (D.copyright . debInfo) %= (\ f -> (\ pkgDesc -> f pkgDesc >>= \ c -> return $ c { _summaryLicense = Just BSD_3_Clause })) (S.source . D.control . debInfo) .= Just (SrcPkgName {unSrcPkgName = "haskell-cabal-debian"}) (S.maintainer . D.control . debInfo) .= Just (NameAddr (Just "David Fox") "dsf@seereason.com") (S.standardsVersion . D.control . debInfo) .= Just (StandardsVersion 3 9 3 (Just 1)) -- This will change as new versions of debian-policy are released (S.buildDepends . D.control . debInfo) %= (++ [[Rel (BinPkgName "debhelper") (Just (GRE (parseDebianVersion ("9" :: String)))) Nothing], [Rel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.9" :: String)))) Nothing], [Rel (BinPkgName "cdbs") Nothing Nothing], [Rel (BinPkgName "ghc") Nothing Nothing], [Rel (BinPkgName "ghc-prof") Nothing Nothing]]) (S.buildDependsIndep . D.control . debInfo) %= (++ [[Rel (BinPkgName "ghc-doc") Nothing Nothing]])) atoms log = ChangeLog [Entry { logPackage = "haskell-cabal-debian" , logVersion = buildDebianVersion Nothing "2.6.2" Nothing , logDists = [ReleaseName {relName = "unstable"}] , logUrgency = "low" , logComments = " * Fix a bug constructing the destination pathnames that was dropping\n files that were supposed to be installed into packages.\n" , logWho = "David Fox " , logDate = "Thu, 20 Dec 2012 06:49:25 -0800" }] test2 :: String -> Test test2 label = TestLabel label $ TestCase (do level <- getDebhelperCompatLevel standards <- getDebianStandardsVersion atoms <- testAtoms deb <- execCabalT (do -- let top = Top "." defaultAtoms newDebianization (ChangeLog [testEntry]) level standards (D.copyright . debInfo) %= (\ f -> (\ pkgDesc -> f pkgDesc >>= \ c -> return $ c { _summaryLicense = Just BSD_3_Clause })) -- inputCabalization top finalizeDebianization) atoms diff <- diffDebianizations (view debInfo (expect atoms)) (view debInfo deb) assertEmptyDiff label diff) where expect atoms = execCabalM (do defaultAtoms newDebianization log (Just 9) (Just (StandardsVersion 3 9 3 (Just 1))) (D.rulesHead . debInfo) %= (const (Just (Text.unlines $ ["#!/usr/bin/make -f", "", "include /usr/share/cdbs/1/rules/debhelper.mk", "include /usr/share/cdbs/1/class/hlibrary.mk"]))) (D.compat . debInfo) .= Just 9 (D.copyright . debInfo) %= (\ f -> (\ pkgDesc -> f pkgDesc >>= \ c -> return $ c { _summaryLicense = Just BSD_3_Clause })) (S.source . D.control . debInfo) .= Just (SrcPkgName {unSrcPkgName = "haskell-cabal-debian"}) (S.maintainer . D.control . debInfo) .= Just (NameAddr {nameAddr_name = Just "David Fox", nameAddr_addr = "dsf@seereason.com"}) (S.standardsVersion . D.control . debInfo) .= Just (StandardsVersion 3 9 3 (Just 1)) (S.buildDepends . D.control . debInfo) %= (++ [[Rel (BinPkgName "debhelper") (Just (GRE (parseDebianVersion ("7.0" :: String)))) Nothing], [Rel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.8" :: String)))) Nothing], [Rel (BinPkgName "cdbs") Nothing Nothing], [Rel (BinPkgName "ghc") Nothing Nothing], [Rel (BinPkgName "ghc-prof") Nothing Nothing]]) (S.buildDependsIndep . D.control . debInfo) %= (++ [[Rel (BinPkgName "ghc-doc") Nothing Nothing]])) atoms log = ChangeLog [Entry {logPackage = "haskell-cabal-debian", logVersion = Debian.Version.parseDebianVersion ("2.6.2" :: String), logDists = [ReleaseName {relName = "unstable"}], logUrgency = "low", logComments = Prelude.unlines [" * Fix a bug constructing the destination pathnames that was dropping", " files that were supposed to be installed into packages."], logWho = "David Fox ", logDate = "Thu, 20 Dec 2012 06:49:25 -0800"}] #endif testEntry :: ChangeLogEntry testEntry = either (error "Error in test changelog entry") fst (parseEntry (Prelude.unlines [ "haskell-cabal-debian (2.6.2) unstable; urgency=low" , "" , " * Fix a bug constructing the destination pathnames that was dropping" , " files that were supposed to be installed into packages." , "" , " -- David Fox Thu, 20 Dec 2012 06:49:25 -0800" ])) test3 :: String -> Test test3 label = TestLabel label $ TestCase (let top = "test-data/haskell-devscripts" in withCurrentDirectory top $ do atoms <- testAtoms deb <- (execCabalT (liftCabal inputDebianization) atoms) diff <- diffDebianizations (view debInfo (testDeb2 atoms)) (view debInfo deb) assertEmptyDiff label diff) where testDeb2 :: CabalInfo -> CabalInfo testDeb2 atoms = execCabalM (do defaultAtoms newDebianization log (Just 7) (Just (StandardsVersion 3 9 4 Nothing)) (debInfo . D.sourceFormat) .= Native3 (debInfo . D.rulesHead) .= Just (Text.unlines ["#!/usr/bin/make -f", "# -*- makefile -*-", "", "# Uncomment this to turn on verbose mode.", "#export DH_VERBOSE=1", "", "DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')", "", "manpages = $(shell cat debian/manpages)", "", "%.1: %.pod", "\tpod2man -c 'Haskell devscripts documentation' -r 'Haskell devscripts $(DEB_VERSION)' $< > $@", "", "%.1: %", "\tpod2man -c 'Haskell devscripts documentation' -r 'Haskell devscripts $(DEB_VERSION)' $< > $@", "", ".PHONY: build", "build: $(manpages)", "", "install-stamp:", "\tdh install", "", ".PHONY: install", "install: install-stamp", "", "binary-indep-stamp: install-stamp", "\tdh binary-indep", "\ttouch $@", "", ".PHONY: binary-indep", "binary-indep: binary-indep-stamp", "", ".PHONY: binary-arch", "binary-arch: install-stamp", "", ".PHONY: binary", "binary: binary-indep-stamp", "", ".PHONY: clean", "clean:", "\tdh clean", "\trm -f $(manpages)", "", ""]) (debInfo . D.compat) .= Just 9 (debInfo . D.copyright) %= (Just . id . fromMaybe (readCopyrightDescription "This package was debianized by John Goerzen on\nWed, 6 Oct 2004 09:46:14 -0500.\n\nCopyright information removed from this test data.\n")) (debInfo . D.control . S.source) .= Just (SrcPkgName {unSrcPkgName = "haskell-devscripts"}) (debInfo . D.control . S.maintainer) .= Right (NameAddr {nameAddr_name = Just "Debian Haskell Group", nameAddr_addr = "pkg-haskell-maintainers@lists.alioth.debian.org"}) (debInfo . D.control . S.uploaders) .= [NameAddr {nameAddr_name = Just "Marco Silva", nameAddr_addr = "marcot@debian.org"},NameAddr {nameAddr_name = Just "Joachim Breitner", nameAddr_addr = "nomeata@debian.org"}] (debInfo . D.control . S.priority) .= Just Extra (debInfo . D.control . S.section) .= Just (MainSection "haskell") (debInfo . D.control . S.buildDepends) %= (++ [[Rel (BinPkgName {unBinPkgName = "debhelper"}) (Just (GRE (Debian.Version.parseDebianVersion' ("7" :: String)))) Nothing]]) (debInfo . D.control . S.buildDependsIndep) %= (++ [[Rel (BinPkgName {unBinPkgName = "perl"}) Nothing Nothing]]) (debInfo . D.control . S.standardsVersion) .= Just (StandardsVersion 3 9 4 Nothing) (debInfo . D.control . S.vcsFields) %= Set.union (Set.fromList [ S.VCSBrowser "http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts" , S.VCSDarcs "http://darcs.debian.org/pkg-haskell/haskell-devscripts"]) (debInfo . D.binaryDebDescription (BinPkgName "haskell-devscripts") . B.architecture) .= Just All (debInfo . D.binaryDebDescription (BinPkgName "haskell-devscripts") . B.description) .= Just (intercalate "\n" ["Tools to help Debian developers build Haskell packages", " This package provides a collection of scripts to help build Haskell", " packages for Debian. Unlike haskell-utils, this package is not", " expected to be installed on the machines of end users.", " .", " This package is designed to support Cabalized Haskell libraries. It", " is designed to build a library for each supported Debian compiler or", " interpreter, generate appropriate postinst/prerm files for each one,", " generate appropriate substvars entries for each one, and install the", " package in the Debian temporary area as part of the build process."]) (debInfo . D.binaryDebDescription (BinPkgName "haskell-devscripts") . B.relations . B.depends) .= [ [Rel (BinPkgName {unBinPkgName = "dctrl-tools"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "debhelper"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "dh-buildinfo"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "ghc"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.6" :: String)))) Nothing] , [Rel (BinPkgName {unBinPkgName = "cdbs"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "${misc:Depends}"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "html-xml-utils"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "hscolour"}) (Just (GRE (Debian.Version.parseDebianVersion'("1.8" :: String)))) Nothing] , [Rel (BinPkgName {unBinPkgName = "ghc-haddock"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.4" :: String)))) Nothing] ] {- control %= (\ y -> y { S.source = , S.maintainer = Just (NameAddr {nameAddr_name = Just "Debian Haskell Group", nameAddr_addr = "pkg-haskell-maintainers@lists.alioth.debian.org"}) , S.uploaders = [NameAddr {nameAddr_name = Just "Marco Silva", nameAddr_addr = "marcot@debian.org"},NameAddr {nameAddr_name = Just "Joachim Breitner", nameAddr_addr = "nomeata@debian.org"}] , S.priority = Just Extra , S.section = Just (MainSection "haskell") , S.buildDepends = (S.buildDepends y) ++ [[Rel (BinPkgName {unBinPkgName = "debhelper"}) (Just (GRE (Debian.Version.parseDebianVersion'("7" :: String)))) Nothing]] , S.buildDependsIndep = (S.buildDependsIndep y) ++ [[Rel (BinPkgName {unBinPkgName = "perl"}) Nothing Nothing]] , S.standardsVersion = Just (StandardsVersion 3 9 4 Nothing) , S.vcsFields = Set.union (S.vcsFields y) (Set.fromList [ S.VCSBrowser "http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts" , S.VCSDarcs "http://darcs.debian.org/pkg-haskell/haskell-devscripts"]) , S.binaryPackages = [S.BinaryDebDescription { B.package = BinPkgName {unBinPkgName = "haskell-devscripts"} , B.architecture = All , B.binarySection = Nothing , B.binaryPriority = Nothing , B.essential = False , B.description = Just $ (T.intercalate "\n" ["Tools to help Debian developers build Haskell packages", " This package provides a collection of scripts to help build Haskell", " packages for Debian. Unlike haskell-utils, this package is not", " expected to be installed on the machines of end users.", " .", " This package is designed to support Cabalized Haskell libraries. It", " is designed to build a library for each supported Debian compiler or", " interpreter, generate appropriate postinst/prerm files for each one,", " generate appropriate substvars entries for each one, and install the", " package in the Debian temporary area as part of the build process."]) , B.relations = B.PackageRelations { B.depends = [ [Rel (BinPkgName {unBinPkgName = "dctrl-tools"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "debhelper"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "dh-buildinfo"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "ghc"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.6" :: String)))) Nothing] , [Rel (BinPkgName {unBinPkgName = "cdbs"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "${misc:Depends}"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "html-xml-utils"}) Nothing Nothing] , [Rel (BinPkgName {unBinPkgName = "hscolour"}) (Just (GRE (Debian.Version.parseDebianVersion'("1.8" :: String)))) Nothing] , [Rel (BinPkgName {unBinPkgName = "ghc-haddock"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.4" :: String)))) Nothing] ] , B.recommends = [] , B.suggests = [] , B.preDepends = [] , B.breaks = [] , B.conflicts = [] , B.provides_ = [] , B.replaces_ = [] , B.builtUsing = [] }}]}) -} ) atoms log = ChangeLog [Entry { logPackage = "haskell-devscripts" , logVersion = Debian.Version.parseDebianVersion'("0.8.13" :: String) , logDists = [ReleaseName {relName = "experimental"}] , logUrgency = "low" , logComments = " [ Joachim Breitner ]\n * Improve parsing of \"Setup register\" output, patch by David Fox\n * Enable creation of hoogle files, thanks to Kiwamu Okabe for the\n suggestion. \n\n [ Kiwamu Okabe ]\n * Need --html option to fix bug that --hoogle option don't output html file.\n * Support to create /usr/lib/ghc-doc/hoogle/*.txt for hoogle package.\n\n [ Joachim Breitner ]\n * Symlink hoogle\8217s txt files to /usr/lib/ghc-doc/hoogle/\n * Bump ghc dependency to 7.6 \n * Bump standards version\n" , logWho = "Joachim Breitner " , logDate = "Mon, 08 Oct 2012 21:14:50 +0200" }, Entry { logPackage = "haskell-devscripts" , logVersion = Debian.Version.parseDebianVersion'("0.8.12" :: String) , logDists = [ReleaseName {relName = "unstable"}] , logUrgency = "low" , logComments = " * Depend on ghc >= 7.4, adjusting to its haddock --interface-version\n behaviour.\n" , logWho = "Joachim Breitner " , logDate = "Sat, 04 Feb 2012 10:50:33 +0100"}] test4 :: String -> Test test4 label = TestLabel label $ TestCase (do let outTop = "test-data/clckwrks-dot-com/output" let inTop = "test-data/clckwrks-dot-com/input" atoms <- withCurrentDirectory inTop $ testAtoms old <- withCurrentDirectory outTop $ do execCabalT (liftCabal inputDebianization) atoms let log = view (debInfo . D.changelog) old new <- withCurrentDirectory inTop $ do execCabalT (debianize (defaultAtoms >> customize log)) atoms diff <- diffDebianizations (view debInfo old) (view debInfo ({-copyFirstLogEntry old-} new)) assertEmptyDiff label diff) where customize :: Maybe ChangeLog -> CabalT IO () customize log = do (debInfo . D.flags . verbosity) .= 1 (debInfo . D.changelog) .= log liftCabal tight fixRules doBackups (BinPkgName "clckwrks-dot-com-backups") "clckwrks-dot-com-backups" doWebsite (BinPkgName "clckwrks-dot-com-production") (theSite (BinPkgName "clckwrks-dot-com-production")) (A.debInfo . D.revision) .= Nothing (A.debInfo . D.missingDependencies) %= Set.insert (BinPkgName "libghc-clckwrks-theme-clckwrks-doc") (A.debInfo . D.sourceFormat) .= Native3 (A.debInfo . D.control . S.homepage) .= Just "http://www.clckwrks.com/" newDebianization' (Just 9) (Just (StandardsVersion 3 9 6 Nothing)) {- customize log = modifyM (lift . customize' log) customize' :: Maybe ChangeLog -> CabalInfo -> IO CabalInfo customize' log atoms = execCabalT (newDebianization' (Just 7) (Just (StandardsVersion 3 9 4 Nothing))) . over T.control (\ y -> y {T.homepage = Just "http://www.clckwrks.com/"}) . set T.sourceFormat (Just Native3) . over T.missingDependencies (insert (BinPkgName "libghc-clckwrks-theme-clckwrks-doc")) . set T.revision Nothing . execCabalM (doWebsite (BinPkgName "clckwrks-dot-com-production") (theSite (BinPkgName "clckwrks-dot-com-production"))) . execCabalM (doBackups (BinPkgName "clckwrks-dot-com-backups") "clckwrks-dot-com-backups") . fixRules . execCabalM tight . set T.changelog log -} -- A log entry gets added when the Debianization is generated, -- it won't match so drop it for the comparison. serverNames = map BinPkgName ["clckwrks-dot-com-production"] -- , "clckwrks-dot-com-staging", "clckwrks-dot-com-development"] -- Insert a line just above the debhelper.mk include fixRules = (debInfo . D.rulesSettings) %= (++ ["DEB_SETUP_GHC_CONFIGURE_ARGS = -fbackups"]) {- mapAtoms f deb where f :: DebAtomKey -> DebAtom -> Set (DebAtomKey, DebAtom) f Source (DebRulesHead t) = singleton (Source, DebRulesHead (T.unlines $ concat $ map (\ line -> if line == "include /usr/share/cdbs/1/rules/debhelper.mk" then ["DEB_SETUP_GHC_CONFIGURE_ARGS = -fbackups", "", line] :: [T.Text] else [line] :: [T.Text]) (T.lines t))) f k a = singleton (k, a) -} tight = mapM_ (tightDependencyFixup [(BinPkgName "libghc-clckwrks-theme-clckwrks-dev", BinPkgName "haskell-clckwrks-theme-clckwrks-utils"), (BinPkgName "libghc-clckwrks-plugin-media-dev", BinPkgName "haskell-clckwrks-plugin-media-utils"), (BinPkgName "libghc-clckwrks-plugin-bugs-dev", BinPkgName "haskell-clckwrks-plugin-bugs-utils"), (BinPkgName "libghc-clckwrks-dev", BinPkgName "haskell-clckwrks-utils")]) serverNames theSite :: BinPkgName -> D.Site theSite deb = D.Site { D.domain = hostname' , D.serverAdmin = "logic@seereason.com" , D.server = theServer deb } theServer :: BinPkgName -> D.Server theServer deb = D.Server { D.hostname = case deb of BinPkgName "clckwrks-dot-com-production" -> hostname' _ -> hostname' , D.port = portNum deb , D.headerMessage = "Generated by clckwrks-dot-com/Setup.hs" , D.retry = "60" , D.serverFlags = [ "--http-port", show (portNum deb) , "--hide-port" , "--hostname", hostname' , "--top", databaseDirectory deb , "--enable-analytics" , "--jquery-path", "/usr/share/javascript/jquery/" , "--jqueryui-path", "/usr/share/javascript/jquery-ui/" , "--jstree-path", jstreePath , "--json2-path",json2Path ] , D.installFile = D.InstallFile { D.execName = "clckwrks-dot-com-server" , D.destName = ppShow deb , D.sourceDir = Nothing , D.destDir = Nothing } } hostname' = "clckwrks.com" portNum :: BinPkgName -> Int portNum (BinPkgName deb) = case deb of "clckwrks-dot-com-production" -> 9029 "clckwrks-dot-com-staging" -> 9038 "clckwrks-dot-com-development" -> 9039 _ -> error $ "Unexpected package name: " ++ deb jstreePath = "/usr/share/clckwrks-0.13.2/jstree" json2Path = "/usr/share/clckwrks-0.13.2/json2" anyrel :: BinPkgName -> Relation anyrel b = Rel b Nothing Nothing test5 :: String -> Test test5 label = TestLabel label $ TestCase (do let inTop = "test-data/creativeprompts/input" outTop = "test-data/creativeprompts/output" atoms <- withCurrentDirectory inTop testAtoms old <- withCurrentDirectory outTop $ newFlags >>= execDebianT inputDebianization . D.makeDebInfo let standards = view (D.control . S.standardsVersion) old level = view D.compat old new <- withCurrentDirectory inTop (execCabalT (debianize (defaultAtoms >> customize old level standards)) atoms) diff <- diffDebianizations old (view debInfo new) assertEmptyDiff label diff) where customize old level standards = do (debInfo . D.flags . verbosity) .= 1 (A.debInfo . D.utilsPackageNameBase) .= Just "creativeprompts-data" newDebianization' level standards (debInfo . D.changelog) .= (view D.changelog old) doWebsite (BinPkgName "creativeprompts-production") (theSite (BinPkgName "creativeprompts-production")) doServer (BinPkgName "creativeprompts-development") (theServer (BinPkgName "creativeprompts-development")) doBackups (BinPkgName "creativeprompts-backups") "creativeprompts-backups" (A.debInfo . D.execMap) %= Map.insert "trhsx" [[Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing]] mapM_ (\ b -> (debInfo . D.binaryDebDescription b . B.relations . B.depends) %= \ deps -> deps ++ [[anyrel (BinPkgName "markdown")]]) [(BinPkgName "creativeprompts-production"), (BinPkgName "creativeprompts-development")] (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-development") . B.description) .= Just (intercalate "\n" [ "Configuration for running the creativeprompts.com server" , " Testing version of the blog server, runs on port" , " 8000 with HTML validation turned on." ]) (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-data") . B.description) .= Just (intercalate "\n" [ "creativeprompts.com data files" , " Static data files for creativeprompts.com"]) (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-production") . B.description) .= Just (intercalate "\n" [ "Configuration for running the creativeprompts.com server" , " Production version of the blog server, runs on port" , " 9021 with HTML validation turned off." ]) (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-backups") . B.description) .= Just (intercalate "\n" [ "backup program for creativeprompts.com" , " Install this somewhere other than creativeprompts.com to run automated" , " backups of the database."]) (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-production") . B.architecture) .= Just All (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-data") . B.architecture) .= Just All (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-development") . B.architecture) .= Just All (debInfo . D.sourceFormat) .= Native3 theSite :: BinPkgName -> D.Site theSite deb = D.Site { D.domain = hostname' , D.serverAdmin = "logic@seereason.com" , D.server = theServer deb } theServer :: BinPkgName -> D.Server theServer deb = D.Server { D.hostname = case deb of BinPkgName "clckwrks-dot-com-production" -> hostname' _ -> hostname' , D.port = portNum deb , D.headerMessage = "Generated by creativeprompts-dot-com/debian/Debianize.hs" , D.retry = "60" , D.serverFlags = [ "--http-port", show (portNum deb) , "--hide-port" , "--hostname", hostname' , "--top", databaseDirectory deb , "--enable-analytics" , "--jquery-path", "/usr/share/javascript/jquery/" , "--jqueryui-path", "/usr/share/javascript/jquery-ui/" , "--jstree-path", jstreePath , "--json2-path",json2Path ] , D.installFile = D.InstallFile { D.execName = "creativeprompts-server" , D.destName = ppShow deb , D.sourceDir = Nothing , D.destDir = Nothing } } hostname' = "creativeprompts.com" portNum :: BinPkgName -> Int portNum (BinPkgName deb) = case deb of "creativeprompts-production" -> 9022 "creativeprompts-staging" -> 9033 "creativeprompts-development" -> 9034 _ -> error $ "Unexpected package name: " ++ deb jstreePath = "/usr/share/clckwrks-0.13.2/jstree" json2Path = "/usr/share/clckwrks-0.13.2/json2" -- | Obviously this is a hack, but the builddir is set to "dist-ghc" -- by haskell-devscripts, while by default cabal sets it to "dist". findBuildDir :: IO FilePath findBuildDir = doesDirectoryExist "dist-ghc" >>= return . bool "dist" "dist-ghc" test6 :: String -> Test test6 label = TestLabel label $ TestCase (do dist <- findBuildDir (code, out, err) <- readProcessWithExitCode "runhaskell" ["--ghc-arg=-package-db=" ++ dist ++ "/package.conf.inplace", "test-data/artvaluereport2/input/debian/Debianize.hs", "--dry-run", "--verbose"] "" assertEqual label (ExitSuccess, "", err) (code, out, err)) test7 :: String -> Test test7 label = TestLabel label $ TestCase (do dist <- findBuildDir (code, out, _err) <- readProcessWithExitCode "runhaskell" ["--ghc-arg=-package-db=" ++ dist ++ "/package.conf.inplace", "debian/Debianize.hs", "--dry-run", "--native", "--verbose"] "" assertEqual label (ExitSuccess, "Ignored debianization file: debian/cabal-debian.1\nIgnored debianization file: debian/cabal-debian.manpages\nDebianization (dry run):\n No changes\n\n") (code, out) {- assertBool label (elem new [(ExitSuccess, "Ignored debianization file: debian/cabal-debian.1\nIgnored debianization file: debian/cabal-debian.manpages\nDebianization (dry run):\n No changes\n\n", ""), (ExitSuccess, "Ignored debianization file: debian/cabal-debian.manpages\nIgnored debianization file: debian/cabal-debian.1\nDebianization (dry run):\n No changes\n\n", "")]) -}) test8 :: String -> Test test8 label = TestLabel label $ TestCase ( do let inTop = "test-data/artvaluereport-data/input" outTop = "test-data/artvaluereport-data/output" (old :: D.DebInfo) <- withCurrentDirectory outTop $ newFlags >>= execDebianT inputDebianization . D.makeDebInfo let log = view D.changelog old new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= either (error "test8 - newCabalInfo failed") (execCabalT (debianize (defaultAtoms >> customize log))) diff <- diffDebianizations old (view debInfo new) assertEmptyDiff label diff ) where customize Nothing = error "Missing changelog" customize (Just log) = do (debInfo . D.flags . verbosity) .= 1 (debInfo . D.control . S.buildDepends) %= (++ [[Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing]]) (debInfo . D.control . S.homepage) .= Just "http://artvaluereportonline.com" (debInfo . D.sourceFormat) .= Native3 (debInfo . D.changelog) .= Just log newDebianization' (Just 9) (Just (StandardsVersion 3 9 6 Nothing)) test9 :: String -> Test test9 label = TestLabel label $ TestCase (do let inTop = "test-data/alex/input" outTop = "test-data/alex/output" new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= either (error "test9 - newCabalInfo failed") (execCabalT (debianize (defaultAtoms >> customize))) let Just (ChangeLog (entry : _)) = view (debInfo . D.changelog) new old <- withCurrentDirectory outTop $ newFlags >>= execDebianT (inputDebianization >> copyChangelogDate (logDate entry)) . D.makeDebInfo diff <- diffDebianizations old (view debInfo new) assertEmptyDiff label diff) where customize = do newDebianization' (Just 9) (Just (StandardsVersion 3 9 6 Nothing)) mapM_ (\ name -> (debInfo . D.atomSet) %= (Set.insert $ D.InstallData (BinPkgName "alex") name name)) [ "AlexTemplate" , "AlexTemplate-debug" , "AlexTemplate-ghc" , "AlexTemplate-ghc-debug" , "AlexWrapper-basic" , "AlexWrapper-basic-bytestring" , "AlexWrapper-gscan" , "AlexWrapper-monad" , "AlexWrapper-monad-bytestring" , "AlexWrapper-monadUserState" , "AlexWrapper-monadUserState-bytestring" , "AlexWrapper-posn" , "AlexWrapper-posn-bytestring" , "AlexWrapper-strict-bytestring"] (debInfo . D.flags . verbosity) .= 1 (debInfo . D.control . S.homepage) .= Just "http://www.haskell.org/alex/" (debInfo . D.sourceFormat) .= Native3 (debInfo . D.debVersion) .= Just (parseDebianVersion'("3.0.2-1~hackage1" :: String)) doExecutable (BinPkgName "alex") (D.InstallFile {D.execName = "alex", D.destName = "alex", D.sourceDir = Nothing, D.destDir = Nothing}) -- Bootstrap self-dependency (debInfo . D.allowDebianSelfBuildDeps) .= True (debInfo . D.control . S.buildDepends) %= (++ [[Rel (BinPkgName "alex") Nothing Nothing]]) test10 :: String -> Test test10 label = TestLabel label $ TestCase (do let inTop = "test-data/archive/input" outTop = "test-data/archive/output" old <- withCurrentDirectory outTop $ newFlags >>= execDebianT inputDebianization . D.makeDebInfo let Just (ChangeLog (entry : _)) = view D.changelog old new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= either (error "test10 - newCabalInfo failed") (execCabalT (debianize (defaultAtoms >> customize >> (liftCabal $ copyChangelogDate $ logDate entry)))) diff <- diffDebianizations old (view debInfo new) assertEmptyDiff label diff) where customize :: CabalT IO () customize = do (A.debInfo . D.flags . verbosity) .= 1 (A.debInfo . D.sourceFormat) .= Native3 (A.debInfo . D.sourcePackageName) .= Just (SrcPkgName "seereason-darcs-backups") (A.debInfo . D.compat) .= Just 9 (A.debInfo . D.control . S.standardsVersion) .= Just (StandardsVersion 3 8 1 Nothing) (A.debInfo . D.control . S.maintainer) .= parseMaintainer "David Fox " (A.debInfo . D.binaryDebDescription (BinPkgName "seereason-darcs-backups") . B.relations . B.depends) %= (++ [[Rel (BinPkgName "anacron") Nothing Nothing]]) (A.debInfo . D.control . S.section) .= Just (MainSection "haskell") (A.debInfo . D.utilsPackageNameBase) .= Just "seereason-darcs-backups" (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallCabalExec (BinPkgName "seereason-darcs-backups") "seereason-darcs-backups" "/etc/cron.hourly") copyChangelogDate :: Monad m => String -> DebianT m () copyChangelogDate date = D.changelog %= (\ (Just (ChangeLog (entry : older))) -> Just (ChangeLog (entry {logDate = date} : older))) data Change k a = Created k a | Deleted k a | Modified k a a | Unchanged k a deriving (Eq, Show) diffMaps :: (Ord k, Eq a, Show k, Show a) => Map.Map k a -> Map.Map k a -> [Change k a] diffMaps old new = Map.elems (intersectionWithKey combine1 old new) ++ map (uncurry Deleted) (Map.toList (differenceWithKey combine2 old new)) ++ map (uncurry Created) (Map.toList (differenceWithKey combine2 new old)) where combine1 k a b = if a == b then Unchanged k a else Modified k a b combine2 _ _ _ = Nothing diffDebianizations :: D.DebInfo -> D.DebInfo -> IO String -- [Change FilePath T.Text] diffDebianizations old new = do old' <- evalDebianT (sortBinaryDebs >> debianizationFileMap) old new' <- evalDebianT (sortBinaryDebs >> debianizationFileMap) new return $ show $ mconcat $ map prettyChange $ filter (not . isUnchanged) $ diffMaps old' new' where isUnchanged (Unchanged _ _) = True isUnchanged _ = False prettyChange :: Change FilePath Text -> Doc prettyChange (Unchanged p _) = text "Unchanged: " <> pPrint p <> text "\n" prettyChange (Deleted p _) = text "Deleted: " <> pPrint p <> text "\n" prettyChange (Created p b) = text "Created: " <> pPrint p <> text "\n" <> prettyContextDiff (text ("old" p)) (text ("new" p)) (text . unpack) -- We use split here instead of lines so we can -- detect whether the file has a final newline -- character. (getContextDiff 2 mempty (split (== '\n') b)) prettyChange (Modified p a b) = text "Modified: " <> pPrint p <> text "\n" <> prettyContextDiff (text ("old" p)) (text ("new" p)) (text . unpack) (getContextDiff 2 (split (== '\n') a) (split (== '\n') b)) sortBinaryDebs :: DebianT IO () sortBinaryDebs = (D.control . S.binaryPackages) %= sortBy (compare `on` view B.package) test11 :: String -> Test test11 label = TestLabel label $ TestCase $ do let input = "test-data/diff/input" expected = "test-data/diff/expected.ghcjs" gitResetSubdir input withCurrentDirectory input (performDebianization (do debianDefaults (debInfo . D.flags . compilerFlavor) .= GHCJS (debInfo . D.testsStatus) .= D.TestsDisable (debInfo . D.sourceFormat) .= Native3)) assertEmptyDiff expected input test12 :: String -> Test test12 label = TestLabel label $ TestCase $ withModifiedPATH (hvrCompilerPATH (Version [8,0,1] [])) $ do let input = "test-data/diff/input" expected = "test-data/diff/expected.hvr" gitResetSubdir input withCurrentDirectory input (performDebianization (do debianDefaults (debInfo . D.testsStatus) .= D.TestsDisable (debInfo . D.sourceFormat) .= Native3)) assertEmptyDiff expected input main :: IO () main = do cts <- withModifiedPATH (const "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games") (runTestTT tests) exitWith $ if errors cts + failures cts > 0 then ExitFailure 1 else ExitSuccess -- Cusstom HUnit assertion, which prints the diffs without using 'show' assertEmptyDiff :: String -- ^ The message prefix -> String -- ^ The actual diff -> Assertion assertEmptyDiff _preface "" = return () assertEmptyDiff preface diff = assertFailure $ (if null preface then "" else preface ++ "\n") ++ "diff not empty:\n" ++ diff cabal-debian-5.0/changelog0000644000000000000000000014431013530623213013701 0ustar0000000000000000haskell-cabal-debian (4.38.6) unstable; urgency=medium * Changes due to changes in debian 3.95 -- David Fox Fri, 15 Feb 2019 15:22:09 -0800 haskell-cabal-debian (4.38.5) unstable; urgency=medium * Use Cabal's pretty printer, there is a corresponding change to the debian package. -- David Fox Tue, 12 Feb 2019 16:50:15 -0800 haskell-cabal-debian (4.38.2) unstable; urgency=medium * Support for Cabal-2.2 -- David Fox Tue, 03 Jul 2018 07:48:47 -0700 haskell-cabal-debian (4.38) unstable; urgency=medium * It turns out we now need to install the profiling libraries for executable and test suite build dependencies. -- David Fox Sat, 28 Apr 2018 09:14:20 -0700 haskell-cabal-debian (4.37) unstable; urgency=medium * Decouple the website building code from the rest. -- David Fox Fri, 27 Apr 2018 14:28:42 -0700 haskell-cabal-debian (4.36.1) unstable; urgency=medium * Disable some debug output. -- David Fox Wed, 22 Nov 2017 03:42:18 -0800 haskell-cabal-debian (4.36) unstable; urgency=medium * Support for Cabal-2 -- David Fox Fri, 13 Oct 2017 00:11:19 -0700 haskell-cabal-debian (4.35.7) unstable; urgency=low * Remove logrotate from standard server package site config. -- David Fox Sun, 11 Dec 2016 12:26:58 -0800 haskell-cabal-debian (4.35.6) unstable; urgency=low * Restore ghc-7.6.3 support -- David Fox Wed, 30 Nov 2016 05:57:29 -0800 haskell-cabal-debian (4.35.5) unstable; urgency=low * Fix up some ghcjs and hvr packaging issues. -- David Fox Sun, 27 Nov 2016 09:19:02 -0800 haskell-cabal-debian (4.35.4) unstable; urgency=low * Get rid of CompilerChoice and CompilerVendor types, just look for the ghc executable via the $PATH and use that info. -- David Fox Sat, 26 Nov 2016 11:39:48 -0800 haskell-cabal-debian (4.35.3) unstable; urgency=low * Prefer dependency on haskell-devscript-minimal over haskell-devscript * Do not assume deb containing ghc executable is named ghc, nor ghcjs. -- David Fox Sat, 26 Nov 2016 04:29:21 -0800 haskell-cabal-debian (4.35) unstable; urgency=low * Add support for the packages in hvr's compiler repository. * Revive the test suite -- David Fox Sat, 19 Nov 2016 07:35:29 -0800 haskell-cabal-debian (4.34.1) unstable; urgency=low * That was a a terrible idea. -- David Fox Sat, 12 Nov 2016 05:33:58 -0800 haskell-cabal-debian (4.34) unstable; urgency=low * Make sure the appropriate compiler package is installed before asking it what its version number is. -- David Fox Fri, 11 Nov 2016 16:35:17 -0800 haskell-cabal-debian (4.33) unstable; urgency=low * Remove code that tried to copy the changelog from debian/changelog to ./changelog, and delete other obsolete code from Setup.hs. -- David Fox Thu, 06 Oct 2016 12:11:36 -0700 haskell-cabal-debian (4.32.7) unstable; urgency=low * Look for changelog in several places rather than just debian/changelog: ./changelog, ./ChangeLog, ./CHANGELOG. These are the places where hackage looks, so cabal-debian should add its entry and deposit the new changelog in debian/changelog. -- David Fox Thu, 06 Oct 2016 10:07:17 -0700 haskell-cabal-debian (4.32.4) unstable; urgency=low * Merge pull request #55 from neongreen/master * Bump standards version to 3.9.8 (Dmitry Bogatov) * Use secure (https) URI in Vcs-Git field in debian/control (Dmitry Bogatov) * Fix misleading error message (Dmitry Bogatov) -- David Fox Wed, 18 May 2016 11:46:45 -0700 haskell-cabal-debian (4.32.2) unstable; urgency=low * Ifdef a use of GHCJS * Add (failing) tests for ghc-8.0.1 -- David Fox Mon, 18 Jan 2016 06:21:08 -0800 haskell-cabal-debian (4.32) unstable; urgency=low * Compute bundled dependencies by looking for library .conf files included in the debian package, rather than by looking at the deb's "Provides" attribute. Some ghc debs (e.g. hvr's ppa) do not generate a "Provides" lines that describes bundled libraries. -- David Fox Mon, 18 Jan 2016 05:49:55 -0800 haskell-cabal-debian (4.31.9) unstable; urgency=low * Fix official haskell packages repository URI * Update expected test results -- David Fox Mon, 21 Dec 2015 09:14:14 -0800 haskell-cabal-debian (4.31.8) unstable; urgency=low * Handle some idempotent cases in mapCabal and splitCabal * Add version split for happstack-authenticate package -- David Fox Thu, 08 Oct 2015 11:42:13 -0400 haskell-cabal-debian (4.31.7) unstable; urgency=low * Allow optparse-applicative-0.12. -- David Fox Fri, 25 Sep 2015 11:18:00 -0700 haskell-cabal-debian (4.31.6) unstable; urgency=low * Signature change in Debian.Version.parseDebianVersion -- David Fox Tue, 22 Sep 2015 06:56:28 -0700 haskell-cabal-debian (4.31.5) unstable; urgency=low * If there is no Setup.hs or Setup.lhs file we cannot build debian/hlibrary.setup, therefore we should set DEB_SETUP_BIN_NAME to "cabal". -- David Fox Thu, 17 Sep 2015 08:21:46 -0700 haskell-cabal-debian (4.31.4) unstable; urgency=low * The test suite was failing during the debian package build because it assumes the buildDir is in dist/, look for it in dist-ghc/ first. -- David Fox Sat, 22 Aug 2015 07:56:04 -0700 haskell-cabal-debian (4.31.3) unstable; urgency=low * Fix error message formatting (Joachim Breitner) * Fix test suite result code (Joachim Breitner) -- David Fox Fri, 21 Aug 2015 17:29:57 -0700 haskell-cabal-debian (4.31.2) unstable; urgency=low * Fix some names in Extra-Source-Files and add some missing ones. -- David Fox Thu, 20 Aug 2015 16:01:40 -0700 haskell-cabal-debian (4.31.1) unstable; urgency=low * Map the cabal library Cabal library to the debian library packages libghc-cabal-dev et. al. -- David Fox Thu, 20 Aug 2015 15:48:59 -0700 haskell-cabal-debian (4.31) unstable; urgency=low * Add some mappings from cabal build tools to debian package names: ghc -> ghc, alex -> alex, happy -> happy * Support Multi-Arch field in binaries (Joachim Breitner) * Implement --roundtrip option (Joachim Breitner) * Fixes for changelog entry formatting (Joachim Breitner) * Fixes for License field of debian/copyright (Joachim Breitner) * Only depend on ghc-doc if the package builds a library * New mode of operation --upgrade * No -prof and -doc package dependencies for binary and test suite packages -- David Fox Thu, 20 Aug 2015 14:31:28 -0700 haskell-cabal-debian (4.30.2) unstable; urgency=low * have runDebianizeScript look for source in src/ as well as ./ -- David Fox 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 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 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 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 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 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 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 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 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 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 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 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 of CompilerInfo. This makes cabal file directives like impl(ghc >= 7.9) work for ghcjs packages. -- David Fox Sun, 29 Mar 2015 12:38:33 -0700 haskell-cabal-debian (4.24.7) unstable; urgency=low * Remove the Data.Algorithm.Diff modules, they have moved into Diff-0.3.1 -- David Fox Tue, 24 Mar 2015 16:51:29 -0700 haskell-cabal-debian (4.24.6) unstable; urgency=low * Use build dependency haskell-devscripts >= 0.8 for unofficial, >= 0.9 for official. * Straighten out the test suite options: --no-tests, --no-run-tests -- David Fox Mon, 23 Mar 2015 11:31:14 -0700 haskell-cabal-debian (4.24.5) unstable; urgency=low * Patch from Dmitry Bogatov for filling in debian/copyright fields * Patch from Dmitry Bogatov for debhelper and haskell-devscripts build deps * Patch from Dmitry Bogatov for default changelog message * Add a --no-run-tests flag to control the nocheck option * Compatibility with different GHC versions -- David Fox Sat, 21 Mar 2015 10:14:48 -0700 haskell-cabal-debian (4.24.3) unstable; urgency=low * Always include the test suite build dependencies in debian/control, even if the testEnabled flag is set to False (at the moment it seems as if it always is.) -- David Fox Mon, 02 Mar 2015 17:33:52 -0800 haskell-cabal-debian (4.24.2) unstable; urgency=low * Distinguish between the place we find the data files (dataTop) and the place we put then (dataDest) * Add a case for the ISC license -- David Fox Sun, 22 Feb 2015 15:09:56 -0800 haskell-cabal-debian (4.24.1) unstable; urgency=low * Don't assign the name "cabal-ghcjs" to newer Cabal library versions -- David Fox Sun, 22 Feb 2015 06:08:28 -0800 haskell-cabal-debian (4.24) unstable; urgency=low * Convert from old data-lens package to lens. * Implement --allow-debian-self-build-deps -- David Fox Sat, 14 Feb 2015 06:15:01 -0800 haskell-cabal-debian (4.23.1) unstable; urgency=low * ifdefs for Cabal-1.18, 1.20, and 1.22, ghc-7.6, and 7.8. -- David Fox Sun, 08 Feb 2015 23:21:07 -0800 haskell-cabal-debian (4.23) unstable; urgency=low * Add DEB_ENABLE_TESTS = yes to rules file when appropriate * Add test suite build dependencies when appropriate * Add --no-test-suite option * Add --allow-debian-self-build-deps * Filter out self dependencies in the debian package space, not the cabal package space. * Fix generation of machine readable debian/copyright files * Use the homepage value found in the cabal file * Add travis build file -- David Fox Fri, 06 Feb 2015 06:25:08 -0800 haskell-cabal-debian (4.22) unstable; urgency=low * Big module reorganization for more type safety. -- David Fox Tue, 03 Feb 2015 13:22:29 -0800 haskell-cabal-debian (4.21.1) unstable; urgency=low * Fix --buildenvdir command line option. * Add an option for cabal flags -- David Fox Fri, 30 Jan 2015 13:46:08 -0800 haskell-cabal-debian (4.21) unstable; urgency=low * Split the enormous Atoms record into three layers - the innermost is Flags, which contains information obtained from the command line arguments. Flags is also the argument to the inputCabalization function, which inputs a Cabal PackageDescription. The Flags record is embedded in a DebInfo, which holds information related to the Debianization only. The DebInfo and the PackageDescription are used to build the old Atoms record. DebInfo is the state value of the DebianT monad, while Atoms is the state value of the CabalT monad. The point of all this is to ensure that a PackageDescription exists before we start converting the Cabalization to a Debianization. -- David Fox Thu, 29 Jan 2015 12:29:52 -0800 haskell-cabal-debian (4.20.2) unstable; urgency=low * Do not lowercase the package name when constructing the data file destination directory (/usr/share/). -- David Fox Fri, 16 Jan 2015 05:45:23 -0800 haskell-cabal-debian (4.20.1) unstable; urgency=low * Fix a bug in the computation of the debian maintainer field * Improve rules file generation -- David Fox Wed, 14 Jan 2015 14:38:56 -0800 haskell-cabal-debian (4.20) unstable; urgency=low * Add a --source-section option * Fix handling of debian maintainer and debian uploaders * Improve formatting of debian/rules file * Rename function debianization -> debianize * Rename function finalizeDebianization' -> finalizeDebianization * Rename function getDebianMaintainer -> getCurrentDebianUser -- David Fox Fri, 09 Jan 2015 11:49:04 -0800 haskell-cabal-debian (4.19.3) unstable; urgency=low * Fix issue #23, so that if you run 'cabal-debian' and then 'cabal-debian --compare' it says there are no differences. * Fix issue #16 - set revision if format is Quilt3. -- David Fox Thu, 08 Jan 2015 05:20:32 -0800 haskell-cabal-debian (4.19.2) unstable; urgency=low * Use canonical to put the debianization in a standard form before trying to compare existing and generated. * Fix bug where cabal-debian program processed the command line options twice. * Avoid using paths that point to ../ in the cabal file (even if disabled by a flag), it causes the package to be rejected by hackage. -- David Fox Wed, 07 Jan 2015 13:26:33 -0800 haskell-cabal-debian (4.19.1) unstable; urgency=low * Support Cabal-1.22 * Test whether apt-file is installed (from creichert) * Conditional compilation for new symbols MPL and BSD2 (from creichert) -- David Fox Wed, 07 Jan 2015 12:56:00 -0800 haskell-cabal-debian (4.19) unstable; urgency=low * Add remapCabal function here from a private package * Remove debianVersionSplits, which has long been replaced by debianDefaultAtoms. -- David Fox Mon, 08 Dec 2014 10:07:06 -0800 haskell-cabal-debian (4.18) unstable; urgency=low * Add types to support machine readable copyright files. * Add --debian-base-name option and overrideDebianBaseName lens. * Add --omit-prof-version-deps option flag, have --official imply it -- David Fox Thu, 27 Nov 2014 07:11:35 -0800 haskell-cabal-debian (4.17.5) unstable; urgency=low * Use the prettyclass package and the PP wrappers in the latest debian package to do pretty printing. * Change default priority to extra * Use the new watch file suggested by nomeata * Use the control file template suggested in issue #3 -- David Fox Mon, 15 Sep 2014 13:28:36 -0700 haskell-cabal-debian (4.17.4) unstable; urgency=low * Add missing ifdefs to hide the GHCJS constructor when ghcjs-support flag is False. * Require Cabal < 1.21 when ghcjs-support flag is False. -- David Fox Tue, 02 Sep 2014 09:06:20 -0700 haskell-cabal-debian (4.17.3) unstable; urgency=low * Moved source repository to github.com. -- David Fox Fri, 29 Aug 2014 13:55:26 -0700 haskell-cabal-debian (4.17.2) unstable; urgency=low * Fix formatting of the generated debian/*.install files. -- David Fox Tue, 19 Aug 2014 16:04:27 -0700 haskell-cabal-debian (4.17.1) unstable; urgency=low * Fix install of ghcjs executables - there was an extra subdir. * Don't append -ghcjs to default package name. -- David Fox Tue, 19 Aug 2014 10:15:46 -0700 haskell-cabal-debian (4.17) unstable; urgency=low * Fix bug in architecture dependent build dependency generation - it was getting the indep dependencies as well. * Support GHCJS executable packages, which are directories with the extension .jsexe. -- David Fox Mon, 18 Aug 2014 17:31:35 -0700 haskell-cabal-debian (4.16.1) unstable; urgency=low * Support for packaging libraries produced by the GHCJS compiler. * Generate debianizations that include libraries for multiple compiler flavors (not yet suppored in haskell-devscripts and/or Cabal.) * Put a DEB_DEFAULT_COMPILER assignment in debian/rules if we can infer it from the command line options. -- David Fox Sat, 16 Aug 2014 07:56:50 -0700 haskell-cabal-debian (4.15.2) unstable; urgency=low * Lowercase the strings in the extraLibs argument of allBuildDepends before wrapping them in BinPkgName. Those types, which come from the debian package, should be opaque and do this whenever a BinPkgName (or SrcPkgName) is created, because upper case is never ok in Debian source or binary package names. In the meantime I will make this requested change. Thanks to Sven Bartscher for pointing this out. -- David Fox Tue, 12 Aug 2014 07:47:17 -0700 haskell-cabal-debian (4.15.1) unstable; urgency=low * Add Data and Typeable instances. -- David Fox Thu, 17 Jul 2014 11:22:17 -0700 haskell-cabal-debian (4.15) unstable; urgency=low * Don't hardcode the compiler name in makefile targets. -- David Fox Sat, 12 Jul 2014 12:15:10 -0700 haskell-cabal-debian (4.14) unstable; urgency=low * Move the code to map the cabal package named "Cabal" to the debian package named "libghc-cabal-*" from the seereason defaults to the debian defaults. -- David Fox Mon, 07 Jul 2014 08:35:39 -0700 haskell-cabal-debian (4.13) unstable; urgency=low * Add a flag for ghcjs support. -- David Fox Thu, 03 Jul 2014 12:05:21 -0700 haskell-cabal-debian (4.12) unstable; urgency=low * Remove the Top type and argument - use getWorkingDirectory instead. -- David Fox Sun, 29 Jun 2014 08:11:01 -0700 haskell-cabal-debian (4.11) unstable; urgency=low * Use MonadIO instead of IO for all signatures. This is so we can more easily use cabal debian from a Shelly script. -- David Fox Sun, 29 Jun 2014 07:16:45 -0700 haskell-cabal-debian (4.10.1) unstable; urgency=low * Fix a tail exception in builtIn. -- David Fox Tue, 17 Jun 2014 07:21:22 -0700 haskell-cabal-debian (4.10) unstable; urgency=low * Rename knownVersionSplits -> debianVersionSplits and move to Debian.Debianize.Details. (Should that be renamed Debian.Debianize.Debian?) * Add HC=ghc or HC=ghcjs to header of debian/rules depending on the value of the compilerFlavor atom. -- David Fox Sat, 14 Jun 2014 10:20:01 -0700 haskell-cabal-debian (4.9) unstable; urgency=low * Generate the library package prefix, previously hard coded as libghc-, using the CompilerFlavor value, so we get libghcjs-foo-dev when using ghcjs. -- David Fox Fri, 13 Jun 2014 09:58:13 -0700 haskell-cabal-debian (4.8) unstable; urgency=low * Add a --no-hoogle flag to omit the hoogle documentation link. This link doesn't contain the package's version number, so it will conflict with other versions of the library (such as those built into ghc.) -- David Fox Tue, 10 Jun 2014 10:42:38 -0700 haskell-cabal-debian (4.7.1) unstable; urgency=low * Fix the code added in 4.7. * Add --recommends and --suggests options, similar to --depends et. al. -- David Fox Tue, 03 Jun 2014 07:14:52 -0700 haskell-cabal-debian (4.7) unstable; urgency=low * Improve the treatment of dependencies which are built into ghc. This will allow the use of newer libraries than the ones built into ghc, provided they are given deb names that are different than the one ghc specifically conflicts with. For example, a newer version of Cabal could be used if it was in the deb package libghc-cabal-ghcjs-dev. To change the debian names of libraries we need to use the mapCabal and splitCabal functions, as is done in the autobuilder-seereason module Debian.AutoBuilder.Details.Atoms. -- David Fox Mon, 02 Jun 2014 14:28:59 -0700 haskell-cabal-debian (4.6.2) unstable; urgency=low * Move a seereason specific function from here to the autobuilder-seereason package. -- David Fox Mon, 02 Jun 2014 11:03:13 -0700 haskell-cabal-debian (4.6.1) unstable; urgency=low * Don't compute the current ghc version so often. -- David Fox Fri, 30 May 2014 13:40:12 -0700 haskell-cabal-debian (4.6) unstable; urgency=low * Add a --default-package option to change haskell-packagename-utils to some other name. * Fix treatment of cabalfile Data-Dir field - it describes where the data files are in the source tree, but shouldn't affect where they will be installed. -- David Fox Thu, 29 May 2014 08:27:54 -0700 haskell-cabal-debian (4.5) unstable; urgency=low * Remove the ghcVersion field and lens. -- David Fox Mon, 05 May 2014 11:55:53 -0700 haskell-cabal-debian (4.4) unstable; urgency=low * Add the copytruncate directive to logrotate files we generate. As things were, hslogger would continue writing to the deleted log file after it was rotated. -- David Fox Sun, 30 Mar 2014 13:05:48 -0700 haskell-cabal-debian (4.3.2) unstable; urgency=low * Speed up debianization by computing the ghc version once when we enter the DebT monad rather than repeatedly. It is slow because it needs to chroot. -- David Fox Fri, 28 Mar 2014 13:03:57 -0700 haskell-cabal-debian (4.3.1) unstable; urgency=low * Safer default value for buildEnv - "/" instead of "". This is where we look for the GHC version number. -- David Fox Thu, 27 Mar 2014 06:12:28 -0700 haskell-cabal-debian (4.3) unstable; urgency=low * Make the default value for buildEnv "/", this makes it normally look at the version number of the ghc compiler installed in the root environment. -- David Fox Mon, 24 Mar 2014 06:01:49 -0700 haskell-cabal-debian (4.2) unstable; urgency=low * Get the GHC compiler version from the build environment, which now needs to be explicitly set. -- David Fox Fri, 07 Mar 2014 10:58:37 -0800 haskell-cabal-debian (4.1.1) unstable; urgency=low * Remove build dependency on ansi-wl-pprint. * Split module Debian.Debianize.BuildDependencies out of Debian.Debianize.Finalize -- David Fox Sun, 02 Feb 2014 07:37:03 -0800 haskell-cabal-debian (4.0.6) unstable; urgency=low * Ifdef out duplicate instances for Cabal-1.18.0 - thanks to Tom Nielsen. -- David Fox Tue, 28 Jan 2014 17:10:48 -0800 haskell-cabal-debian (4.0.5) unstable; urgency=low * Changes for debian-3.81 - use the pretty printer in Debian.Pretty instead of ansi-wl-pprint. -- David Fox Tue, 14 Jan 2014 05:02:59 -0800 haskell-cabal-debian (4.0.4) unstable; urgency=low * Restore the test data, the problem I had with long filenames is solved by using cabal sdist to create the tarball rather than runhaskell Setup sdist. -- David Fox Wed, 18 Dec 2013 09:37:34 -0800 haskell-cabal-debian (4.0.3) unstable; urgency=low * Include the build dependencies of the executables in the debian source deb build dependencies. -- David Fox Tue, 10 Dec 2013 14:37:20 -0800 haskell-cabal-debian (4.0.2) unstable; urgency=low * Export some lens state operators from Prelude. -- David Fox Tue, 10 Dec 2013 05:38:00 -0800 haskell-cabal-debian (4.0.1) unstable; urgency=low * Make sure the utilities package gets created even if no name has been specified for it - use the name generated in DebianNames.hs. -- David Fox Tue, 10 Dec 2013 05:10:11 -0800 haskell-cabal-debian (4.0.0) unstable; urgency=low * Massive lens overhaul -- David Fox Thu, 05 Dec 2013 12:26:31 -0800 haskell-cabal-debian (3.10.3) unstable; urgency=low * Go back to using lens interface directly * Collect debianization fact code in Facts/ -- David Fox Sun, 24 Nov 2013 10:40:02 -0800 haskell-cabal-debian (3.10.2) unstable; urgency=low * Make some signatures in Monad.hs clearer -- David Fox Wed, 20 Nov 2013 14:26:28 -0800 haskell-cabal-debian (3.10.1) unstable; urgency=low * More API changes - want need to get all the clients in sync before proceeding. -- David Fox Tue, 19 Nov 2013 11:31:16 -0800 haskell-cabal-debian (3.10) unstable; urgency=low * Add a monadic interface -- David Fox Sat, 16 Nov 2013 10:42:02 -0800 haskell-cabal-debian (3.9) unstable; urgency=low * Clean up documentation * Allow more than one utility package name, each of which will get copies of the data-files and leftover executables. * Make the --debianize option a no-op, the behavior is now the default. * Update the unit tests and build an executable to run them. * Copy debian/changelog to top directory at beginning of build so hackage will see it. -- David Fox Tue, 05 Nov 2013 11:34:48 -0800 haskell-cabal-debian (3.8.3) unstable; urgency=low * Add an ifdef for compatibility with GHC-7.4.1. -- David Fox Sun, 20 Oct 2013 15:50:47 -0700 haskell-cabal-debian (3.8.2) unstable; urgency=low * Actually, copy changelog from debian/changelog before building sdist tarball. -- David Fox Tue, 15 Oct 2013 06:42:39 -0700 haskell-cabal-debian (3.8.1) unstable; urgency=low * Move changelog top top directory so hackage will see it. -- David Fox Tue, 15 Oct 2013 06:24:25 -0700 haskell-cabal-debian (3.8) unstable; urgency=low * Downcase the package name to build the datadir name in /usr/share, this matches the paths in dist/autogen/Paths_packagename. -- David Fox Mon, 14 Oct 2013 20:48:39 -0700 haskell-cabal-debian (3.7) unstable; urgency=low * Change path to hackage tarball in watch file for hackage2. -- David Fox Fri, 04 Oct 2013 09:22:51 -0700 haskell-cabal-debian (3.6) unstable; urgency=low * Require haskell-devscripts >= 0.8.19. This version changes the value of datasubdir from /usr/share/packagename-packageversion to simply /usr/share/packagename. This could break some packaging. -- David Fox Fri, 06 Sep 2013 16:48:18 -0700 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 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. -- David Fox Sat, 31 Aug 2013 07:57:15 -0700 haskell-cabal-debian (3.4.2) unstable; urgency=low * Notify user when debhelper isn't installed. * Avoid use of partial function read -- David Fox Mon, 24 Jun 2013 13:51:51 -0700 haskell-cabal-debian (3.4.1) unstable; urgency=low * Remove call to test script in Setup.hs * Remove unused dependencies -- David Fox Mon, 10 Jun 2013 09:12:38 -0700 haskell-cabal-debian (3.4) unstable; urgency=low * Add support for modifying the Provides and Replaces fields. -- David Fox Sun, 09 Jun 2013 14:18:39 -0700 haskell-cabal-debian (3.3.2) unstable; urgency=low * Changes for debian-3.71 -- David Fox Sun, 14 Apr 2013 13:32:04 -0700 haskell-cabal-debian (3.3.1) unstable; urgency=low * Don't fail during dry run if the existing debianization has no copyright file. -- David Fox Wed, 13 Mar 2013 10:00:25 -0700 haskell-cabal-debian (3.3) unstable; urgency=low * Add Debian.Debianize.Details, with default Atoms values for Debian and SeeReason. -- David Fox Mon, 11 Mar 2013 11:44:10 -0700 haskell-cabal-debian (3.2.5) unstable; urgency=low * Add move the VersionSplits type into a module, and fix the code that splits the mapping of cabal to debian names over a version range. -- David Fox Tue, 05 Mar 2013 05:17:03 -0800 haskell-cabal-debian (3.2.4) unstable; urgency=low * Fix long standing bug in Debian.Debianize.Interspersed.foldTriples. -- David Fox Sun, 03 Mar 2013 09:45:14 -0800 haskell-cabal-debian (3.2.3) unstable; urgency=low * Clean up mapping from cabal names to debian names. -- David Fox Sat, 02 Mar 2013 07:36:16 -0800 haskell-cabal-debian (3.2.2) unstable; urgency=low * Remove unused Debian.Debianize.Generic and Triplets modules. -- David Fox Fri, 01 Mar 2013 11:14:33 -0800 haskell-cabal-debian (3.2.1) unstable; urgency=low * Do not add the options +RTS -IO -RTS to the server options, this is a security risk. Instead, server executables should built with -with-rtsopts=-IO. -- David Fox Thu, 28 Feb 2013 09:02:39 -0800 haskell-cabal-debian (3.2) unstable; urgency=low * Strip executables when installing (well, at least some. There may be more work to do here.) * Change the build dependency type from BinPkgName to Relation, so we can specify version dependencies (though as yet not or relations.) -- David Fox Tue, 26 Feb 2013 07:17:30 -0800 haskell-cabal-debian (3.1.1) unstable; urgency=low * Fix the code in the init file that checks for and sources a file in /etc/default. -- David Fox Mon, 25 Feb 2013 14:46:02 -0800 haskell-cabal-debian (3.1) unstable; urgency=low * Create a Top type to represent the top directory of a debianization * Change the signature of Debian.Debianize.debianization so it notices command line arguments and environment arguments. -- David Fox Fri, 22 Feb 2013 13:28:30 -0800 haskell-cabal-debian (3.0.7) unstable; urgency=low * Fix to copyright/license code * have the init script load /etc/default/packagename if available * Add an alternative function to showCommandForUser (called showCommand) that uses double quotes instead of single quotes so you can reference shell variables. -- David Fox Wed, 20 Feb 2013 09:29:11 -0800 haskell-cabal-debian (3.0.6) unstable; urgency=low * When packaging a web site or server, don't add code to the postinst to start a server, it gets generated by debhelper. * Add the changelog and the Debianize.hs file to extra-source-files. * Add HTTP=1 to the list of known epoch mappings. -- David Fox Thu, 14 Feb 2013 14:41:17 -0800 haskell-cabal-debian (3.0.5) unstable; urgency=low * Compatibility with ghc-7.4 -- David Fox Wed, 13 Feb 2013 10:48:19 -0800 haskell-cabal-debian (3.0.4) unstable; urgency=low * Add dependency on debian-policy, so we can compute the latest standards-version. * Documentation improvements * Test case improvements * Error message improvements -- David Fox Sun, 10 Feb 2013 11:03:55 -0800 haskell-cabal-debian (3.0.3) unstable; urgency=low * Due to a typo, the noDocumentationLibrary lens was turning off profiling rather than documentation. -- David Fox Fri, 08 Feb 2013 17:14:09 -0800 haskell-cabal-debian (3.0.2) unstable; urgency=low * Fix argument and exception handling in cabal-debian * Make Standards-Version field non-mandatory * Make sure every binary deb paragraph has a non-empty description -- David Fox Thu, 07 Feb 2013 10:03:25 -0800 haskell-cabal-debian (3.0.1) unstable; urgency=low * Don't build Debian version numbers with revision (Just ""). * Output the descriptions of the binary packages. -- David Fox Tue, 05 Feb 2013 14:48:33 -0800 haskell-cabal-debian (3.0) unstable; urgency=low * Moved the Distribution.Debian modules to Debian.Cabal and Debian.Debianize. * Refactored the debianize function for easier testing * Added test cases. * Add a Debianization type that intends to fully describe a debian package, with functions to read, build, modify, and write a Debianization. -- David Fox Wed, 26 Dec 2012 05:45:35 -0800 haskell-cabal-debian (2.6.3) unstable; urgency=low * Fix pretty printing of Relations (i.e. dependency lists.) There is an instance for printing lists in ansi-wl-pprint which prevents us from writing customized Pretty instances for type aliases like Relations, AndRelation, and OrRelation. -- David Fox Fri, 04 Jan 2013 09:30:48 -0800 haskell-cabal-debian (2.6.2) unstable; urgency=low * Fix a bug constructing the destination pathnames that was dropping files that were supposed to be installed into packages. -- David Fox Thu, 20 Dec 2012 06:49:25 -0800 haskell-cabal-debian (2.6.1) unstable; urgency=low * Remove the modifyAtoms field from the Flags record, we want to be able to create instances like Read and Show for this type. The modifyAtoms function is now passed separately to debianize. * The flags field of Server was renamed serverFlags because the newly exported Config record has a flags field. -- David Fox Wed, 19 Dec 2012 09:45:22 -0800 haskell-cabal-debian (2.5.10) unstable; urgency=low * Filter cabal self dependencies out before generating Build-Depends-Indep, just as we added code to filter them out of Build-Depends in version 2.5.7. -- David Fox Tue, 18 Dec 2012 13:23:39 -0800 haskell-cabal-debian (2.5.9) unstable; urgency=low * Always add +RTS -IO -RTS to server flags. -- David Fox Sun, 16 Dec 2012 10:40:52 -0800 haskell-cabal-debian (2.5.8) unstable; urgency=low * Add a builtin list for ghc-7.6.1. -- David Fox Sat, 15 Dec 2012 07:04:49 -0800 haskell-cabal-debian (2.5.7) unstable; urgency=low * Filter out cabal self-dependencies before building the debian dependencies. In cabal a self dependency means you need the library to build an executable, while in debian it means you need an older version installed to build the current version. -- David Fox Thu, 29 Nov 2012 08:42:30 -0800 haskell-cabal-debian (2.5.6) unstable; urgency=low * Don't add --base-uri and --http-port arguments automatically, they can be computed by calling the oldClckwrksFlags function and adding the value to the flags field. Clckwrks-0.3 no longer needs the --base-uri argument. -- David Fox Tue, 27 Nov 2012 13:34:31 -0800 haskell-cabal-debian (2.5.5) unstable; urgency=low * Have the debianize function return False if there is no debian/Debianize.hs file, but throw an exception if running it failed, so we notice bad debianization code. -- David Fox Tue, 27 Nov 2012 07:34:51 -0800 haskell-cabal-debian (2.5.4) unstable; urgency=low * Insert "SetEnv proxy-sendcl 1" line into Apache config. -- David Fox Tue, 20 Nov 2012 13:43:54 -0800 haskell-cabal-debian (2.5.3) unstable; urgency=low * Remove extra copy of binary from the executable debs * Add a sourcePackageName field to Flags, and a --source-package-name command line option. -- David Fox Sat, 17 Nov 2012 00:16:21 -0800 haskell-cabal-debian (2.5.2) unstable; urgency=low * Fix the path to where the DHInstallTo and DHInstallCabalExecTo DebAtoms put their files. -- David Fox Fri, 16 Nov 2012 18:11:45 -0800 haskell-cabal-debian (2.5.1) unstable; urgency=low * Add a destName field to Executable so we can give installed executables a different name than they had in the build. -- David Fox Fri, 16 Nov 2012 15:37:16 -0800 haskell-cabal-debian (2.5) unstable; urgency=low * Add a debName field to the Executable record, before the deb package name had to equal the executable name. -- David Fox Fri, 16 Nov 2012 12:32:39 -0800 haskell-cabal-debian (2.4.2) unstable; urgency=low * Move location of cabal install files from dist/build/install to debian/cabalInstall, the dist directory was getting wiped at bad moments. * Split the autobuilder function autobuilderDebianize into two new functions in cabal-debian: runDebianize and callDebianize. * Custom debianization code now goes in debian/Debianize.hs rather than in setup, so we can distinguish it failing from it not existing more easily. -- David Fox Thu, 15 Nov 2012 11:00:08 -0800 haskell-cabal-debian (2.4.1) unstable; urgency=low * We need to verify that debian/compat was created after running the debianize function, because ghc still exits with ExitSuccess -- David Fox Thu, 15 Nov 2012 06:34:02 -0800 haskell-cabal-debian (2.4.0) unstable; urgency=low * You can run a function in Setup.hs other than main using ghc -e, so we will use this trick to run the debianize function directly rather than running main. * Eliminate the autobuilderDebianize function. -- David Fox Thu, 15 Nov 2012 04:05:49 -0800 haskell-cabal-debian (2.3.4) unstable; urgency=low * Fix the builddir used when running the cabal-debian standalone executable - it was dist-cabal/build, so the resulting debianization had files in places where cabal didn't expect them. -- David Fox Tue, 13 Nov 2012 06:20:51 -0800 haskell-cabal-debian (2.3.3) unstable; urgency=low * Eliminate class MonadBuild and the BuildT monad. -- David Fox Sun, 11 Nov 2012 17:46:31 -0800 haskell-cabal-debian (2.3.2) unstable; urgency=low * Fix exception that was keeping changelogs from being preserved. -- David Fox Sat, 10 Nov 2012 10:07:50 -0800 haskell-cabal-debian (2.3.1) unstable; urgency=low * Fix the extension of the debhelper links files * Add a general mechanism for installing a file into a deb when we have the file's text in a String (rather than in a file.) -- David Fox Sat, 10 Nov 2012 07:35:09 -0800 haskell-cabal-debian (2.3) unstable; urgency=low * Add MonadBuild. -- David Fox Fri, 09 Nov 2012 12:21:14 -0800 haskell-cabal-debian (2.2.1) unstable; urgency=low * Add a modifyAtoms function to Flags that is applied to final list of DebAtom before writing the debianization. * Add DHApacheSite and DHInstallCabalExec atoms so atoms don't depend on the build directory * Add #DEBHELPER# and exit 0 to default web server postinst. -- David Fox Fri, 09 Nov 2012 10:25:32 -0800 haskell-cabal-debian (2.2.0) unstable; urgency=low * Append a trailing slash to the --base-uri argument passed to the server. This is required by Web.Routes.Site.runSite. -- David Fox Thu, 08 Nov 2012 04:40:08 -0800 haskell-cabal-debian (2.1.4) unstable; urgency=low * Merge the Executable and Script constructors of the Executable type * Add a destDir field to Executable to specify the destination. -- David Fox Tue, 06 Nov 2012 13:24:25 -0800 haskell-cabal-debian (2.1.3) unstable; urgency=low * Don't append a slash to the base-uri. * Construct the name of the data directory in /usr/share from the cabal package name rather than the debian source package name. * Add a --self-depend flag to include a build dependency on this library in all generated debianizations. -- David Fox Tue, 06 Nov 2012 07:07:57 -0800 haskell-cabal-debian (2.1.2) unstable; urgency=low * Output the server support files. -- David Fox Tue, 06 Nov 2012 06:37:18 -0800 haskell-cabal-debian (2.1.1) unstable; urgency=low * Restore code that checks for version number match when validating a debianization. The autobuilder can now pass the version number to cabal-debian, so it should match. -- David Fox Mon, 05 Nov 2012 17:42:32 -0800 haskell-cabal-debian (2.1.0) unstable; urgency=low * Enable processing of Script, Server and WebSite executables. -- David Fox Mon, 05 Nov 2012 12:45:42 -0800 haskell-cabal-debian (2.0.9) unstable; urgency=low * Add a Library section, export all the modules. -- David Fox Mon, 05 Nov 2012 06:41:25 -0800 haskell-cabal-debian (2.0.8) unstable; urgency=low * Bypass abandoned versions. -- David Fox Sat, 03 Nov 2012 06:13:27 -0700 haskell-cabal-debian (1.26) unstable; urgency=low * Don't try to update the existing debianization, except for the changelog where we retain entries that look older than the one we generate. * Use .install files instead of adding rules to debian/rules * Add --depends and --conflicts options -- David Fox Thu, 25 Oct 2012 12:03:49 -0700 haskell-cabal-debian (1.25) unstable; urgency=low * If the --disable-haddock flag is given omit the doc package from the control file. * The tarball that was uploaded to Hackage as version 1.24 had a (buggy) change which was not pushed to darcs. This resolves that confusion. -- David Fox Sat, 16 Jun 2012 14:42:12 -0700 haskell-cabal-debian (1.24) unstable; urgency=low * No wonder it doesn't build on hackage - none of the source modules were shipped. -- David Fox Thu, 14 Jun 2012 08:19:19 -0700 haskell-cabal-debian (1.23) unstable; urgency=low * Add a --quilt option to switch from native to quilt format. Without this option the file debian/source/format will contain '3.0 (native)', with it '3.0 (quilt)'. -- David Fox Fri, 01 Jun 2012 05:53:36 -0700 haskell-cabal-debian (1.22) unstable; urgency=low * Bump version to make sure all changes are uploaded. -- David Fox Wed, 23 May 2012 19:54:17 -0700 haskell-cabal-debian (1.21) unstable; urgency=low * fix conversion of wildcards into intersected ranges -- David Fox Wed, 23 May 2012 19:51:34 -0700 haskell-cabal-debian (1.20) unstable; urgency=low * Fix generation of debian library dependencies from the Extra-Libraries field of the cabal file. -- David Fox Wed, 23 May 2012 19:50:39 -0700 haskell-cabal-debian (1.19) unstable; urgency=low * Handle cabal equals dependencies. -- David Fox Tue, 20 Mar 2012 14:34:58 -0700 haskell-cabal-debian (1.18) unstable; urgency=low * High level of confidence this time. Interesting new Interspersed class, and an implementation of invertVersionRanges which should be forwarded to the Cabal folks. * Removes dependency on logic-classes -- David Fox Tue, 20 Mar 2012 08:17:25 -0700 haskell-cabal-debian (1.17) unstable; urgency=low * Restore code to downcase cabal package name before using it as the base of the debian package name. -- David Fox Sun, 18 Mar 2012 15:32:04 -0700 haskell-cabal-debian (1.16) unstable; urgency=low * Remove code that implements a special case for the debian name of the haskell-src-exts package. -- David Fox Sun, 18 Mar 2012 14:11:21 -0700 haskell-cabal-debian (1.15) unstable; urgency=low * Yet another stab at fixing the code for converting cabal dependencies to debian dependencies, with support for splitting version ranges of cabal files among different debian packages. -- David Fox Fri, 16 Mar 2012 17:59:28 -0700 haskell-cabal-debian (1.14) unstable; urgency=low * Don't try to strip data files * Use permissions 644 for data files, not 755. -- David Fox Wed, 07 Mar 2012 14:46:04 -0800 haskell-cabal-debian (1.13) unstable; urgency=low * Append the version number when constructing the directory for data files. -- David Fox Wed, 07 Mar 2012 08:56:39 -0800 haskell-cabal-debian (1.12) unstable; urgency=low * Include any files listed in the Data-Files field of the cabal file in the utils package. -- David Fox Tue, 06 Mar 2012 11:31:47 -0800 haskell-cabal-debian (1.11) unstable; urgency=low * Replace --epoch flag with --epoch-map, so we can specify epoch numbers for both the package being built and for dependency packages. -- David Fox Thu, 09 Feb 2012 07:01:19 -0800 haskell-cabal-debian (1.10) unstable; urgency=low * Add bundled package list for ghc 7.4.1. -- David Fox Sat, 04 Feb 2012 14:44:33 -0800 haskell-cabal-debian (1.9) unstable; urgency=low * Add --dep-map flag to allow mapping of cabal package names to the base of a debian package name. This modifies the name to which the prefix "lib" and the suffix "-dev" are added. * Fix dependency generation bug introduced in 1.8. -- David Fox Mon, 23 Jan 2012 14:13:05 -0800 haskell-cabal-debian (1.8) unstable; urgency=low * Add a --dev-dep flag to make one or more packages install dependencies of the dev package. -- David Fox Mon, 23 Jan 2012 05:00:46 -0800 haskell-cabal-debian (1.7) unstable; urgency=low * Add info about ghc 7.4.0 pre-release. -- David Fox Wed, 11 Jan 2012 09:57:45 -0800 haskell-cabal-debian (1.6) unstable; urgency=low * Don't omit dependencies built into ghc, they should be satisfied by the Provides in the compiler if they are not available in the repository. However, we do need to make ghc an alterantive to any versioned dependencies that are bundled with the compiler, since the built in dependencies are virtual packages and thus unversioned. -- David Fox Wed, 07 Dec 2011 06:10:17 -0800 haskell-cabal-debian (1.5) unstable; urgency=low * Fix the generation of build dependency version ranges by using an intermediate version range type. * If the version range for the cabal file touches two different debian package, don't try to write build dependencies that allow either one, it can't really be done. Just give the allowable versions of the newer package (e.g. libghc-parsec3-dev rather than libghc-parsec2-dev.) -- David Fox Sun, 04 Dec 2011 05:59:25 -0800 haskell-cabal-debian (1.4) unstable; urgency=low * Add a --revision flag which appends a (perhaps empty) string cabal version number to get the debian version number. Without this flag the string "-1~hackage1" is appended. * Make it an error to specify a debian version via --deb-version that is older than the current cabal version. -- David Fox Sun, 20 Nov 2011 06:45:33 -0800 haskell-cabal-debian (1.3) unstable; urgency=low * Fix error message when compiler version is not in bundled package list. * Add bundled package list for compiler 7.0.4 (same as 7.0.3.) -- David Fox Sat, 08 Oct 2011 07:58:19 -0700 haskell-cabal-debian (1.2) unstable; urgency=low * When computing the debian name from a package's cabal name, if we have no particular version number we are comparing to, use the name from the version split that corresponds to newer version numbers. * Add code to make the cabal package haskell-src-exts map to the debian packages libghc-src-exts-dev etc. Normally it would map to libghc-haskell-src-exts-dev. -- David Fox Thu, 06 Oct 2011 09:27:02 -0700 haskell-cabal-debian (1.1) unstable; urgency=low * Use propositional logic package to compute normal form for dependencies * Make sure to correct format of cabal package synopsis before using as debian package description. -- David Fox Fri, 30 Sep 2011 06:16:34 -0700 haskell-cabal-debian (1.0) unstable; urgency=low * Debianization generated by cabal-debian -- David Fox Sun, 18 Sep 2011 06:40:21 -0700 cabal-debian-5.0/cabal-debian.cabal0000644000000000000000000002402613530623213015276 0ustar0000000000000000Name: cabal-debian Version: 5.0 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2019 Clint Adams License: BSD3 License-File: LICENSE Author: David Fox Category: Debian, Distribution, System Maintainer: Clint Adams Homepage: https://github.com/clinty/cabal-debian Build-Type: Simple Synopsis: Create a Debianization for a Cabal package Description: This package supports the generation of a package Debianization (i.e. the files in the @debian@ subdirectory) for a cabal package, either through a library API or using the cabal-debian executable. For documentation of the executable, run @cabal-debian --help@, for documentation of the library API follow the link to the @Debian.Debianize@ module below. Cabal-Version: >= 1.10 Extra-Source-Files: changelog debian/cabal-debian.1 debian/cabal-debian.install debian/cabal-debian.manpages debian/compat debian/control debian/copyright debian/Debianize.hs debian/rules debian/source/format debian/watch test-data/creativeprompts/input/debian/changelog test-data/creativeprompts/input/debian/copyright test-data/creativeprompts/input/creativeprompts.cabal test-data/creativeprompts/output/debian/creativeprompts-development.init test-data/creativeprompts/output/debian/creativeprompts-development.logrotate test-data/creativeprompts/output/debian/watch test-data/creativeprompts/output/debian/creativeprompts-production.logrotate test-data/creativeprompts/output/debian/creativeprompts-production.install test-data/creativeprompts/output/debian/cabalInstall/a1cb9e4b5241944a3da44e00220b5c31/creativeprompts.com.conf test-data/creativeprompts/output/debian/creativeprompts-production.links test-data/creativeprompts/output/debian/changelog test-data/creativeprompts/output/debian/creativeprompts-production.postinst test-data/creativeprompts/output/debian/creativeprompts-backups.install test-data/creativeprompts/output/debian/creativeprompts-development.postinst test-data/creativeprompts/output/debian/creativeprompts-backups.postinst test-data/creativeprompts/output/debian/creativeprompts-production.dirs test-data/creativeprompts/output/debian/rules test-data/creativeprompts/output/debian/compat test-data/creativeprompts/output/debian/source/format test-data/creativeprompts/output/debian/control test-data/creativeprompts/output/debian/creativeprompts-data.install test-data/creativeprompts/output/debian/creativeprompts-production.init test-data/creativeprompts/output/debian/copyright test-data/clckwrks-dot-com/input/debian/changelog test-data/clckwrks-dot-com/input/debian/Debianize.hs test-data/clckwrks-dot-com/input/LICENSE test-data/clckwrks-dot-com/input/clckwrks-dot-com.cabal test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.postinst test-data/clckwrks-dot-com/output/debian/watch test-data/clckwrks-dot-com/output/debian/cabalInstall/6cb4323c6b76525f567919adaf912663/clckwrks.com.conf test-data/clckwrks-dot-com/output/debian/changelog test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.links test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-backups.postinst test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.logrotate test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-backups.install test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.install test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.init test-data/clckwrks-dot-com/output/debian/Debianize.hs test-data/clckwrks-dot-com/output/debian/rules test-data/clckwrks-dot-com/output/debian/compat test-data/clckwrks-dot-com/output/debian/source/format test-data/clckwrks-dot-com/output/debian/control test-data/clckwrks-dot-com/output/debian/copyright test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.dirs test-data/haskell-devscripts/debian/manpages test-data/haskell-devscripts/debian/changelog test-data/haskell-devscripts/debian/install test-data/haskell-devscripts/debian/rules test-data/haskell-devscripts/debian/compat test-data/haskell-devscripts/debian/dirs test-data/haskell-devscripts/debian/source/format test-data/haskell-devscripts/debian/control test-data/haskell-devscripts/debian/copyright test-data/haskell-devscripts/debian/docs test-data/alex/input/LICENSE test-data/alex/input/alex.cabal test-data/alex/output/debian/watch test-data/alex/output/debian/alex.install test-data/alex/output/debian/changelog test-data/alex/output/debian/rules test-data/alex/output/debian/compat test-data/alex/output/debian/source/format test-data/alex/output/debian/control test-data/alex/output/debian/copyright test-data/artvaluereport-data/input/debian/changelog test-data/artvaluereport-data/input/artvaluereport-data.cabal test-data/artvaluereport-data/input/Debianize.hs test-data/artvaluereport-data/output/debian/watch test-data/artvaluereport-data/output/debian/extra-depends test-data/artvaluereport-data/output/debian/changelog test-data/artvaluereport-data/output/debian/Debianize.hs test-data/artvaluereport-data/output/debian/rules test-data/artvaluereport-data/output/debian/compat test-data/artvaluereport-data/output/debian/source/format test-data/artvaluereport-data/output/debian/control test-data/artvaluereport-data/output/debian/copyright test-data/archive/input/debian/changelog test-data/archive/input/debian/copyright test-data/archive/input/seereason-darcs-backups.cabal test-data/archive/output/debian/watch test-data/archive/output/debian/changelog test-data/archive/output/debian/rules test-data/archive/output/debian/compat test-data/archive/output/debian/control test-data/archive/output/debian/seereason-darcs-backups.install test-data/archive/output/debian/copyright test-data/archive/output/debian/source/format test-data/artvaluereport2/input/artvaluereport2.cabal test-data/artvaluereport2/input/debian/changelog test-data/artvaluereport2/input/debian/Debianize.hs test-data/artvaluereport2/output/debian/artvaluereport2-development.init test-data/artvaluereport2/output/debian/artvaluereport2-staging.postinst test-data/artvaluereport2/output/debian/artvaluereport2-production.postinst test-data/artvaluereport2/output/debian/watch test-data/artvaluereport2/output/debian/cabalInstall/7e4b5d8641f6fae99e9ae9b2d8893bc7/my.appraisalreportonline.com.conf test-data/artvaluereport2/output/debian/artvaluereport2-staging.install test-data/artvaluereport2/output/debian/artvaluereport2-staging.init test-data/artvaluereport2/output/debian/artvaluereport2-production.install test-data/artvaluereport2/output/debian/changelog test-data/artvaluereport2/output/debian/artvaluereport2-production.logrotate test-data/artvaluereport2/output/debian/artvaluereport2-production.links test-data/artvaluereport2/output/debian/artvaluereport2-development.logrotate test-data/artvaluereport2/output/debian/artvaluereport2-backups.postinst test-data/artvaluereport2/output/debian/artvaluereport2-development.install test-data/artvaluereport2/output/debian/artvaluereport2-development.postinst test-data/artvaluereport2/output/debian/artvaluereport2-staging.logrotate test-data/artvaluereport2/output/debian/artvaluereport2-production.init test-data/artvaluereport2/output/debian/artvaluereport2-production.dirs test-data/artvaluereport2/output/debian/rules test-data/artvaluereport2/output/debian/compat test-data/artvaluereport2/output/debian/appraisalscope.install test-data/artvaluereport2/output/debian/control test-data/artvaluereport2/output/debian/artvaluereport2-backups.install test-data/artvaluereport2/output/debian/copyright test-data/artvaluereport2/output/debian/source/format Tested-With: GHC ==8.6.5 || ==8.4.4 || ==8.2.2 Source-Repository head type: git location: https://github.com/clinty/cabal-debian Library Default-Language: Haskell2010 Hs-Source-Dirs: src GHC-Options: -Wall Build-Depends: base < 5, bifunctors, Cabal >= 1.18, containers, data-default, deepseq, Diff >= 0.3.1, directory, exceptions, filepath, hsemail, HUnit, lens, mtl, network-uri, newtype-generics >= 0.4, parsec >= 3, pretty >= 1.1.2, process, pureMD5, regex-tdfa, syb, text, unix, unliftio >= 0.2.8.0, utf8-string, optparse-applicative >= 0.11, ansi-wl-pprint == 0.6.*, debian >= 3.95 Exposed-Modules: Data.Maybe.Extended Debian.GHC Debian.Policy Distribution.Version.Invert Debian.Debianize Debian.Debianize.BasicInfo Debian.Debianize.BinaryDebDescription Debian.Debianize.BuildDependencies Debian.Debianize.Bundled Debian.Debianize.CabalInfo Debian.Debianize.Changelog Debian.Debianize.CopyrightDescription Debian.Debianize.DebianName Debian.Debianize.DebInfo Debian.Debianize.Details Debian.Debianize.ExecAtoms Debian.Debianize.Files Debian.Debianize.Finalize Debian.Debianize.Goodies Debian.Debianize.InputCabal Debian.Debianize.InputDebian Debian.Debianize.Interspersed Debian.Debianize.Monad Debian.Debianize.Optparse Debian.Debianize.Output Debian.Debianize.Prelude Debian.Debianize.SourceDebDescription Debian.Debianize.VersionSplits Paths_cabal_debian System.Git Other-Modules: Debian.Orphans Executable cabal-debian Default-Language: Haskell2010 Hs-Source-Dirs: . Main-is: CabalDebian.hs ghc-options: -threaded -Wall Build-Depends: base, cabal-debian, Cabal >= 1.18, debian >= 3.95, lens, mtl, pretty >= 1.1.2 Test-Suite cabal-debian-tests Buildable: False Default-Language: Haskell2010 Type: exitcode-stdio-1.0 Hs-Source-Dirs: . Main-is: Tests.hs ghc-options: -threaded -Wall Build-Depends: base < 5, cabal-debian, Cabal >= 1.16, containers, debian >= 3.95, Diff >= 0.3.1, directory, filepath, hsemail, HUnit, lens, pretty >= 1.1.2, process, text cabal-debian-5.0/test-data/0000755000000000000000000000000013530623213013712 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/0000755000000000000000000000000013530623213017053 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/input/0000755000000000000000000000000013530623213020212 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/input/artvaluereport2.cabal0000644000000000000000000000731213530623213024342 0ustar0000000000000000Name: ArtValueReport Version: 1.9.29 License: AllRightsReserved Copyright: (c) 2008-2011, SeeReason Partners LLC Author: David Fox , Clifford Beshers Maintainer: Clifford Beshers Homepage: http://my.appraisalreportonline.com Synopsis: Haskell modules for fine art appraisal applications Description: Haskell modules for fine art appraisal applications Cabal-version: >= 1.2.3.0 build-type: Custom flag local-artvaluereport-data Description: Build with local copy of the artvaluereport-data library Default: False Manual: True Executable artvaluereport2-server Main-is: Main.hs GHC-options: -threaded -O2 -rtsopts -eventlog -Wall -Wwarn -fno-warn-name-shadowing -fno-warn-type-defaults if flag (local-artvaluereport-data) Hs-Source-Dirs: ., ../artvaluereport-data Build-Depends: RJson, xhtml, html-entities, old-time, pwstore-purehaskell, unordered-containers, aeson, HJavaScript, artvaluereport-data >= 1.66 Build-Depends: binary, cereal GHC-options: -Wwarn else Build-Depends: artvaluereport-data >= 1.66 GHC-options: -Wwarn Build-Depends: happstack-authenticate, happstack-scaffolding (>= 0.23) Build-Depends: acid-state >= 0.6, applicative-extras >= 0.1.5, authenticate, base, blaze-html, blaze-markup, bytestring, containers, data-accessor, debian-packaging >= 0.8, digestive-functors, digestive-functors-happstack, directory, directory-tree, Extra >= 1.35, fb, filepath, groom, happstack, happstack-extra, happstack-hsp, happstack-server, happstack-util, harp, HJScript, hslogger, hsp >= 0.4.4, hsx, html, ixset, jmacro >= 0.6.2, json, language-css, lifted-base, mtl, network >= 2.4, old-locale, old-time, parsec, pretty, process, process-extras >= 0.5, QuickCheck >= 2, random, regex-compat, revision, safe, safecopy >= 0.5.1, syb, syb-with-class, tagged, text, time, transformers, uniplate, unix, Unixutils, utf8-string, web-routes, web-routes-happstack, web-routes-hsp, web-routes-th Extensions: FlexibleContexts, FlexibleInstances, NoImplicitPrelude, OverlappingInstances, ScopedTypeVariables, TemplateHaskell, TypeSynonymInstances, UndecidableInstances Executable artvaluereport2-backups Main-Is: Backups.hs GHC-Options: -threaded -Wall -Wwarn -O2 -fno-warn-name-shadowing -fno-warn-missing-signatures -fwarn-tabs -fno-warn-unused-binds -fno-warn-orphans -fwarn-unused-imports -fno-spec-constr Build-depends: archive >= 1.2.9, base, Extra executable lookatareport Main-Is: Tools/LookAtAReport.hs -- Hs-Source-Dirs: ., ../artvaluereport-data_1 -- GHC-Options: -Wall -optP-include -optPdist/build/autogen/cabal_macros.h GHC-Options: -Wall Build-Depends: binary, cereal, debian, HaTeX, html-entities, pandoc, pureMD5, RJson, xhtml executable appraisalscope Main-Is: Tools/AppraisalScope.hs -- Hs-Source-Dirs: ., ../artvaluereport-data_1 -- GHC-Options: -Wall -optP-include -optPdist/build/autogen/cabal_macros.h GHC-Options: -Wall Build-Depends: binary, cereal, debian, HaTeX, html-entities, pandoc, pureMD5, RJson, xhtml cabal-debian-5.0/test-data/artvaluereport2/input/debian/0000755000000000000000000000000013530623213021434 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/input/debian/Debianize.hs0000644000000000000000000002166713530623213023676 0ustar0000000000000000{-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings #-} import Control.Lens import Data.Maybe (fromMaybe) import Data.Monoid (mempty) import Data.Set as Set (singleton, insert) import Data.Text as Text (intercalate) import Debian.Changes (ChangeLog(..)) import Debian.Debianize import Debian.Debianize.Finalize (debianize) import Debian.Debianize.Optparse (parseProgramArguments, CommandLineOptions(..)) import Debian.Pretty (ppShow) import Debian.Policy (databaseDirectory, PackageArchitectures(All), StandardsVersion(StandardsVersion)) import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel), SrcPkgName(..), VersionReq(SLT)) import Debian.Version (parseDebianVersion') -- This looks somewhat like a "real" Debianize.hs file except that (1) it -- expects to be run from the cabal-debian source directory and (2) it returns -- the comparison string instead of doing a writeDebianization, and (3) it reads -- and writes the test-data directories instead of ".". Also, you wouldn't want -- to copyFirstLogEntry in real life, this is to make sure old and new match. main :: IO () main = do log <- withCurrentDirectory "test-data/artvaluereport2/input" $ parseProgramArguments >>= \opts -> newCabalInfo (_flags opts) >>= either error (evalCabalT (liftCabal inputChangeLog >> use (debInfo . changelog))) new <- withCurrentDirectory "test-data/artvaluereport2/input" $ parseProgramArguments >>= \opts -> newCabalInfo (_flags opts) >>= either error (execCabalT (debianize (debianDefaults >> customize log {- >> removeFirstLogEntry -}))) old <- withCurrentDirectory "test-data/artvaluereport2/output" $ parseProgramArguments >>= \opts -> execDebianT inputDebianization (makeDebInfo (_flags opts)) -- The newest log entry gets modified when the Debianization is -- generated, it won't match so drop it for the comparison. putStr $ concat $ compareDebianization old $ view debInfo new where customize :: Maybe ChangeLog -> CabalT IO () customize log = do (debInfo . revision) .= Nothing (debInfo . sourceFormat) .= Native3 (debInfo . changelog) .?= log (debInfo . atomSet) %= (Set.insert $ InstallCabalExec (BinPkgName "appraisalscope") "lookatareport" "usr/bin") doExecutable (BinPkgName "appraisalscope") (InstallFile {execName = "appraisalscope", sourceDir = Nothing, destDir = Nothing, destName = "appraisalscope"}) doServer (BinPkgName "artvaluereport2-development") (theServer (BinPkgName "artvaluereport2-development")) doServer (BinPkgName "artvaluereport2-staging") (theServer (BinPkgName "artvaluereport2-staging")) doWebsite (BinPkgName "artvaluereport2-production") (theSite (BinPkgName "artvaluereport2-production")) doBackups (BinPkgName "artvaluereport2-backups") "artvaluereport2-backups" -- This should go into the "real" data directory. And maybe a different icon for each server? -- install (BinPkgName "artvaluereport2-server") ("theme/ArtValueReport_SunsetSpectrum.ico", "usr/share/artvaluereport2-data") (debInfo . binaryDebDescription (BinPkgName "artvaluereport2-backups") . description) .= Just (Text.intercalate "\n" [ "backup program for the appraisalreportonline.com site" , " Install this somewhere other than where the server is running get" , " automated backups of the database." ]) addDep (BinPkgName "artvaluereport2-production") (BinPkgName "apache2") addServerData addServerDeps (debInfo . binaryDebDescription (BinPkgName "appraisalscope") . description) .= Just "Offline manipulation of appraisal database" (debInfo . control . buildDependsIndep) %= (++ [[Rel (BinPkgName "libjs-jquery-ui") (Just (SLT (parseDebianVersion' ("1.10" :: String)))) Nothing]]) (debInfo . control . buildDependsIndep) %= (++ [[Rel (BinPkgName "libjs-jquery") Nothing Nothing]]) (debInfo . control . buildDependsIndep) %= (++ [[Rel (BinPkgName "libjs-jcrop") Nothing Nothing]]) (debInfo . binaryDebDescription (BinPkgName "artvaluereport2-staging") . architecture) .= Just All (debInfo . binaryDebDescription (BinPkgName "artvaluereport2-production") . architecture) .= Just All (debInfo . binaryDebDescription (BinPkgName "artvaluereport2-development") . architecture) .= Just All -- utilsPackageNames [BinPkgName "artvaluereport2-server"] (debInfo . sourcePackageName) .= Just (SrcPkgName "haskell-artvaluereport2") (debInfo . control . standardsVersion) .= Just (StandardsVersion 3 9 6 Nothing) (debInfo . control . homepage) .= Just "http://appraisalreportonline.com" (debInfo . compat) .= Just 9 addServerDeps :: CabalT IO () addServerDeps = mapM_ addDeps (map BinPkgName ["artvaluereport2-development", "artvaluereport2-staging", "artvaluereport2-production"]) addDeps p = mapM_ (addDep p) (map BinPkgName ["libjpeg-progs", "libjs-jcrop", "libjs-jquery", "libjs-jquery-ui", "netpbm", "texlive-fonts-extra", "texlive-fonts-recommended", "texlive-latex-extra", "texlive-latex-recommended"]) addDep p dep = (debInfo . binaryDebDescription p . relations . depends) %= (++ [[Rel dep Nothing Nothing]]) addServerData :: CabalT IO () addServerData = mapM_ addData (map BinPkgName ["artvaluereport2-development", "artvaluereport2-staging", "artvaluereport2-production"]) addData p = do (debInfo . atomSet) %= (Set.insert $ InstallData p "theme/ArtValueReport_SunsetSpectrum.ico" "ArtValueReport_SunsetSpectrum.ico") mapM_ (addDataFile p) ["Udon.js", "flexbox.css", "DataTables-1.8.2", "html5sortable", "jGFeed", "searchMag.png", "Clouds.jpg", "tweaks.css", "verticalTabs.css", "blueprint", "jquery.blockUI", "jquery.tinyscrollbar"] addDataFile p path = (debInfo . atomSet) %= (Set.insert $ InstallData p path path) theSite :: BinPkgName -> Site theSite deb = Site { domain = hostname' , serverAdmin = "logic@seereason.com" , server = theServer deb } theServer :: BinPkgName -> Server theServer deb = Server { hostname = case deb of BinPkgName "artvaluereport2-production" -> hostname' _ -> hostname' , port = portNum deb , headerMessage = "Generated by artvaluereport2/Setup.hs" , retry = "60" , serverFlags = ([ "--http-port", show (portNum deb) , "--base-uri", case deb of BinPkgName "artvaluereport2-production" -> "http://" ++ hostname' ++ "/" _ -> "http://seereason.com:" ++ show (portNum deb) ++ "/" , "--top", databaseDirectory deb , "--logs", "/var/log/" ++ ppShow deb , "--log-mode", case deb of BinPkgName "artvaluereport2-production" -> "Production" _ -> "Development" , "--static", "/usr/share/artvaluereport2-data" , "--no-validate" ] ++ (case deb of BinPkgName "artvaluereport2-production" -> [{-"--enable-analytics"-}] _ -> []) {- ++ [ "--jquery-path", "/usr/share/javascript/jquery/" , "--jqueryui-path", "/usr/share/javascript/jquery-ui/" , "--jstree-path", jstreePath , "--json2-path",json2Path ] -}) , installFile = InstallFile { execName = "artvaluereport2-server" , destName = ppShow deb , sourceDir = Nothing , destDir = Nothing } } hostname' = "my.appraisalreportonline.com" portNum :: BinPkgName -> Int portNum (BinPkgName deb) = case deb of "artvaluereport2-production" -> 9027 "artvaluereport2-staging" -> 9031 "artvaluereport2-development" -> 9032 _ -> error $ "Unexpected package name: " ++ deb anyrel :: BinPkgName -> Relation anyrel b = Rel b Nothing Nothing removeFirstLogEntry :: Monad m => CabalT m () removeFirstLogEntry = (debInfo . changelog) %= fmap (\ (ChangeLog (_ : tl)) -> ChangeLog tl) copyFirstLogEntry :: DebInfo -> DebInfo -> DebInfo copyFirstLogEntry deb1 deb2 = over changelog (const (Just (ChangeLog (hd1 : tl2)))) deb2 where ChangeLog (hd1 : _) = fromMaybe (error "Missing debian/changelog") (view changelog deb1) ChangeLog (_ : tl2) = fromMaybe (error "Missing debian/changelog") (view changelog deb2) cabal-debian-5.0/test-data/artvaluereport2/input/debian/changelog0000644000000000000000000001526513530623213023317 0ustar0000000000000000haskell-artvaluereport2 (1.9.29) unstable; urgency=low * Add a package for the appraisalscope executable. -- David Fox Fri, 01 Feb 2013 12:34:49 -0800 haskell-artvaluereport2 (1.9.28) unstable; urgency=low * Fix the formatting of the new creation date column in the report list and pave the way for converting the old EpochMilli into UTC time. -- Clifford Beshers Tue, 29 Jan 2013 18:51:00 -0800 haskell-artvaluereport2 (1.9.27) unstable; urgency=low * Report deletion. Reports now in map with key uuid. -- Clifford Beshers Mon, 28 Jan 2013 00:05:49 -0800 haskell-artvaluereport2 (1.9.26) unstable; urgency=low * Add report copying. -- Clifford Beshers Thu, 17 Jan 2013 22:34:49 -0800 haskell-artvaluereport2 (1.9.25) unstable; urgency=low * Myriad. Bump cabal version from 1.9.18. -- David Fox Mon, 17 Dec 2012 14:41:44 -0800 haskell-artvaluereport2 (1.9.24) unstable; urgency=low * Repair the repair of Dimension values. The repair was being rerun on fixed values because I didn't implement this as a migration. Next step, get past event files with these errors, then remove the fixvalue call. -- Clifford Beshers Sun, 04 Nov 2012 20:33:54 -0800 haskell-artvaluereport2 (1.9.23) unstable; urgency=low * Restrict imageSize to a range, set default. * Repair Dimension menu which had values and labels confused. * Repair events which had the bad Dimension values. -- Clifford Beshers Sat, 03 Nov 2012 18:29:31 -0700 haskell-artvaluereport2 (1.9.22) unstable; urgency=low * unsafePerformIO around logging, error to myerror and MyPrelude to control behind the scene failures. * acid-state updates rewritten to be small. -- Clifford Beshers Thu, 01 Nov 2012 22:25:26 -0700 haskell-artvaluereport2 (1.9.21) unstable; urgency=low * Multiple image upload, client greeting, more Item field revisions. Image captions and print size. -- Clifford Beshers Fri, 26 Oct 2012 09:37:05 -0700 haskell-artvaluereport2 (1.9.20) unstable; urgency=low * Item field revisions. -- Clifford Beshers Fri, 19 Oct 2012 00:42:20 -0700 haskell-artvaluereport2 (1.9.19) unstable; urgency=low * Up the minimum size of the request body. Things were being silently truncated, causing decodeJSON errors. -- Clifford Beshers Sat, 13 Oct 2012 21:44:24 -0700 haskell-artvaluereport2 (1.9.18) unstable; urgency=low * Fix errant widget selector that was causing index out of range when editing item lists. -- Clifford Beshers Thu, 11 Oct 2012 23:40:46 -0700 haskell-artvaluereport2 (1.9.17) unstable; urgency=low * Remove errant undefined in image list reordering. -- Clifford Beshers Thu, 11 Oct 2012 12:00:06 -0700 haskell-artvaluereport2 (1.9.16) unstable; urgency=low * Fix new report, which was returning to the wrong report. Add in the UUID for report ids, as yet unused. -- Clifford Beshers Mon, 01 Oct 2012 18:51:11 -0700 haskell-artvaluereport2 (1.9.15) unstable; urgency=low * Fix some layout issues. Turn off the image croppers until fixed. -- Clifford Beshers Thu, 30 Aug 2012 17:33:25 -0700 haskell-artvaluereport2 (1.9.14) unstable; urgency=low * Small tweaks to the appearance. -- Clifford Beshers Wed, 29 Aug 2012 17:02:15 -0700 haskell-artvaluereport2 (1.9.13) unstable; urgency=low * List editing. Mostly. -- Clifford Beshers Wed, 29 Aug 2012 14:53:55 -0700 haskell-artvaluereport2 (1.9.12) unstable; urgency=low * List editing. Testing and one page (Limiting Conditions.) -- Clifford Beshers Tue, 07 Aug 2012 12:27:04 -0700 haskell-artvaluereport2 (1.9.11) unstable; urgency=low * Open pdf in the same tab by default instead of forcing a new one. * Attach "Property to be Appraised" to reportBriefItems. * Expose ItemsOwner with label Client. -- Clifford Beshers Thu, 19 Jul 2012 11:19:50 -0700 haskell-artvaluereport2 (1.9.10) unstable; urgency=low * Use textAreas in the item editor, resize them based on the data. -- Clifford Beshers Mon, 16 Jul 2012 11:32:14 -0700 haskell-artvaluereport2 (1.9.9) unstable; urgency=low * Fix IntendedUse form. -- Clifford Beshers Mon, 16 Jul 2012 00:08:25 -0700 haskell-artvaluereport2 (1.9.8) unstable; urgency=low * Remove debugging links from home page. * Add missing tab for Certifications -- Clifford Beshers Sun, 15 Jul 2012 12:16:03 -0700 haskell-artvaluereport2 (1.9.7) unstable; urgency=low * Many updates, validating that the PDF is getting closer to what it should be. -- Clifford Beshers Fri, 13 Jul 2012 18:31:05 -0700 haskell-artvaluereport2 (1.9.6) unstable; urgency=low * Item fields restored. They are a list, not a record, which is not handled by Builders.empty, so they needed to be created specially. -- Clifford Beshers Fri, 13 Jul 2012 00:52:00 -0700 haskell-artvaluereport2 (1.9.5) unstable; urgency=low * Image source url sort of working. -- Clifford Beshers Thu, 12 Jul 2012 23:43:46 -0700 haskell-artvaluereport2 (1.9.4) unstable; urgency=low * Image source url start. -- Clifford Beshers Thu, 12 Jul 2012 01:42:52 -0700 haskell-artvaluereport2 (1.9.3) unstable; urgency=low * Merge of big fork. Close to critical mass. -- Clifford Beshers Tue, 10 Jul 2012 21:48:43 -0700 haskell-artvaluereport2 (1.9.2) unstable; urgency=low * Bumping version number to ensure everything is pushed to server, tracking down mysterious new report bug. -- Clifford Beshers Mon, 07 May 2012 16:27:06 -0700 haskell-artvaluereport2 (1.9.1) unstable; urgency=low * Many improvements. -- Clifford Beshers Tue, 01 May 2012 12:14:45 -0700 haskell-artvaluereport2 (1.9.0-1~hackage3) unstable; urgency=low * Add markup for missing image. -- Clifford Beshers Wed, 28 Mar 2012 10:02:45 -0700 haskell-artvaluereport2 (1.9.0-1~hackage2) unstable; urgency=low * Lots of formatting fixes. -- Clifford Beshers Tue, 27 Mar 2012 22:32:41 -0700 haskell-artvaluereport2 (1.9.0-1~hackage1) unstable; urgency=low * Debianization generated by cabal-debian -- Clifford Beshers Wed, 29 Jun 2011 01:01:02 -0700 cabal-debian-5.0/test-data/artvaluereport2/output/0000755000000000000000000000000013530623213020413 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/output/debian/0000755000000000000000000000000013530623213021635 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/output/debian/rules0000644000000000000000000000174513530623213022721 0ustar0000000000000000#!/usr/bin/make -f DEB_SETUP_BIN_NAME = cabal DEB_CABAL_PACKAGE = artvaluereport DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk build/artvaluereport2-staging:: build-ghc-stamp build/artvaluereport2-production:: build-ghc-stamp build/artvaluereport2-development:: build-ghc-stamp build/artvaluereport2-backups:: build-ghc-stamp build/appraisalscope:: build-ghc-stamp binary-fixup/artvaluereport2-staging:: install -Dps dist-ghc/build/artvaluereport2-server/artvaluereport2-server debian/artvaluereport2-staging/usr/bin/artvaluereport2-staging binary-fixup/artvaluereport2-production:: install -Dps dist-ghc/build/artvaluereport2-server/artvaluereport2-server debian/artvaluereport2-production/usr/bin/artvaluereport2-production binary-fixup/artvaluereport2-development:: install -Dps dist-ghc/build/artvaluereport2-server/artvaluereport2-server debian/artvaluereport2-development/usr/bin/artvaluereport2-development cabal-debian-5.0/test-data/artvaluereport2/output/debian/watch0000644000000000000000000000020513530623213022663 0ustar0000000000000000version=3 http://hackage.haskell.org/package/ArtValueReport/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-production.links0000644000000000000000000000017413530623213030226 0ustar0000000000000000/etc/apache2/sites-available/my.appraisalreportonline.com.conf /etc/apache2/sites-enabled/my.appraisalreportonline.com.conf cabal-debian-5.0/test-data/artvaluereport2/output/debian/control0000644000000000000000000001235613530623213023247 0ustar0000000000000000Source: haskell-artvaluereport2 Priority: extra Section: haskell Maintainer: Clifford Beshers Build-Depends: debhelper (>= 9) , haskell-devscripts-minimal | haskell-devscripts (>= 0.8) , cdbs , ghc , ghc-prof , libghc-extra-dev (>= 1.35) , libghc-hjscript-dev , libghc-hatex-dev , libghc-quickcheck2-dev (>= 2) , libghc-rjson-dev , libghc-unixutils-dev , libghc-acid-state-dev (>= 0.6) , libghc-applicative-extras-dev (>= 0.1.5) , libghc-archive-dev (>= 1.2.9) , libghc-artvaluereport-data-dev (>= 1.66) , libghc-authenticate-dev , libghc-blaze-html-dev , libghc-blaze-markup-dev , libghc-cereal-dev , libghc-data-accessor-dev , libghc-debian-dev , libghc-debian-packaging-dev (>= 0.8) , libghc-digestive-functors-dev , libghc-digestive-functors-happstack-dev , libghc-directory-tree-dev , libghc-fb-dev , libghc-groom-dev , libghc-happstack-dev , libghc-happstack-authenticate-dev (>= 2) | libghc-happstack-authenticate-0-dev (<< 2), , libghc-happstack-extra-dev , libghc-happstack-hsp-dev , libghc-happstack-scaffolding-dev (>= 0.23) , libghc-happstack-server-dev , libghc-happstack-util-dev , libghc-harp-dev , libghc-hslogger-dev , libghc-hsp-dev (>= 0.4.4) , libghc-hsx-dev , libghc-html-dev , libghc-html-entities-dev , libghc-ixset-dev , libghc-jmacro-dev (>= 0.6.2) , libghc-json-dev , libghc-language-css-dev , libghc-lifted-base-dev , libghc-mtl-dev , libghc-network-dev (>= 2.4) , libghc-old-locale-dev , libghc-old-time-dev , libghc-pandoc-dev , libghc-parsec3-dev , libghc-process-extras-dev (>= 0.5) , libghc-puremd5-dev , libghc-random-dev , libghc-regex-compat-dev , libghc-revision-dev , libghc-safe-dev , libghc-safecopy-dev (>= 0.5.1) , libghc-syb-dev , libghc-syb-with-class-dev , libghc-tagged-dev , libghc-text-dev , libghc-uniplate-dev , libghc-utf8-string-dev , libghc-web-routes-dev , libghc-web-routes-happstack-dev , libghc-web-routes-hsp-dev , libghc-web-routes-th-dev Standards-Version: 3.9.6 Homepage: http://appraisalreportonline.com X-Description: Haskell modules for fine art appraisal applications Haskell modules for fine art appraisal applications Package: artvaluereport2-backups Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, anacron Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: backup program for the appraisalreportonline.com site Install this somewhere other than where the server is running get automated backups of the database. Package: artvaluereport2-production Architecture: all Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, apache2, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: artvaluereport2-development Architecture: all Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: artvaluereport2-staging Architecture: all Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, libjpeg-progs, libjs-jcrop, libjs-jquery, libjs-jquery-ui, netpbm, texlive-fonts-extra, texlive-fonts-recommended, texlive-latex-extra, texlive-latex-recommended Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: appraisalscope Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: Offline manipulation of appraisal database cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-backups.install0000644000000000000000000000012013530623213030005 0ustar0000000000000000dist-ghc/build/artvaluereport2-backups/artvaluereport2-backups /etc/cron.hourly cabal-debian-5.0/test-data/artvaluereport2/output/debian/appraisalscope.install0000644000000000000000000000015013530623213026227 0ustar0000000000000000dist-ghc/build/appraisalscope/appraisalscope usr/bin dist-ghc/build/lookatareport/lookatareport usr/bin cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-staging.logrotate0000644000000000000000000000026413530623213030354 0ustar0000000000000000/var/log/artvaluereport2-staging/access.log { weekly rotate 5 compress missingok } /var/log/artvaluereport2-staging/app.log { weekly rotate 5 compress missingok } cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-development.init0000644000000000000000000000215213530623213030203 0ustar0000000000000000#! /bin/sh -e . /lib/lsb/init-functions test -f /etc/default/artvaluereport2-development && . /etc/default/artvaluereport2-development case "$1" in start) test -x /usr/bin/artvaluereport2-development || exit 0 log_begin_msg "Starting artvaluereport2-development..." mkdir -p /srv/artvaluereport2-development export ArtValueReport_datadir=/usr/share/ArtValueReport "start-stop-daemon" "--start" "-b" "--make-pidfile" "-d" "/srv/artvaluereport2-development" "--exec" "/usr/bin/artvaluereport2-development" "--pidfile" "/var/run/artvaluereport2-development" "--" "--http-port" "9032" "--base-uri" "http://seereason.com:9032/" "--top" "/srv/artvaluereport2-development" "--logs" "/var/log/artvaluereport2-development" "--log-mode" "Development" "--static" "/usr/share/artvaluereport2-data" "--no-validate" log_end_msg $? ;; stop) log_begin_msg "Stopping artvaluereport2-development..." "start-stop-daemon" "--stop" "--oknodo" "--retry=60" "--pidfile" "/var/run/artvaluereport2-development" log_end_msg $? ;; *) log_success_msg "Usage: ${0} {start|stop}" exit 1 esac exit 0 cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-production.postinst0000644000000000000000000000053413530623213030771 0ustar0000000000000000#!/bin/sh case "$1" in configure) # Apache won't start if this directory doesn't exist mkdir -p /var/log/apache2/artvaluereport2-production # Restart apache so it sees the new file in /etc/apache2/sites-enabled /usr/sbin/a2enmod proxy /usr/sbin/a2enmod proxy_http service apache2 restart ;; esac #DEBHELPER# exit 0 cabal-debian-5.0/test-data/artvaluereport2/output/debian/compat0000644000000000000000000000000213530623213023033 0ustar00000000000000009 cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-development.postinst0000644000000000000000000000010613530623213031120 0ustar0000000000000000#!/bin/sh case "$1" in configure) ;; esac #DEBHELPER# exit 0 cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-production.install0000644000000000000000000000123113530623213030547 0ustar0000000000000000Clouds.jpg usr/share/ArtValueReport/. DataTables-1.8.2 usr/share/ArtValueReport/. Udon.js usr/share/ArtValueReport/. blueprint usr/share/ArtValueReport/. debian/cabalInstall/7e4b5d8641f6fae99e9ae9b2d8893bc7/my.appraisalreportonline.com.conf /etc/apache2/sites-available/ flexbox.css usr/share/ArtValueReport/. html5sortable usr/share/ArtValueReport/. jGFeed usr/share/ArtValueReport/. jquery.blockUI usr/share/ArtValueReport/. jquery.tinyscrollbar usr/share/ArtValueReport/. searchMag.png usr/share/ArtValueReport/. theme/ArtValueReport_SunsetSpectrum.ico usr/share/ArtValueReport/. tweaks.css usr/share/ArtValueReport/. verticalTabs.css usr/share/ArtValueReport/. cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-development.install0000644000000000000000000000104413530623213030705 0ustar0000000000000000Clouds.jpg usr/share/ArtValueReport/. DataTables-1.8.2 usr/share/ArtValueReport/. Udon.js usr/share/ArtValueReport/. blueprint usr/share/ArtValueReport/. flexbox.css usr/share/ArtValueReport/. html5sortable usr/share/ArtValueReport/. jGFeed usr/share/ArtValueReport/. jquery.blockUI usr/share/ArtValueReport/. jquery.tinyscrollbar usr/share/ArtValueReport/. searchMag.png usr/share/ArtValueReport/. theme/ArtValueReport_SunsetSpectrum.ico usr/share/ArtValueReport/. tweaks.css usr/share/ArtValueReport/. verticalTabs.css usr/share/ArtValueReport/. cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-staging.init0000644000000000000000000000207213530623213027316 0ustar0000000000000000#! /bin/sh -e . /lib/lsb/init-functions test -f /etc/default/artvaluereport2-staging && . /etc/default/artvaluereport2-staging case "$1" in start) test -x /usr/bin/artvaluereport2-staging || exit 0 log_begin_msg "Starting artvaluereport2-staging..." mkdir -p /srv/artvaluereport2-staging export ArtValueReport_datadir=/usr/share/ArtValueReport "start-stop-daemon" "--start" "-b" "--make-pidfile" "-d" "/srv/artvaluereport2-staging" "--exec" "/usr/bin/artvaluereport2-staging" "--pidfile" "/var/run/artvaluereport2-staging" "--" "--http-port" "9031" "--base-uri" "http://seereason.com:9031/" "--top" "/srv/artvaluereport2-staging" "--logs" "/var/log/artvaluereport2-staging" "--log-mode" "Development" "--static" "/usr/share/artvaluereport2-data" "--no-validate" log_end_msg $? ;; stop) log_begin_msg "Stopping artvaluereport2-staging..." "start-stop-daemon" "--stop" "--oknodo" "--retry=60" "--pidfile" "/var/run/artvaluereport2-staging" log_end_msg $? ;; *) log_success_msg "Usage: ${0} {start|stop}" exit 1 esac exit 0 cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-backups.postinst0000644000000000000000000000015313530623213030230 0ustar0000000000000000#!/bin/sh case "$1" in configure) /etc/cron.hourly/artvaluereport2-backups --initialize ;; esac cabal-debian-5.0/test-data/artvaluereport2/output/debian/copyright0000644000000000000000000000064213530623213023572 0ustar0000000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: ArtValueReport Upstream-Contact: Clifford Beshers Source: https://hackage.haskell.org/package/ArtValueReport Files: * Copyright: (c) 2008-2011, SeeReason Partners LLC License: AllRightsReserved Files: debian/* Copyright: held by the contributors mentioned in debian/changelog License: AllRightsReserved cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-staging.install0000644000000000000000000000104413530623213030017 0ustar0000000000000000Clouds.jpg usr/share/ArtValueReport/. DataTables-1.8.2 usr/share/ArtValueReport/. Udon.js usr/share/ArtValueReport/. blueprint usr/share/ArtValueReport/. flexbox.css usr/share/ArtValueReport/. html5sortable usr/share/ArtValueReport/. jGFeed usr/share/ArtValueReport/. jquery.blockUI usr/share/ArtValueReport/. jquery.tinyscrollbar usr/share/ArtValueReport/. searchMag.png usr/share/ArtValueReport/. theme/ArtValueReport_SunsetSpectrum.ico usr/share/ArtValueReport/. tweaks.css usr/share/ArtValueReport/. verticalTabs.css usr/share/ArtValueReport/. cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-production.logrotate0000644000000000000000000000064513530623213031111 0ustar0000000000000000/var/log/apache2/artvaluereport2-production/access.log { copytruncate weekly rotate 5 compress missingok } /var/log/apache2/artvaluereport2-production/error.log { copytruncate weekly rotate 5 compress missingok } /var/log/artvaluereport2-production/access.log { weekly rotate 5 compress missingok } /var/log/artvaluereport2-production/app.log { weekly rotate 5 compress missingok } cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-staging.postinst0000644000000000000000000000010613530623213030232 0ustar0000000000000000#!/bin/sh case "$1" in configure) ;; esac #DEBHELPER# exit 0 cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-development.logrotate0000644000000000000000000000027413530623213031243 0ustar0000000000000000/var/log/artvaluereport2-development/access.log { weekly rotate 5 compress missingok } /var/log/artvaluereport2-development/app.log { weekly rotate 5 compress missingok } cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-production.init0000644000000000000000000000214713530623213030053 0ustar0000000000000000#! /bin/sh -e . /lib/lsb/init-functions test -f /etc/default/artvaluereport2-production && . /etc/default/artvaluereport2-production case "$1" in start) test -x /usr/bin/artvaluereport2-production || exit 0 log_begin_msg "Starting artvaluereport2-production..." mkdir -p /srv/artvaluereport2-production export ArtValueReport_datadir=/usr/share/ArtValueReport "start-stop-daemon" "--start" "-b" "--make-pidfile" "-d" "/srv/artvaluereport2-production" "--exec" "/usr/bin/artvaluereport2-production" "--pidfile" "/var/run/artvaluereport2-production" "--" "--http-port" "9027" "--base-uri" "http://my.appraisalreportonline.com/" "--top" "/srv/artvaluereport2-production" "--logs" "/var/log/artvaluereport2-production" "--log-mode" "Production" "--static" "/usr/share/artvaluereport2-data" "--no-validate" log_end_msg $? ;; stop) log_begin_msg "Stopping artvaluereport2-production..." "start-stop-daemon" "--stop" "--oknodo" "--retry=60" "--pidfile" "/var/run/artvaluereport2-production" log_end_msg $? ;; *) log_success_msg "Usage: ${0} {start|stop}" exit 1 esac exit 0 cabal-debian-5.0/test-data/artvaluereport2/output/debian/changelog0000644000000000000000000001526513530623213023520 0ustar0000000000000000haskell-artvaluereport2 (1.9.29) unstable; urgency=low * Add a package for the appraisalscope executable. -- David Fox Fri, 01 Feb 2013 12:34:49 -0800 haskell-artvaluereport2 (1.9.28) unstable; urgency=low * Fix the formatting of the new creation date column in the report list and pave the way for converting the old EpochMilli into UTC time. -- Clifford Beshers Tue, 29 Jan 2013 18:51:00 -0800 haskell-artvaluereport2 (1.9.27) unstable; urgency=low * Report deletion. Reports now in map with key uuid. -- Clifford Beshers Mon, 28 Jan 2013 00:05:49 -0800 haskell-artvaluereport2 (1.9.26) unstable; urgency=low * Add report copying. -- Clifford Beshers Thu, 17 Jan 2013 22:34:49 -0800 haskell-artvaluereport2 (1.9.25) unstable; urgency=low * Myriad. Bump cabal version from 1.9.18. -- David Fox Mon, 17 Dec 2012 14:41:44 -0800 haskell-artvaluereport2 (1.9.24) unstable; urgency=low * Repair the repair of Dimension values. The repair was being rerun on fixed values because I didn't implement this as a migration. Next step, get past event files with these errors, then remove the fixvalue call. -- Clifford Beshers Sun, 04 Nov 2012 20:33:54 -0800 haskell-artvaluereport2 (1.9.23) unstable; urgency=low * Restrict imageSize to a range, set default. * Repair Dimension menu which had values and labels confused. * Repair events which had the bad Dimension values. -- Clifford Beshers Sat, 03 Nov 2012 18:29:31 -0700 haskell-artvaluereport2 (1.9.22) unstable; urgency=low * unsafePerformIO around logging, error to myerror and MyPrelude to control behind the scene failures. * acid-state updates rewritten to be small. -- Clifford Beshers Thu, 01 Nov 2012 22:25:26 -0700 haskell-artvaluereport2 (1.9.21) unstable; urgency=low * Multiple image upload, client greeting, more Item field revisions. Image captions and print size. -- Clifford Beshers Fri, 26 Oct 2012 09:37:05 -0700 haskell-artvaluereport2 (1.9.20) unstable; urgency=low * Item field revisions. -- Clifford Beshers Fri, 19 Oct 2012 00:42:20 -0700 haskell-artvaluereport2 (1.9.19) unstable; urgency=low * Up the minimum size of the request body. Things were being silently truncated, causing decodeJSON errors. -- Clifford Beshers Sat, 13 Oct 2012 21:44:24 -0700 haskell-artvaluereport2 (1.9.18) unstable; urgency=low * Fix errant widget selector that was causing index out of range when editing item lists. -- Clifford Beshers Thu, 11 Oct 2012 23:40:46 -0700 haskell-artvaluereport2 (1.9.17) unstable; urgency=low * Remove errant undefined in image list reordering. -- Clifford Beshers Thu, 11 Oct 2012 12:00:06 -0700 haskell-artvaluereport2 (1.9.16) unstable; urgency=low * Fix new report, which was returning to the wrong report. Add in the UUID for report ids, as yet unused. -- Clifford Beshers Mon, 01 Oct 2012 18:51:11 -0700 haskell-artvaluereport2 (1.9.15) unstable; urgency=low * Fix some layout issues. Turn off the image croppers until fixed. -- Clifford Beshers Thu, 30 Aug 2012 17:33:25 -0700 haskell-artvaluereport2 (1.9.14) unstable; urgency=low * Small tweaks to the appearance. -- Clifford Beshers Wed, 29 Aug 2012 17:02:15 -0700 haskell-artvaluereport2 (1.9.13) unstable; urgency=low * List editing. Mostly. -- Clifford Beshers Wed, 29 Aug 2012 14:53:55 -0700 haskell-artvaluereport2 (1.9.12) unstable; urgency=low * List editing. Testing and one page (Limiting Conditions.) -- Clifford Beshers Tue, 07 Aug 2012 12:27:04 -0700 haskell-artvaluereport2 (1.9.11) unstable; urgency=low * Open pdf in the same tab by default instead of forcing a new one. * Attach "Property to be Appraised" to reportBriefItems. * Expose ItemsOwner with label Client. -- Clifford Beshers Thu, 19 Jul 2012 11:19:50 -0700 haskell-artvaluereport2 (1.9.10) unstable; urgency=low * Use textAreas in the item editor, resize them based on the data. -- Clifford Beshers Mon, 16 Jul 2012 11:32:14 -0700 haskell-artvaluereport2 (1.9.9) unstable; urgency=low * Fix IntendedUse form. -- Clifford Beshers Mon, 16 Jul 2012 00:08:25 -0700 haskell-artvaluereport2 (1.9.8) unstable; urgency=low * Remove debugging links from home page. * Add missing tab for Certifications -- Clifford Beshers Sun, 15 Jul 2012 12:16:03 -0700 haskell-artvaluereport2 (1.9.7) unstable; urgency=low * Many updates, validating that the PDF is getting closer to what it should be. -- Clifford Beshers Fri, 13 Jul 2012 18:31:05 -0700 haskell-artvaluereport2 (1.9.6) unstable; urgency=low * Item fields restored. They are a list, not a record, which is not handled by Builders.empty, so they needed to be created specially. -- Clifford Beshers Fri, 13 Jul 2012 00:52:00 -0700 haskell-artvaluereport2 (1.9.5) unstable; urgency=low * Image source url sort of working. -- Clifford Beshers Thu, 12 Jul 2012 23:43:46 -0700 haskell-artvaluereport2 (1.9.4) unstable; urgency=low * Image source url start. -- Clifford Beshers Thu, 12 Jul 2012 01:42:52 -0700 haskell-artvaluereport2 (1.9.3) unstable; urgency=low * Merge of big fork. Close to critical mass. -- Clifford Beshers Tue, 10 Jul 2012 21:48:43 -0700 haskell-artvaluereport2 (1.9.2) unstable; urgency=low * Bumping version number to ensure everything is pushed to server, tracking down mysterious new report bug. -- Clifford Beshers Mon, 07 May 2012 16:27:06 -0700 haskell-artvaluereport2 (1.9.1) unstable; urgency=low * Many improvements. -- Clifford Beshers Tue, 01 May 2012 12:14:45 -0700 haskell-artvaluereport2 (1.9.0-1~hackage3) unstable; urgency=low * Add markup for missing image. -- Clifford Beshers Wed, 28 Mar 2012 10:02:45 -0700 haskell-artvaluereport2 (1.9.0-1~hackage2) unstable; urgency=low * Lots of formatting fixes. -- Clifford Beshers Tue, 27 Mar 2012 22:32:41 -0700 haskell-artvaluereport2 (1.9.0-1~hackage1) unstable; urgency=low * Debianization generated by cabal-debian -- Clifford Beshers Wed, 29 Jun 2011 01:01:02 -0700 cabal-debian-5.0/test-data/artvaluereport2/output/debian/artvaluereport2-production.dirs0000644000000000000000000000011113530623213030036 0ustar0000000000000000/var/log/apache2/artvaluereport2-production /etc/apache2/sites-available cabal-debian-5.0/test-data/artvaluereport2/output/debian/cabalInstall/0000755000000000000000000000000013530623213024226 5ustar0000000000000000test-data/artvaluereport2/output/debian/cabalInstall/7e4b5d8641f6fae99e9ae9b2d8893bc7/0000755000000000000000000000000013530623213030733 5ustar0000000000000000cabal-debian-5.0output/debian/cabalInstall/7e4b5d8641f6fae99e9ae9b2d8893bc7/my.appraisalreportonline.com.conf0000644000000000000000000000162013530623213037417 0ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2 ServerAdmin logic@seereason.com ServerName www.my.appraisalreportonline.com ServerAlias my.appraisalreportonline.com ErrorLog /var/log/apache2/artvaluereport2-production/error.log CustomLog /var/log/apache2/artvaluereport2-production/access.log combined ProxyRequests Off AllowEncodedSlashes NoDecode AddDefaultCharset off Order deny,allow #Allow from .example.com Deny from all #Allow from all AddDefaultCharset off Order deny,allow #Allow from .example.com #Deny from all Allow from all SetEnv proxy-sendcl 1 ProxyPass / http://127.0.0.1:9027/ nocanon ProxyPassReverse / http://127.0.0.1:9027/ cabal-debian-5.0/test-data/artvaluereport2/output/debian/source/0000755000000000000000000000000013530623213023135 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport2/output/debian/source/format0000644000000000000000000000001513530623213024344 0ustar00000000000000003.0 (native) cabal-debian-5.0/test-data/haskell-devscripts/0000755000000000000000000000000013530623213017521 5ustar0000000000000000cabal-debian-5.0/test-data/haskell-devscripts/debian/0000755000000000000000000000000013530623213020743 5ustar0000000000000000cabal-debian-5.0/test-data/haskell-devscripts/debian/docs0000644000000000000000000000000713530623213021613 0ustar0000000000000000README cabal-debian-5.0/test-data/haskell-devscripts/debian/rules0000644000000000000000000000143513530623213022023 0ustar0000000000000000#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') manpages = $(shell cat debian/manpages) %.1: %.pod pod2man -c 'Haskell devscripts documentation' -r 'Haskell devscripts $(DEB_VERSION)' $< > $@ %.1: % pod2man -c 'Haskell devscripts documentation' -r 'Haskell devscripts $(DEB_VERSION)' $< > $@ .PHONY: build build: $(manpages) install-stamp: dh install .PHONY: install install: install-stamp binary-indep-stamp: install-stamp dh binary-indep touch $@ .PHONY: binary-indep binary-indep: binary-indep-stamp .PHONY: binary-arch binary-arch: install-stamp .PHONY: binary binary: binary-indep-stamp .PHONY: clean clean: dh clean rm -f $(manpages) cabal-debian-5.0/test-data/haskell-devscripts/debian/control0000644000000000000000000000240513530623213022347 0ustar0000000000000000Source: haskell-devscripts Section: haskell Priority: extra Maintainer: Debian Haskell Group Uploaders: Marco Silva , Joachim Breitner Build-Depends: debhelper (>= 7) Build-Depends-Indep: perl Standards-Version: 3.9.4 Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-devscripts Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts Package: haskell-devscripts Architecture: all Depends: dctrl-tools , debhelper , dh-buildinfo , ghc (>= 7.6) , cdbs , ${misc:Depends} , html-xml-utils , hscolour (>= 1.8) , ghc-haddock (>= 7.4) Description: Tools to help Debian developers build Haskell packages This package provides a collection of scripts to help build Haskell packages for Debian. Unlike haskell-utils, this package is not expected to be installed on the machines of end users. . This package is designed to support Cabalized Haskell libraries. It is designed to build a library for each supported Debian compiler or interpreter, generate appropriate postinst/prerm files for each one, generate appropriate substvars entries for each one, and install the package in the Debian temporary area as part of the build process. cabal-debian-5.0/test-data/haskell-devscripts/debian/compat0000644000000000000000000000000213530623213022141 0ustar00000000000000007 cabal-debian-5.0/test-data/haskell-devscripts/debian/copyright0000644000000000000000000000023513530623213022676 0ustar0000000000000000This package was debianized by John Goerzen on Wed, 6 Oct 2004 09:46:14 -0500. Copyright information removed from this test data. cabal-debian-5.0/test-data/haskell-devscripts/debian/dirs0000644000000000000000000000007513530623213021631 0ustar0000000000000000usr/bin usr/share/haskell-devscripts usr/share/cdbs/1/class/ cabal-debian-5.0/test-data/haskell-devscripts/debian/manpages0000644000000000000000000000013513530623213022460 0ustar0000000000000000dh_haskell_provides.1 dh_haskell_depends.1 dh_haskell_shlibdeps.1 dh_haskell_extra_depends.1 cabal-debian-5.0/test-data/haskell-devscripts/debian/install0000644000000000000000000000036513530623213022340 0ustar0000000000000000dh_haskell_provides usr/bin/ dh_haskell_depends usr/bin/ dh_haskell_shlibdeps usr/bin/ dh_haskell_extra_depends usr/bin/ Dh_Haskell.sh usr/share/haskell-devscripts/ hlibrary.mk usr/share/cdbs/1/class cabal-debian-5.0/test-data/haskell-devscripts/debian/changelog0000644000000000000000000000150513530623213022616 0ustar0000000000000000haskell-devscripts (0.8.13) experimental; urgency=low [ Joachim Breitner ] * Improve parsing of "Setup register" output, patch by David Fox * Enable creation of hoogle files, thanks to Kiwamu Okabe for the suggestion. [ Kiwamu Okabe ] * Need --html option to fix bug that --hoogle option don't output html file. * Support to create /usr/lib/ghc-doc/hoogle/*.txt for hoogle package. [ Joachim Breitner ] * Symlink hoogle’s txt files to /usr/lib/ghc-doc/hoogle/ * Bump ghc dependency to 7.6 * Bump standards version -- Joachim Breitner Mon, 08 Oct 2012 21:14:50 +0200 haskell-devscripts (0.8.12) unstable; urgency=low * Depend on ghc >= 7.4, adjusting to its haddock --interface-version behaviour. -- Joachim Breitner Sat, 04 Feb 2012 10:50:33 +0100 cabal-debian-5.0/test-data/haskell-devscripts/debian/source/0000755000000000000000000000000013530623213022243 5ustar0000000000000000cabal-debian-5.0/test-data/haskell-devscripts/debian/source/format0000644000000000000000000000001513530623213023452 0ustar00000000000000003.0 (native) cabal-debian-5.0/test-data/creativeprompts/0000755000000000000000000000000013530623213017141 5ustar0000000000000000cabal-debian-5.0/test-data/creativeprompts/input/0000755000000000000000000000000013530623213020300 5ustar0000000000000000cabal-debian-5.0/test-data/creativeprompts/input/creativeprompts.cabal0000644000000000000000000000642513530623213024522 0ustar0000000000000000Name: creativeprompts Version: 1.5.2 License: AllRightsReserved License-File: debian/copyright Copyright: (c) 2010-2011 SeeReason Partners LLC Author: Jeremy Shaw Maintainer: Jeremy Shaw Stability: Experimental Category: Web Synopsis: creativeprompts.com Description: A social site for sharing story ideas. Cabal-version: >= 1.8 Build-type: Custom Data-files: static/theme/comment-bottom.png static/theme/comment-middle.png static/theme/comment-top.png static/theme/creative-prompts-logo.png static/theme/entry-bottom.png static/theme/entry-middle.png static/theme/entry-top.png static/theme/json2.js static/theme/menu-bar-background.png static/theme/menu-gradient.png static/theme/paint-background.jpg static/theme/site.js static/theme/style.css Flag base4 Description: Choose the even newer, even smaller, split-up base package. Executable creativeprompts-server Main-Is: Main.hs GHC-Options: -threaded -Wall -Wwarn -O2 -rtsopts -fno-warn-name-shadowing -fno-warn-missing-signatures -fwarn-tabs -fno-warn-unused-binds -fno-warn-orphans -fwarn-unused-imports -fno-spec-constr Build-depends: acid-state >= 0.6.0, authenticate >= 0.8.0, blaze-html >= 0.5, blaze-markup, bytestring, containers, debian-packaging >= 0.8, -- PBKDF2 >= 0.3.1 && < 0.4, safecopy >= 0.6.0, directory, extensible-exceptions, Extra, filepath, digestive-functors >= 0.2, digestive-functors-happstack >= 0.1, digestive-functors-hsp >= 0.3.1, happstack-authenticate >= 0.6, -- happstack-extra, happstack-hsp == 7.1.*, ixset, -- happstack-facebook, happstack-server == 7.0.*, HJScript, hslogger, hsx >= 0.10.2 && < 0.11, hsp >= 0.7.1 && < 0.8, HTTP, jmacro, json, mtl, network, old-time, old-locale, parsec, process, QuickCheck, random, text >= 0.11, time, unix, Unixutils >= 1.29, Unixutils-shadow, utf8-string, web-routes >= 0.26.2, web-routes-happstack, web-routes-hsp, web-routes-th, xss-sanitize >= 0.3.0.1 if !os(windows) -- Cabal has a bug on windows and cannot find trhsx Build-Tools: trhsx if flag(base4) Build-Depends: base >= 4 && < 5, syb Executable creativeprompts-backups Main-Is: Backups.hs GHC-Options: -threaded -Wall -Wwarn -O2 -rtsopts -fno-warn-name-shadowing -fno-warn-missing-signatures -fwarn-tabs -fno-warn-unused-binds -fno-warn-orphans -fwarn-unused-imports -fno-spec-constr Build-depends: archive >= 1.2.9, base, Extra cabal-debian-5.0/test-data/creativeprompts/input/debian/0000755000000000000000000000000013530623213021522 5ustar0000000000000000cabal-debian-5.0/test-data/creativeprompts/input/debian/copyright0000644000000000000000000000021613530623213023454 0ustar0000000000000000This package is not part of the Debian GNU/Linux distribution. Copyright: (c) 2010-2011, SeeReason Partners LLC License: All Rights Reserved cabal-debian-5.0/test-data/creativeprompts/input/debian/changelog0000644000000000000000000001062213530623213023375 0ustar0000000000000000haskell-creativeprompts (1.5.2) unstable; urgency=low * Updated to hsx 0.10 -- Jeremy Shaw Tue, 24 Apr 2012 14:16:12 -0500 haskell-creativeprompts (1.5.1) unstable; urgency=low * Updated to safecopy / acid-state 0.6.0 -- Jeremy Shaw Tue, 15 Nov 2011 21:28:31 -0600 haskell-creativeprompts (1.4.1) unstable; urgency=low * Updated to web-routes-0.26.2 -- Jeremy Shaw Fri, 07 Oct 2011 21:49:47 -0500 haskell-creativeprompts (1.4.0) unstable; urgency=low * Updated to latest happstack-authenticate -- Jeremy Shaw Tue, 27 Sep 2011 19:13:21 -0500 haskell-creativeprompts (1.3.0) unstable; urgency=low * Upgrade to latest ixset * Upgrade to latest xss-sanitize * Remove old happstack-data code -- Jeremy Shaw Mon, 19 Sep 2011 17:15:11 -0500 haskell-creativeprompts (1.2.1) unstable; urgency=low * Update textareas to reflect the swap order of col/row params -- Jeremy Shaw Sun, 21 Aug 2011 14:20:43 -0500 haskell-creativeprompts (1.2.0) unstable; urgency=low * Migrated to acid-state -- Jeremy Shaw Sat, 16 Jul 2011 11:39:15 -0500 haskell-creativeprompts (1.1.6) unstable; urgency=low * Updated to new digestive-functors >= 0.1 and friends -- Jeremy Shaw Tue, 03 May 2011 16:30:46 -0500 haskell-creativeprompts (1.1.5) unstable; urgency=low * Updated theme -- Jeremy Shaw Sat, 16 Apr 2011 17:56:52 -0500 haskell-creativeprompts (1.1.4) unstable; urgency=low * Add -rtsopts to GHC-Options and pass +RTS -IO to the server at startup. -- David Fox Wed, 13 Apr 2011 21:40:26 -0700 haskell-creativeprompts (1.1.3) unstable; urgency=low * Minor update to the copy -- Jeremy Shaw Wed, 13 Apr 2011 16:10:35 -0500 haskell-creativeprompts (1.1.2) unstable; urgency=low * Added a little more copy to the pages -- Jeremy Shaw Mon, 04 Apr 2011 14:17:16 -0500 haskell-creativeprompts (1.1.1) unstable; urgency=low * Added back editProfilePage * Fixed entry top img render issues with ie -- Jeremy Shaw Wed, 30 Mar 2011 23:09:05 -0500 haskell-creativeprompts (1.1.0) unstable; urgency=low * Migration to happstack-authentication -- Jeremy Shaw Mon, 28 Mar 2011 10:35:20 -0500 haskell-creativeprompts (1.0.6) unstable; urgency=low * Updated to authenticate 0.8.0 -- Jeremy Shaw Wed, 23 Feb 2011 10:55:47 -0600 haskell-creativeprompts (1.0.5) unstable; urgency=low * Include author name in prompt * Add build dependency on happstack-hsp * Add ability to edit a prompt after you have submitted it -- Jeremy Shaw Mon, 24 Jan 2011 18:43:07 -0600 haskell-creativeprompts (1.0.4) unstable; urgency=low * Automatically add to Moderator powers as well when becoming an Admin * Fixed two typos related to becoming admin -- Jeremy Shaw Thu, 20 Jan 2011 16:18:08 -0600 haskell-creativeprompts (1.0.3) unstable; urgency=low * Switch admin group from 'admin' to 'seereason' -- Jeremy Shaw Thu, 20 Jan 2011 15:50:50 -0600 haskell-creativeprompts (1.0.2) unstable; urgency=low * Minor theme cleanups -- Jeremy Shaw Thu, 20 Jan 2011 15:46:47 -0600 haskell-creativeprompts (1.0.1) unstable; urgency=low * fix login to use baseURI from webConf -- Jeremy Shaw Thu, 20 Jan 2011 14:01:25 -0600 haskell-creativeprompts (1.0.0) unstable; urgency=low * Fixed build issue * Fixed title for prompt page -- Jeremy Shaw Thu, 20 Jan 2011 13:30:41 -0600 haskell-creativeprompts (0.0.4) unstable; urgency=low * Add a backup package. -- David Fox Mon, 03 Jan 2011 13:27:15 -0800 haskell-creativeprompts (0.0.3) unstable; urgency=low * Add analytics to coming soon page as well -- Jeremy Shaw Mon, 13 Dec 2010 17:30:04 -0600 haskell-creativeprompts (0.0.2) unstable; urgency=low * Added analytics code -- Jeremy Shaw Mon, 13 Dec 2010 16:26:18 -0600 haskell-creativeprompts (0.0.1) unstable; urgency=low * Debianization generated by cabal-debian -- Jeremy Shaw Sun, 05 Dec 2010 10:58:18 -0600 cabal-debian-5.0/test-data/creativeprompts/output/0000755000000000000000000000000013530623213020501 5ustar0000000000000000cabal-debian-5.0/test-data/creativeprompts/output/debian/0000755000000000000000000000000013530623213021723 5ustar0000000000000000cabal-debian-5.0/test-data/creativeprompts/output/debian/rules0000644000000000000000000000141113530623213022775 0ustar0000000000000000#!/usr/bin/make -f DEB_SETUP_BIN_NAME = cabal DEB_CABAL_PACKAGE = creativeprompts DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk build/creativeprompts-production:: build-ghc-stamp build/creativeprompts-development:: build-ghc-stamp build/creativeprompts-data:: build-ghc-stamp build/creativeprompts-backups:: build-ghc-stamp binary-fixup/creativeprompts-production:: install -Dps dist-ghc/build/creativeprompts-server/creativeprompts-server debian/creativeprompts-production/usr/bin/creativeprompts-production binary-fixup/creativeprompts-development:: install -Dps dist-ghc/build/creativeprompts-server/creativeprompts-server debian/creativeprompts-development/usr/bin/creativeprompts-development cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-backups.postinst0000644000000000000000000000015313530623213030404 0ustar0000000000000000#!/bin/sh case "$1" in configure) /etc/cron.hourly/creativeprompts-backups --initialize ;; esac cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-production.init0000644000000000000000000000230013530623213030216 0ustar0000000000000000#! /bin/sh -e . /lib/lsb/init-functions test -f /etc/default/creativeprompts-production && . /etc/default/creativeprompts-production case "$1" in start) test -x /usr/bin/creativeprompts-production || exit 0 log_begin_msg "Starting creativeprompts-production..." mkdir -p /srv/creativeprompts-production export creativeprompts_datadir=/usr/share/creativeprompts "start-stop-daemon" "--start" "-b" "--make-pidfile" "-d" "/srv/creativeprompts-production" "--exec" "/usr/bin/creativeprompts-production" "--pidfile" "/var/run/creativeprompts-production" "--" "--http-port" "9022" "--hide-port" "--hostname" "creativeprompts.com" "--top" "/srv/creativeprompts-production" "--enable-analytics" "--jquery-path" "/usr/share/javascript/jquery/" "--jqueryui-path" "/usr/share/javascript/jquery-ui/" "--jstree-path" "/usr/share/clckwrks-0.13.2/jstree" "--json2-path" "/usr/share/clckwrks-0.13.2/json2" log_end_msg $? ;; stop) log_begin_msg "Stopping creativeprompts-production..." "start-stop-daemon" "--stop" "--oknodo" "--retry=60" "--pidfile" "/var/run/creativeprompts-production" log_end_msg $? ;; *) log_success_msg "Usage: ${0} {start|stop}" exit 1 esac exit 0 cabal-debian-5.0/test-data/creativeprompts/output/debian/watch0000644000000000000000000000020613530623213022752 0ustar0000000000000000version=3 http://hackage.haskell.org/package/creativeprompts/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/test-data/creativeprompts/output/debian/control0000644000000000000000000000763613530623213023342 0ustar0000000000000000Source: haskell-creativeprompts Maintainer: Jeremy Shaw Priority: extra Section: haskell Build-Depends: debhelper (>= 9) , haskell-devscripts-minimal | haskell-devscripts (>= 0.8) , cdbs , ghc , ghc-prof , libghc-extra-dev , libghc-hjscript-dev , libghc-http-dev , libghc-quickcheck2-dev (>= 2) | libghc-quickcheck1-dev (<< 2) , libghc-unixutils-dev (>= 1.29) , libghc-unixutils-shadow-dev , libghc-acid-state-dev (>= 0.6.0) , libghc-archive-dev (>= 1.2.9) , libghc-authenticate-dev (>= 0.8.0) , libghc-blaze-html-dev (>= 0.5) , libghc-blaze-markup-dev , libghc-debian-packaging-dev (>= 0.8) , libghc-digestive-functors-dev (>= 0.2) , libghc-digestive-functors-happstack-dev (>= 0.1) , libghc-digestive-functors-hsp-dev (>= 0.3.1) , libghc-extensible-exceptions-dev , libghc-happstack-authenticate-dev (>= 0.6) , libghc-happstack-hsp-dev (>= 7.1) , libghc-happstack-hsp-dev (<< 7.2) , libghc-happstack-server-dev (>= 7.0) , libghc-happstack-server-dev (<< 7.1) , libghc-hslogger-dev , libghc-hsp-dev (>= 0.7.1) , libghc-hsp-dev (<< 0.8) , libghc-hsx-dev (>= 0.10.2) , libghc-hsx-dev (<< 0.11) , libghc-ixset-dev , libghc-jmacro-dev , libghc-json-dev , libghc-mtl-dev , libghc-network-dev , libghc-old-locale-dev , libghc-old-time-dev , libghc-parsec3-dev (>= 3) | libghc-parsec2-dev (<< 3) , libghc-random-dev , libghc-safecopy-dev (>= 0.6.0) , libghc-syb-dev , libghc-text-dev (>= 0.11) , libghc-utf8-string-dev , libghc-web-routes-dev (>= 0.26.2) , libghc-web-routes-happstack-dev , libghc-web-routes-hsp-dev , libghc-web-routes-th-dev , libghc-xss-sanitize-dev (>= 0.3.0.1) , haskell-hsx-utils Standards-Version: 3.8.1 X-Description: creativeprompts.com A social site for sharing story ideas. Package: creativeprompts-data Architecture: all Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: creativeprompts.com data files Static data files for creativeprompts.com Package: creativeprompts-production Architecture: all Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, markdown, Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: Configuration for running the creativeprompts.com server Production version of the blog server, runs on port 9021 with HTML validation turned off. Package: creativeprompts-development Architecture: all Section: misc Depends: ${haskell:Depends} ${misc:Depends}, markdown, Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: Configuration for running the creativeprompts.com server Testing version of the blog server, runs on port 8000 with HTML validation turned on. Package: creativeprompts-backups Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, anacron Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: backup program for creativeprompts.com Install this somewhere other than creativeprompts.com to run automated backups of the database. cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-production.install0000644000000000000000000000015313530623213030725 0ustar0000000000000000debian/cabalInstall/a1cb9e4b5241944a3da44e00220b5c31/creativeprompts.com.conf /etc/apache2/sites-available/cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-production.postinst0000644000000000000000000000053413530623213031145 0ustar0000000000000000#!/bin/sh case "$1" in configure) # Apache won't start if this directory doesn't exist mkdir -p /var/log/apache2/creativeprompts-production # Restart apache so it sees the new file in /etc/apache2/sites-enabled /usr/sbin/a2enmod proxy /usr/sbin/a2enmod proxy_http service apache2 restart ;; esac #DEBHELPER# exit 0 cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-production.dirs0000644000000000000000000000011013530623213030211 0ustar0000000000000000/etc/apache2/sites-available /var/log/apache2/creativeprompts-productioncabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-production.logrotate0000644000000000000000000000064513530623213031265 0ustar0000000000000000/var/log/apache2/creativeprompts-production/access.log { copytruncate weekly rotate 5 compress missingok } /var/log/apache2/creativeprompts-production/error.log { copytruncate weekly rotate 5 compress missingok } /var/log/creativeprompts-production/access.log { weekly rotate 5 compress missingok } /var/log/creativeprompts-production/app.log { weekly rotate 5 compress missingok } cabal-debian-5.0/test-data/creativeprompts/output/debian/compat0000644000000000000000000000000213530623213023121 0ustar00000000000000009 cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-backups.install0000644000000000000000000000011713530623213030167 0ustar0000000000000000dist-ghc/build/creativeprompts-backups/creativeprompts-backups /etc/cron.hourlycabal-debian-5.0/test-data/creativeprompts/output/debian/copyright0000644000000000000000000000021613530623213023655 0ustar0000000000000000This package is not part of the Debian GNU/Linux distribution. Copyright: (c) 2010-2011, SeeReason Partners LLC License: All Rights Reserved cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-production.links0000644000000000000000000000015113530623213030375 0ustar0000000000000000/etc/apache2/sites-available/creativeprompts.com.conf /etc/apache2/sites-enabled/creativeprompts.com.confcabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-development.postinst0000644000000000000000000000010613530623213031274 0ustar0000000000000000#!/bin/sh case "$1" in configure) ;; esac #DEBHELPER# exit 0 cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-development.init0000644000000000000000000000231313530623213030356 0ustar0000000000000000#! /bin/sh -e . /lib/lsb/init-functions test -f /etc/default/creativeprompts-development && . /etc/default/creativeprompts-development case "$1" in start) test -x /usr/bin/creativeprompts-development || exit 0 log_begin_msg "Starting creativeprompts-development..." mkdir -p /srv/creativeprompts-development export creativeprompts_datadir=/usr/share/creativeprompts "start-stop-daemon" "--start" "-b" "--make-pidfile" "-d" "/srv/creativeprompts-development" "--exec" "/usr/bin/creativeprompts-development" "--pidfile" "/var/run/creativeprompts-development" "--" "--http-port" "9034" "--hide-port" "--hostname" "creativeprompts.com" "--top" "/srv/creativeprompts-development" "--enable-analytics" "--jquery-path" "/usr/share/javascript/jquery/" "--jqueryui-path" "/usr/share/javascript/jquery-ui/" "--jstree-path" "/usr/share/clckwrks-0.13.2/jstree" "--json2-path" "/usr/share/clckwrks-0.13.2/json2" log_end_msg $? ;; stop) log_begin_msg "Stopping creativeprompts-development..." "start-stop-daemon" "--stop" "--oknodo" "--retry=60" "--pidfile" "/var/run/creativeprompts-development" log_end_msg $? ;; *) log_success_msg "Usage: ${0} {start|stop}" exit 1 esac exit 0 cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-data.install0000644000000000000000000000163013530623213027451 0ustar0000000000000000./static/theme/comment-bottom.png usr/share/creativeprompts/static/theme ./static/theme/comment-middle.png usr/share/creativeprompts/static/theme ./static/theme/comment-top.png usr/share/creativeprompts/static/theme ./static/theme/creative-prompts-logo.png usr/share/creativeprompts/static/theme ./static/theme/entry-bottom.png usr/share/creativeprompts/static/theme ./static/theme/entry-middle.png usr/share/creativeprompts/static/theme ./static/theme/entry-top.png usr/share/creativeprompts/static/theme ./static/theme/json2.js usr/share/creativeprompts/static/theme ./static/theme/menu-bar-background.png usr/share/creativeprompts/static/theme ./static/theme/menu-gradient.png usr/share/creativeprompts/static/theme ./static/theme/paint-background.jpg usr/share/creativeprompts/static/theme ./static/theme/site.js usr/share/creativeprompts/static/theme ./static/theme/style.css usr/share/creativeprompts/static/theme cabal-debian-5.0/test-data/creativeprompts/output/debian/creativeprompts-development.logrotate0000644000000000000000000000027413530623213031417 0ustar0000000000000000/var/log/creativeprompts-development/access.log { weekly rotate 5 compress missingok } /var/log/creativeprompts-development/app.log { weekly rotate 5 compress missingok } cabal-debian-5.0/test-data/creativeprompts/output/debian/changelog0000644000000000000000000001062113530623213023575 0ustar0000000000000000haskell-creativeprompts (1.5.2) unstable; urgency=low * Updated to hsx 0.10 -- Jeremy Shaw Tue, 24 Apr 2012 14:16:12 -0500 haskell-creativeprompts (1.5.1) unstable; urgency=low * Updated to safecopy / acid-state 0.6.0 -- Jeremy Shaw Tue, 15 Nov 2011 21:28:31 -0600 haskell-creativeprompts (1.4.1) unstable; urgency=low * Updated to web-routes-0.26.2 -- Jeremy Shaw Fri, 07 Oct 2011 21:49:47 -0500 haskell-creativeprompts (1.4.0) unstable; urgency=low * Updated to latest happstack-authenticate -- Jeremy Shaw Tue, 27 Sep 2011 19:13:21 -0500 haskell-creativeprompts (1.3.0) unstable; urgency=low * Upgrade to latest ixset * Upgrade to latest xss-sanitize * Remove old happstack-data code -- Jeremy Shaw Mon, 19 Sep 2011 17:15:11 -0500 haskell-creativeprompts (1.2.1) unstable; urgency=low * Update textareas to reflect the swap order of col/row params -- Jeremy Shaw Sun, 21 Aug 2011 14:20:43 -0500 haskell-creativeprompts (1.2.0) unstable; urgency=low * Migrated to acid-state -- Jeremy Shaw Sat, 16 Jul 2011 11:39:15 -0500 haskell-creativeprompts (1.1.6) unstable; urgency=low * Updated to new digestive-functors >= 0.1 and friends -- Jeremy Shaw Tue, 03 May 2011 16:30:46 -0500 haskell-creativeprompts (1.1.5) unstable; urgency=low * Updated theme -- Jeremy Shaw Sat, 16 Apr 2011 17:56:52 -0500 haskell-creativeprompts (1.1.4) unstable; urgency=low * Add -rtsopts to GHC-Options and pass +RTS -IO to the server at startup. -- David Fox Wed, 13 Apr 2011 21:40:26 -0700 haskell-creativeprompts (1.1.3) unstable; urgency=low * Minor update to the copy -- Jeremy Shaw Wed, 13 Apr 2011 16:10:35 -0500 haskell-creativeprompts (1.1.2) unstable; urgency=low * Added a little more copy to the pages -- Jeremy Shaw Mon, 04 Apr 2011 14:17:16 -0500 haskell-creativeprompts (1.1.1) unstable; urgency=low * Added back editProfilePage * Fixed entry top img render issues with ie -- Jeremy Shaw Wed, 30 Mar 2011 23:09:05 -0500 haskell-creativeprompts (1.1.0) unstable; urgency=low * Migration to happstack-authentication -- Jeremy Shaw Mon, 28 Mar 2011 10:35:20 -0500 haskell-creativeprompts (1.0.6) unstable; urgency=low * Updated to authenticate 0.8.0 -- Jeremy Shaw Wed, 23 Feb 2011 10:55:47 -0600 haskell-creativeprompts (1.0.5) unstable; urgency=low * Include author name in prompt * Add build dependency on happstack-hsp * Add ability to edit a prompt after you have submitted it -- Jeremy Shaw Mon, 24 Jan 2011 18:43:07 -0600 haskell-creativeprompts (1.0.4) unstable; urgency=low * Automatically add to Moderator powers as well when becoming an Admin * Fixed two typos related to becoming admin -- Jeremy Shaw Thu, 20 Jan 2011 16:18:08 -0600 haskell-creativeprompts (1.0.3) unstable; urgency=low * Switch admin group from 'admin' to 'seereason' -- Jeremy Shaw Thu, 20 Jan 2011 15:50:50 -0600 haskell-creativeprompts (1.0.2) unstable; urgency=low * Minor theme cleanups -- Jeremy Shaw Thu, 20 Jan 2011 15:46:47 -0600 haskell-creativeprompts (1.0.1) unstable; urgency=low * fix login to use baseURI from webConf -- Jeremy Shaw Thu, 20 Jan 2011 14:01:25 -0600 haskell-creativeprompts (1.0.0) unstable; urgency=low * Fixed build issue * Fixed title for prompt page -- Jeremy Shaw Thu, 20 Jan 2011 13:30:41 -0600 haskell-creativeprompts (0.0.4) unstable; urgency=low * Add a backup package. -- David Fox Mon, 03 Jan 2011 13:27:15 -0800 haskell-creativeprompts (0.0.3) unstable; urgency=low * Add analytics to coming soon page as well -- Jeremy Shaw Mon, 13 Dec 2010 17:30:04 -0600 haskell-creativeprompts (0.0.2) unstable; urgency=low * Added analytics code -- Jeremy Shaw Mon, 13 Dec 2010 16:26:18 -0600 haskell-creativeprompts (0.0.1) unstable; urgency=low * Debianization generated by cabal-debian -- Jeremy Shaw Sun, 05 Dec 2010 10:58:18 -0600 cabal-debian-5.0/test-data/creativeprompts/output/debian/cabalInstall/0000755000000000000000000000000013530623213024314 5ustar0000000000000000test-data/creativeprompts/output/debian/cabalInstall/a1cb9e4b5241944a3da44e00220b5c31/0000755000000000000000000000000013530623213030474 5ustar0000000000000000cabal-debian-5.0creativeprompts/output/debian/cabalInstall/a1cb9e4b5241944a3da44e00220b5c31/creativeprompts.com.conf0000644000000000000000000000157613530623213035360 0ustar0000000000000000cabal-debian-5.0/test-data ServerAdmin logic@seereason.com ServerName www.creativeprompts.com ServerAlias creativeprompts.com ErrorLog /var/log/apache2/creativeprompts-production/error.log CustomLog /var/log/apache2/creativeprompts-production/access.log combined ProxyRequests Off AllowEncodedSlashes NoDecode AddDefaultCharset off Order deny,allow #Allow from .example.com Deny from all #Allow from all AddDefaultCharset off Order deny,allow #Allow from .example.com #Deny from all Allow from all SetEnv proxy-sendcl 1 ProxyPass / http://127.0.0.1:9022/ nocanon ProxyPassReverse / http://127.0.0.1:9022/ cabal-debian-5.0/test-data/creativeprompts/output/debian/source/0000755000000000000000000000000013530623213023223 5ustar0000000000000000cabal-debian-5.0/test-data/creativeprompts/output/debian/source/format0000644000000000000000000000001513530623213024432 0ustar00000000000000003.0 (native) cabal-debian-5.0/test-data/alex/0000755000000000000000000000000013530623213014643 5ustar0000000000000000cabal-debian-5.0/test-data/alex/input/0000755000000000000000000000000013530623213016002 5ustar0000000000000000cabal-debian-5.0/test-data/alex/input/alex.cabal0000644000000000000000000000403413530623213017720 0ustar0000000000000000name: alex version: 3.0.2 license: BSD3 license-file: LICENSE copyright: (c) Chis Dornan, Simon Marlow author: Chris Dornan and Simon Marlow maintainer: Simon Marlow bug-reports: mailto:marlowsd@gmail.com stability: stable homepage: http://www.haskell.org/alex/ synopsis: Alex is a tool for generating lexical analysers in Haskell category: Development cabal-version: >= 1.6 build-type: Custom extra-source-files: ANNOUNCE README TODO alex.spec doc/Makefile doc/aclocal.m4 doc/alex.1.in doc/alex.xml doc/config.mk.in doc/configure.ac doc/docbook-xml.mk doc/fptools.css examples/Makefile examples/Tokens.x examples/Tokens_gscan.x examples/Tokens_posn.x examples/examples.x examples/haskell.x examples/lit.x examples/pp.x examples/state.x examples/tiny.y examples/tkns.hs examples/words.x examples/words_monad.x examples/words_posn.x src/Parser.y src/Scan.hs src/ghc_hooks.c templates/GenericTemplate.hs templates/Makefile templates/wrappers.hs tests/Makefile tests/simple.x tests/tokens.x tests/tokens_gscan.x tests/tokens_posn.x tests/tokens_bytestring.x tests/tokens_posn_bytestring.x tests/tokens_strict_bytestring.x tests/unicode.x source-repository head type: git location: https://github.com/simonmar/alex.git flag small_base description: Choose the new smaller, split-up base package. executable alex hs-source-dirs: src main-is: Main.hs if flag(small_base) build-depends: base >= 2.1, array, containers, directory else build-depends: base >= 1.0 build-depends: base < 5 -- build-depends: Ranged-sets build-depends: QuickCheck >=2 extensions: CPP ghc-options: -Wall -rtsopts other-modules: AbsSyn CharSet DFA DFAMin DFS Info Main Map NFA Output Parser ParseMonad Scan Set Sort Util UTF8 Data.Ranged Data.Ranged.Boundaries Data.Ranged.RangedSet Data.Ranged.Ranges cabal-debian-5.0/test-data/alex/input/LICENSE0000644000000000000000000000301713530623213017010 0ustar0000000000000000Copyright (c) 1995-2011, Chris Dornan and Simon Marlow All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holders, nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cabal-debian-5.0/test-data/alex/output/0000755000000000000000000000000013530623213016203 5ustar0000000000000000cabal-debian-5.0/test-data/alex/output/debian/0000755000000000000000000000000013530623213017425 5ustar0000000000000000cabal-debian-5.0/test-data/alex/output/debian/rules0000644000000000000000000000033313530623213020501 0ustar0000000000000000#!/usr/bin/make -f DEB_SETUP_BIN_NAME = cabal DEB_CABAL_PACKAGE = alex DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk build/alex:: build-ghc-stamp cabal-debian-5.0/test-data/alex/output/debian/watch0000644000000000000000000000017313530623213020457 0ustar0000000000000000version=3 http://hackage.haskell.org/package/alex/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/test-data/alex/output/debian/control0000644000000000000000000000145013530623213021030 0ustar0000000000000000Source: haskell-alex Priority: extra Section: haskell Maintainer: Simon Marlow Build-Depends: debhelper (>= 9), haskell-devscripts-minimal | haskell-devscripts (>= 0.8), cdbs, ghc, ghc-prof, alex, libghc-quickcheck2-dev (>= 2), Standards-Version: 3.9.6 Homepage: http://www.haskell.org/alex/ X-Description: Alex is a tool for generating lexical analysers in Haskell Package: alex Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} cabal-debian-5.0/test-data/alex/output/debian/alex.install0000644000000000000000000000112313530623213021743 0ustar0000000000000000AlexTemplate usr/share/alex/. AlexTemplate-debug usr/share/alex/. AlexTemplate-ghc usr/share/alex/. AlexTemplate-ghc-debug usr/share/alex/. AlexWrapper-basic usr/share/alex/. AlexWrapper-basic-bytestring usr/share/alex/. AlexWrapper-gscan usr/share/alex/. AlexWrapper-monad usr/share/alex/. AlexWrapper-monad-bytestring usr/share/alex/. AlexWrapper-monadUserState usr/share/alex/. AlexWrapper-monadUserState-bytestring usr/share/alex/. AlexWrapper-posn usr/share/alex/. AlexWrapper-posn-bytestring usr/share/alex/. AlexWrapper-strict-bytestring usr/share/alex/. dist-ghc/build/alex/alex usr/bin cabal-debian-5.0/test-data/alex/output/debian/compat0000644000000000000000000000000213530623213020623 0ustar00000000000000009 cabal-debian-5.0/test-data/alex/output/debian/copyright0000644000000000000000000000364613530623213021371 0ustar0000000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: alex Upstream-Contact: Simon Marlow Source: https://hackage.haskell.org/package/alex Files: * Copyright: (c) Chis Dornan, Simon Marlow License: BSD3 Files: debian/* Copyright: held by the contributors mentioned in debian/changelog License: BSD3 License: BSD3 Copyright (c) 1995-2011, Chris Dornan and Simon Marlow All rights reserved. . Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * Neither the name of the copyright holders, nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cabal-debian-5.0/test-data/alex/output/debian/changelog0000644000000000000000000000022513530623213021276 0ustar0000000000000000haskell-alex (3.0.2-1~hackage1) UNRELEASED; urgency=low * Initial release -- Simon Marlow Thu, 31 Jan 2013 10:51:47 -0800 cabal-debian-5.0/test-data/alex/output/debian/source/0000755000000000000000000000000013530623213020725 5ustar0000000000000000cabal-debian-5.0/test-data/alex/output/debian/source/format0000644000000000000000000000001513530623213022134 0ustar00000000000000003.0 (native) cabal-debian-5.0/test-data/archive/0000755000000000000000000000000013530623213015333 5ustar0000000000000000cabal-debian-5.0/test-data/archive/input/0000755000000000000000000000000013530623213016472 5ustar0000000000000000cabal-debian-5.0/test-data/archive/input/seereason-darcs-backups.cabal0000644000000000000000000000155313530623213024166 0ustar0000000000000000Name: seereason-darcs-backups Version: 0.9 License: AllRightsReserved License-File: debian/copyright Copyright: (c) 2010-2011, SeeReason Partners LLC Author: SeeReason Partners Maintainer: SeeReason Partners Synopsis: Backups of the seereason darcs repositories Description: Install this somewhere other than where the server is running get automated backups of the database. Build-Type: Custom Category: Web, Language Cabal-version: >= 1.2 Executable seereason-darcs-backups Main-Is: Backups.hs GHC-Options: -threaded -Wall -Wwarn -O2 -fno-warn-name-shadowing -fno-warn-missing-signatures -fwarn-tabs -fno-warn-unused-binds -fno-warn-orphans -fwarn-unused-imports -fno-spec-constr Build-depends: archive >= 1.7, base, Extra, network cabal-debian-5.0/test-data/archive/input/debian/0000755000000000000000000000000013530623213017714 5ustar0000000000000000cabal-debian-5.0/test-data/archive/input/debian/copyright0000644000000000000000000000021613530623213021646 0ustar0000000000000000This package is not part of the Debian GNU/Linux distribution. Copyright: (c) 2010-2011, SeeReason Partners LLC License: All Rights Reserved cabal-debian-5.0/test-data/archive/input/debian/changelog0000644000000000000000000000050413530623213021565 0ustar0000000000000000seereason-darcs-backups (0.9) unstable; urgency=low * New package to pull backups of our darcs repositories from our server, and eventually anything else which is precious and not otherwise backed up. * Debianization generated by cabal-debian -- David Fox Sat, 23 Nov 2013 07:27:06 -0800 cabal-debian-5.0/test-data/archive/output/0000755000000000000000000000000013530623213016673 5ustar0000000000000000cabal-debian-5.0/test-data/archive/output/debian/0000755000000000000000000000000013530623213020115 5ustar0000000000000000cabal-debian-5.0/test-data/archive/output/debian/rules0000644000000000000000000000040113530623213021165 0ustar0000000000000000#!/usr/bin/make -f DEB_SETUP_BIN_NAME = cabal DEB_CABAL_PACKAGE = seereason-darcs-backups DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk build/seereason-darcs-backups:: build-ghc-stamp cabal-debian-5.0/test-data/archive/output/debian/watch0000644000000000000000000000021613530623213021145 0ustar0000000000000000version=3 http://hackage.haskell.org/package/seereason-darcs-backups/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/test-data/archive/output/debian/control0000644000000000000000000000164613530623213021527 0ustar0000000000000000Source: seereason-darcs-backups Priority: extra Maintainer: David Fox Section: haskell Build-Depends: debhelper (>= 9) , haskell-devscripts-minimal | haskell-devscripts (>= 0.8) , cdbs , ghc , ghc-prof , libghc-extra-dev , libghc-archive-dev (>= 1.7) , libghc-network-dev Standards-Version: 3.8.1 X-Description: Backups of the seereason darcs repositories Install this somewhere other than where the server is running get automated backups of the database. Package: seereason-darcs-backups Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, anacron Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} cabal-debian-5.0/test-data/archive/output/debian/seereason-darcs-backups.install0000644000000000000000000000012013530623213026202 0ustar0000000000000000dist-ghc/build/seereason-darcs-backups/seereason-darcs-backups /etc/cron.hourly cabal-debian-5.0/test-data/archive/output/debian/compat0000644000000000000000000000000213530623213021313 0ustar00000000000000009 cabal-debian-5.0/test-data/archive/output/debian/copyright0000644000000000000000000000021613530623213022047 0ustar0000000000000000This package is not part of the Debian GNU/Linux distribution. Copyright: (c) 2010-2011, SeeReason Partners LLC License: All Rights Reserved cabal-debian-5.0/test-data/archive/output/debian/changelog0000644000000000000000000000050413530623213021766 0ustar0000000000000000seereason-darcs-backups (0.9) unstable; urgency=low * New package to pull backups of our darcs repositories from our server, and eventually anything else which is precious and not otherwise backed up. * Debianization generated by cabal-debian -- David Fox Sat, 23 Nov 2013 07:27:06 -0800 cabal-debian-5.0/test-data/archive/output/debian/source/0000755000000000000000000000000013530623213021415 5ustar0000000000000000cabal-debian-5.0/test-data/archive/output/debian/source/format0000644000000000000000000000001513530623213022624 0ustar00000000000000003.0 (native) cabal-debian-5.0/test-data/artvaluereport-data/0000755000000000000000000000000013530623213017700 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport-data/input/0000755000000000000000000000000013530623213021037 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport-data/input/Debianize.hs0000644000000000000000000000030713530623213023265 0ustar0000000000000000import Distribution.Debian main :: IO () main = debianize (Config { flags = defaultFlags {buildDeps = ["haskell-hsx-utils"] ++ buildDeps defaultFlags} , modifyAtoms = id }) cabal-debian-5.0/test-data/artvaluereport-data/input/artvaluereport-data.cabal0000644000000000000000000000662413530623213026021 0ustar0000000000000000Name: artvaluereport-data Version: 1.66.1 License: AllRightsReserved Copyright: (c) 2008-2011, SeeReason Partners LLC Author: David Fox Maintainer: David Fox Homepage: http://artvaluereport.com Synopsis: Data structures used by the fine art appraisal application Description: Data structures used by the fine art appraisal application Cabal-version: >= 1.2.3.0 build-type: Custom Library GHC-Options: -Wall -fno-warn-name-shadowing -- CPP-Options: -DLAZYIMAGES Extensions: CPP Exposed-modules: Appraisal.Config Appraisal.Image Appraisal.Report Appraisal.Report.Archive Appraisal.Report.BoilerPlate Appraisal.Report.IO Appraisal.Report.Item Appraisal.Report.LaTeX Appraisal.Report.Twins Appraisal.Report.Wiki Appraisal.ReportStore Appraisal.Permissions Appraisal.State Appraisal.Types Appraisal.WebConf Document.CIString Document.Classes Document.FormText Document.HaXml Document.IsText Document.LaTeX Document.Markdown Document.Unicode Document.Wiki Extra.Currency Extra.File Extra.Html Extra.Image Extra.ImageFile Extra.LaTeX Extra.List Extra.Simplify Extra.Text Extra.Trace Extra.Unicode Happstack.Server.Account Happstack.Server.Formlets Happstack.Server.Session Logger State Types.Account Types.Session Appraisal.Data.UUID Appraisal.Data.UUID.V1 Appraisal.Data.UUID.V3 Appraisal.Data.UUID.V4 Appraisal.Data.UUID.V5 Other-Modules: Appraisal.Data.UUID.Builder, Appraisal.Data.UUID.Internal, Appraisal.Data.UUID.Named Build-Depends: acid-state, applicative-extras, base, binary, bytestring, cabal-debian, cereal, containers, cryptohash >= 0.7, debian >= 3.67, directory, Extra, filepath, formlets, happstack-extra, happstack-hsp, happstack-server, happstack-util, HaTeX >= 3.4, HaXml >= 1.22.5, hslogger, hsp, hsx, html-entities >= 1.3, HUnit, ixset, ListLike, listlike-instances, maccatcher, mtl, network >= 2.4, old-time, pandoc, pandoc-types, parsec, process, process-extras >= 0.6, process-progress, pureMD5, random, regex-compat, revision >= 0.8, RJson, safecopy, syb, syb-with-class, text, time, unix, Unixutils >= 1.50, utf8-string, xhtml cabal-debian-5.0/test-data/artvaluereport-data/input/debian/0000755000000000000000000000000013530623213022261 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport-data/input/debian/changelog0000644000000000000000000003061713530623213024142 0ustar0000000000000000haskell-artvaluereport-data (1.67) unstable; urgency=low * Add fromEpochMilli and showEpochMilli to module State. -- David Fox Fri, 25 Jan 2013 15:13:22 -0800 haskell-artvaluereport-data (1.66.2) unstable; urgency=low * Fix a place where [Client] wasn't getting expanded * Make sure there's a blank line after "Dear so-and-so" -- David Fox Fri, 18 Jan 2013 13:57:53 -0800 haskell-artvaluereport-data (1.66.1) unstable; urgency=low * Change the latex command to pdflatex. -- David Fox Mon, 17 Dec 2012 11:54:23 -0800 haskell-artvaluereport-data (1.66) unstable; urgency=low * New image processing primitives: imageIO replaced by updateOriginal, modifyOriginal, updateDerived, and modifyDerived. -- David Fox Sat, 15 Dec 2012 12:29:18 -0800 haskell-artvaluereport-data (1.65.1) unstable; urgency=low * Don't filter blank lines out of the address block * Migration to merge some items in a particular report -- David Fox Wed, 12 Dec 2012 09:37:30 -0800 haskell-artvaluereport-data (1.65) unstable; urgency=low * Rework the LaTeX generation. -- David Fox Thu, 06 Dec 2012 09:37:23 -0800 haskell-artvaluereport-data (1.64.3) unstable; urgency=low * Remove extra caption on Appraised Item Summary, make total label left justified and bold. -- David Fox Sat, 01 Dec 2012 08:45:38 -0800 haskell-artvaluereport-data (1.64.2) unstable; urgency=low * Rework the Appaised Item Summary table. -- David Fox Sat, 01 Dec 2012 07:15:51 -0800 haskell-artvaluereport-data (1.64.1) unstable; urgency=low * Move the modules from haskell-debian into this package. -- David Fox Fri, 30 Nov 2012 13:34:22 -0800 haskell-artvaluereport-data (1.64) unstable; urgency=low * Move sortElems to Appraisal.Types and export. -- David Fox Fri, 30 Nov 2012 06:47:30 -0800 haskell-artvaluereport-data (1.63.5) unstable; urgency=low * Supply a case for new ReportIntendedUse constructor * Don't allow warnings in Appraisal.Types * Remove -O0 flag from Appraisal.Types. -- David Fox Mon, 26 Nov 2012 10:30:00 -0800 haskell-artvaluereport-data (1.63.4) unstable; urgency=low * Use cabal-debian for packaging. -- David Fox Sun, 18 Nov 2012 15:51:26 -0800 haskell-artvaluereport-data (1.63.3) unstable; urgency=low * Increase width of left column on item pages -- David Fox Fri, 16 Nov 2012 10:18:50 -0800 haskell-artvaluereport-data (1.63.2) unstable; urgency=low * Sort the item entries in the generated PDF by Item Number. -- David Fox Wed, 14 Nov 2012 13:28:56 -0800 haskell-artvaluereport-data (1.63.1) unstable; urgency=low * A migration to update some report permissions, soon we will have a UI for this purpose. -- David Fox Mon, 12 Nov 2012 13:11:41 -0800 haskell-artvaluereport-data (1.63) unstable; urgency=low * Add an EstateTax constructor to ReportIntendedUse. -- David Fox Mon, 05 Nov 2012 12:01:23 -0800 haskell-artvaluereport-data (1.62) unstable; urgency=low * Another migration was necessary after all. -- Clifford Beshers Sat, 20 Oct 2012 11:20:18 -0700 haskell-artvaluereport-data (1.61) unstable; urgency=low * Hide Item AdditionalNotes field from the report generation, as it used to be. This migration should have removed constructors from ItemFieldName. The decision to leave them in was a mistake, but I'll wait until the next migration to fix it. -- Clifford Beshers Fri, 19 Oct 2012 12:49:09 -0700 haskell-artvaluereport-data (1.60) unstable; urgency=low * Bug 452: add Edition field to Item after Condition. -- Clifford Beshers Thu, 18 Oct 2012 17:02:13 -0700 haskell-artvaluereport-data (1.59) unstable; urgency=low * turn on LAZYIMAGES -- David Fox Sat, 13 Oct 2012 10:27:11 -0700 haskell-artvaluereport-data (1.58) unstable; urgency=low * Remove the local copies of the readProcess functions. -- David Fox Thu, 11 Oct 2012 13:54:55 -0700 haskell-artvaluereport-data (1.57) unstable; urgency=low * Add ifdefs to control whether we are using lazy or strict readProcess functions, set it to Lazy for now. Still using the local copies of the readProcess functions, can switch to process-extras soon. -- David Fox Thu, 11 Oct 2012 13:51:41 -0700 haskell-artvaluereport-data (1.56) unstable; urgency=low * Make all the uses of readProcess and readProcessWithExitCode the non-lazy versions. -- David Fox Thu, 11 Oct 2012 06:06:48 -0700 haskell-artvaluereport-data (1.55) unstable; urgency=low * Use the Paths class in the File and ImageFile modules. -- David Fox Mon, 08 Oct 2012 13:20:12 -0700 haskell-artvaluereport-data (1.54) unstable; urgency=low * Move the FileCache modules into this package. * Eliminate newdata and Default instances. -- David Fox Sun, 07 Oct 2012 08:11:09 -0700 haskell-artvaluereport-data (1.53.1) unstable; urgency=low * Add a PadsMonad class which provides the functionality of class Paths in a monad. -- David Fox Sat, 06 Oct 2012 16:53:28 -0700 haskell-artvaluereport-data (1.53) unstable; urgency=low * Merge Appraisal.Paths into Appraisal.Config * Clean up path handling: Replace all AVRVersion arguments with arguments that are an instance of Paths. -- David Fox Sat, 06 Oct 2012 08:37:09 -0700 haskell-artvaluereport-data (1.52) unstable; urgency=low * Add /reports/ to the report path. -- David Fox Fri, 05 Oct 2012 05:23:15 -0700 haskell-artvaluereport-data (1.51) unstable; urgency=low * Add a UUID field which will serve as a permenant identifier for the report across all the servers we might create to handle these reports. * Add report archiving and unarchiving. * Add an event to replace a report by UUID number. -- David Fox Sat, 29 Sep 2012 06:45:10 -0700 haskell-artvaluereport-data (1.50) unstable; urgency=low * All new names for the path description variables in Appraisal.Config. -- David Fox Tue, 25 Sep 2012 10:52:45 -0700 haskell-artvaluereport-data (1.49) unstable; urgency=low * Add a copy of the uuid package so we can give UUID a complete Data instance. Eventually I may have to make a uuid-data package which is a wrapper around the UUID type with that instance. -- David Fox Fri, 21 Sep 2012 08:23:56 -0700 haskell-artvaluereport-data (1.48) unstable; urgency=low * Add a UUID field to Report, and a status field that says whether the report is in an Archived state. By "Archived" we mean that a file has been downloaded to elsewhere that is assumed to contain the authoritative report data. -- David Fox Thu, 20 Sep 2012 11:20:28 -0700 haskell-artvaluereport-data (1.47) unstable; urgency=low * Strip ^M from latex text. -- David Fox Wed, 05 Sep 2012 16:20:23 -0700 haskell-artvaluereport-data (1.46) unstable; urgency=low * Change signature of Appraisal.Image.updateOriginal - the second argument was URI, now Either URI L.ByteString. -- David Fox Mon, 16 Jul 2012 13:09:25 -0700 haskell-artvaluereport-data (1.45) unstable; urgency=low * Changes for building AVR1. -- David Fox Sat, 14 Jul 2012 14:33:51 -0700 haskell-artvaluereport-data (1.44) unstable; urgency=low * Add a Appraisal.Paths module with a class that manages file locations. -- David Fox Fri, 13 Jul 2012 11:04:12 -0700 haskell-artvaluereport-data (1.43) unstable; urgency=low * Export imageIO. -- Clifford Beshers Thu, 12 Jul 2012 01:41:18 -0700 haskell-artvaluereport-data (1.42) unstable; urgency=low * Fix the paths generated for AVR2 by reportPath and updateLogo. -- David Fox Wed, 11 Jul 2012 10:04:05 -0700 haskell-artvaluereport-data (1.41) unstable; urgency=low * Add a reportBranding field to the Report type to control the logo and other branding features. -- David Fox Mon, 25 Jun 2012 10:31:04 -0700 haskell-artvaluereport-data (1.40) unstable; urgency=low * Changes to make LaTeX output more compact. -- David Fox Tue, 19 Jun 2012 09:20:12 -0700 haskell-artvaluereport-data (1.39) unstable; urgency=low * Fix a buggy SafeCopy instance in Happstack.Server.Account. -- David Fox Fri, 08 Jun 2012 09:08:16 -0700 haskell-artvaluereport-data (1.38) unstable; urgency=low * Remove signature from Privacy Policy. -- Clifford Beshers Tue, 29 May 2012 11:49:02 -0700 haskell-artvaluereport-data (1.37) unstable; urgency=low * Add an AVRVersion argument where necessary to control generation of pathnames. * Make the loge byte string a parameter. -- David Fox Tue, 01 May 2012 12:46:54 -0700 haskell-artvaluereport-data (1.36) unstable; urgency=low * Modify WebConf to match what we now use in avr2 - replaces parameters "store", "home", "cache" with just one called "top". * Don't die when we have a bad image url in an image struct, just do nothing and enter a log message. -- David Fox Mon, 02 Apr 2012 11:52:00 -0700 haskell-artvaluereport-data (1.35) unstable; urgency=low * Replace use of lazyCommand with enhanced readCommandWithExitCode from Unixutils. -- David Fox Sun, 25 Mar 2012 07:16:15 -0700 haskell-artvaluereport-data (1.34) unstable; urgency=low * Migrate the Permissions type from storing Usernames to define which users can see a report to storing UserIds. This closes a serious security hole. -- David Fox Mon, 12 Mar 2012 10:42:12 -0700 haskell-artvaluereport-data (1.33) unstable; urgency=low * Remove the leading slash from the result of the reportURI and reportBase and reportPath functions in Appraisal.Types. -- David Fox Thu, 08 Mar 2012 09:36:15 -0800 haskell-artvaluereport-data (1.32) unstable; urgency=low * Export Appraisal.Types.reportBase -- David Fox Tue, 06 Mar 2012 17:22:01 -0800 haskell-artvaluereport-data (1.31) unstable; urgency=low * Migrate old report record to new. This replaces the old reportClient field with reportClientName and reportClientAddress. It leaves two fields that are not used by the new report generator: reportFolder and revisionInfo. -- David Fox Tue, 06 Mar 2012 14:49:40 -0800 haskell-artvaluereport-data (1.30) unstable; urgency=low * Improve formatting of Appraised Item List -- David Fox Thu, 09 Feb 2012 17:09:16 -0800 haskell-artvaluereport-data (1.29) unstable; urgency=low * Remove dependencies on happstack-state * Remove version numbers from some module names * Rename deb packages -- David Fox Tue, 07 Feb 2012 06:36:44 -0800 haskell-appraisal-data (1.28) unstable; urgency=low * Move Appraisal.Permissions into artvaluereport package to avoid dependency hereon happstack-state. -- David Fox Mon, 30 Jan 2012 16:16:15 -0800 haskell-appraisal-data (1.27) unstable; urgency=low * Add an interface to change IntendedUse. -- David Fox Thu, 05 Jan 2012 20:45:40 -0800 haskell-appraisal-data (1.26) unstable; urgency=low * Make the abbreviations "ValueType", "ValueTypeDescription", "ValueTypeLongDescription", and "ValueApproachExplanation" override the values stored in the report's reportValueTypeInfo field if they are available. -- David Fox Thu, 05 Jan 2012 10:11:04 -0800 haskell-appraisal-data (1.25) unstable; urgency=low * Export module Report2. -- Clifford Beshers Thu, 08 Dec 2011 12:16:56 -0800 haskell-appraisal-data (1.24) unstable; urgency=low * Add safecopy instances. -- David Fox Sat, 19 Nov 2011 07:23:19 -0800 haskell-appraisal-data (1.23-1~hackage1) unstable; urgency=low * Debianization generated by cabal-debian -- David Fox Fri, 18 Nov 2011 09:23:34 -0800 cabal-debian-5.0/test-data/artvaluereport-data/output/0000755000000000000000000000000013530623213021240 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport-data/output/debian/0000755000000000000000000000000013530623213022462 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport-data/output/debian/rules0000644000000000000000000000031413530623213023535 0ustar0000000000000000#!/usr/bin/make -f DEB_SETUP_BIN_NAME = cabal DEB_CABAL_PACKAGE = artvaluereport-data DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk cabal-debian-5.0/test-data/artvaluereport-data/output/debian/watch0000644000000000000000000000021213530623213023506 0ustar0000000000000000version=3 http://hackage.haskell.org/package/artvaluereport-data/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/test-data/artvaluereport-data/output/debian/control0000644000000000000000000001550013530623213024066 0ustar0000000000000000Source: haskell-artvaluereport-data Priority: extra Section: haskell Maintainer: David Fox Build-Depends: debhelper (>= 9) , haskell-devscripts-minimal | haskell-devscripts (>= 0.8) , cdbs , ghc , ghc-prof , haskell-hsx-utils , libghc-extra-dev , libghc-extra-prof , libghc-hunit-dev , libghc-hunit-prof , libghc-hatex-dev (>= 3.4) , libghc-hatex-prof (>= 3.4) , libghc-haxml-dev (>= 1:1.22.5) , libghc-haxml-prof (>= 1:1.22.5) , libghc-listlike-dev , libghc-listlike-prof , libghc-rjson-dev , libghc-rjson-prof , libghc-unixutils-dev (>= 1.50) , libghc-unixutils-prof (>= 1.50) , libghc-acid-state-dev , libghc-acid-state-prof , libghc-applicative-extras-dev , libghc-applicative-extras-prof , libghc-cabal-debian-dev , libghc-cabal-debian-prof , libghc-cereal-dev , libghc-cereal-prof , libghc-cryptohash-dev (>= 0.7) , libghc-cryptohash-prof (>= 0.7) , libghc-debian-dev (>= 3.67) , libghc-debian-prof (>= 3.67) , libghc-formlets-dev , libghc-formlets-prof , libghc-happstack-extra-dev , libghc-happstack-extra-prof , libghc-happstack-hsp-dev , libghc-happstack-hsp-prof , libghc-happstack-server-dev , libghc-happstack-server-prof , libghc-happstack-util-dev , libghc-happstack-util-prof , libghc-hslogger-dev , libghc-hslogger-prof , libghc-hsp-dev , libghc-hsp-prof , libghc-hsx-dev , libghc-hsx-prof , libghc-html-entities-dev (>= 1.3) , libghc-html-entities-prof (>= 1.3) , libghc-ixset-dev , libghc-ixset-prof , libghc-listlike-instances-dev , libghc-listlike-instances-prof , libghc-maccatcher-dev , libghc-maccatcher-prof , libghc-mtl-dev , libghc-mtl-prof , libghc-network-dev (>= 2.4) , libghc-network-prof (>= 2.4) , libghc-old-time-dev , libghc-old-time-prof , libghc-pandoc-dev , libghc-pandoc-prof , libghc-pandoc-types-dev , libghc-pandoc-types-prof , libghc-parsec3-dev (>= 3) | libghc-parsec2-dev (<< 3) , libghc-parsec3-prof (>= 3) | libghc-parsec2-prof (<< 3) , libghc-process-extras-dev (>= 0.6) , libghc-process-extras-prof (>= 0.6) , libghc-process-progress-dev , libghc-process-progress-prof , libghc-puremd5-dev , libghc-puremd5-prof , libghc-random-dev , libghc-random-prof , libghc-regex-compat-dev , libghc-regex-compat-prof , libghc-revision-dev (>= 0.8) , libghc-revision-prof (>= 0.8) , libghc-safecopy-dev , libghc-safecopy-prof , libghc-syb-dev , libghc-syb-prof , libghc-syb-with-class-dev , libghc-syb-with-class-prof , libghc-text-dev , libghc-text-prof , libghc-utf8-string-dev , libghc-utf8-string-prof Build-Depends-Indep: ghc-doc , libghc-extra-doc , libghc-hunit-doc , libghc-hatex-doc , libghc-haxml-doc , libghc-listlike-doc , libghc-rjson-doc , libghc-unixutils-doc , libghc-acid-state-doc , libghc-applicative-extras-doc , libghc-cabal-debian-doc , libghc-cereal-doc , libghc-cryptohash-doc , libghc-debian-doc , libghc-formlets-doc , libghc-happstack-extra-doc , libghc-happstack-hsp-doc , libghc-happstack-server-doc , libghc-happstack-util-doc , libghc-hslogger-doc , libghc-hsp-doc , libghc-hsx-doc , libghc-html-entities-doc , libghc-ixset-doc , libghc-listlike-instances-doc , libghc-maccatcher-doc , libghc-mtl-doc , libghc-network-doc , libghc-old-time-doc , libghc-pandoc-doc , libghc-pandoc-types-doc , libghc-parsec3-doc (>= 3) | libghc-parsec2-doc (<< 3) , libghc-process-extras-doc , libghc-process-progress-doc , libghc-puremd5-doc , libghc-random-doc , libghc-regex-compat-doc , libghc-revision-doc , libghc-safecopy-doc , libghc-syb-doc , libghc-syb-with-class-doc , libghc-text-doc , libghc-utf8-string-doc Standards-Version: 3.9.6 Homepage: http://artvaluereportonline.com X-Description: Data structures used by the fine art appraisal application Data structures used by the fine art appraisal application Package: libghc-artvaluereport-data-dev Architecture: any Depends: ${haskell:Depends} , ${misc:Depends} , ${shlibs:Depends} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-artvaluereport-data-prof Architecture: any Depends: ${haskell:Depends} , ${misc:Depends} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-artvaluereport-data-doc Architecture: all Section: doc Depends: ${haskell:Depends} , ${misc:Depends} Conflicts: ${haskell:Conflicts} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} cabal-debian-5.0/test-data/artvaluereport-data/output/debian/extra-depends0000644000000000000000000000000113530623213025137 0ustar0000000000000000 cabal-debian-5.0/test-data/artvaluereport-data/output/debian/Debianize.hs0000644000000000000000000000030713530623213024710 0ustar0000000000000000import Distribution.Debian main :: IO () main = debianize (Config { flags = defaultFlags {buildDeps = ["haskell-hsx-utils"] ++ buildDeps defaultFlags} , modifyAtoms = id }) cabal-debian-5.0/test-data/artvaluereport-data/output/debian/compat0000644000000000000000000000000213530623213023660 0ustar00000000000000009 cabal-debian-5.0/test-data/artvaluereport-data/output/debian/copyright0000644000000000000000000000064113530623213024416 0ustar0000000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: artvaluereport-data Upstream-Contact: David Fox Source: https://hackage.haskell.org/package/artvaluereport-data Files: * Copyright: (c) 2008-2011, SeeReason Partners LLC License: AllRightsReserved Files: debian/* Copyright: held by the contributors mentioned in debian/changelog License: AllRightsReserved cabal-debian-5.0/test-data/artvaluereport-data/output/debian/changelog0000644000000000000000000002774213530623213024350 0ustar0000000000000000haskell-artvaluereport-data (1.66.1) unstable; urgency=low * Change the latex command to pdflatex. -- David Fox Mon, 17 Dec 2012 11:54:23 -0800 haskell-artvaluereport-data (1.66) unstable; urgency=low * New image processing primitives: imageIO replaced by updateOriginal, modifyOriginal, updateDerived, and modifyDerived. -- David Fox Sat, 15 Dec 2012 12:29:18 -0800 haskell-artvaluereport-data (1.65.1) unstable; urgency=low * Don't filter blank lines out of the address block * Migration to merge some items in a particular report -- David Fox Wed, 12 Dec 2012 09:37:30 -0800 haskell-artvaluereport-data (1.65) unstable; urgency=low * Rework the LaTeX generation. -- David Fox Thu, 06 Dec 2012 09:37:23 -0800 haskell-artvaluereport-data (1.64.3) unstable; urgency=low * Remove extra caption on Appraised Item Summary, make total label left justified and bold. -- David Fox Sat, 01 Dec 2012 08:45:38 -0800 haskell-artvaluereport-data (1.64.2) unstable; urgency=low * Rework the Appaised Item Summary table. -- David Fox Sat, 01 Dec 2012 07:15:51 -0800 haskell-artvaluereport-data (1.64.1) unstable; urgency=low * Move the modules from haskell-debian into this package. -- David Fox Fri, 30 Nov 2012 13:34:22 -0800 haskell-artvaluereport-data (1.64) unstable; urgency=low * Move sortElems to Appraisal.Types and export. -- David Fox Fri, 30 Nov 2012 06:47:30 -0800 haskell-artvaluereport-data (1.63.5) unstable; urgency=low * Supply a case for new ReportIntendedUse constructor * Don't allow warnings in Appraisal.Types * Remove -O0 flag from Appraisal.Types. -- David Fox Mon, 26 Nov 2012 10:30:00 -0800 haskell-artvaluereport-data (1.63.4) unstable; urgency=low * Use cabal-debian for packaging. -- David Fox Sun, 18 Nov 2012 15:51:26 -0800 haskell-artvaluereport-data (1.63.3) unstable; urgency=low * Increase width of left column on item pages -- David Fox Fri, 16 Nov 2012 10:18:50 -0800 haskell-artvaluereport-data (1.63.2) unstable; urgency=low * Sort the item entries in the generated PDF by Item Number. -- David Fox Wed, 14 Nov 2012 13:28:56 -0800 haskell-artvaluereport-data (1.63.1) unstable; urgency=low * A migration to update some report permissions, soon we will have a UI for this purpose. -- David Fox Mon, 12 Nov 2012 13:11:41 -0800 haskell-artvaluereport-data (1.63) unstable; urgency=low * Add an EstateTax constructor to ReportIntendedUse. -- David Fox Mon, 05 Nov 2012 12:01:23 -0800 haskell-artvaluereport-data (1.62) unstable; urgency=low * Another migration was necessary after all. -- Clifford Beshers Sat, 20 Oct 2012 11:20:18 -0700 haskell-artvaluereport-data (1.61) unstable; urgency=low * Hide Item AdditionalNotes field from the report generation, as it used to be. This migration should have removed constructors from ItemFieldName. The decision to leave them in was a mistake, but I'll wait until the next migration to fix it. -- Clifford Beshers Fri, 19 Oct 2012 12:49:09 -0700 haskell-artvaluereport-data (1.60) unstable; urgency=low * Bug 452: add Edition field to Item after Condition. -- Clifford Beshers Thu, 18 Oct 2012 17:02:13 -0700 haskell-artvaluereport-data (1.59) unstable; urgency=low * turn on LAZYIMAGES -- David Fox Sat, 13 Oct 2012 10:27:11 -0700 haskell-artvaluereport-data (1.58) unstable; urgency=low * Remove the local copies of the readProcess functions. -- David Fox Thu, 11 Oct 2012 13:54:55 -0700 haskell-artvaluereport-data (1.57) unstable; urgency=low * Add ifdefs to control whether we are using lazy or strict readProcess functions, set it to Lazy for now. Still using the local copies of the readProcess functions, can switch to process-extras soon. -- David Fox Thu, 11 Oct 2012 13:51:41 -0700 haskell-artvaluereport-data (1.56) unstable; urgency=low * Make all the uses of readProcess and readProcessWithExitCode the non-lazy versions. -- David Fox Thu, 11 Oct 2012 06:06:48 -0700 haskell-artvaluereport-data (1.55) unstable; urgency=low * Use the Paths class in the File and ImageFile modules. -- David Fox Mon, 08 Oct 2012 13:20:12 -0700 haskell-artvaluereport-data (1.54) unstable; urgency=low * Move the FileCache modules into this package. * Eliminate newdata and Default instances. -- David Fox Sun, 07 Oct 2012 08:11:09 -0700 haskell-artvaluereport-data (1.53.1) unstable; urgency=low * Add a PadsMonad class which provides the functionality of class Paths in a monad. -- David Fox Sat, 06 Oct 2012 16:53:28 -0700 haskell-artvaluereport-data (1.53) unstable; urgency=low * Merge Appraisal.Paths into Appraisal.Config * Clean up path handling: Replace all AVRVersion arguments with arguments that are an instance of Paths. -- David Fox Sat, 06 Oct 2012 08:37:09 -0700 haskell-artvaluereport-data (1.52) unstable; urgency=low * Add /reports/ to the report path. -- David Fox Fri, 05 Oct 2012 05:23:15 -0700 haskell-artvaluereport-data (1.51) unstable; urgency=low * Add a UUID field which will serve as a permenant identifier for the report across all the servers we might create to handle these reports. * Add report archiving and unarchiving. * Add an event to replace a report by UUID number. -- David Fox Sat, 29 Sep 2012 06:45:10 -0700 haskell-artvaluereport-data (1.50) unstable; urgency=low * All new names for the path description variables in Appraisal.Config. -- David Fox Tue, 25 Sep 2012 10:52:45 -0700 haskell-artvaluereport-data (1.49) unstable; urgency=low * Add a copy of the uuid package so we can give UUID a complete Data instance. Eventually I may have to make a uuid-data package which is a wrapper around the UUID type with that instance. -- David Fox Fri, 21 Sep 2012 08:23:56 -0700 haskell-artvaluereport-data (1.48) unstable; urgency=low * Add a UUID field to Report, and a status field that says whether the report is in an Archived state. By "Archived" we mean that a file has been downloaded to elsewhere that is assumed to contain the authoritative report data. -- David Fox Thu, 20 Sep 2012 11:20:28 -0700 haskell-artvaluereport-data (1.47) unstable; urgency=low * Strip ^M from latex text. -- David Fox Wed, 05 Sep 2012 16:20:23 -0700 haskell-artvaluereport-data (1.46) unstable; urgency=low * Change signature of Appraisal.Image.updateOriginal - the second argument was URI, now Either URI L.ByteString. -- David Fox Mon, 16 Jul 2012 13:09:25 -0700 haskell-artvaluereport-data (1.45) unstable; urgency=low * Changes for building AVR1. -- David Fox Sat, 14 Jul 2012 14:33:51 -0700 haskell-artvaluereport-data (1.44) unstable; urgency=low * Add a Appraisal.Paths module with a class that manages file locations. -- David Fox Fri, 13 Jul 2012 11:04:12 -0700 haskell-artvaluereport-data (1.43) unstable; urgency=low * Export imageIO. -- Clifford Beshers Thu, 12 Jul 2012 01:41:18 -0700 haskell-artvaluereport-data (1.42) unstable; urgency=low * Fix the paths generated for AVR2 by reportPath and updateLogo. -- David Fox Wed, 11 Jul 2012 10:04:05 -0700 haskell-artvaluereport-data (1.41) unstable; urgency=low * Add a reportBranding field to the Report type to control the logo and other branding features. -- David Fox Mon, 25 Jun 2012 10:31:04 -0700 haskell-artvaluereport-data (1.40) unstable; urgency=low * Changes to make LaTeX output more compact. -- David Fox Tue, 19 Jun 2012 09:20:12 -0700 haskell-artvaluereport-data (1.39) unstable; urgency=low * Fix a buggy SafeCopy instance in Happstack.Server.Account. -- David Fox Fri, 08 Jun 2012 09:08:16 -0700 haskell-artvaluereport-data (1.38) unstable; urgency=low * Remove signature from Privacy Policy. -- Clifford Beshers Tue, 29 May 2012 11:49:02 -0700 haskell-artvaluereport-data (1.37) unstable; urgency=low * Add an AVRVersion argument where necessary to control generation of pathnames. * Make the loge byte string a parameter. -- David Fox Tue, 01 May 2012 12:46:54 -0700 haskell-artvaluereport-data (1.36) unstable; urgency=low * Modify WebConf to match what we now use in avr2 - replaces parameters "store", "home", "cache" with just one called "top". * Don't die when we have a bad image url in an image struct, just do nothing and enter a log message. -- David Fox Mon, 02 Apr 2012 11:52:00 -0700 haskell-artvaluereport-data (1.35) unstable; urgency=low * Replace use of lazyCommand with enhanced readCommandWithExitCode from Unixutils. -- David Fox Sun, 25 Mar 2012 07:16:15 -0700 haskell-artvaluereport-data (1.34) unstable; urgency=low * Migrate the Permissions type from storing Usernames to define which users can see a report to storing UserIds. This closes a serious security hole. -- David Fox Mon, 12 Mar 2012 10:42:12 -0700 haskell-artvaluereport-data (1.33) unstable; urgency=low * Remove the leading slash from the result of the reportURI and reportBase and reportPath functions in Appraisal.Types. -- David Fox Thu, 08 Mar 2012 09:36:15 -0800 haskell-artvaluereport-data (1.32) unstable; urgency=low * Export Appraisal.Types.reportBase -- David Fox Tue, 06 Mar 2012 17:22:01 -0800 haskell-artvaluereport-data (1.31) unstable; urgency=low * Migrate old report record to new. This replaces the old reportClient field with reportClientName and reportClientAddress. It leaves two fields that are not used by the new report generator: reportFolder and revisionInfo. -- David Fox Tue, 06 Mar 2012 14:49:40 -0800 haskell-artvaluereport-data (1.30) unstable; urgency=low * Improve formatting of Appraised Item List -- David Fox Thu, 09 Feb 2012 17:09:16 -0800 haskell-artvaluereport-data (1.29) unstable; urgency=low * Remove dependencies on happstack-state * Remove version numbers from some module names * Rename deb packages -- David Fox Tue, 07 Feb 2012 06:36:44 -0800 haskell-appraisal-data (1.28) unstable; urgency=low * Move Appraisal.Permissions into artvaluereport package to avoid dependency hereon happstack-state. -- David Fox Mon, 30 Jan 2012 16:16:15 -0800 haskell-appraisal-data (1.27) unstable; urgency=low * Add an interface to change IntendedUse. -- David Fox Thu, 05 Jan 2012 20:45:40 -0800 haskell-appraisal-data (1.26) unstable; urgency=low * Make the abbreviations "ValueType", "ValueTypeDescription", "ValueTypeLongDescription", and "ValueApproachExplanation" override the values stored in the report's reportValueTypeInfo field if they are available. -- David Fox Thu, 05 Jan 2012 10:11:04 -0800 haskell-appraisal-data (1.25) unstable; urgency=low * Export module Report2. -- Clifford Beshers Thu, 08 Dec 2011 12:16:56 -0800 haskell-appraisal-data (1.24) unstable; urgency=low * Add safecopy instances. -- David Fox Sat, 19 Nov 2011 07:23:19 -0800 haskell-appraisal-data (1.23-1~hackage1) unstable; urgency=low * Debianization generated by cabal-debian -- David Fox Fri, 18 Nov 2011 09:23:34 -0800 cabal-debian-5.0/test-data/artvaluereport-data/output/debian/source/0000755000000000000000000000000013530623213023762 5ustar0000000000000000cabal-debian-5.0/test-data/artvaluereport-data/output/debian/source/format0000644000000000000000000000001513530623213025171 0ustar00000000000000003.0 (native) cabal-debian-5.0/test-data/clckwrks-dot-com/0000755000000000000000000000000013530623213017075 5ustar0000000000000000cabal-debian-5.0/test-data/clckwrks-dot-com/input/0000755000000000000000000000000013530623213020234 5ustar0000000000000000cabal-debian-5.0/test-data/clckwrks-dot-com/input/clckwrks-dot-com.cabal0000644000000000000000000000356413530623213024413 0ustar0000000000000000name: clckwrks-dot-com version: 0.2.4 synopsis: clckwrks.com homepage: http://www.clckwrks.com/ license: BSD3 license-file: LICENSE copyright: Copyright (c) 2012, Jeremy Shaw author: Jeremy Shaw maintainer: Jeremy Shaw category: Clckwrks build-type: Simple cabal-version: >=1.8 synopsis: clckwrks.com source-repository head type: darcs subdir: clckwrks-dot-com location: http://hub.darcs.net/stepcut/clckwrks Flag backups Description: enable the backups executable (currently disabled by default do to wacky dependencies not on hackage) Default: False Executable clckwrks-dot-com-server main-is: Main.hs ghc-options: -threaded -O2 -rtsopts -with-rtsopts=-I0 build-depends: base > 4 && <5, clckwrks >= 0.13 && < 0.15, clckwrks-theme-clckwrks == 0.2.*, clckwrks-plugin-bugs == 0.3.*, clckwrks-plugin-media == 0.3.*, containers == 0.4.*, happstack-server >= 7.0 && < 7.2, hsp == 0.7.*, mtl >= 2.0 && < 2.2, text == 0.11.*, web-plugins == 0.1.* Executable clckwrks-dot-com-backups Main-Is: Backups.hs if flag(backups) Buildable: True GHC-Options: -threaded -Wall -Wwarn -O2 -fno-warn-name-shadowing -fno-warn-missing-signatures -fwarn-tabs -fno-warn-unused-binds -fno-warn-orphans -fwarn-unused-imports -fno-spec-constr Build-depends: archive >= 1.2.9, base, Extra else Buildable: False cabal-debian-5.0/test-data/clckwrks-dot-com/input/LICENSE0000644000000000000000000000276013530623213021246 0ustar0000000000000000Copyright (c) 2012, Jeremy Shaw All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Jeremy Shaw nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cabal-debian-5.0/test-data/clckwrks-dot-com/input/debian/0000755000000000000000000000000013530623213021456 5ustar0000000000000000cabal-debian-5.0/test-data/clckwrks-dot-com/input/debian/Debianize.hs0000644000000000000000000001115313530623213023705 0ustar0000000000000000import Data.List (isPrefixOf) import Debian.Relation (BinPkgName(..)) import Debian.Cabal.Config (Flags(..), defaultConfig, defaultFlags, Executable(..), Server(..), Site(..), tightDependencyFixup) import Debian.Cabal.Types (DebAtom(..)) import Debian.Cabal.Debianize import Debian.Cabal.Server (databaseDirectory) import Distribution.Simple import qualified Paths_clckwrks as Clckwrks main :: IO () main = config >>= deb >>= uncurry (doDebianization config) deb :: Config -> IO (Debianization, Debianization) deb config = debianizationWithIO config config :: IO Config config = do jstreePath <- Clckwrks.getDataFileName "jstree" json2Path <- Clckwrks.getDataFileName "json2" (defaultConfig defaultFlags) { missingDependencies = ["libghc-clckwrks-theme-clckwrks-doc"] , executablePackages = map (theSite jstreePath json2Path "clckwrks-dot-com-server") serverNames ++ [backups] , haddock = True , revision = "" , modifyAtoms = \ atoms -> map fixRulesHead atoms ++ concatMap (\ package -> tightDependencyFixup package -- For each pair (A, B) make sure that this package requires the -- same exact version of package B as the version of A currently -- installed during the build. [("libghc-clckwrks-theme-clckwrks-dev", "haskell-clckwrks-theme-clckwrks-utils"), ("libghc-clckwrks-plugin-media-dev", "haskell-clckwrks-plugin-media-utils"), ("libghc-clckwrks-plugin-bugs-dev", "haskell-clckwrks-plugin-bugs-utils"), ("libghc-clckwrks-dev", "haskell-clckwrks-utils")]) serverNames } where serverNames = map BinPkgName ["clckwrks-dot-com-production"] -- , "clckwrks-dot-com-staging", "clckwrks-dot-com-development"] -- Insert a line just above the debhelper.mk include fixRulesHead (DebRulesHead s) = DebRulesHead $ unlines $ concat $ map (\ line -> if line == "include /usr/share/cdbs/1/rules/debhelper.mk" then ["DEB_SETUP_GHC_CONFIGURE_ARGS = -fbackups", "", line] else [line]) (lines s) fixRulesHead x = x theSite :: FilePath -> FilePath -> String -> BinPkgName -> Executable theSite jstreePath json2Path name (BinPkgName deb) = let this = Executable { debName = deb , execName = name , destName = deb , sourceDir = Nothing , destDir = Nothing , execServer = Just (Server { hostname = case deb of "clckwrks-dot-com-production" -> hostname _ -> hostname , port = portNum , site = case deb of "clckwrks-dot-com-production" -> Just (Site { domain = hostname, serverAdmin = "logic@seereason.com" }) _ -> Nothing , headerMessage = "Generated by clckwrks-dot-com/Setup.hs" , retry = "60" , flags = [ "--http-port", show portNum , "--hide-port" , "--hostname", hostname , "--top", databaseDirectory this , "--enable-analytics" , "--jquery-path", "/usr/share/javascript/jquery/" , "--jqueryui-path", "/usr/share/javascript/jquery-ui/" , "--jstree-path", jstreePath , "--json2-path",json2Path ] }) } in this where hostname = "clckwrks.com" portNum = case deb of "clckwrks-dot-com-production" -> 9029 "clckwrks-dot-com-staging" -> 9038 "clckwrks-dot-com-development" -> 9039 _ -> error $ "Unexpected package name: " ++ name backups = Executable { execName = "clckwrks-dot-com-backups" , destName = "clckwrks-dot-com-backups" , debName = "clckwrks-dot-com-backups" , sourceDir = Nothing , destDir = Just "/etc/cron.hourly" , execServer = Nothing } cabal-debian-5.0/test-data/clckwrks-dot-com/input/debian/changelog0000644000000000000000000000601713530623213023334 0ustar0000000000000000haskell-clckwrks-dot-com (0.2.4) unstable; urgency=low * Bumped to allow clckwrks 0.14 -- Jeremy Shaw Wed, 26 Dec 2012 11:56:20 -0600 haskell-clckwrks-dot-com (0.2.3) unstable; urgency=low * Added -rtsopts flag because the debian packaging requires it -- Jeremy Shaw Thu, 20 Dec 2012 15:51:07 -0600 haskell-clckwrks-dot-com (0.2.2) unstable; urgency=low * Added -with-rtsopts=-I0 flag to ghc-options -- Jeremy Shaw Wed, 19 Dec 2012 15:20:12 -0600 haskell-clckwrks-dot-com (0.2.1) unstable; urgency=low * include blogHandler hack -- Jeremy Shaw Tue, 11 Dec 2012 00:06:09 -0600 haskell-clckwrks-dot-com (0.2.0) unstable; urgency=low * Updated to clckwrks 0.13.* * Debianization generated by cabal-debian * Debianization generated by cabal-debian * Debianization generated by cabal-debian * Debianization generated by cabal-debian -- Jeremy Shaw Wed, 28 Nov 2012 15:58:44 -0600 haskell-clckwrks-dot-com (0.1.18) unstable; urgency=low * Allow most recent containers -- Jeremy Shaw Fri, 05 Oct 2012 18:49:33 -0500 haskell-clckwrks-dot-com (0.1.17) unstable; urgency=low * Updated to clckwrks 0.12 * Added waitForTermination -- Jeremy Shaw Wed, 22 Aug 2012 12:08:33 -0500 haskell-clckwrks-dot-com (0.1.16) unstable; urgency=low * Now with support for page slugs -- Jeremy Shaw Fri, 10 Aug 2012 15:13:24 -0500 haskell-clckwrks-dot-com (0.1.15) unstable; urgency=low * updated to latest clcwrks -- Jeremy Shaw Tue, 19 Jun 2012 17:48:37 -0500 haskell-clckwrks-dot-com (0.1.13) unstable; urgency=low * Bumped by accident, but whatever. -- Jeremy Shaw Sat, 09 Jun 2012 17:52:18 -0500 haskell-clckwrks-dot-com (0.1.11) unstable; urgency=low * Who knows -- Jeremy Shaw Tue, 05 Jun 2012 16:39:52 -0500 haskell-clckwrks-dot-com (0.1.6) unstable; urgency=low * Also generate depends on haskell-clckwrks-utils -- Jeremy Shaw Mon, 21 May 2012 18:22:27 -0500 haskell-clckwrks-dot-com (0.1.5) unstable; urgency=low * Fixed debian/rules so that it generates the depends for haskell-clckwrks-theme-clckwrks-utils -- Jeremy Shaw Mon, 21 May 2012 16:31:20 -0500 haskell-clckwrks-dot-com (0.1.4) unstable; urgency=low * Added missing 'cpp-options: -DCABAL' to .cabal * Added missing depends on haskell-clckwrks-theme-clckwrks-utils -- Jeremy Shaw Mon, 21 May 2012 15:07:35 -0500 haskell-clckwrks-dot-com (0.1.3) unstable; urgency=low * Updated command-line processing to match what happstack-debianization expects -- Jeremy Shaw Mon, 21 May 2012 12:39:45 -0500 haskell-clckwrks-dot-com (0.1.2-1~hackage1) unstable; urgency=low * Debianization generated by cabal-debian -- Jeremy Shaw Sun, 20 May 2012 13:50:50 -0500 cabal-debian-5.0/test-data/clckwrks-dot-com/output/0000755000000000000000000000000013530623213020435 5ustar0000000000000000cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/0000755000000000000000000000000013530623213021657 5ustar0000000000000000cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/rules0000644000000000000000000000453113530623213022737 0ustar0000000000000000#!/usr/bin/make -f DEB_SETUP_GHC_CONFIGURE_ARGS = -fbackups DEB_SETUP_BIN_NAME = cabal DEB_CABAL_PACKAGE = clckwrks-dot-com DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk build/clckwrks-dot-com-production:: build-ghc-stamp build/clckwrks-dot-com-backups:: build-ghc-stamp binary-fixup/clckwrks-dot-com-production:: install -Dps dist-ghc/build/clckwrks-dot-com-server/clckwrks-dot-com-server debian/clckwrks-dot-com-production/usr/bin/clckwrks-dot-com-production binary-fixup/clckwrks-dot-com-production:: echo -n 'haskell:Depends=' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-theme-clckwrks-utils (=$${Version})' libghc-clckwrks-theme-clckwrks-dev >> debian/clckwrks-dot-com-production.substvars echo -n ', ' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-plugin-media-utils (=$${Version})' libghc-clckwrks-plugin-media-dev >> debian/clckwrks-dot-com-production.substvars echo -n ', ' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-plugin-bugs-utils (=$${Version})' libghc-clckwrks-plugin-bugs-dev >> debian/clckwrks-dot-com-production.substvars echo -n ', ' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-utils (=$${Version})' libghc-clckwrks-dev >> debian/clckwrks-dot-com-production.substvars echo '' >> debian/clckwrks-dot-com-production.substvars echo -n 'haskell:Conflicts=' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-theme-clckwrks-utils (>>$${Version})' libghc-clckwrks-theme-clckwrks-dev >> debian/clckwrks-dot-com-production.substvars echo -n ', ' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-plugin-media-utils (>>$${Version})' libghc-clckwrks-plugin-media-dev >> debian/clckwrks-dot-com-production.substvars echo -n ', ' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-plugin-bugs-utils (>>$${Version})' libghc-clckwrks-plugin-bugs-dev >> debian/clckwrks-dot-com-production.substvars echo -n ', ' >> debian/clckwrks-dot-com-production.substvars dpkg-query -W -f='haskell-clckwrks-utils (>>$${Version})' libghc-clckwrks-dev >> debian/clckwrks-dot-com-production.substvars echo '' >> debian/clckwrks-dot-com-production.substvars cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-backups.postinst0000644000000000000000000000015413530623213030275 0ustar0000000000000000#!/bin/sh case "$1" in configure) /etc/cron.hourly/clckwrks-dot-com-backups --initialize ;; esac cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/watch0000644000000000000000000000020713530623213022707 0ustar0000000000000000version=3 http://hackage.haskell.org/package/clckwrks-dot-com/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/control0000644000000000000000000000371313530623213023266 0ustar0000000000000000Source: haskell-clckwrks-dot-com Maintainer: Jeremy Shaw Priority: extra Section: haskell Build-Depends: debhelper (>= 9) , haskell-devscripts-minimal | haskell-devscripts (>= 0.8) , cdbs , ghc , ghc-prof , libghc-clckwrks-dev (>= 0.13) , libghc-clckwrks-dev (<< 0.15) , libghc-clckwrks-plugin-bugs-dev (>= 0.3) , libghc-clckwrks-plugin-bugs-dev (<< 0.4) , libghc-clckwrks-plugin-media-dev (>= 0.3) , libghc-clckwrks-plugin-media-dev (<< 0.4) , libghc-clckwrks-theme-clckwrks-dev (>= 0.2) , libghc-clckwrks-theme-clckwrks-dev (<< 0.3) , libghc-happstack-server-dev (>= 7.0) , libghc-happstack-server-dev (<< 7.2) , libghc-hsp-dev (>= 0.7) , libghc-hsp-dev (<< 0.8) , libghc-mtl-dev (>= 2.0) , libghc-mtl-dev (<< 2.2) , libghc-text-dev (>= 0.11) , libghc-text-dev (<< 0.12) , libghc-web-plugins-dev (>= 0.1) , libghc-web-plugins-dev (<< 0.2) Standards-Version: 3.9.6 Homepage: http://www.clckwrks.com/ X-Description: clckwrks.com Package: clckwrks-dot-com-production Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: clckwrks-dot-com-backups Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, anacron Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Conflicts: ${haskell:Conflicts} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.links0000644000000000000000000000013413530623213030266 0ustar0000000000000000/etc/apache2/sites-available/clckwrks.com.conf /etc/apache2/sites-enabled/clckwrks.com.conf cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/Debianize.hs0000644000000000000000000001104713530623213024110 0ustar0000000000000000import Data.List (isPrefixOf) import Debian.Relation (BinPkgName(..)) import Distribution.Debian (Flags(..), Config(..), defaultFlags, Executable(..), Server(..), Site(..), tightDependencyFixup) import Distribution.Debian.DebHelper (DebAtom(..)) import Distribution.Debian.Debianize import Distribution.Debian.Server (databaseDirectory) import Distribution.Simple import qualified Paths_clckwrks as Clckwrks main :: IO () main = do jstreePath <- Clckwrks.getDataFileName "jstree" json2Path <- Clckwrks.getDataFileName "json2" Distribution.Debian.Debianize.debianize $ Config { flags = defaultFlags { missingDependencies = ["libghc-clckwrks-theme-clckwrks-doc"] , executablePackages = map (theSite jstreePath json2Path "clckwrks-dot-com-server") serverNames ++ [backups] , haddock = True , revision = "" } , modifyAtoms = \ atoms -> map fixRulesHead atoms ++ concatMap (\ package -> tightDependencyFixup package -- For each pair (A, B) make sure that this package requires the -- same exact version of package B as the version of A currently -- installed during the build. [("libghc-clckwrks-theme-clckwrks-dev", "haskell-clckwrks-theme-clckwrks-utils"), ("libghc-clckwrks-plugin-media-dev", "haskell-clckwrks-plugin-media-utils"), ("libghc-clckwrks-plugin-bugs-dev", "haskell-clckwrks-plugin-bugs-utils"), ("libghc-clckwrks-dev", "haskell-clckwrks-utils")]) serverNames } where serverNames = map BinPkgName ["clckwrks-dot-com-production"] -- , "clckwrks-dot-com-staging", "clckwrks-dot-com-development"] -- Insert a line just above the debhelper.mk include fixRulesHead (DebRulesHead s) = DebRulesHead $ unlines $ concat $ map (\ line -> if line == "include /usr/share/cdbs/1/rules/debhelper.mk" then ["DEB_SETUP_GHC_CONFIGURE_ARGS = -fbackups", "", line] else [line]) (lines s) fixRulesHead x = x theSite :: FilePath -> FilePath -> String -> BinPkgName -> Executable theSite jstreePath json2Path name (BinPkgName deb) = let this = Executable { debName = deb , execName = name , destName = deb , sourceDir = Nothing , destDir = Nothing , execServer = Just (Server { hostname = case deb of "clckwrks-dot-com-production" -> hostname _ -> hostname , port = portNum , site = case deb of "clckwrks-dot-com-production" -> Just (Site { domain = hostname, serverAdmin = "logic@seereason.com" }) _ -> Nothing , headerMessage = "Generated by clckwrks-dot-com/Setup.hs" , retry = "60" , serverFlags = [ "--http-port", show portNum , "--hide-port" , "--hostname", hostname , "--top", databaseDirectory this , "--enable-analytics" , "--jquery-path", "/usr/share/javascript/jquery/" , "--jqueryui-path", "/usr/share/javascript/jquery-ui/" , "--jstree-path", jstreePath , "--json2-path",json2Path ] }) } in this where hostname = "clckwrks.com" portNum = case deb of "clckwrks-dot-com-production" -> 9029 "clckwrks-dot-com-staging" -> 9038 "clckwrks-dot-com-development" -> 9039 _ -> error $ "Unexpected package name: " ++ name backups = Executable { execName = "clckwrks-dot-com-backups" , destName = "clckwrks-dot-com-backups" , debName = "clckwrks-dot-com-backups" , sourceDir = Nothing , destDir = Just "/etc/cron.hourly" , execServer = Nothing } cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-backups.install0000644000000000000000000000012213530623213030053 0ustar0000000000000000dist-ghc/build/clckwrks-dot-com-backups/clckwrks-dot-com-backups /etc/cron.hourly cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/compat0000644000000000000000000000000213530623213023055 0ustar00000000000000009 cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/copyright0000644000000000000000000000364313530623213023620 0ustar0000000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: clckwrks-dot-com Upstream-Contact: Jeremy Shaw Source: https://hackage.haskell.org/package/clckwrks-dot-com Files: * Copyright: Copyright (c) 2012, Jeremy Shaw License: BSD3 Files: debian/* Copyright: held by the contributors mentioned in debian/changelog License: BSD3 License: BSD3 Copyright (c) 2012, Jeremy Shaw . All rights reserved. . Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * Neither the name of Jeremy Shaw nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.init0000644000000000000000000000230613530623213030114 0ustar0000000000000000#! /bin/sh -e . /lib/lsb/init-functions test -f /etc/default/clckwrks-dot-com-production && . /etc/default/clckwrks-dot-com-production case "$1" in start) test -x /usr/bin/clckwrks-dot-com-production || exit 0 log_begin_msg "Starting clckwrks-dot-com-production..." mkdir -p /srv/clckwrks-dot-com-production export clckwrks_dot_com_datadir=/usr/share/clckwrks_dot_com "start-stop-daemon" "--start" "-b" "--make-pidfile" "-d" "/srv/clckwrks-dot-com-production" "--exec" "/usr/bin/clckwrks-dot-com-production" "--pidfile" "/var/run/clckwrks-dot-com-production" "--" "--http-port" "9029" "--hide-port" "--hostname" "clckwrks.com" "--top" "/srv/clckwrks-dot-com-production" "--enable-analytics" "--jquery-path" "/usr/share/javascript/jquery/" "--jqueryui-path" "/usr/share/javascript/jquery-ui/" "--jstree-path" "/usr/share/clckwrks-0.13.2/jstree" "--json2-path" "/usr/share/clckwrks-0.13.2/json2" log_end_msg $? ;; stop) log_begin_msg "Stopping clckwrks-dot-com-production..." "start-stop-daemon" "--stop" "--oknodo" "--retry=60" "--pidfile" "/var/run/clckwrks-dot-com-production" log_end_msg $? ;; *) log_success_msg "Usage: ${0} {start|stop}" exit 1 esac exit 0 cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.install0000644000000000000000000000014513530623213030616 0ustar0000000000000000debian/cabalInstall/6cb4323c6b76525f567919adaf912663/clckwrks.com.conf /etc/apache2/sites-available/ cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.postinst0000644000000000000000000000053513530623213031036 0ustar0000000000000000#!/bin/sh case "$1" in configure) # Apache won't start if this directory doesn't exist mkdir -p /var/log/apache2/clckwrks-dot-com-production # Restart apache so it sees the new file in /etc/apache2/sites-enabled /usr/sbin/a2enmod proxy /usr/sbin/a2enmod proxy_http service apache2 restart ;; esac #DEBHELPER# exit 0 cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.dirs0000644000000000000000000000011213530623213030103 0ustar0000000000000000/etc/apache2/sites-available /var/log/apache2/clckwrks-dot-com-production cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/clckwrks-dot-com-production.logrotate0000644000000000000000000000065113530623213031152 0ustar0000000000000000/var/log/apache2/clckwrks-dot-com-production/access.log { copytruncate weekly rotate 5 compress missingok } /var/log/apache2/clckwrks-dot-com-production/error.log { copytruncate weekly rotate 5 compress missingok } /var/log/clckwrks-dot-com-production/access.log { weekly rotate 5 compress missingok } /var/log/clckwrks-dot-com-production/app.log { weekly rotate 5 compress missingok } cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/changelog0000644000000000000000000000601613530623213023534 0ustar0000000000000000haskell-clckwrks-dot-com (0.2.4) unstable; urgency=low * Bumped to allow clckwrks 0.14 -- Jeremy Shaw Wed, 26 Dec 2012 11:56:20 -0600 haskell-clckwrks-dot-com (0.2.3) unstable; urgency=low * Added -rtsopts flag because the debian packaging requires it -- Jeremy Shaw Thu, 20 Dec 2012 15:51:07 -0600 haskell-clckwrks-dot-com (0.2.2) unstable; urgency=low * Added -with-rtsopts=-I0 flag to ghc-options -- Jeremy Shaw Wed, 19 Dec 2012 15:20:12 -0600 haskell-clckwrks-dot-com (0.2.1) unstable; urgency=low * include blogHandler hack -- Jeremy Shaw Tue, 11 Dec 2012 00:06:09 -0600 haskell-clckwrks-dot-com (0.2.0) unstable; urgency=low * Updated to clckwrks 0.13.* * Debianization generated by cabal-debian * Debianization generated by cabal-debian * Debianization generated by cabal-debian * Debianization generated by cabal-debian -- Jeremy Shaw Wed, 28 Nov 2012 15:58:44 -0600 haskell-clckwrks-dot-com (0.1.18) unstable; urgency=low * Allow most recent containers -- Jeremy Shaw Fri, 05 Oct 2012 18:49:33 -0500 haskell-clckwrks-dot-com (0.1.17) unstable; urgency=low * Updated to clckwrks 0.12 * Added waitForTermination -- Jeremy Shaw Wed, 22 Aug 2012 12:08:33 -0500 haskell-clckwrks-dot-com (0.1.16) unstable; urgency=low * Now with support for page slugs -- Jeremy Shaw Fri, 10 Aug 2012 15:13:24 -0500 haskell-clckwrks-dot-com (0.1.15) unstable; urgency=low * updated to latest clcwrks -- Jeremy Shaw Tue, 19 Jun 2012 17:48:37 -0500 haskell-clckwrks-dot-com (0.1.13) unstable; urgency=low * Bumped by accident, but whatever. -- Jeremy Shaw Sat, 09 Jun 2012 17:52:18 -0500 haskell-clckwrks-dot-com (0.1.11) unstable; urgency=low * Who knows -- Jeremy Shaw Tue, 05 Jun 2012 16:39:52 -0500 haskell-clckwrks-dot-com (0.1.6) unstable; urgency=low * Also generate depends on haskell-clckwrks-utils -- Jeremy Shaw Mon, 21 May 2012 18:22:27 -0500 haskell-clckwrks-dot-com (0.1.5) unstable; urgency=low * Fixed debian/rules so that it generates the depends for haskell-clckwrks-theme-clckwrks-utils -- Jeremy Shaw Mon, 21 May 2012 16:31:20 -0500 haskell-clckwrks-dot-com (0.1.4) unstable; urgency=low * Added missing 'cpp-options: -DCABAL' to .cabal * Added missing depends on haskell-clckwrks-theme-clckwrks-utils -- Jeremy Shaw Mon, 21 May 2012 15:07:35 -0500 haskell-clckwrks-dot-com (0.1.3) unstable; urgency=low * Updated command-line processing to match what happstack-debianization expects -- Jeremy Shaw Mon, 21 May 2012 12:39:45 -0500 haskell-clckwrks-dot-com (0.1.2-1~hackage1) unstable; urgency=low * Debianization generated by cabal-debian -- Jeremy Shaw Sun, 20 May 2012 13:50:50 -0500 cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/cabalInstall/0000755000000000000000000000000013530623213024250 5ustar0000000000000000test-data/clckwrks-dot-com/output/debian/cabalInstall/6cb4323c6b76525f567919adaf912663/0000755000000000000000000000000013530623213030345 5ustar0000000000000000cabal-debian-5.0clckwrks-dot-com/output/debian/cabalInstall/6cb4323c6b76525f567919adaf912663/clckwrks.com.conf0000644000000000000000000000156213530623213033620 0ustar0000000000000000cabal-debian-5.0/test-data ServerAdmin logic@seereason.com ServerName www.clckwrks.com ServerAlias clckwrks.com ErrorLog /var/log/apache2/clckwrks-dot-com-production/error.log CustomLog /var/log/apache2/clckwrks-dot-com-production/access.log combined ProxyRequests Off AllowEncodedSlashes NoDecode AddDefaultCharset off Order deny,allow #Allow from .example.com Deny from all #Allow from all AddDefaultCharset off Order deny,allow #Allow from .example.com #Deny from all Allow from all SetEnv proxy-sendcl 1 ProxyPass / http://127.0.0.1:9029/ nocanon ProxyPassReverse / http://127.0.0.1:9029/ cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/source/0000755000000000000000000000000013530623213023157 5ustar0000000000000000cabal-debian-5.0/test-data/clckwrks-dot-com/output/debian/source/format0000644000000000000000000000001513530623213024366 0ustar00000000000000003.0 (native) cabal-debian-5.0/src/0000755000000000000000000000000013530623213012613 5ustar0000000000000000cabal-debian-5.0/src/Distribution/0000755000000000000000000000000013530623213015272 5ustar0000000000000000cabal-debian-5.0/src/Distribution/Version/0000755000000000000000000000000013530623213016717 5ustar0000000000000000cabal-debian-5.0/src/Distribution/Version/Invert.hs0000644000000000000000000000422213530623213020522 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Distribution.Version.Invert ( invertVersionRange , invertVersionIntervals ) where #if MIN_VERSION_Cabal(1,24,0) import Distribution.Version (invertVersionRange, invertVersionIntervals) #else import Distribution.Version (Version(Version), VersionRange, fromVersionIntervals, asVersionIntervals, mkVersionIntervals, LowerBound(LowerBound), UpperBound(UpperBound, NoUpperBound), Bound(InclusiveBound, ExclusiveBound)) -- | This function belongs in Cabal, see http://hackage.haskell.org/trac/hackage/ticket/935. invertVersionRange :: VersionRange -> VersionRange invertVersionRange = fromVersionIntervals . maybe (error "invertVersionRange") id . mkVersionIntervals . invertVersionIntervals . asVersionIntervals invertVersionIntervals :: [(LowerBound, UpperBound)] -> [(LowerBound, UpperBound)] invertVersionIntervals xs = case xs of [] -> [(lb0, NoUpperBound)] ((LowerBound (Version [0] []) InclusiveBound, ub) : more) -> invertVersionIntervals' ub more ((lb, ub) : more) -> (lb0, invertLowerBound lb) : invertVersionIntervals' ub more where invertVersionIntervals' :: UpperBound -> [(LowerBound, UpperBound)] -> [(LowerBound, UpperBound)] invertVersionIntervals' NoUpperBound [] = [] invertVersionIntervals' ub0 [] = [(invertUpperBound ub0, NoUpperBound)] invertVersionIntervals' ub0 [(lb, NoUpperBound)] = [(invertUpperBound ub0, invertLowerBound lb)] invertVersionIntervals' ub0 ((lb, ub1) : more) = (invertUpperBound ub0, invertLowerBound lb) : invertVersionIntervals' ub1 more invertLowerBound :: LowerBound -> UpperBound invertLowerBound (LowerBound v b) = UpperBound v (invertBound b) invertUpperBound :: UpperBound -> LowerBound invertUpperBound (UpperBound v b) = LowerBound v (invertBound b) invertUpperBound NoUpperBound = error "NoUpperBound: unexpected" invertBound :: Bound -> Bound invertBound ExclusiveBound = InclusiveBound invertBound InclusiveBound = ExclusiveBound lb0 :: LowerBound lb0 = LowerBound (Version [0] []) InclusiveBound #endif cabal-debian-5.0/src/Data/0000755000000000000000000000000013530623213013464 5ustar0000000000000000cabal-debian-5.0/src/Data/Maybe/0000755000000000000000000000000013530623213014521 5ustar0000000000000000cabal-debian-5.0/src/Data/Maybe/Extended.hs0000644000000000000000000000026513530623213016620 0ustar0000000000000000module Data.Maybe.Extended ( module Data.Maybe, nothingIf ) where import Data.Maybe nothingIf :: (a -> Bool) -> a -> Maybe a nothingIf p x = if p x then Nothing else Just x cabal-debian-5.0/src/Debian/0000755000000000000000000000000013530623213013775 5ustar0000000000000000cabal-debian-5.0/src/Debian/GHC.hs0000644000000000000000000002670013530623213014737 0ustar0000000000000000{-# LANGUAGE CPP, RankNTypes, ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.GHC ( withCompilerVersion , newestAvailable , compilerIdFromDebianVersion , compilerFlavorOption , newestAvailableCompilerId -- , ghcNewestAvailableVersion' -- , ghcNewestAvailableVersion -- , compilerIdFromDebianVersion , withModifiedPATH -- , CompilerChoice(..), hcVendor, hcFlavor , compilerPackageName #if MIN_VERSION_Cabal(1,22,0) , getCompilerInfo #endif ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) #endif import Control.Exception (SomeException, throw, try) import Control.Lens (_2, over) import Control.Monad ((<=<)) import Control.Monad.Trans (MonadIO, liftIO) import Data.Char (isSpace, toLower, toUpper) import Data.List (intercalate) import Debian.Debianize.BinaryDebDescription (PackageType(..)) import Debian.Relation (BinPkgName(BinPkgName)) import Debian.Version (DebianVersion, parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..), CompilerId(CompilerId)) #if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (CompilerInfo(..), unknownCompilerInfo, AbiTag(NoAbiTag)) #endif #if MIN_VERSION_Cabal(2,0,0) import Distribution.Pretty (prettyShow) import Distribution.Version (mkVersion', mkVersion, Version, versionNumbers) import Data.Version (parseVersion) #else import Data.Version (showVersion, Version(..), parseVersion) #endif import System.Console.GetOpt (ArgDescr(ReqArg), OptDescr(..)) import System.Environment (getEnv) import System.Exit (ExitCode(ExitFailure, ExitSuccess)) -- import System.IO (hPutStrLn, stderr) import System.IO.Error (isDoesNotExistError) import System.Process (readProcess, showCommandForUser, readProcessWithExitCode) import System.Posix.Env (setEnv) import Text.ParserCombinators.ReadP (readP_to_S) import Text.Read (readMaybe) import Text.Regex.TDFA ((=~)) import UnliftIO.Memoize (memoizeMVar, runMemoized, Memoized) toVersion :: String -> Maybe Version toVersion s = case filter (all isSpace . snd) (readP_to_S parseVersion s) of #if MIN_VERSION_Cabal(2,0,0) [(v, _)] -> Just (mkVersion' v) #else [(v, _)] -> Just v #endif _ -> Nothing withCompilerVersion :: CompilerFlavor -> (DebianVersion -> a) -> IO (Either String a) withCompilerVersion hc f = newestAvailableCompiler hc >>= \nac -> return (fmap f nac) withModifiedPATH :: MonadIO m => (String -> String) -> m a -> m a withModifiedPATH f action = do path0 <- liftIO $ getEnv "PATH" liftIO $ setEnv "PATH" (f path0) True -- liftIO $ hPutStrLn stderr $ "*** withCompilerPath vendor=" ++ show vendor -- liftIO $ hPutStrLn stderr $ "*** Setting $PATH to " ++ show path r <- action -- liftIO $ hPutStrLn stderr $ "*** Resetting $PATH to " ++ show path0 liftIO $ setEnv "PATH" path0 True return r -- | Memoized version of newestAvailable' newestAvailable :: BinPkgName -> IO (Memoized (Either String DebianVersion)) newestAvailable pkg = memoizeMVar (f pkg) where f :: BinPkgName -> IO (Either String DebianVersion) f = newestAvailable' -- | Look up the newest version of a deb available newestAvailable' :: BinPkgName -> IO (Either String DebianVersion) newestAvailable' (BinPkgName name) = do versions <- try $ dropWhile (/= "Versions: ") . lines <$> readProcess "apt-cache" ["showpkg", name] "" :: IO (Either SomeException [String]) case versions of Left e -> return $ Left $ "newestAvailable failed: " ++ show e Right (_ : versionLine : _) -> return . Right . parseDebianVersion' . takeWhile (/= ' ') $ versionLine Right x -> return $ Left $ "Unexpected result from apt-cache showpkg: " ++ show x newestAvailableCompiler :: CompilerFlavor -> IO (Either String DebianVersion) newestAvailableCompiler hc = maybe (return (Left "No compiler package")) (runMemoized <=< newestAvailable) =<< compilerPackageName hc Development newestAvailableCompilerId :: CompilerFlavor -> IO (Either String CompilerId) newestAvailableCompilerId hc = fmap (compilerIdFromDebianVersion hc) <$> newestAvailableCompiler hc {- -- | The IO portion of ghcVersion. For there to be no version of ghc -- available is an exceptional condition, it has been standard in -- Debian and Ubuntu for a long time. ghcNewestAvailableVersion :: CompilerFlavor -> IO DebianVersion ghcNewestAvailableVersion hc = do versions <- try $ chroot $ (readProcess "apt-cache" ["showpkg", map toLower (show hc)] "" >>= return . dropWhile (/= "Versions: ") . lines) :: IO (Either SomeException [String]) case versions of Left e -> error $ "ghcNewestAvailableVersion failed in: " ++ show e Right (_ : versionLine : _) -> return . parseDebianVersion . takeWhile (/= ' ') $ versionLine _ -> error $ "No version of ghc available" -- | Memoize the CompilerId built for the newest available version of -- the compiler package so we don't keep running apt-cache showpkg -- over and over. ghcNewestAvailableVersion' :: CompilerFlavor -> CompilerId ghcNewestAvailableVersion' hc = memoize f hc where f :: (CompilerFlavor, FilePath) -> CompilerId f hc' = unsafePerformIO (g hc') g hc = do ver <- ghcNewestAvailableVersion hc let cid = compilerIdFromDebianVersion ver -- hPutStrLn stderr ("GHC Debian version: " ++ show ver ++ ", Compiler ID: " ++ show cid) return cid -} compilerIdFromDebianVersion :: CompilerFlavor -> DebianVersion -> CompilerId compilerIdFromDebianVersion hc debVersion = #if MIN_VERSION_Cabal(2,0,0) let ds = versionNumbers (greatestLowerBound debVersion (map (\ d -> mkVersion [d]) [0..])) in CompilerId hc (greatestLowerBound debVersion (map (\ d -> mkVersion (ds ++ [d])) [0..])) #else let (Version ds ts) = greatestLowerBound debVersion (map (\ d -> Version [d] []) [0..]) in CompilerId hc (greatestLowerBound debVersion (map (\ d -> Version (ds ++ [d]) ts) [0..])) #endif where greatestLowerBound :: DebianVersion -> [Version] -> Version greatestLowerBound b xs = last $ takeWhile (\ v -> parseDebianVersion' (prettyShow v) < b) xs -- | General function to build a command line option that reads most -- of the possible values for CompilerFlavor. compilerFlavorOption :: forall a. (CompilerFlavor -> a -> a) -> OptDescr (a -> a) compilerFlavorOption f = Option [] ["hc", "compiler-flavor"] (ReqArg readHC "COMPILER") "Build packages using this Haskell compiler" where -- Most of the constructors in CompilerFlavor are arity zero and -- all caps, though two are capitalized - Hugs and Helium. This -- won't read those, and it won't read HaskellSuite String or -- OtherCompiler String readHC :: String -> a -> a readHC s = maybe (error $ "Invalid CompilerFlavor: " ++ show s) f (readMaybe (map toUpper s)) {- debName :: CompilerFlavor -> Maybe BinPkgName debName hc = case map toLower (show hc) of s | any isSpace s -> Nothing s -> Just (BinPkgName s) -} -- | Compute the compiler package names by finding out what package -- contains the corresponding executable. compilerPackageName :: CompilerFlavor -> PackageType -> IO (Maybe BinPkgName) compilerPackageName hc typ = do mcp <- compilerPackage hc return $ fmap finish mcp where finish (BinPkgName hcname) = let isDebian = map toLower (show hc) == hcname in -- hcname is the package that contains the compiler -- executable. This will be ghc or ghcjs for Debian -- packages, anything else is an hvr package. case (hc, typ, isDebian) of -- Debian puts the .haddock files in ghc-doc (GHC, Documentation, True) -> BinPkgName (hcname ++ "-doc") -- In HVR repo the .haddock files required to buid html -- are in the main compiler package. However, the html -- files in ghc--htmldocs are also needed to -- create links. (GHC, Documentation, False) -> BinPkgName (hcname ++ "-htmldocs") (GHC, Profiling, _) -> BinPkgName (hcname ++ "-prof") _ -> BinPkgName hcname compilerPackage :: CompilerFlavor -> IO (Maybe BinPkgName) compilerPackage GHC = filePackage "ghc" >>= runMemoized #if MIN_VERSION_Cabal(1,22,0) compilerPackage GHCJS = filePackage "ghcjs" >>= runMemoized #endif compilerPackage x = error $ "compilerPackage - unsupported CompilerFlavor: " ++ show x filePackage :: FilePath -> IO (Memoized (Maybe BinPkgName)) filePackage = memoizeMVar . f where f :: FilePath -> IO (Maybe BinPkgName) f p = which p >>= maybe (return Nothing) (\x -> package <$> readProcess "dpkg-query" ["-S", x] "") package :: String -> Maybe BinPkgName package s = case s =~ "^(.*): .*$" :: (String, String, String, [String]) of (_, _, _, [name]) -> Just (BinPkgName name) _ -> Nothing which :: String -> IO (Maybe FilePath) which bin = toPath . over _2 lines <$> readProcessWithExitCode "which" [bin] "" where toPath :: (ExitCode, [String], String) -> Maybe String toPath (ExitSuccess, [path], _) = Just path toPath _ = Nothing #if MIN_VERSION_Cabal(1,22,0) -- | IO based alternative to newestAvailableCompilerId - install the -- compiler into the chroot if necessary and ask it for its version -- number. This has the benefit of working for ghcjs, which doesn't -- make the base ghc version available in the version number. getCompilerInfo :: MonadIO m => CompilerFlavor -> m (Either String CompilerInfo) getCompilerInfo flavor = liftIO $ getCompilerInfo' flavor getCompilerInfo' :: CompilerFlavor -> IO (Either String CompilerInfo) getCompilerInfo' flavor = do r <- try $ readProcessWithExitCode (hcCommand flavor) ["--numeric-version"] "" case r of Left e | isDoesNotExistError e -> return $ Left $ "getCompilerInfo - " ++ show e Left e -> throw e Right r'@(ExitFailure _, _, _) -> error $ processErrorMessage "getCompilerInfo" (hcCommand flavor) ["--numeric-version"] r' Right (_, out, _) -> do let compilerId = maybe (error $ "Parse error in version string: " ++ show out) (CompilerId flavor) (toVersion out) compilerCompat <- case flavor of #if MIN_VERSION_Cabal(1,22,0) GHCJS -> do (r' :: Either IOError (ExitCode, String, String)) <- try $ readProcessWithExitCode (hcCommand flavor) ["--numeric-ghc-version"] "" case r' of Right (ExitSuccess, out', _) -> maybe (error $ "getCompilerInfo - parse error in version string: " ++ show out') (return . Just . (: []) . CompilerId GHC) (toVersion out') _ -> error "getCompilerInfo - failure computing compilerCompat" #endif _ -> return Nothing return $ Right $ (unknownCompilerInfo compilerId NoAbiTag) {compilerInfoCompat = compilerCompat} processErrorMessage :: String -> String -> [String] -> (ExitCode, String, String) -> String processErrorMessage msg cmd args (ExitFailure n, out, err) = msg ++ " - " ++ showCommandForUser cmd args ++ " -> " ++ show n ++ "\n stdout: " ++ indent out ++ "\n stderr: " ++ indent err where indent :: String -> String indent = intercalate "\n " . lines processErrorMessage _msg _cmd _args (ExitSuccess, _out, _err) = "" hcCommand :: CompilerFlavor -> String hcCommand GHC = "ghc" #if MIN_VERSION_Cabal(1,22,0) hcCommand GHCJS = "ghcjs" #endif hcCommand flavor = error $ "hcCommand - unexpected CompilerFlavor: " ++ show flavor #endif cabal-debian-5.0/src/Debian/Debianize.hs0000644000000000000000000001507413530623213016232 0ustar0000000000000000-- | [/QUICK START:/] -- -- You can either run @cabal-debian@, or -- for more power and flexibility you can put a @Debianize.hs@ script in -- the package's @debian@ subdirectory. -- -- To see what your debianization would produce, or how it differs -- from the debianization already present: -- -- > % cabal-debian -n -- -- This is equivalent to the library call -- -- > % ghc -e 'System.Environment.withArgs ["-n"] $ Debian.Debianize.performDebianization Debian.Debianize.debianDefaults' -- -- To actually create the debianization and then build the debs, -- -- > % ghc -e 'Debian.Debianize.performDebianization Debian.Debianize.debianDefaults' -- > % sudo dpkg-buildpackage -- -- At this point you may need a script to achieve specific packaging -- goals. Put this this in debian/Debianize.hs: -- -- > import Control.Lens -- > import Data.Map as Map -- > import Data.Set as Set -- > import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel)) -- > import Debian.Debianize -- > main = performDebianization $ do -- > debianDefaults -- > (debInfo . binaryDebDescription (BinPkgName "cabal-debian") . relations . depends) %= (++ (rels "apt-file, debian-policy, debhelper, haskell-devscripts (>= 0.8.19)")) -- -- Then to test it, -- -- > % runhaskell debian/Debianize.hs -n -- -- and to run it for real: -- -- > % runhaskell debian/Debianize.hs -- -- [/DESIGN OVERVIEW/] -- -- The three phases of the operation of the system are Input -> Finalization -> Output. -- -- [Input] Module "Debian.Debianize.Input" - gather inputs using IO -- operations and customization functions, from the .cabal file, an -- existing debianization, and so on. This information results in -- a value of type @Atoms@. Modules @Types@, @Lenses@, @Inputs@. -- -- [Customize] Make modifications to the input values -- -- [Finalization] Module "Debian.Debianize.Finalize" - Fill in any -- information missing from @Atoms@ that is required to build the -- debianization based on the inputs and our policy decisions. -- -- [Debianize] Module "Debian.Debianize.Files" - Compute the paths -- and files of the debianization from the Atoms value. -- -- [Output] Module "Debian.Debianize.Output" - Perform a variety of -- output operations on the debianzation - writing or updating the -- files in a debian directory, comparing two debianizations, -- validate a debianization (ensure two debianizations match in -- source and binary package names), or describe a debianization. -- -- There is also a high level function to run a script that runs this -- entire pipeline when it finds from a script found in a -- debian/Debianize.hs file. module Debian.Debianize ( -- * Collect information about desired debianization module Debian.Debianize.BasicInfo , module Debian.Debianize.DebInfo , module Debian.Debianize.SourceDebDescription , module Debian.Debianize.BinaryDebDescription , module Debian.Debianize.CopyrightDescription , module Debian.Debianize.CabalInfo -- * State monads to carry the collected information, command line options , module Debian.Debianize.Monad -- * Functions for maping Cabal name and version number to Debian name , module Debian.Debianize.DebianName -- * Specific details about the particular packages and versions in the Debian repo , module Debian.Debianize.Details -- * Functions to configure some useful packaging idioms - web server packages, -- tight install dependencies, etc. , module Debian.Debianize.Goodies -- * IO functions for reading debian or cabal packaging info , module Debian.Debianize.InputDebian , module Debian.Debianize.InputCabal -- * Finish computing the debianization and output the result -- , module Debian.Debianize.Finalize , module Debian.Debianize.Output -- * Utility functions , module Debian.Debianize.Prelude , module Debian.Debianize.VersionSplits , module Debian.GHC , module Debian.Policy ) where import Debian.Debianize.CabalInfo -- (debianNameMap, debInfo, epochMap, newAtoms, packageDescription, PackageInfo, packageInfo, showAtoms) import Debian.Debianize.BasicInfo import Debian.Debianize.BinaryDebDescription import Debian.Debianize.CopyrightDescription import Debian.Debianize.DebInfo -- (Atom(..), atomSet, changelog, compat, control, copyright, DebInfo, file, flags, install, installCabalExec, installCabalExecTo, installData, installDir, installInit, installTo, intermediateFiles, link, logrotateStanza, makeDebInfo, postInst, postRm, preInst, preRm, rulesFragments, rulesHead, rulesIncludes, rulesSettings, sourceFormat, warning, watch, apacheSite, backups, buildDir, comments, debVersion, execMap, executable, extraDevDeps, extraLibMap, InstallFile(..), maintainerOption, missingDependencies, noDocumentationLibrary, noProfilingLibrary, official, omitLTDeps, omitProfVersionDeps, revision, Server(..), serverInfo, Site(..), sourceArchitectures, sourcePackageName, uploadersOption, utilsPackageNameBase, website, xDescription, overrideDebianNameBase) import Debian.Debianize.DebianName (mapCabal, splitCabal, remapCabal) import Debian.Debianize.Details (debianDefaults) --import Debian.Debianize.Finalize (debianize) import Debian.Debianize.Goodies -- (doBackups, doExecutable, doServer, doWebsite, tightDependencyFixup) import Debian.Debianize.InputDebian (inputChangeLog, inputDebianization, inputDebianizationFile) import Debian.Debianize.InputCabal (inputCabalization) import Debian.Debianize.Monad (CabalM, CabalT, evalCabalM, evalCabalT, execCabalM, execCabalT, runCabalM, runCabalT, DebianT, execDebianT, evalDebianT, liftCabal) import Debian.Debianize.Output (compareDebianization, describeDebianization, finishDebianization, performDebianization, runDebianizeScript, validateDebianization, writeDebianization) import Debian.Debianize.Prelude (buildDebVersionMap, debOfFile, dpkgFileMap, withCurrentDirectory, (.?=)) import Debian.Debianize.SourceDebDescription import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.GHC () 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) cabal-debian-5.0/src/Debian/Orphans.hs0000644000000000000000000001215713530623213015751 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, StandaloneDeriving, CPP #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Orphans where import Data.Function (on) import Data.Generics (Data, Typeable) import Data.List (intersperse, isPrefixOf) import Data.Maybe (fromMaybe) import Data.Monoid ((<>)) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..)) 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 (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.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 instance Ord PackageDescription where compare = compare `on` package dropPrefix :: String -> String -> Maybe String dropPrefix p s = if isPrefixOf p s then Just (drop (length p) s) else Nothing deriving instance Data ArchitectureReq deriving instance Data ChangeLog deriving instance Data ChangeLogEntry deriving instance Data Relation deriving instance Data VersionReq deriving instance Typeable ArchitectureReq deriving instance Typeable ChangeLog deriving instance Typeable ChangeLogEntry deriving instance Typeable Relation deriving instance Typeable VersionReq 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 pretty (PP (GPL _)) = text "GPL" pretty (PP (LGPL _)) = text "LGPL" pretty (PP BSD3) = text "BSD" pretty (PP BSD4) = text "BSD-like" pretty (PP PublicDomain) = text "Public Domain" pretty (PP AllRightsReserved) = text "Proprietary" pretty (PP OtherLicense) = text "Non-distributable" pretty (PP MIT) = text "MIT" pretty (PP (UnknownLicense _)) = text "Unknown" pretty (PP x) = text (show x) deriving instance Data NameAddr deriving instance Typeable NameAddr deriving instance Read NameAddr -- This Pretty instance gives a string used to create a valid -- changelog entry, it *must* have a name followed by an email address -- in angle brackets. instance Pretty (PP NameAddr) where pretty (PP x) = text (fromMaybe (nameAddr_addr x) (nameAddr_name x) ++ " <" ++ nameAddr_addr x ++ ">") -- pretty x = text (maybe (nameAddr_addr x) (\ n -> n ++ " <" ++ nameAddr_addr x ++ ">") (nameAddr_name x)) instance Pretty (PP [NameAddr]) where 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 instance Pretty (PP Version) where pretty = text . prettyShow . unPP instance Pretty (PP URI) where pretty = text . show . unPP cabal-debian-5.0/src/Debian/Policy.hs0000644000000000000000000004265313530623213015602 0ustar0000000000000000-- | Code pulled out of cabal-debian that straightforwardly implements -- parts of the Debian policy manual, or other bits of Linux standards. {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings #-} module Debian.Policy ( -- * Paths databaseDirectory , dataDirectory , apacheLogDirectory , apacheErrorLog , apacheAccessLog , serverLogDirectory , serverAppLog , serverAccessLog , errorLogBaseName , appLogBaseName , accessLogBaseName -- * Installed packages , debianPackageVersion , getDebhelperCompatLevel , StandardsVersion(..) , getDebianStandardsVersion , parseStandardsVersion -- * Package fields , SourceFormat(..) , readSourceFormat , PackagePriority(..) , readPriority , PackageArchitectures(..) , parsePackageArchitectures , Section(..) , readSection , MultiArch(..) , readMultiArch , Area(..) , parseUploaders , parseMaintainer , maintainerOfLastResort , getCurrentDebianUser , haskellMaintainer , License(..) , fromCabalLicense , toCabalLicense , readLicense ) where import Codec.Binary.UTF8.String (decodeString) import Control.Arrow (second) import Control.Monad (mplus) import Data.Char (isSpace, toLower) import Data.Generics (Data, Typeable) import Data.List (groupBy, intercalate) import Data.Maybe (fromMaybe, mapMaybe) import Data.Monoid ((<>)) import Data.Text (pack, strip, Text, unpack) import Debian.Debianize.Prelude (read') import Debian.Pretty (PP(..)) import Debian.Relation (BinPkgName) import Debian.Version (DebianVersion, parseDebianVersion', version) import qualified Distribution.License as Cabal (License(..)) import Distribution.Package (PackageIdentifier(pkgName)) import Distribution.PackageDescription (PackageDescription(package)) import Distribution.Text (display) import System.Environment (getEnvironment) import System.FilePath (()) import System.Process (readProcess) import Text.Parsec (parse) #if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (address, NameAddr(..)) #else import Text.ParserCombinators.Parsec.Rfc2822 (address, NameAddr(..)) #endif import Text.PrettyPrint.HughesPJClass (text) import Distribution.Pretty (Pretty(pretty)) import Text.Read (readMaybe) databaseDirectory :: BinPkgName -> String databaseDirectory x = "/srv" show (pretty . PP $ x) dataDirectory :: PackageDescription -> String dataDirectory pkgDesc = "/usr/share" showPkgName (pkgName (package pkgDesc)) where -- Copied from Distribution.Simple.Build.PatsModule in Cabal showPkgName = map fixchar . display fixchar '-' = '_' fixchar c = c apacheLogDirectory :: BinPkgName -> String apacheLogDirectory x = "/var/log/apache2/" ++ show (pretty . PP $ x) apacheErrorLog :: BinPkgName -> String apacheErrorLog x = apacheLogDirectory x errorLogBaseName apacheAccessLog :: BinPkgName -> String apacheAccessLog x = apacheLogDirectory x accessLogBaseName serverLogDirectory :: BinPkgName -> String serverLogDirectory x = "/var/log/" ++ show (pretty . PP $ x) serverAppLog :: BinPkgName -> String serverAppLog x = serverLogDirectory x appLogBaseName serverAccessLog :: BinPkgName -> String serverAccessLog x = serverLogDirectory x accessLogBaseName appLogBaseName :: String appLogBaseName = "app.log" errorLogBaseName :: String errorLogBaseName = "error.log" accessLogBaseName :: String accessLogBaseName = "access.log" debianPackageVersion :: String -> IO (Maybe DebianVersion) debianPackageVersion name = readProcess "dpkg-query" ["--show", "--showformat=${version}", name] "" >>= return . parseDebianVersion'' where -- This should maybe be the real parseDebianVersion parseDebianVersion'' "" = Nothing parseDebianVersion'' s = Just (parseDebianVersion' s) -- | With the current state of CDBS, anything above 10 breaks, so -- for now we force this to 10. getDebhelperCompatLevel :: IO (Maybe Int) getDebhelperCompatLevel = return (Just 10) data StandardsVersion = StandardsVersion Int Int Int (Maybe Int) deriving (Eq, Ord, Show, Data, Typeable) instance Pretty (PP StandardsVersion) where pretty (PP (StandardsVersion a b c (Just d))) = text (show a) <> text "." <> text (show b) <> text "." <> text (show c) <> text "." <> text (show d) pretty (PP (StandardsVersion a b c Nothing)) = text (show a) <> text "." <> text (show b) <> text "." <> text (show c) -- | Assumes debian-policy is installed getDebianStandardsVersion :: IO (Maybe StandardsVersion) getDebianStandardsVersion = debianPackageVersion "debian-policy" >>= return . fmap (parseStandardsVersion . version) parseStandardsVersion :: String -> StandardsVersion parseStandardsVersion s = case filter (/= ".") (groupBy (\ a b -> (a == '.') == (b == '.')) s) of (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 = Native3 | Quilt3 deriving (Eq, Ord, Show, Data, Typeable) instance Pretty (PP SourceFormat) where pretty (PP Quilt3) = text "3.0 (quilt)\n" pretty (PP Native3) = text "3.0 (native)\n" readSourceFormat :: Text -> Either Text SourceFormat readSourceFormat s = case () of _ | strip s == "3.0 (native)" -> Right Native3 _ | strip s == "3.0 (quilt)" -> Right Quilt3 _ -> Left $ "Invalid debian/source/format: " <> pack (show (strip s)) data PackagePriority = Required | Important | Standard | Optional | Extra deriving (Eq, Ord, Read, Show, Data, Typeable) readPriority :: String -> PackagePriority readPriority s = case unpack (strip (pack s)) of "required" -> Required "important" -> Important "standard" -> Standard "optional" -> Optional "extra" -> Extra x -> error $ "Invalid priority string: " ++ show x instance Pretty (PP PackagePriority) where pretty = text . map toLower . show . unPP -- | The architectures for which a binary deb can be built. data PackageArchitectures = All -- ^ The package is architecture independenct | Any -- ^ The package can be built for any architecture | Names [String] -- ^ The list of suitable architectures deriving (Read, Eq, Ord, Show, Data, Typeable) instance Pretty (PP PackageArchitectures) where pretty (PP All) = text "all" pretty (PP Any) = text "any" pretty (PP (Names xs)) = text $ intercalate " " xs parsePackageArchitectures :: String -> PackageArchitectures parsePackageArchitectures "all" = All parsePackageArchitectures "any" = Any parsePackageArchitectures s = error $ "FIXME: parsePackageArchitectures " ++ show s data Section = MainSection String -- Equivalent to AreaSection Main s? | AreaSection Area String deriving (Read, Eq, Ord, Show, Data, Typeable) readSection :: String -> Section readSection s = case break (== '/') s of ("contrib", '/' : b) -> AreaSection Contrib (tail b) ("non-free", '/' : b) -> AreaSection NonFree (tail b) ("main", '/' : b) -> AreaSection Main (tail b) (a, '/' : _) -> error $ "readSection - unknown area: " ++ show a (a, _) -> MainSection a instance Pretty (PP Section) where pretty (PP (MainSection sec)) = text sec pretty (PP (AreaSection area sec)) = pretty (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 pretty (PP MANo) = text "no" pretty (PP MASame) = text "same" pretty (PP MAForeign) = text "foreign" pretty (PP MAAllowed) = text "allowed" -- Is this really all that is allowed here? Doesn't Ubuntu have different areas? data Area = Main | Contrib | NonFree deriving (Read, Eq, Ord, Show, Data, Typeable) instance Pretty (PP Area) where pretty (PP Main) = text "main" pretty (PP Contrib) = text "contrib" pretty (PP NonFree) = text "non-free" {- Create a debian maintainer field from the environment variables: DEBFULLNAME (preferred) or NAME DEBEMAIL (preferred) or EMAIL More work could be done to match dch, but this is sufficient for now. Here is what the man page for dch has to say: If the environment variable DEBFULLNAME is set, this will be used for the maintainer full name; if not, then NAME will be checked. If the environment variable DEBEMAIL is set, this will be used for the email address. If this variable has the form "name ", then the maintainer name will also be taken from here if neither DEBFULLNAME nor NAME is set. If this variable is not set, the same test is performed on the environment variable EMAIL. Next, if the full name has still not been determined, then use getpwuid(3) to determine the name from the pass‐word file. If this fails, use the previous changelog entry. For the email address, if it has not been set from DEBEMAIL or EMAIL, then look in /etc/mailname, then attempt to build it from the username and FQDN, otherwise use the email address in the previous changelog entry. In other words, it’s a good idea to set DEBEMAIL and DEBFULLNAME when using this script. -} getCurrentDebianUser :: IO (Maybe NameAddr) getCurrentDebianUser = do env <- map (second decodeString) `fmap` getEnvironment return $ do fullname <- lookup "DEBFULLNAME" env `mplus` lookup "NAME" env email <- lookup "DEBEMAIL" env `mplus` lookup "EMAIL" env either (const Nothing) Just (parseMaintainer (fullname ++ " <" ++ email ++ ">")) haskellMaintainer :: NameAddr haskellMaintainer = NameAddr { nameAddr_name = Just "Debian Haskell Group" , nameAddr_addr = "pkg-haskell-maintainers@lists.alioth.debian.org"} -- | Turn the uploaders field of a cabal package into a list of -- RFC2822 NameAddr values. parseUploaders :: String -> Either String [NameAddr] parseUploaders x = either (Left . show) fixNameAddrs (parse address "" ("Names: " ++ map fixWhite x ++ ";")) -- either (\ e -> error ("Failure parsing uploader list: " ++ show x ++ " -> " ++ show e)) id $ where fixWhite c = if isSpace c then ' ' else c -- We absoletely need a name. fixNameAddrs :: [NameAddr] -> Either String [NameAddr] fixNameAddrs xs = case mapMaybe fixNameAddr xs of [] -> Left ("No valid debian maintainers in " ++ show x) xs' -> Right xs' fixNameAddr :: NameAddr -> Maybe NameAddr fixNameAddr y = case nameAddr_name y of Nothing -> Nothing _ -> Just y -- | Parse a string containing a single NameAddr value. parseMaintainer :: String -> Either String NameAddr parseMaintainer x = case parseUploaders x of Left s -> Left s Right [y] -> Right y Right [] -> Left $ "Missing maintainer: " ++ show x Right ys -> Left $ "Too many maintainers: " ++ show ys -- | Maintainer is a mandatory field, so we need a value we can use -- when all else fails. maintainerOfLastResort :: NameAddr Right maintainerOfLastResort = parseMaintainer "nobody " -- | Official Debian license types as described in -- . data License = Public_Domain -- ^ No license required for any purpose; the work is not subject to copyright in any jurisdiction. | Apache -- ^ Apache license 1.0, 2.0. | Artistic -- ^ Artistic license 1.0, 2.0. | BSD_2_Clause -- ^ Berkeley software distribution license, 2-clause version. | BSD_3_Clause -- ^ Berkeley software distribution license, 3-clause version. | BSD_4_Clause -- ^ Berkeley software distribution license, 4-clause version. | ISC -- ^ Internet Software Consortium, sometimes also known as the OpenBSD License. | CC_BY -- ^ Creative Commons Attribution license 1.0, 2.0, 2.5, 3.0. | CC_BY_SA -- ^ Creative Commons Attribution Share Alike license 1.0, 2.0, 2.5, 3.0. | CC_BY_ND -- ^ Creative Commons Attribution No Derivatives license 1.0, 2.0, 2.5, 3.0. | CC_BY_NC -- ^ Creative Commons Attribution Non-Commercial license 1.0, 2.0, 2.5, 3.0. | CC_BY_NC_SA -- ^ Creative Commons Attribution Non-Commercial Share Alike license 1.0, 2.0, 2.5, 3.0. | CC_BY_NC_ND -- ^ Creative Commons Attribution Non-Commercial No Derivatives license 1.0, 2.0, 2.5, 3.0. | CC0 -- ^ Creative Commons Zero 1.0 Universal. Omit "Universal" from the license version when forming the short name. | CDDL -- ^ Common Development and Distribution License 1.0. | CPL -- ^ IBM Common Public License. | EFL -- ^ The Eiffel Forum License 1.0, 2.0. | Expat -- ^ The Expat license. | GPL -- ^ GNU General Public License 1.0, 2.0, 3.0. | LGPL -- ^ GNU Lesser General Public License 2.1, 3.0, or GNU Library General Public License 2.0. | GFDL -- ^ GNU Free Documentation License 1.0, 1.1, 1.2, or 1.3. Use GFDL-NIV instead if there are no Front-Cover or Back-Cover Texts or Invariant Sections. | GFDL_NIV -- ^ GNU Free Documentation License, with no Front-Cover or Back-Cover Texts or Invariant Sections. Use the same version numbers as GFDL. | LPPL -- ^ LaTeX Project Public License 1.0, 1.1, 1.2, 1.3c. | MPL -- ^ Mozilla Public License 1.1. | Perl -- ^ erl license (use "GPL-1+ or Artistic-1" instead) | Python -- ^ Python license 2.0. | QPL -- ^ Q Public License 1.0. | W3C -- ^ W3C Software License For more information, consult the W3C Intellectual Rights FAQ. | Zlib -- ^ zlib/libpng license. | Zope -- ^ Zope Public License 1.0, 1.1, 2.0, 2.1. | OtherLicense String -- ^ Any other license name deriving (Read, Show, Eq, Ord, Data, Typeable) -- We need a license parse function that converts these strings back -- into License values. instance Pretty License where pretty Public_Domain = text "public-domain" pretty Apache = text "Apache" pretty Artistic = text "Artistic" pretty BSD_2_Clause = text "BSD-2-clause" pretty BSD_3_Clause = text "BSD-3-clause" pretty BSD_4_Clause = text "BSD-4-clause" pretty ISC = text "ISC" pretty CC_BY = text "CC-BY" pretty CC_BY_SA = text "CC-BY-SA" pretty CC_BY_ND = text "CC-BY-ND" pretty CC_BY_NC = text "CC-BY-NC" pretty CC_BY_NC_SA = text "CC-BY-NC-SA" pretty CC_BY_NC_ND = text "CC-BY-NC-ND" pretty CC0 = text "CC0" pretty CDDL = text "CDDL" pretty CPL = text "CPL" pretty EFL = text "EFL" pretty Expat = text "Expat" pretty GPL = text "GPL" pretty LGPL = text "LGPL" pretty GFDL = text "GFDL" pretty GFDL_NIV = text "GFDL-NIV" pretty LPPL = text "LPPL" pretty MPL = text "MPL" pretty Perl = text "Perl" pretty Python = text "Python" pretty QPL = text "QPL" pretty W3C = text "W3C" pretty Zlib = text "Zlib" pretty Zope = text "Zope" pretty (OtherLicense s) = text s -- | Convert the Cabal license to a Debian license. I would welcome input -- on how to make this more correct. fromCabalLicense :: Cabal.License -> License fromCabalLicense x = case x of Cabal.GPL _ -> GPL -- FIXME - what about the version number? same below Cabal.AGPL _ -> OtherLicense (show x) Cabal.LGPL _ -> LGPL Cabal.BSD3 -> BSD_3_Clause Cabal.BSD4 -> BSD_4_Clause Cabal.MIT -> OtherLicense (show x) Cabal.Apache _ -> Apache Cabal.PublicDomain -> Public_Domain Cabal.AllRightsReserved -> OtherLicense "AllRightsReserved" Cabal.OtherLicense -> OtherLicense (show x) Cabal.UnknownLicense _ -> OtherLicense (show x) #if MIN_VERSION_Cabal(1,20,0) Cabal.MPL _ -> MPL #if MIN_VERSION_Cabal(1,22,0) Cabal.BSD2 -> BSD_2_Clause Cabal.ISC -> OtherLicense (show x) Cabal.UnspecifiedLicense -> OtherLicense (show x) #endif #endif -- | Convert a Debian license to a Cabal license. Additional cases -- and corrections welcome. toCabalLicense :: License -> Cabal.License toCabalLicense x = -- This needs to be finished case x of #if MIN_VERSION_Cabal(1,22,0) BSD_2_Clause -> Cabal.BSD2 #endif BSD_3_Clause -> Cabal.BSD3 BSD_4_Clause -> Cabal.BSD4 OtherLicense s -> Cabal.UnknownLicense s _ -> Cabal.UnknownLicense (show x) invalidLicense :: Text -> License invalidLicense = OtherLicense . unpack -- | I think we need an actual parser for license names. readLicense :: Text -> License readLicense t = let s = unpack (strip t) in fromMaybe (invalidLicense t) (readMaybe s) cabal-debian-5.0/src/Debian/Debianize/0000755000000000000000000000000013530623213015667 5ustar0000000000000000cabal-debian-5.0/src/Debian/Debianize/Output.hs0000644000000000000000000002335313530623213017531 0ustar0000000000000000-- | Wrappers around the debianization function to perform various -- tasks - output, describe, validate a debianization, run an external -- script to produce a debianization. {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE FlexibleInstances, OverloadedStrings, ScopedTypeVariables, StandaloneDeriving, TupleSections, TypeSynonymInstances, RankNTypes #-} {-# OPTIONS -Wall -fno-warn-name-shadowing -fno-warn-orphans #-} module Debian.Debianize.Output ( finishDebianization , runDebianizeScript , writeDebianization , describeDebianization , compareDebianization , validateDebianization , performDebianization , performDebianizationOfWebsite , performDebianizationWith ) where import Control.Exception as E (throw) import Control.Lens import Control.Monad.Fail (MonadFail) 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) import Data.Maybe (fromMaybe) import Data.Text as Text (split, Text, unpack) import Debian.Debianize.CabalInfo (newCabalInfo) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..)) 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) import Debian.Debianize.InputDebian (inputDebianization) import Debian.Debianize.Goodies (expandWebsite) import Debian.Debianize.Monad (DebianT, CabalT, evalDebianT, evalCabalT) import Debian.Debianize.Prelude (indent, replaceFile, zipMaps) import Debian.Debianize.Finalize (debianizeWith) import Debian.Debianize.Optparse import Debian.Debianize.BinaryDebDescription as B (canonical, package) import qualified Debian.Debianize.SourceDebDescription as S import Debian.Pretty (ppShow, ppPrint) import Prelude hiding (unlines, writeFile) import System.Directory (createDirectoryIfMissing, doesFileExist, getCurrentDirectory, getPermissions, Permissions(executable), setPermissions) import System.Exit (ExitCode(ExitSuccess)) import System.FilePath ((), takeDirectory) import System.IO (hPutStrLn, stderr) import System.Process (readProcessWithExitCode, showCommandForUser) import Text.PrettyPrint.HughesPJClass (text) -- import System.Posix.Env (setEnv) -- | Run the script in @debian/Debianize.hs@ with the given command -- line arguments. Returns @True@ if the script exists and succeeds. -- In this case it may be assumed that a debianization was created (or -- updated) in the debian subdirectory of the current directory. In -- this way we can include a script in a package to produce a -- customized debianization more sophisticated than the one that would -- be produced by the cabal-debian executable. An example is included -- in the debian subdirectory of this library. runDebianizeScript :: [String] -> IO Bool runDebianizeScript args = getCurrentDirectory >>= \here -> doesFileExist "debian/Debianize.hs" >>= \ exists -> case exists of False -> return False True -> do -- By default runhaskell looks for source in ., we will also look -- in src. Better would be to see where the cabal file looks. let args' = ["-i.:src", "debian/Debianize.hs"] ++ args hPutStrLn stderr ("running external debianization script in " ++ show here ++ ":\n " ++ showCommandForUser "runhaskell" args') result <- readProcessWithExitCode "runhaskell" args' "" case result of (ExitSuccess, _, _) -> return True (code, out, err) -> error (" external debianization script failed:\n " ++ showCommandForUser "runhaskell" args' ++ " -> " ++ show code ++ "\n stdout: " ++ show out ++"\n stderr: " ++ show err) -- | Perform whole debianization. You provide your customization, -- this function does everything else. performDebianization :: CabalT IO () -> IO () performDebianization = performDebianizationWith (return ()) performDebianizationOfWebsite :: CabalT IO () -> IO () performDebianizationOfWebsite = performDebianizationWith expandWebsite performDebianizationWith :: CabalT IO () -> CabalT IO () -> IO () performDebianizationWith goodies custom = parseProgramArguments >>= \CommandLineOptions {..} -> do -- _ <- try (readProcessWithExitCode "apt-get" ["install", "-y", "--force-yes", hcDeb (view compilerFlavor _flags)] "") newCabalInfo _flags >>= either (error . ("peformDebianization - " ++)) (evalCabalT $ do handleBehaviorAdjustment _adjustment debianizeWith goodies custom finishDebianization) -- hcDeb :: CompilerFlavor -> String -- hcDeb GHC = "ghc" -- hcDeb GHCJS = "ghcjs" -- hcDeb flavor = error $ "hcDeb - unexpected CompilerFlavor: " ++ show flavor -- | Depending on the options in @atoms@, either validate, describe, -- or write the generated debianization. finishDebianization :: forall m. (MonadIO m, MonadFail m) => StateT CabalInfo m () finishDebianization = zoom debInfo $ do new <- get case () of _ | view (D.flags . validate) new -> do inputDebianization old <- get return $ validateDebianization old new _ | view (D.flags . dryRun) new -> do inputDebianization 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 -- | Write the files of the debianization @d@ to ./debian writeDebianization :: (MonadIO m, MonadFail m) => DebianT m () writeDebianization = do files <- debianizationFileMap liftIO $ mapM_ (uncurry doFile) (Map.toList files) liftIO $ getPermissions "debian/rules" >>= setPermissions "debian/rules" . (\ p -> p {executable = True}) where doFile path text = do createDirectoryIfMissing True (takeDirectory path) replaceFile path (unpack text) -- | Return a string describing the debianization - a list of file -- names and their contents in a somewhat human readable format. describeDebianization :: (MonadIO m, MonadFail 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. compareDebianization :: D.DebInfo -> D.DebInfo -> [String] compareDebianization old new = let ~(Just oldFiles) = evalDebianT debianizationFileMap (canonical old) ~(Just newFiles) = evalDebianT debianizationFileMap (canonical new) in elems $ zipMaps doFile oldFiles newFiles where doFile :: FilePath -> Maybe Text -> Maybe Text -> Maybe String doFile path (Just _) Nothing = Just (path ++ ": Deleted\n") doFile path Nothing (Just n) = Just (path ++ ": Created\n" ++ indent " | " (unpack n)) doFile path (Just o) (Just n) = if o == n then Nothing -- Just (path ++ ": Unchanged\n") else Just (show (prettyContextDiff (text ("old" path)) (text ("new" path)) (text . unpack) (getContextDiff 2 (split (== '\n') o) (split (== '\n') n)))) doFile _path Nothing Nothing = error "Internal error in zipMaps" -- | Make sure the new debianization matches the existing -- debianization in several ways - specifically, version number, and -- the names of the source and binary packages. Some debian packages -- come with a skeleton debianization that needs to be filled in, this -- can be used to make sure the debianization we produce is usable. validateDebianization :: D.DebInfo -> D.DebInfo -> () validateDebianization old new = case () of _ | oldVersion /= newVersion -> throw (userError ("Version mismatch, expected " ++ ppShow oldVersion ++ ", found " ++ ppShow newVersion)) | oldSource /= newSource -> throw (userError ("Source mismatch, expected " ++ ppShow oldSource ++ ", found " ++ ppShow newSource)) | oldPackages /= newPackages -> throw (userError ("Package mismatch, expected " ++ show (map ppPrint oldPackages) ++ ", found " ++ show (map ppPrint newPackages))) | True -> () where oldVersion = logVersion (head (unChangeLog (fromMaybe (error "Missing changelog") (view D.changelog old)))) newVersion = logVersion (head (unChangeLog (fromMaybe (error "Missing changelog") (view D.changelog new)))) oldSource = view (D.control . S.source) old newSource = view (D.control . S.source) new oldPackages = map (view B.package) $ view (D.control . S.binaryPackages) old newPackages = map (view B.package) $ view (D.control . S.binaryPackages) new unChangeLog :: ChangeLog -> [ChangeLogEntry] unChangeLog (ChangeLog x) = x cabal-debian-5.0/src/Debian/Debianize/ExecAtoms.hs0000644000000000000000000000412213530623213020112 0ustar0000000000000000-- | Things that seem like they could be clients of this library, but -- are instead included as part of the library. {-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings #-} {-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind #-} module Debian.Debianize.ExecAtoms ( execAtoms ) where import Control.Lens ( over, (%=) ) import Data.Maybe ( fromMaybe ) import Data.Set as Set ( insert ) import Data.Text as Text ( pack ) import qualified Debian.Debianize.DebInfo as D ( InstallFile(destName, destDir, execName, sourceDir), Atom(InstallTo, InstallCabalExecTo, Install, InstallCabalExec), rulesFragments, atomSet ) import Debian.Debianize.Monad ( CabalInfo, execCabalM ) import qualified Debian.Debianize.CabalInfo as A ( debInfo ) import qualified Debian.Debianize.BinaryDebDescription as B () import Debian.Pretty ( ppShow ) import Debian.Relation ( BinPkgName ) import System.FilePath ( () ) execAtoms :: BinPkgName -> D.InstallFile -> CabalInfo -> CabalInfo execAtoms b ifile r = over (A.debInfo . D.rulesFragments) (Set.insert (pack ("build" ppShow b ++ ":: build-ghc-stamp\n"))) . fileAtoms b ifile $ r fileAtoms :: BinPkgName -> D.InstallFile -> CabalInfo -> CabalInfo fileAtoms b installFile' r = fileAtoms' b (D.sourceDir installFile') (D.execName installFile') (D.destDir installFile') (D.destName installFile') r fileAtoms' :: BinPkgName -> Maybe FilePath -> String -> Maybe FilePath -> String -> CabalInfo -> CabalInfo fileAtoms' b sourceDir' execName' destDir' destName' r = case (sourceDir', execName' == destName') of (Nothing, True) -> execCabalM ((A.debInfo . D.atomSet) %= (Set.insert $ D.InstallCabalExec b execName' d)) r (Just s, True) -> execCabalM ((A.debInfo . D.atomSet) %= (Set.insert $ D.Install b (s execName') d)) r (Nothing, False) -> execCabalM ((A.debInfo . D.atomSet) %= (Set.insert $ D.InstallCabalExecTo b execName' (d destName'))) r (Just s, False) -> execCabalM ((A.debInfo . D.atomSet) %= (Set.insert $ D.InstallTo b (s execName') (d destName'))) r where d = fromMaybe "usr/bin" destDir' cabal-debian-5.0/src/Debian/Debianize/SourceDebDescription.hs0000644000000000000000000001244413530623213022307 0ustar0000000000000000{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, TemplateHaskell, TypeSynonymInstances #-} module Debian.Debianize.SourceDebDescription ( SourceDebDescription , newSourceDebDescription , newSourceDebDescription' , source , maintainer , changedBy , uploaders , dmUploadAllowed , priority , section , buildDepends , buildConflicts , buildDependsIndep , buildConflictsIndep , standardsVersion , homepage , vcsFields , xFields , xDescription , binaryPackages , VersionControlSpec(..) , XField(..) , XFieldDest(..) ) where import Control.Lens.TH (makeLenses) import Data.Generics (Data, Typeable) import Data.Set as Set (empty, Set) import Data.Text (Text) import Debian.Debianize.BinaryDebDescription (BinaryDebDescription, Canonical(canonical)) import Debian.Orphans () import Debian.Policy (PackagePriority, Section, StandardsVersion) import Debian.Relation (Relations, SrcPkgName) import Prelude hiding (init, init, log, log, unlines) #if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr) #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr) #endif -- | This type represents the debian/control file, which is the core -- of the source package debianization. It includes the information -- that goes in the first, or source, section, and then a list of the -- succeeding binary package sections. data SourceDebDescription = SourceDebDescription { _source :: Maybe SrcPkgName -- ^ , _maintainer :: Either String NameAddr -- ^ , _changedBy :: Maybe NameAddr -- ^ , _uploaders :: [NameAddr] -- ^ , _dmUploadAllowed :: Bool -- ^ , _priority :: Maybe PackagePriority -- ^ , _section :: Maybe Section -- ^ , _standardsVersion :: Maybe StandardsVersion -- ^ , _homepage :: Maybe Text -- ^ , _vcsFields :: Set VersionControlSpec -- ^ , _xFields :: Set XField -- ^ , _buildDepends :: Relations , _buildConflicts :: Relations , _buildDependsIndep :: Relations , _buildConflictsIndep :: Relations , _xDescription :: Maybe Text , _binaryPackages :: [BinaryDebDescription] -- ^ The binary debs. This should be a map, but we may need to preserve the order } deriving (Eq, Ord, Show, Data, Typeable) instance Canonical SourceDebDescription where canonical x = x { _binaryPackages = canonical (_binaryPackages x) , _buildDepends = canonical (_buildDepends x) , _buildConflicts = canonical (_buildConflicts x) , _buildDependsIndep = canonical (_buildDependsIndep x) , _buildConflictsIndep = canonical (_buildConflictsIndep x) } newSourceDebDescription :: SourceDebDescription newSourceDebDescription = SourceDebDescription { _source = Nothing , _maintainer = Left "Maintainer not set" , _changedBy = Nothing , _uploaders = [] , _dmUploadAllowed = False , _priority = Nothing , _section = Nothing , _buildDepends = [] , _buildConflicts = [] , _buildDependsIndep = [] , _buildConflictsIndep = [] , _standardsVersion = Nothing , _homepage = Nothing , _vcsFields = Set.empty , _xFields = Set.empty , _xDescription = Nothing -- Quick hack, I should maybe put this into _xFields , _binaryPackages = [] } newSourceDebDescription' :: SrcPkgName -> NameAddr -> SourceDebDescription newSourceDebDescription' src who = newSourceDebDescription { _source = Just src , _maintainer = Right who } data VersionControlSpec = VCSBrowser Text | VCSArch Text | VCSBzr Text | VCSCvs Text | VCSDarcs Text | VCSGit Text | VCSHg Text | VCSMtn Text | VCSSvn Text deriving (Eq, Ord, Show, Data, Typeable) -- | User defined fields. Parse the line "XBS-Comment: I stand -- between the candle and the star." to get XField (fromList "BS") -- "Comment" " I stand between the candle and the star." data XField = XField (Set XFieldDest) Text Text deriving (Eq, Ord, Show, Data, Typeable) data XFieldDest = B -- ^ Field will be copied to the binary packgae control files | S -- ^ Field will be copied to the source packgae control files | C -- ^ Field will be copied to the upload control (.changes) file deriving (Eq, Ord, Read, Show, Data, Typeable) $(makeLenses ''SourceDebDescription) cabal-debian-5.0/src/Debian/Debianize/CabalInfo.hs0000644000000000000000000001007213530623213020041 0ustar0000000000000000{-# LANGUAGE CPP, DeriveDataTypeable, OverloadedStrings, TemplateHaskell #-} {-# OPTIONS_GHC -Wall #-} module Debian.Debianize.CabalInfo ( -- * Types CabalInfo , PackageInfo(PackageInfo, cabalName, devDeb, docDeb, profDeb) -- * Lenses , packageDescription , debInfo , debianNameMap , epochMap , packageInfo -- * Builder , newCabalInfo ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) import Data.Monoid (Monoid(..)) #endif import Control.Lens import Control.Monad.Catch (MonadMask) import Control.Monad.State (execStateT) import Control.Monad.Trans (MonadIO, liftIO) import Data.Generics (Data, Typeable) import Data.Map as Map (Map) import Data.Text as Text (null, pack, strip) import Debian.Debianize.BasicInfo (Flags) import Debian.Debianize.DebInfo as D (control, copyright, DebInfo, makeDebInfo) import Debian.Debianize.BinaryDebDescription (Canonical(canonical)) import Debian.Debianize.CopyrightDescription (defaultCopyrightDescription) import Debian.Debianize.InputCabal (inputCabalization) import Debian.Debianize.SourceDebDescription as S (homepage) import Debian.Debianize.VersionSplits (VersionSplits) import Debian.Orphans () import Debian.Relation (BinPkgName) import Debian.Version (DebianVersion) import Distribution.Package (PackageName) import Distribution.PackageDescription as Cabal (PackageDescription(homepage)) import Prelude hiding (init, init, log, log, null) -- | Bits and pieces of information about the mapping from cabal package -- names and versions to debian package names and versions. In essence, -- an 'Atoms' value represents a package's debianization. The lenses in -- this module are used to get and set the values hidden in this Atoms -- value. Many of the values should be left alone to be set when the -- debianization is finalized. data CabalInfo = CabalInfo { _packageDescription :: PackageDescription -- ^ The result of reading a cabal configuration file. , _debInfo :: DebInfo -- ^ Information required to represent a non-cabal debianization. , _debianNameMap :: Map PackageName VersionSplits -- ^ Mapping from cabal package name and version to debian source -- package name. This allows different ranges of cabal versions to -- map to different debian source package names. , _epochMap :: Map PackageName Int -- ^ Specify epoch numbers for the debian package generated from a -- cabal package. Example: @EpochMapping (PackageName "HTTP") 1@. , _packageInfo :: Map PackageName PackageInfo -- ^ Supply some info about a cabal package. } deriving (Show, Data, Typeable) data PackageInfo = PackageInfo { cabalName :: PackageName , devDeb :: Maybe (BinPkgName, DebianVersion) , profDeb :: Maybe (BinPkgName, DebianVersion) , docDeb :: Maybe (BinPkgName, DebianVersion) } deriving (Eq, Ord, Show, Data, Typeable) $(makeLenses ''CabalInfo) instance Canonical CabalInfo where canonical x = x {_debInfo = canonical (_debInfo x)} -- | Given the 'Flags' value read the cabalization and build a new -- 'CabalInfo' record. newCabalInfo :: (MonadIO m, MonadMask m{-, Functor m-}) => Flags -> m (Either String CabalInfo) newCabalInfo flags' = inputCabalization flags' >>= either (return . Left) (\p -> Right <$> doPkgDesc p) where doPkgDesc pkgDesc = do copyrt <- liftIO $ defaultCopyrightDescription pkgDesc execStateT (do (debInfo . copyright) .= Just copyrt (debInfo . control . S.homepage) .= case strip (pack (Cabal.homepage pkgDesc)) of x | Text.null x -> Nothing x -> Just x) (makeCabalInfo flags' pkgDesc) makeCabalInfo :: Flags -> PackageDescription -> CabalInfo makeCabalInfo fs pkgDesc = CabalInfo { _packageDescription = pkgDesc , _epochMap = mempty , _packageInfo = mempty , _debianNameMap = mempty , _debInfo = makeDebInfo fs } cabal-debian-5.0/src/Debian/Debianize/Interspersed.hs0000644000000000000000000000500613530623213020673 0ustar0000000000000000-- | A class used while converting Cabal dependencies into Debian -- dependencies. {-# LANGUAGE FlexibleInstances, FunctionalDependencies, MultiParamTypeClasses, StandaloneDeriving, TypeSynonymInstances #-} {-# OPTIONS_GHC -Wall -Werror #-} module Debian.Debianize.Interspersed ( Interspersed(..) ) where import Debug.Trace (trace) -- | A class of Bs insterspersed with Cs. It is used when converting -- the cabal dependencies to debian, where the "around" type is the -- binary package name and the "between" type is the version number. -- -- Minimum implementation is a method to return the leftmost B, and -- another to return the following (C,B) pairs. Its unfortunate to -- require lists in the implementation, a fold function would be -- better (though I find implementing such folds to be a pain in the -- you-know-what.) -- -- The class provides implementations of three folds, each of which -- exposes slightly different views of the data. class Interspersed t around between | t -> around, t -> between where leftmost :: t -> around pairs :: t -> [(between, around)] foldTriples :: (around -> between -> around -> r -> r) -> r -> t -> r foldTriples f r0 x = snd $ foldl (\ (b1, r) (c, b2) -> (b1, f b1 c b2 r)) (leftmost x, r0) (pairs x) -- Treat the b's as the centers and the c's as the things to their -- left and right. Use Maybe to make up for the missing c's at the -- ends. foldInverted :: (Maybe between -> around -> Maybe between -> r -> r) -> r -> t -> r foldInverted f r0 x = (\ (bn, an, r) -> f bn an Nothing r) $ foldl g (Nothing, leftmost x, r0) (pairs x) where g (b1, a1, r) (b2, a2) = (Just b2, a2, f b1 a1 (Just b2) r) foldArounds :: (around -> around -> r -> r) -> r -> t -> r foldArounds f r0 x = snd $ foldl (\ (a1, r) (_, a2) -> (a2, f a1 a2 r)) (leftmost x, r0) (pairs x) foldBetweens :: (between -> r -> r) -> r -> t -> r foldBetweens f r0 x = foldl (\ r (b, _) -> (f b r)) r0 (pairs x) -- | An example data Splits = Splits Double [(String, Double)] deriving Show instance Interspersed Splits Double String where leftmost (Splits x _) = x pairs (Splits _ x) = x _splits :: Splits _splits = Splits 1.0 [("between 1 and 2", 2.0), ("between 2 and 3", 3.0)] _test1 :: () _test1 = foldTriples (\ l s r () -> trace ("l=" ++ show l ++ " s=" ++ show s ++ " r=" ++ show r) ()) () _splits _test2 :: () _test2 = foldInverted (\ sl f sr () -> trace ("sl=" ++ show sl ++ " f=" ++ show f ++ " sr=" ++ show sr) ()) () _splits cabal-debian-5.0/src/Debian/Debianize/BuildDependencies.hs0000644000000000000000000005451713530623213021605 0ustar0000000000000000-- | Compute the debianization of a cabal package. {-# LANGUAGE CPP, OverloadedStrings, ScopedTypeVariables, TupleSections #-} module Debian.Debianize.BuildDependencies ( debianBuildDeps , debianBuildDepsIndep ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) #endif import Control.Lens import Control.Monad ((>=>)) import Control.Monad.IO.Class (liftIO) import Control.Monad.State (MonadState(get)) import Control.Monad.Trans (MonadIO) import Data.Char (isSpace, toLower) 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.Monoid ((<>)) import Data.Set as Set (empty, fold, fromList, map, member, Set, singleton, toList, union) import Debian.Debianize.Prelude import Debian.Debianize.BasicInfo (compilerFlavor) import Debian.Debianize.Bundled (builtIn) import qualified Debian.Debianize.DebInfo as D import Debian.Debianize.DebianName (mkPkgName, mkPkgName') import Debian.Debianize.Monad as Monad (CabalInfo, CabalT) import qualified Debian.Debianize.BinaryDebDescription as B import qualified Debian.Debianize.CabalInfo as A import qualified Debian.Debianize.SourceDebDescription as S import Debian.Debianize.VersionSplits (packageRangesFromVersionSplits) import Debian.GHC (compilerPackageName) import Debian.Orphans () import Debian.Relation (BinPkgName(..), checkVersionReq, Relation(..), Relations) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..), Relations, VersionReq(EEQ, GRE, LTE, SGR, SLT)) 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 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.Invert (invertVersionRange) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (findExecutable) import System.Exit (ExitCode(ExitSuccess)) import System.IO.Unsafe (unsafePerformIO) import System.Process (readProcessWithExitCode) data Dependency_ = BuildDepends Dependency | BuildTools Dependency | PkgConfigDepends Dependency | ExtraLibs Relations deriving (Eq, Show) -- | Naive conversion of Cabal build dependencies to Debian -- dependencies will usually result in a self dependency, due to the -- fact that a Cabal executable often depends on the associated -- library to build. Due to the fact that Debian build dependencies -- are global to the package, this results in unwanted self -- dependencies, which usually need to be filtered out. -- Unfortunately, some Debian packages actually do depend on an -- earlier version of themselves to build (e.g. most compilers.) So a -- command line option is probably necessary. -- -- selfDependency :: PackageIdentifier -> Dependency_ -> Bool -- selfDependency pkgId (BuildDepends (Dependency name _)) = name == pkgName pkgId -- selfDependency _ _ = False unboxDependency :: Dependency_ -> Maybe Dependency unboxDependency (BuildDepends d) = Just d unboxDependency (BuildTools d) = Just d unboxDependency (PkgConfigDepends d) = Just d unboxDependency (ExtraLibs _) = Nothing -- Dependency (PackageName d) anyVersion -- |Debian packages don't have per binary package build dependencies, -- so we just gather them all up here. allBuildDepends :: Monad m => [BuildInfo] -> CabalT m [Dependency_] allBuildDepends buildInfos = allBuildDepends' (mergeCabalDependencies $ concatMap Cabal.targetBuildDepends buildInfos) (mergeCabalDependencies $ mapMaybe convertLegacy $ concatMap buildTools buildInfos) (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 return $ nub $ List.map BuildDepends buildDepends' ++ List.map BuildTools buildTools' ++ List.map PkgConfigDepends pkgconfigDepends' ++ [ExtraLibs (fixDeps atoms extraLibs')] fixDeps :: CabalInfo -> [String] -> Relations fixDeps atoms = concatMap (\ cab -> fromMaybe [[D.Rel (D.BinPkgName ("lib" ++ List.map toLower cab ++ "-dev")) Nothing Nothing]] (Map.lookup cab (view (A.debInfo . D.extraLibMap) atoms))) -- | Take the intersection of all the dependencies on a given package name mergeCabalDependencies :: [Dependency] -> [Dependency] mergeCabalDependencies = List.map (foldl1 (\ (Dependency name range1) (Dependency _ range2) -> Dependency name (intersectVersionRanges range1 range2))) . groupBy ((==) `on` dependencyPackage) . sortBy (compare `on` dependencyPackage) where dependencyPackage (Dependency x _) = x -- The haskell-cdbs package contains the hlibrary.mk file with -- the rules for building haskell packages. debianBuildDeps :: (MonadIO m) => PackageDescription -> CabalT m D.Relations debianBuildDeps pkgDesc = do hflavor <- use (A.debInfo . D.flags . compilerFlavor) 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 = fold union empty $ Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypes hc') hcs 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) (if testsStatus /= D.TestsDisable then testDeps else []) ] bDeps <- use (A.debInfo . D.control . S.buildDepends) compat <- use (A.debInfo . D.compat) ghcdev <- liftIO $ compilerPackageName hflavor B.Development ghcprof <- liftIO $ compilerPackageName hflavor B.Profiling let ghcrel = if member GHC hcs then maybe [] ((: []) . anyrel') ghcdev else [] let ghcrelprof = if prof then maybe [] ((: []) . anyrel') ghcprof else [] let xs = nub $ [maybe [] (\ n -> [D.Rel (D.BinPkgName "debhelper") (Just (D.GRE (parseDebianVersion' (show n)))) Nothing]) compat, [D.Rel (D.BinPkgName "haskell-devscripts-minimal") Nothing Nothing, 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 where -- No point in installing profiling packages for the -- dependencies of binaries and test suites. (I take it back, -- some executable builds fail if the profiling library isn't -- installed.) #if 0 hcPackageTypesBins :: CompilerFlavor -> Set B.PackageType hcPackageTypesBins GHC = singleton [B.Development, B.Profiling] hcPackageTypesTests :: CompilerFlavor -> Set B.PackageType hcPackageTypesTests GHC = singleton [B.Development, B.Profiling] #endif class IsBuildable e where isBuildable :: e -> Bool instance IsBuildable Executable where isBuildable = buildable . buildInfo instance IsBuildable BuildInfo where isBuildable = buildable instance IsBuildable TestSuite where isBuildable = buildable . testBuildInfo -- | Collect the dependencies required to build any packages that have -- architecture "all". debianBuildDepsIndep :: (MonadIO 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) libDeps <- allBuildDepends (maybe [] (return . libBuildInfo) (Cabal.library pkgDesc)) cDeps <- mapM docDependencies libDeps ghcdoc <- liftIO $ compilerPackageName hc B.Documentation let hcdocdep = if doc && member GHC hcs then maybe [] ((: []) . anyrel') ghcdoc else [] let xs = nub $ if doc && isJust (Cabal.library pkgDesc) then hcdocdep ++ bDeps ++ concat cDeps else [] filterMissing xs -- | The documentation dependencies for a package include the -- documentation package for any libraries which are build -- dependencies, so we have use to all the cross references. docDependencies :: (MonadIO m) => Dependency_ -> CabalT m D.Relations docDependencies (BuildDepends (Dependency name ranges)) = do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial omitProfDeps <- use (A.debInfo . D.omitProfVersionDeps) concat <$> mapM (\ hc' -> dependencies hc' B.Documentation name ranges omitProfDeps) (toList hcs) docDependencies _ = return [] -- | The Debian build dependencies for a package include the profiling -- libraries and the documentation packages, used for creating cross -- references. Also the packages associated with extra libraries. buildDependencies :: (MonadIO m) => Set (CompilerFlavor, B.PackageType) -> Dependency_ -> CabalT m D.Relations buildDependencies hcTypePairs (BuildDepends (Dependency name ranges)) = use (A.debInfo . D.omitProfVersionDeps) >>= \ omitProfDeps -> concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs) buildDependencies _ dep@(ExtraLibs _) = do mp <- use (A.debInfo . D.execMap) return $ concat $ adapt mp dep buildDependencies _ dep = case unboxDependency dep of Just (Dependency _name _ranges) -> do mp <- view (A.debInfo . D.execMap) <$> get return $ concat $ adapt mp dep Nothing -> return [] adapt :: Map.Map String Relations -> Dependency_ -> [Relations] adapt mp (PkgConfigDepends (Dependency pkg _)) = maybe (aptFile (unPackageName pkg)) (: []) (Map.lookup (unPackageName pkg) mp) adapt mp (BuildTools (Dependency pkg _)) = maybe (aptFile (unPackageName pkg)) (: []) (Map.lookup (unPackageName pkg) mp) adapt _flags (ExtraLibs x) = [x] adapt _flags (BuildDepends (Dependency pkg _)) = [[[D.Rel (D.BinPkgName (unPackageName pkg)) Nothing Nothing]]] -- There are three reasons this may not work, or may work -- incorrectly: (1) the build environment may be a different -- distribution than the parent environment (the environment the -- autobuilder was run from), so the packages in that -- environment might have different names, (2) the package -- we are looking for may not be installed in the parent -- environment, and (3) the apt-file executable is not installed. aptFile :: String -> [Relations] -- Maybe would probably be more correct aptFile pkg = unsafePerformIO $ findExecutable "apt-file" >>= aptFile' where aptFile' Nothing = error "The apt-file executable could not be found." aptFile' (Just aptfile) = do ret <- readProcessWithExitCode aptfile ["-l", "search", pkg ++ ".pc"] "" return $ case ret of (ExitSuccess, out, _) -> case takeWhile (not . isSpace) out of "" -> error $ "Unable to locate a debian package containing the build tool " ++ pkg ++ ", try using --exec-map " ++ pkg ++ ": or execMap " ++ show pkg ++ " [[Rel (BinPkgName \"\") Nothing Nothing]]" s -> [[[D.Rel (D.BinPkgName s) Nothing Nothing]]] _ -> [] anyrel :: String -> [D.Relation] anyrel x = anyrel' (D.BinPkgName x) anyrel' :: D.BinPkgName -> [D.Relation] anyrel' x = [D.Rel x Nothing Nothing] -- | Turn a cabal dependency into debian dependencies. The result -- needs to correspond to a single debian package to be installed, -- so we will return just an OrRelation. dependencies :: MonadIO m => CompilerFlavor -> B.PackageType -> PackageName -> VersionRange -> Bool -> CabalT m Relations dependencies hc typ name cabalRange omitProfVersionDeps = do nameMap <- use A.debianNameMap -- Compute a list of alternative debian dependencies for -- satisfying a cabal dependency. The only caveat is that -- we may need to distribute any "and" dependencies implied -- by a version range over these "or" dependences. let alts :: [(BinPkgName, VersionRange)] alts = case Map.lookup name nameMap of -- If there are no splits for this package just -- return the single dependency for the package. Nothing -> [(mkPkgName hc name typ, cabalRange')] -- If there are splits create a list of (debian package name, VersionRange) pairs Just splits' -> List.map (\ (n, r) -> (mkPkgName' hc typ n, r)) (packageRangesFromVersionSplits splits') mapM convert alts >>= mapM (doBundled typ name hc) . convert' . canonical . Or . catMaybes where convert (dname, range) = 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 -> 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 -> 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 -- 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 range'' = canon (unionVersionRanges range' (invertVersionRange range)) -- Restrict the range to the versions specified for this debian package range' = intersectVersionRanges cabalRange' range -- When we see a cabal equals dependency we need to turn it into -- 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 noVersionPackageType = (if omitProfVersionDeps then [B.Profiling] else []) ++ [B.Documentation] simpler v1 v2 = minimumBy (compare `on` (length . asVersionIntervals)) [v1, v2] -- Simplify a VersionRange canon = fromVersionIntervals . toVersionIntervals -- | If a package is bundled with the compiler we make the -- compiler a substitute for that package. If we were to -- specify the virtual package (e.g. libghc-base-dev) we would -- have to make sure not to specify a version number. doBundled :: MonadIO m => B.PackageType -> PackageName -> CompilerFlavor -> [D.Relation] -> CabalT m [D.Relation] doBundled typ name hc rels = do hcname <- liftIO $ compilerPackageName hc typ concat <$> mapM (doRel hcname) rels where -- If a library is built into the compiler, this is the debian -- package name the compiler will conflict with. doRel :: MonadIO m => Maybe BinPkgName -> D.Relation -> CabalT m [D.Relation] doRel hcname rel@(D.Rel dname req _) = do let comp = maybe [] (\x -> [D.Rel x Nothing Nothing]) hcname -- gver <- use ghcVersion -- Look at what version of the package is provided by the compiler. atoms <- get -- What version of this package (if any) does the compiler provide? relInfo <- liftIO $ builtIn hc let pver = listToMaybe $ fmap (debianVersion'' atoms) (filter ((== name) . pkgName) relInfo) -- The name this library would have if it was in the compiler conflicts list. let naiveDebianName = mkPkgName hc name typ -- The compiler should appear in the build dependency -- if it provides a suitable version of the library, -- or if it conflicts with all versions of the -- library (which, if pver is Nothing, will certainly -- result in an error which needs to be corrected in -- the packaging.) let compilerDependency = if isJust pver && (checkVersionReq req pver || dname == naiveDebianName) then comp else [] -- The library package can satisfy the dependency if -- the compiler doesn't provide a version, or if the -- compiler doesn't conflict with the package's -- debian name. let libraryDependency = if isNothing pver || dname /= naiveDebianName then [rel] else [] -- Is the version number in the library dependency newer than -- the compiler version? If so it should appear to its left, -- otherwise to its right. return $ case req of Just (D.SLT lver) | Just lver < pver -> compilerDependency ++ libraryDependency Just (D.LTE lver) | Just lver < pver -> compilerDependency ++ libraryDependency Just (D.EEQ lver) | Just lver < pver -> compilerDependency ++ libraryDependency _ -> libraryDependency ++ compilerDependency -- Convert a cabal version to a debian version, adding an epoch number if requested debianVersion' :: Monad m => PackageName -> Version -> CabalT m DebianVersion debianVersion' name v = do atoms <- get return $ parseDebianVersion' (maybe "" (\ n -> show n ++ ":") (Map.lookup name (view A.epochMap atoms)) ++ prettyShow v) debianVersion'' :: CabalInfo -> PackageIdentifier -> DebianVersion debianVersion'' atoms i = parseDebianVersion' (maybe "" (\ n -> show n ++ ":") (Map.lookup (pkgName i) (view A.epochMap atoms)) ++ prettyShow (pkgVersion i)) data Rels a = And {unAnd :: [Rels a]} | Or {unOr :: [Rels a]} | Rel' {unRel :: a} deriving Show convert' :: Rels a -> [[a]] convert' = List.map (List.map unRel . unOr) . unAnd . canonical -- | return and of ors of rel canonical :: Rels a -> Rels a canonical (Rel' rel) = And [Or [Rel' rel]] canonical (And rels) = And $ concatMap (unAnd . canonical) rels canonical (Or rels) = And . List.map Or $ mapM (concatMap unOr . unAnd . canonical) rels filterMissing :: Monad m => [[Relation]] -> CabalT m [[Relation]] filterMissing rels = get >>= \ atoms -> return $ List.filter (/= []) (List.map (List.filter (\ (Rel name _ _) -> not (Set.member name (view (A.debInfo . D.missingDependencies) atoms)))) rels) cabal-debian-5.0/src/Debian/Debianize/Changelog.hs0000644000000000000000000000224013530623213020110 0ustar0000000000000000module Debian.Debianize.Changelog ( filterEntries , dropFutureEntries , findChangelogEntry , mergeChangelogEntries ) where import Debian.Changes (ChangeLog(..), ChangeLogEntry(..)) import Debian.Version (DebianVersion) import Prelude hiding (log) -- | Apply a filter to the version numbers of the changelog entries. filterEntries :: (DebianVersion -> Bool) -> ChangeLog -> ChangeLog filterEntries p (ChangeLog entries) = ChangeLog $ filter (p . logVersion) $ entries -- | Filter out versions newer than the given one. dropFutureEntries :: DebianVersion -> ChangeLog -> ChangeLog dropFutureEntries ver log = filterEntries (<= ver) log -- | Find the log entry with the given version. findChangelogEntry :: DebianVersion -> ChangeLog -> Maybe ChangeLogEntry findChangelogEntry ver log = case filterEntries (== ver) log of ChangeLog [] -> Nothing ChangeLog [x] -> Just x _ -> error $ "Multiple version " ++ show ver ++ " changelog entries" mergeChangelogEntries :: ChangeLogEntry -> ChangeLogEntry -> ChangeLogEntry mergeChangelogEntries old new = old { logComments = logComments old ++ logComments new , logDate = logDate new } cabal-debian-5.0/src/Debian/Debianize/Goodies.hs0000644000000000000000000003500113530623213017613 0ustar0000000000000000-- | Things that seem like they could be clients of this library, but -- are instead included as part of the library. {-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-} module Debian.Debianize.Goodies ( tightDependencyFixup , expandWebsite, doWebsite , expandServer, doServer , expandBackups, doBackups , doExecutable , oldClckwrksSiteFlags , oldClckwrksServerFlags , siteAtoms , logrotate , serverAtoms , backupAtoms , execAtoms ) where import Control.Lens import Control.Monad.State (MonadState(get), modify) import Data.List as List ({-dropWhileEnd, intercalate,-} intersperse, map) import Data.Map as Map (insert, insertWith, toList) import Data.Monoid ((<>)) #if !MIN_VERSION_base(4,8,0) import Data.Monoid (mappend) #endif import Data.Set as Set (insert, singleton, union) import Data.Text as Text (pack, {-Text,-} unlines) import qualified Debian.Debianize.DebInfo as D import Debian.Debianize.ExecAtoms (execAtoms) import Debian.Debianize.Monad (CabalInfo, CabalT, DebianT, execCabalM) --import Debian.Debianize.Prelude (stripWith) import qualified Debian.Debianize.CabalInfo as A import qualified Debian.Debianize.BinaryDebDescription as B import Debian.Orphans () import Debian.Policy (apacheAccessLog, apacheErrorLog, apacheLogDirectory, databaseDirectory, dataDirectory, serverAccessLog, serverAppLog) import Debian.Pretty (ppText) import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel)) import Distribution.PackageDescription as Cabal (PackageDescription) import Distribution.Simple.Build.PathsModule (pkgPathEnvVar) import Prelude hiding (init, log, map, unlines, writeFile) import System.FilePath (()) showCommand :: String -> [String] -> String showCommand cmd args = unwords (map translate (cmd : args)) translate :: String -> String translate str = '"' : foldr escape "\"" str where escape '"' = showString "\\\"" escape c = showChar c -- | Create equals dependencies. For each pair (A, B), use dpkg-query -- to find out B's version number, version B. Then write a rule into -- P's .substvar that makes P require that that exact version of A, -- and another that makes P conflict with any older version of A. tightDependencyFixup :: Monad m => [(BinPkgName, BinPkgName)] -> BinPkgName -> DebianT m () tightDependencyFixup [] _ = return () tightDependencyFixup pairs p = D.rulesFragments %= Set.insert (Text.unlines $ ([ "binary-fixup/" <> name <> "::" , "\techo -n 'haskell:Depends=' >> debian/" <> name <> ".substvars" ] ++ intersperse ("\techo -n ', ' >> debian/" <> name <> ".substvars") (List.map equals pairs) ++ [ "\techo '' >> debian/" <> name <> ".substvars" , "\techo -n 'haskell:Conflicts=' >> debian/" <> name <> ".substvars" ] ++ intersperse ("\techo -n ', ' >> debian/" <> name <> ".substvars") (List.map newer pairs) ++ [ "\techo '' >> debian/" <> name <> ".substvars" ])) where equals (installed, dependent) = "\tdpkg-query -W -f='" <> display' dependent <> " (=$${Version})' " <> display' installed <> " >> debian/" <> name <> ".substvars" newer (installed, dependent) = "\tdpkg-query -W -f='" <> display' dependent <> " (>>$${Version})' " <> display' installed <> " >> debian/" <> name <> ".substvars" name = display' p display' = ppText -- | Add a debian binary package to the debianization containing a cabal executable file. doExecutable :: Monad m => BinPkgName -> D.InstallFile -> CabalT m () doExecutable p f = (A.debInfo . D.executable) %= Map.insert p f -- | Add a debian binary package to the debianization containing a cabal executable file set up to be a server. doServer :: Monad m => BinPkgName -> D.Server -> CabalT m () doServer p s = (A.debInfo . D.serverInfo) %= Map.insert p s -- | Add a debian binary package to the debianization containing a cabal executable file set up to be a web site. doWebsite :: Monad m => BinPkgName -> D.Site -> CabalT m () doWebsite p w = (A.debInfo . D.website) %= Map.insert p w -- | Add a debian binary package to the debianization containing a cabal executable file set up to be a backup script. doBackups :: Monad m => BinPkgName -> String -> CabalT m () doBackups bin s = do (A.debInfo . D.backups) %= Map.insert bin s (A.debInfo . D.binaryDebDescription bin . B.relations . B.depends) %= (++ [[Rel (BinPkgName "anacron") Nothing Nothing]]) -- depends +++= (bin, Rel (BinPkgName "anacron") Nothing Nothing) oldClckwrksSiteFlags :: D.Site -> [String] oldClckwrksSiteFlags x = [ -- According to the happstack-server documentation this needs a trailing slash. "--base-uri", "http://" ++ D.domain x ++ "/" , "--http-port", show (D.port (D.server x))] oldClckwrksServerFlags :: D.Server -> [String] oldClckwrksServerFlags x = [ -- According to the happstack-server documentation this needs a trailing slash. "--base-uri", "http://" ++ D.hostname x ++ ":" ++ show (D.port x) ++ "/" , "--http-port", show (D.port x)] siteAtoms :: PackageDescription -> BinPkgName -> D.Site -> CabalInfo -> CabalInfo siteAtoms pkgDesc b site = execCabalM (do (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallDir b "/etc/apache2/sites-available") (A.debInfo . D.atomSet) %= (Set.insert $ D.Link b ("/etc/apache2/sites-available/" ++ D.domain site ++ ".conf") ("/etc/apache2/sites-enabled/" ++ D.domain site ++ ".conf")) (A.debInfo . D.atomSet) %= (Set.insert $ D.File b ("/etc/apache2/sites-available" D.domain site ++ ".conf") apacheConfig) (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallDir b (apacheLogDirectory b)) {-logrotate b-}) . serverAtoms pkgDesc b (D.server site) True where -- An apache site configuration file. This is installed via a line -- in debianFiles. apacheConfig = Text.unlines $ [ "" , " ServerAdmin " <> pack (D.serverAdmin site) , " ServerName www." <> pack (D.domain site) , " ServerAlias " <> pack (D.domain site) , "" , " ErrorLog " <> pack (apacheErrorLog b) , " CustomLog " <> pack (apacheAccessLog b) <> " combined" , "" , " ProxyRequests Off" , " AllowEncodedSlashes NoDecode" , "" , " " , " AddDefaultCharset off" , " Order deny,allow" , " #Allow from .example.com" , " Deny from all" , " #Allow from all" , " " , "" , " port' <> "/*>" , " AddDefaultCharset off" , " Order deny,allow" , " #Allow from .example.com" , " #Deny from all" , " Allow from all" , " " , "" , " SetEnv proxy-sendcl 1" , "" , " ProxyPass / http://127.0.0.1:" <> port' <> "/ nocanon" , " ProxyPassReverse / http://127.0.0.1:" <> port' <> "/" , "" ] port' = pack (show (D.port (D.server site))) -- | Install configuration files to do log rotation. This does not -- work well with the haskell logging library, so it is no longer -- called in siteAtoms. logrotate :: MonadState CabalInfo m => BinPkgName -> m () logrotate b = do (A.debInfo . D.logrotateStanza) %= Map.insertWith mappend b (singleton (Text.unlines $ [ pack (apacheAccessLog b) <> " {" , " weekly" , " rotate 5" , " compress" , " missingok" , "}"])) (A.debInfo . D.logrotateStanza) %= Map.insertWith mappend b (singleton (Text.unlines $ [ pack (apacheErrorLog b) <> " {" , " weekly" , " rotate 5" , " compress" , " missingok" , "}" ])) serverAtoms :: PackageDescription -> BinPkgName -> D.Server -> Bool -> CabalInfo -> CabalInfo serverAtoms pkgDesc b server' isSite = over (A.debInfo . D.postInst) (insertWith failOnMismatch b debianPostinst) . over (A.debInfo . D.installInit) (Map.insertWith failOnMismatch b debianInit) . serverLogrotate' b . execAtoms b exec where -- Combine two values (for insertWith) when there should only be -- one. If it happens twice with different values we should -- really find out why. failOnMismatch old new = if old /= new then error ("serverAtoms: " ++ show old ++ " -> " ++ show new) else old exec = D.installFile server' debianInit = Text.unlines $ [ "#! /bin/sh -e" , "" , ". /lib/lsb/init-functions" , "test -f /etc/default/" <> pack (D.destName exec) <> " && . /etc/default/" <> pack (D.destName exec) , "" , "case \"$1\" in" , " start)" , " test -x /usr/bin/" <> pack (D.destName exec) <> " || exit 0" , " log_begin_msg \"Starting " <> pack (D.destName exec) <> "...\"" , " mkdir -p " <> pack (databaseDirectory b) , " export " <> pack (pkgPathEnvVar pkgDesc "datadir") <> "=" <> pack (dataDirectory pkgDesc) , " " <> startCommand , " log_end_msg $?" , " ;;" , " stop)" , " log_begin_msg \"Stopping " <> pack (D.destName exec) <> "...\"" , " " <> stopCommand , " log_end_msg $?" , " ;;" , " *)" , " log_success_msg \"Usage: ${0} {start|stop}\"" , " exit 1" , "esac" , "" , "exit 0" ] startCommand = pack $ showCommand "start-stop-daemon" (startOptions ++ commonOptions ++ ["--"] ++ D.serverFlags server') stopCommand = pack $ showCommand "start-stop-daemon" (stopOptions ++ commonOptions) commonOptions = ["--pidfile", "/var/run/" ++ D.destName exec] startOptions = ["--start", "-b", "--make-pidfile", "-d", databaseDirectory b, "--exec", "/usr/bin" D.destName exec] stopOptions = ["--stop", "--oknodo"] ++ if D.retry server' /= "" then ["--retry=" ++ D.retry server' ] else [] debianPostinst = Text.unlines $ ([ "#!/bin/sh" , "" , "case \"$1\" in" , " configure)" ] ++ (if isSite then [ " # Apache won't start if this directory doesn't exist" , " mkdir -p " <> pack (apacheLogDirectory b) , " # Restart apache so it sees the new file in /etc/apache2/sites-enabled" , " /usr/sbin/a2enmod proxy" , " /usr/sbin/a2enmod proxy_http" , " service apache2 restart" ] else []) ++ [ -- This gets done by the #DEBHELPER# code below. {- " service " <> pack (show (pPrint b)) <> " start", -} " ;;" , "esac" , "" , "#DEBHELPER#" , "" , "exit 0" ]) -- | A configuration file for the logrotate facility, installed via a line -- in debianFiles. serverLogrotate' :: BinPkgName -> CabalInfo -> CabalInfo serverLogrotate' b = over (A.debInfo . D.logrotateStanza) (insertWith Set.union b (singleton (Text.unlines $ [ pack (serverAccessLog b) <> " {" , " weekly" , " rotate 5" , " compress" , " missingok" , "}" ]))) . over (A.debInfo . D.logrotateStanza) (insertWith Set.union b (singleton (Text.unlines $ [ pack (serverAppLog b) <> " {" , " weekly" , " rotate 5" , " compress" , " missingok" , "}" ]))) backupAtoms :: BinPkgName -> String -> CabalInfo -> CabalInfo backupAtoms b name = over (A.debInfo . D.postInst) (insertWith (\ old new -> if old /= new then error $ "backupAtoms: " ++ show old ++ " -> " ++ show new else old) b (Text.unlines $ [ "#!/bin/sh" , "" , "case \"$1\" in" , " configure)" , " " <> pack ("/etc/cron.hourly" name) <> " --initialize" , " ;;" , "esac" ])) . execAtoms b (D.InstallFile { D.execName = name , D.destName = name , D.sourceDir = Nothing , D.destDir = Just "/etc/cron.hourly" }) expandWebsite :: Monad m => CabalT m () expandWebsite = do mp <- get >>= return . view (A.debInfo . D.website) pkgDesc <- use A.packageDescription mapM_ (\ (b, site) -> modify (siteAtoms pkgDesc b site)) (Map.toList mp) expandServer :: Monad m => CabalT m () expandServer = do mp <- get >>= return . view (A.debInfo . D.serverInfo) pkgDesc <- use A.packageDescription mapM_ (\ (b, x) -> modify (serverAtoms pkgDesc b x False)) (Map.toList mp) expandBackups :: Monad m => CabalT m () expandBackups = do mp <- get >>= return . view (A.debInfo . D.backups) mapM_ (\ (b, name) -> modify (backupAtoms b name)) (Map.toList mp) cabal-debian-5.0/src/Debian/Debianize/BasicInfo.hs0000644000000000000000000001437513530623213020072 0ustar0000000000000000-- | The basic information required to load a Cabal or Debian package description. {-# LANGUAGE CPP, DeriveDataTypeable, TemplateHaskell #-} module Debian.Debianize.BasicInfo ( -- * Types Flags(..) , EnvSet(..) , DebType(..) -- * Lenses , verbosity , dryRun , upgrade , roundtrip , validate , compilerFlavor , cabalFlagAssignments , buildEnv -- * State Monad , flagOptions ) where import Control.Lens import Control.Monad.State (StateT) import Control.Monad.Trans (MonadIO) import Data.Char (toLower, toUpper) import Data.Generics (Data, Typeable) import Data.Set as Set (fromList, Set, union) import Debian.Debianize.Prelude (read') import Debian.Orphans () import Distribution.Compiler (CompilerFlavor(..)) #if MIN_VERSION_Cabal(2,0,0) import Distribution.PackageDescription as Cabal (FlagName, mkFlagName) #else import Distribution.PackageDescription as Cabal (FlagName(FlagName)) #endif import Prelude hiding (break, lines, log, null, readFile, sum) import System.Console.GetOpt (ArgDescr(ReqArg, NoArg), OptDescr(Option)) import System.FilePath (()) import Text.Read (readMaybe) -- | This record supplies enough information to locate and load a debianization -- or a cabal file from the IO monad. data Flags = Flags { _verbosity :: Int -- ^ Run with progress messages at the given level of verboseness. , _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 -- debianize during the run of dpkg-buildpackage, when Setup -- configure is run. Specifically, the version number in the top -- changelog entry must match, and the sets of package names in -- the control file must match. , _compilerFlavor :: CompilerFlavor -- ^ Which compiler should we generate library packages for? In theory a single -- deb could handle multiple compiler flavors, but the support tools are not ready -- for this as of right now (28 Jan 2015.) , _cabalFlagAssignments :: Set (FlagName, Bool) -- ^ Flags to pass to Cabal function finalizePackageDescription, -- this can be used to control the flags in the cabal file. It -- can be supplied to the cabal-debian binary using the --flags -- option. , _buildEnv :: EnvSet -- ^ Directory containing the build environment for which the -- debianization will be generated. This determines which -- compiler will be available, which in turn determines which -- basic libraries can be provided by the compiler. By default -- all the paths in EnvSet are "/". } deriving (Eq, Ord, Show, Data, Typeable) data EnvSet = EnvSet { cleanOS :: FilePath -- ^ The output of the debootstrap command , dependOS :: FilePath -- ^ An environment with build dependencies installed , buildOS :: FilePath -- ^ An environment where we have built a package } deriving (Eq, Ord, Show, Data, Typeable) -- | A redundant data type, too lazy to expunge. data DebType = Dev | Prof | Doc deriving (Eq, Ord, Read, Show, Data, Typeable) -- Build the lenses $(makeLenses ''Flags) -- | Command line options which build a function that modifies a -- state monad value of type 'Flags' flagOptions :: MonadIO m => [OptDescr (StateT Flags m ())] flagOptions = [ Option "v" ["verbose"] (ReqArg (\ s -> verbosity .= (read' (\ s' -> error $ "verbose: " ++ show s') s :: Int)) "number") "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", #endif Option "" ["hugs"] (NoArg (compilerFlavor .= Hugs)) "Generate packages for Hugs - same as --with-compiler GHC", Option "" ["with-compiler"] (ReqArg (\ s -> maybe (error $ "Invalid compiler id: " ++ show s) (\ hc -> compilerFlavor .= hc) (readMaybe (map toUpper s) :: Maybe CompilerFlavor)) "COMPILER") (unlines [ "Generate packages for this CompilerFlavor" ]), Option "f" ["flags"] (ReqArg (\ fs -> cabalFlagAssignments %= (Set.union (Set.fromList (flagList fs)))) "FLAGS") -- Option "f" ["flags"] (ReqArg (\ fs p -> foldl (\ p' x -> p' {cabalFlagAssignments_ = Set.insert x (cabalFlagAssignments_ p')}) p (flagList fs)) "FLAGS") (unlines [ "Flags to pass to the finalizePackageDescription function in" , "Distribution.PackageDescription.Configuration when loading the cabal file."]), Option "" ["buildenvdir"] (ReqArg (\ s -> buildEnv .= EnvSet {cleanOS = s "clean", dependOS = s "depend", buildOS = s "build"}) "PATH") "Directory containing the three build environments, clean, depend, and build.", Option "f" ["cabal-flags"] (ReqArg (\ s -> cabalFlagAssignments %= (Set.union (fromList (flagList s)))) "FLAG FLAG ...") "Flags to pass to cabal configure with the --flags= option " ] -- Lifted from Distribution.Simple.Setup, since it's not exported. flagList :: String -> [(FlagName, Bool)] flagList = map tagWithValue . words #if MIN_VERSION_Cabal(2,0,0) where tagWithValue ('-':name) = (mkFlagName (map toLower name), False) tagWithValue name = (mkFlagName (map toLower name), True) #else where tagWithValue ('-':name) = (FlagName (map toLower name), False) tagWithValue name = (FlagName (map toLower name), True) #endif cabal-debian-5.0/src/Debian/Debianize/Monad.hs0000644000000000000000000000407413530623213017266 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Debian.Debianize.Monad ( CabalInfo , CabalT , runCabalT , evalCabalT , execCabalT , CabalM , runCabalM , evalCabalM , execCabalM -- * modify cabal to debian package version map -- , mapCabal -- , splitCabal , DebianT , evalDebianT , evalDebian , execDebianT , liftCabal , ifM , whenM , unlessM ) where import Control.Lens import Control.Monad.State (evalState, evalStateT, execState, execStateT, runState, State, StateT(runStateT)) import Debian.Debianize.DebInfo (DebInfo) import Debian.Debianize.CabalInfo (CabalInfo, debInfo) import Debian.Orphans () import Prelude hiding (init, log, unlines) type CabalT m = StateT CabalInfo m -- Better name - CabalT? type CabalM = State CabalInfo execCabalT :: Monad m => CabalT m a -> CabalInfo -> m CabalInfo execCabalT action atoms = execStateT action atoms evalCabalT :: Monad m => CabalT m a -> CabalInfo -> m a evalCabalT action atoms = evalStateT action atoms runCabalT :: CabalT m a -> CabalInfo -> m (a, CabalInfo) runCabalT action atoms = runStateT action atoms execCabalM :: CabalM a -> CabalInfo -> CabalInfo execCabalM action atoms = execState action atoms evalCabalM :: CabalM a -> CabalInfo -> a evalCabalM action atoms = evalState action atoms runCabalM :: CabalM a -> CabalInfo -> (a, CabalInfo) runCabalM action atoms = runState action atoms type DebianT m = StateT DebInfo m evalDebianT :: Monad m => DebianT m a -> DebInfo -> m a evalDebianT = evalStateT evalDebian :: DebianT Identity a -> DebInfo -> a evalDebian = evalState execDebianT :: Monad m => DebianT m () -> DebInfo -> m DebInfo execDebianT = execStateT liftCabal :: Monad m => StateT DebInfo m a -> StateT CabalInfo m a liftCabal = zoom debInfo ifM :: Monad m => m Bool -> m a -> m a -> m a ifM m t f = m >>= \ b -> if b then t else f whenM :: Monad m => m Bool -> m () -> m () whenM m r = m >>= \ b -> if b then r else return () unlessM :: Monad m => m Bool -> m () -> m () unlessM m r = m >>= \ b -> if b then return () else r cabal-debian-5.0/src/Debian/Debianize/CopyrightDescription.hs0000644000000000000000000003250013530623213022377 0ustar0000000000000000-- | {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell, TupleSections, LambdaCase #-} module Debian.Debianize.CopyrightDescription ( CopyrightDescription(..) , FilesOrLicenseDescription(..) -- * Lenses , format , upstreamName , upstreamContact , upstreamSource , disclaimer , summaryComment , summaryLicense , summaryCopyright , filesAndLicenses , filesPattern , filesCopyright , filesLicense , filesLicenseText , filesComment , license , licenseText , comment -- * Builders , readCopyrightDescription , parseCopyrightDescription , defaultCopyrightDescription ) where import Data.Char (isSpace) import Data.Default (Default(def)) import Data.Either (lefts, rights) import Data.Generics (Data, Typeable) import Control.Lens.TH (makeLenses) import Data.List as List (dropWhileEnd, partition) import Data.Maybe.Extended (isJust, catMaybes, fromJust, fromMaybe, listToMaybe, nothingIf) import Data.Monoid ((<>), mempty) import Data.Text as Text (Text, pack, strip, unpack, null, lines, unlines, dropWhileEnd) import Debian.Control (Field'(Field), fieldValue, Paragraph'(Paragraph), Control'(Control, unControl), parseControl) import Debian.Debianize.Prelude (readFileMaybe) import Debian.Orphans () import Debian.Policy (License(..), readLicense, fromCabalLicense) import Debian.Pretty (prettyText, ppText) import Debug.Trace import qualified Distribution.License as Cabal (License(UnknownLicense)) import qualified Distribution.Package as Cabal #if MIN_VERSION_Cabal(2,2,0) import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFiles, copyright, licenseRaw, package, maintainer)) #else #if MIN_VERSION_Cabal(1,20,0) import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFiles, copyright, license, package, maintainer)) #else import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFile, copyright, license, package, maintainer)) #endif #endif import Network.URI (URI, parseURI) import Prelude hiding (init, init, log, log, unlines, readFile) import Text.PrettyPrint.HughesPJClass (text) import Distribution.Pretty (Pretty(pretty)) unPackageName :: Cabal.PackageName -> String #if MIN_VERSION_Cabal(2,0,0) unPackageName p = Cabal.unPackageName p #else unPackageName (Cabal.PackageName x) = x #endif -- | Description of the machine readable debian/copyright file. A -- special case is used to represeent the old style free format file - -- if the value is equal to newCopyrightDescription except for the -- field _summaryComment, the text in _summaryComment is the copyright -- file. data CopyrightDescription = CopyrightDescription { _format :: URI , _upstreamName :: Maybe Text , _upstreamContact :: Maybe Text , _upstreamSource :: Maybe Text , _disclaimer :: Maybe Text , _summaryComment :: Maybe Text , _summaryLicense :: Maybe (License, Maybe Text) , _summaryCopyright :: Maybe Text , _filesAndLicenses :: [FilesOrLicenseDescription] } deriving (Eq, Ord, Show, Data, Typeable) data FilesOrLicenseDescription = FilesDescription { _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) instance Pretty CopyrightDescription where -- Special case encodes free format debian/copyright file pretty x@(CopyrightDescription {_summaryComment = Just t}) | x {_summaryComment = Nothing} == def = text (List.dropWhileEnd isSpace (unpack t) <> "\n") pretty x = pretty . toControlFile $ x instance Default CopyrightDescription where def = CopyrightDescription { _format = fromJust $ parseURI "https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/" , _upstreamName = Nothing , _upstreamContact = Nothing , _upstreamSource = Nothing , _disclaimer = Nothing , _summaryComment = Nothing , _summaryLicense = Nothing , _summaryCopyright = Nothing , _filesAndLicenses = [] } -- | Read a 'CopyrightDescription' from the text one might obtain from -- a @debian/copyright@ file. readCopyrightDescription :: Text -> CopyrightDescription readCopyrightDescription t = case parseControl "debian/copyright" t of Left _e -> def { _summaryComment = Just t } Right ctl -> case parseCopyrightDescription (unControl ctl) of Just cpy -> cpy Nothing -> def { _summaryComment = Just t } -- | Try to parse a structured copyright file parseCopyrightDescription :: [Paragraph' Text] -> Maybe CopyrightDescription parseCopyrightDescription (hd : tl) = let (muri :: Either (Paragraph' Text) URI) = maybe (Left hd) Right (maybe Nothing (parseURI . unpack) (fieldValue "Format" hd)) in case (muri, map parseFilesOrLicense tl) of (Right uri, fnls) | all (either (const False) (const True)) fnls -> Just $ CopyrightDescription { _format = uri , _upstreamName = fieldValue "Upstream-Name" hd , _upstreamContact = fieldValue "Upstream-Contact" hd , _upstreamSource = fieldValue "Source" hd , _disclaimer = fieldValue "Disclaimer" hd , _summaryComment = fieldValue "Comment" 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) -> let (l,t) = readLicenseField license in Right $ FilesDescription { _filesPattern = unpack files , _filesCopyright = copyright , _filesLicense = l , _filesLicenseText = t , _filesComment = fieldValue "Comment" p } (Nothing, Nothing, Just license) -> let (l,t) = readLicenseField license in Right $ LicenseDescription { _license = l , _licenseText = t , _comment = fieldValue "Comment" p } _ -> Left p toControlFile :: CopyrightDescription -> Control' Text toControlFile d = Control ( Paragraph ( [ Field ("Format", (" " <> ppText (_format d))) ] ++ maybe [] (\x -> [Field ("Upstream-Name", " " <> x)]) (_upstreamName d) ++ maybe [] (\x -> [Field ("Upstream-Contact", " " <> x)]) (_upstreamContact d) ++ maybe [] (\x -> [Field ("Source", " " <> x)]) (_upstreamSource d) ++ maybe [] (\x -> [Field ("Disclaimer", " " <> x)]) (_disclaimer 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) ) toParagraph :: FilesOrLicenseDescription -> Paragraph' Text toParagraph fd@FilesDescription {} = Paragraph $ [ Field ("Files", " " <> pack (_filesPattern fd)) , Field ("Copyright", " " <> _filesCopyright fd) , toLicenseField (_filesLicense fd) (_filesLicenseText fd) ] ++ maybe [] (\ t -> [Field ("Comment", " " <> t)]) (_filesComment fd) toParagraph ld@LicenseDescription {} = Paragraph $ [ 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 } debianDefaultFilesDescription :: License -> FilesOrLicenseDescription debianDefaultFilesDescription license = FilesDescription { _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 = \case [] -> [] [(_, txt)] -> [LicenseDescription license txt Nothing] pairs -> map mkLicenseDescription pairs where mkLicenseDescription (path, txt) = LicenseDescription { #if MIN_VERSION_Cabal(2,2,0) _license = fromCabalLicense (Cabal.UnknownLicense path) #else _license = fromCabalLicense (Cabal.UnknownLicense path) #endif , _licenseText = txt , _comment = mempty } -- | Infer a 'CopyrightDescription' from a Cabal package description. -- This will try to read any copyright files listed in the cabal -- configuration. Inputs include the license field from the cabal -- file, the contents of the license files mentioned there, and the -- provided @copyright0@ value. defaultCopyrightDescription :: Cabal.PackageDescription -> IO CopyrightDescription defaultCopyrightDescription pkgDesc = do #if MIN_VERSION_Cabal(1,20,0) let (debianCopyrightPath, otherLicensePaths) = partition (== "debian/copyright") (Cabal.licenseFiles pkgDesc) #else let (debianCopyrightPath, otherLicensePaths) = partition (== "debian/copyright") [Cabal.licenseFile pkgDesc] #endif #if MIN_VERSION_Cabal(2,2,0) license = either (\x -> OtherLicense ("SPDX license: " ++ show x)) fromCabalLicense $ Cabal.licenseRaw pkgDesc #else license = fromCabalLicense $ Cabal.license pkgDesc #endif pkgname = unPackageName . Cabal.pkgName . Cabal.package $ pkgDesc maintainer = Cabal.maintainer $ pkgDesc -- This is an @Nothing@ unless debian/copyright is (for some -- reason) mentioned in the cabal file. debianCopyrightText <- mapM readFileMaybe debianCopyrightPath >>= return . listToMaybe . catMaybes licenseCommentPairs <- mapM readFileMaybe otherLicensePaths >>= return . filter (isJust . snd) . zip otherLicensePaths return $ case debianCopyrightText of Just t -> def { _summaryComment = Just t } Nothing -> -- All we have is the name of the license let copyrt = fmap dots $ nothingIf (Text.null . strip) (pack (Cabal.copyright pkgDesc)) in def { _filesAndLicenses = [ sourceDefaultFilesDescription copyrt license, debianDefaultFilesDescription license ] ++ defaultLicenseDescriptions license licenseCommentPairs , _upstreamName = Just . pack $ pkgname , _upstreamSource = Just . pack $ "https://hackage.haskell.org/package/" ++ pkgname , _upstreamContact = nothingIf Text.null (pack maintainer) } {- -- We don't really have a way to associate licenses with -- file patterns, so we will just cover some simple cases, -- a single license, no license, etc. -- It is possible we might interpret the license file path -- as a license name, so I hang on to it here. return $ cabalToCopyrightDescription pkgDesc licenseComments (maybe def readCopyrightDescription debianCopyrightText) where cabalToCopyrightDescription :: Cabal.PackageDescription -> [Maybe Text] -> CopyrightDescription -> CopyrightDescription cabalToCopyrightDescription pkgDesc licenseComments copyright0 = let copyrt = fmap dots $ nothingIf (Text.null . strip) (pack (Cabal.copyright pkgDesc)) license = Cabal.license pkgDesc in copyright0 { _filesAndLicenses = map (\ comment -> FilesDescription { _filesPattern = "*" , _filesCopyright = fromMaybe (pack "(No copyright field in cabal file)") copyrt , _filesLicense = fromCabalLicense license , _filesComment = comment }) licenseComments } -} -- | Replace empty lines with single dots dots :: Text -> Text dots = Text.unlines . map (\ line -> if Text.null line then "." else line) . map (Text.dropWhileEnd isSpace) . Text.lines $(makeLenses ''CopyrightDescription) $(makeLenses ''FilesOrLicenseDescription) cabal-debian-5.0/src/Debian/Debianize/Finalize.hs0000644000000000000000000012773213530623213020000 0ustar0000000000000000-- | Compute the debianization of a cabal package. {-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell #-} module Debian.Debianize.Finalize ( debianize , debianizeWith , debianizeWebsite -- , finalizeDebianization -- external use deprecated - used in test script , watchAtom ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) import Data.Monoid (mempty) #endif import Control.Lens hiding ((<.>)) import Control.Monad (unless, when) import Control.Monad as List (mapM_) import Control.Monad.Fail (MonadFail) import Control.Monad.State (get, modify) import Control.Monad.Trans (liftIO, MonadIO) import Data.ByteString.Lazy.UTF8 (fromString) import Data.Char (isSpace, toLower) import Data.Digest.Pure.MD5 (md5) import Data.Function (on) import Data.List as List (dropWhileEnd, filter, intercalate, map, nub, null, unlines, maximumBy) import Data.Map as Map (delete, elems, insertWith, lookup, Map, toList) import Data.Maybe (fromMaybe, isJust, fromJust) import Data.Monoid ((<>)) import Data.Set as Set (difference, filter, fold, fromList, insert, map, null, Set, singleton, toList, union, unions) import Data.Text as Text (intercalate, pack, Text, unlines, unpack) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..)) import Debian.Codename (parseCodename) import Debian.Debianize.BasicInfo (cabalFlagAssignments, compilerFlavor, verbosity) import qualified Debian.Debianize.BinaryDebDescription as B import Debian.Debianize.BuildDependencies (debianBuildDeps, debianBuildDepsIndep) import qualified Debian.Debianize.CabalInfo as A import Debian.Debianize.Changelog (dropFutureEntries) import qualified Debian.Debianize.DebInfo as D import Debian.Debianize.DebianName (debianName, debianNameBase) import Debian.Debianize.ExecAtoms (execAtoms) import Debian.Debianize.Goodies (expandWebsite, expandServer, expandBackups) import Debian.Debianize.InputDebian (dataTop, dataDest, inputChangeLog) import Debian.Debianize.Monad as Monad (CabalT, liftCabal) import Debian.Debianize.Prelude ((.?=), stripWith) import qualified Debian.Debianize.SourceDebDescription as S import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.GHC (compilerPackageName) import Debian.Orphans () import Debian.Policy (getCurrentDebianUser, getDebhelperCompatLevel, haskellMaintainer, maintainerOfLastResort, PackageArchitectures(Any, All), PackagePriority(Optional), parseMaintainer, parseStandardsVersion, Section(..), SourceFormat(Native3)) import Debian.Pretty (PP(..), ppShow) import Debian.Relation (BinPkgName, BinPkgName(BinPkgName), Relation(Rel), Relations, SrcPkgName(SrcPkgName)) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..)) import Debian.Time (getCurrentLocalRFC822Time) import qualified Debian.Version as V (buildDebianVersion, DebianVersion, parseDebianVersion', epoch, version, revision) import Distribution.Compiler (CompilerFlavor(GHC)) #if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (CompilerFlavor(GHCJS)) #endif #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, unPackageName) import Distribution.PackageDescription as Cabal (allBuildInfo, author, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName), FlagName, mkFlagName, unFlagName, maintainer, PackageDescription(testSuites, description)) import Distribution.Types.UnqualComponentName --import Distribution.Utils.ShortText #else import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName)) import Distribution.PackageDescription as Cabal (allBuildInfo, author, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName), FlagName(FlagName), maintainer, PackageDescription(testSuites)) #endif import Distribution.PackageDescription as Cabal (PackageDescription(dataFiles, {-description,-} executables, library, package, synopsis)) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (doesFileExist) import System.FilePath ((<.>), (), makeRelative, splitFileName, takeDirectory, takeFileName) import System.IO (hPutStrLn, stderr) #if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr(..)) #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) #endif import Distribution.Pretty (Pretty(pretty)) -- | @debianize customize@ initializes the CabalT state from the -- environment and the cabal package description in (and possibly the -- debian/changelog file) from the current directory, then runs -- @customize@ and finalizes the debianization so it is ready to be -- output. debianize :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () debianize = debianizeWith (return ()) debianizeWebsite :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () debianizeWebsite = debianizeWith (expandWebsite >> expandServer >> expandBackups) -- | Pass a function with some additional work to do. I don't know -- if this could be done by just summing it with customize - probably. -- But I don't want to untangle this right now. debianizeWith :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () -> CabalT m () debianizeWith goodies customize = do liftCabal inputChangeLog customize finalizeDebianization goodies -- | Do some light IO and call finalizeDebianization. finalizeDebianization :: (MonadIO m, MonadFail m) => CabalT m () -> CabalT m () finalizeDebianization goodies = do date <- liftIO getCurrentLocalRFC822Time currentUser <- liftIO getCurrentDebianUser debhelperCompat <- liftIO getDebhelperCompatLevel setupExists <- or <$> mapM (liftIO . doesFileExist) ["Setup.hs", "Setup.lhs"] finalizeDebianization' goodies date currentUser debhelperCompat setupExists vb <- use (A.debInfo . D.flags . verbosity) when (vb >= 3) (get >>= \ x -> liftIO (putStrLn ("\nFinalized Cabal Info: " ++ show x ++ "\n"))) either (\e -> liftIO $ hPutStrLn stderr ("WARNING: " ++ e)) (\_ -> return ()) =<< use (A.debInfo . D.control . S.maintainer) -- | Now that we know the build and data directories, we can expand -- some atoms into sets of simpler atoms which can eventually be -- turned into the files of the debianization. The original atoms are -- not removed from the list because they may contribute to the -- debianization in other ways, so be careful not to do this twice, -- this function is not idempotent. (Exported for use in unit tests.) -- FIXME: we should be able to run this without a PackageDescription, change -- paramter type to Maybe PackageDescription and propagate down thru code finalizeDebianization' :: (MonadIO m, MonadFail m) => CabalT m () -> String -> Maybe NameAddr -> Maybe Int -> Bool -> CabalT m () finalizeDebianization' goodies date currentUser debhelperCompat setupExists = do -- In reality, hcs must be a singleton or many things won't work. But some day... hc <- use (A.debInfo . D.flags . compilerFlavor) pkgDesc <- use A.packageDescription testsStatus <- use (A.debInfo . D.testsStatus) let testsExist = not $ List.null $ Cabal.testSuites pkgDesc case (testsExist, testsStatus) of (True, D.TestsRun) -> (A.debInfo . D.rulesSettings) %= (++ ["DEB_ENABLE_TESTS = yes"]) (True, D.TestsBuild) -> (A.debInfo . D.rulesSettings) %= (++ ["DEB_ENABLE_TESTS = yes", "DEB_BUILD_OPTIONS += nocheck"]) _ -> return () (A.debInfo . D.rulesSettings) %= (++ ["DEB_SETUP_BIN_NAME = " <> if setupExists then "debian/hlibrary.setup" else "cabal"]) finalizeSourceName B.HaskellSource checkOfficialSettings hc addExtraLibDependencies hc (A.debInfo . D.watch) .?= Just (watchAtom (pkgName $ Cabal.package $ pkgDesc)) (A.debInfo . D.control . S.section) .?= Just (MainSection "haskell") (A.debInfo . D.control . S.priority) .?= Just Optional (A.debInfo . D.compat) .?= debhelperCompat finalizeChangelog date currentUser finalizeControl currentUser finalizeRules -- T.license .?= Just (Cabal.license pkgDesc) expandAtoms goodies -- Create the binary packages for the web sites, servers, backup packges, and other executables use (A.debInfo . D.executable) >>= List.mapM_ (cabalExecBinaryPackage . fst) . Map.toList use (A.debInfo . D.backups) >>= List.mapM_ (cabalExecBinaryPackage . fst) . Map.toList use (A.debInfo . D.serverInfo) >>= List.mapM_ (cabalExecBinaryPackage . fst) . Map.toList use (A.debInfo . D.website) >>= List.mapM_ (cabalExecBinaryPackage . fst) . Map.toList -- Make sure all the control file sections exist before doing the build dependencies, -- because we need to filter out self dependencies. librarySpecs pkgDesc hc makeUtilsPackage pkgDesc hc debs <- use (A.debInfo . D.control . S.binaryPackages) >>= return . List.map (view B.package) allowSelfDeps <- use (A.debInfo . D.allowDebianSelfBuildDeps) putBuildDeps (if allowSelfDeps then id else filterRelations debs) pkgDesc -- Sketchy - I think more things that need expanded could be generated by the code -- executed since the last expandAtoms. Anyway, should be idempotent. expandAtoms goodies -- Turn atoms related to priority, section, and description into debianization elements -- finalizeDescriptions watchAtom :: PackageName -> Text #if MIN_VERSION_Cabal(2,0,0) watchAtom pkgname = pack $ "version=3\nhttps://hackage.haskell.org/package/" ++ unPackageName pkgname ++ "/distro-monitor .*-([0-9\\.]+)\\.(?:zip|tgz|tbz|txz|(?:tar\\.(?:gz|bz2|xz)))\n" #else watchAtom (PackageName pkgname) = pack $ "version=3\nhttps://hackage.haskell.org/package/" ++ pkgname ++ "/distro-monitor .*-([0-9\\.]+)\\.(?:zip|tgz|tbz|txz|(?:tar\\.(?:gz|bz2|xz)))\n" #endif -- | Compute the final values of the BinaryDebDescription record -- description fields from the cabal descriptions and the values that -- have already been set. {- finalizeDescriptions :: (Monad m, Functor m) => CabalT m () finalizeDescriptions = use T.binaryPackages >>= List.mapM_ finalizeDescription finalizeDescription :: (Monad m, Functor m) => B.BinaryDebDescription -> CabalT m () finalizeDescription bdd = do let b = view B.package bdd cabDesc <- describe T.debianDescription .?= Just cabDesc -} -- | Construct the final Debian version number. -- Inputs: -- -- 1. --deb-version argument -- 2. --revision argument -- 3. cabal version number -- 4. latest version in debian/changelog -- -- The --deb-version argument overrides everything. debianVersion :: (Monad m) => CabalT m V.DebianVersion debianVersion = do cabalName <- (pkgName . Cabal.package) <$> use A.packageDescription (cabalVersion :: V.DebianVersion) <- (V.parseDebianVersion' . ppShow . pkgVersion . Cabal.package) <$> use A.packageDescription cabalEpoch <- debianEpoch cabalName fmt <- use (A.debInfo . D.sourceFormat) cabalRevision <- do x <- use (A.debInfo . D.revision) -- from the --revision option let y = case x of Nothing -> Nothing Just "" -> Nothing Just "-" -> Nothing Just ('-':r) -> Just r Just _ -> error "The --revision argument must start with a dash" return $ case fmt of Native3 -> y _ -> maybe (Just "1") (Just . max "1") y versionArg <- use (A.debInfo . D.debVersion) -- from the --deb-version option (debVersion :: Maybe V.DebianVersion) <- use (A.debInfo . D.changelog) >>= return . maybe Nothing changelogVersion case () of _ | maybe False (\ v -> v < V.buildDebianVersion cabalEpoch (ppShow cabalVersion) Nothing) versionArg -> error ("Version from --deb-version (" ++ ppShow versionArg ++ ") is older than cabal version (" ++ ppShow cabalVersion ++ "), maybe you need to unpin this package?") _ | isJust versionArg -> return $ fromJust versionArg _ | isJust debVersion -> case (V.epoch (fromJust debVersion), V.parseDebianVersion' (V.version (fromJust debVersion)), V.revision (fromJust debVersion)) of (debEpoch, debianVersion', (debianRevision :: Maybe String)) -> let finalEpoch = max debEpoch cabalEpoch finalVersion = max debianVersion' cabalVersion (finalRevision :: Maybe String) = maximumBy (compare `on` fmap V.parseDebianVersion') [debianRevision, cabalRevision] in return $ V.buildDebianVersion finalEpoch (ppShow finalVersion) finalRevision _ -> return $ V.buildDebianVersion cabalEpoch (ppShow cabalVersion) cabalRevision changelogVersion :: ChangeLog -> Maybe V.DebianVersion changelogVersion (ChangeLog (Entry {logVersion = x} : _)) = Just x changelogVersion _ = Nothing -- | Return the Debian epoch number assigned to the given cabal -- package - the 1 in version numbers like 1:3.5-2. debianEpoch :: Monad m => PackageName -> CabalT m (Maybe Int) debianEpoch name = get >>= return . Map.lookup name . view A.epochMap -- | Compute and return the debian source package name, based on the -- sourcePackageName if it was specified, and constructed from the -- cabal name otherwise. finalizeSourceName :: (Monad m) => B.PackageType -> CabalT m () finalizeSourceName typ = do DebBase debName <- debianNameBase hc <- use (A.debInfo . D.flags . compilerFlavor) (A.debInfo . D.sourcePackageName) .?= Just (SrcPkgName (case (hc, typ) of -- Haskell source deb names conventionally have the prefix -- "haskell-" added. Here we add prefix "ghcjs-" to -- haskell packages build with the ghcjs compiler. (GHC, B.HaskellSource) -> "haskell-" ++ debName #if MIN_VERSION_Cabal(1,22,0) (GHCJS, B.HaskellSource) -> "ghcjs-" ++ debName #endif (_, B.Source) -> debName _ -> error $ "finalizeSourceName: " ++ show typ)) -- | Try to compute a string for the the debian "Maintainer:" and -- "Uploaders:" fields using, in this order -- 1. the Debian Haskell Group, @pkg-haskell-maintainers\@lists.alioth.debian.org@, -- if --official is set -- 2. the maintainer explicitly specified using "Debian.Debianize.Monad.maintainer" -- 3. the maintainer field of the cabal package, but only if --official is not set, -- 4. the value returned by getDebianMaintainer, which looks in several environment variables, -- 5. the signature from the latest entry in debian/changelog, -- 6. the Debian Haskell Group, @pkg-haskell-maintainers\@lists.alioth.debian.org@ -- -- finalizeMaintainer :: Monad m => Maybe NameAddr -> CabalT m () finalizeMaintainer currentUser = do o <- use (A.debInfo . D.official) pkgDesc <- use A.packageDescription maintainerOption <- use (A.debInfo . D.maintainerOption) uploadersOption <- use (A.debInfo . D.uploadersOption) let cabalAuthorString = takeWhile (\ c -> c /= ',' && c /= '\n') (Cabal.author pkgDesc) cabalMaintainerString = takeWhile (\ c -> c /= ',' && c /= '\n') (Cabal.maintainer pkgDesc) cabalMaintainerString' = cabalAuthorString <> " <" <> cabalMaintainerString <> ">" cabalMaintainerString'' = cabalAuthorString <> " " <> cabalMaintainerString changelogSignature <- do log <- use (A.debInfo . D.changelog) case log of Just (ChangeLog (entry : _)) -> case (parseMaintainer (logWho entry)) of Left _e -> return $ Nothing -- Just $ NameAddr (Just "Invalid signature in changelog") (show e) Right x -> return (Just x) _ -> return Nothing case o of True -> do (A.debInfo . D.control . S.maintainer) .= Right haskellMaintainer (A.debInfo . D.control . S.uploaders) %= whenEmpty (maybe [] (: []) currentUser) False -> do (A.debInfo . D.control . S.maintainer) %= either (\x -> maybe (Left x) Right maintainerOption) Right (A.debInfo . D.control . S.maintainer) %= either (\_ -> parseMaintainer cabalMaintainerString) Right (A.debInfo . D.control . S.maintainer) %= either (\_ -> parseMaintainer cabalMaintainerString') Right (A.debInfo . D.control . S.maintainer) %= either (\_ -> parseMaintainer cabalMaintainerString'') Right -- Sometimes the maintainer is just an email, if it matches the author's email we can use it (A.debInfo . D.control . S.maintainer) %= either (\e -> case parseMaintainer cabalAuthorString of Right x | nameAddr_addr x == cabalMaintainerString -> Right x Right _ -> Left e Left x -> Left x) Right -- Sometimes the maintainer is just an email, try combining it with the author's name (A.debInfo . D.control . S.maintainer) %= either (\e -> case parseMaintainer cabalAuthorString of Right (NameAddr {nameAddr_name = Just name}) -> parseMaintainer (name ++ " <" ++ cabalMaintainerString ++ ">") Right _ -> Left e Left x -> Left x) Right (A.debInfo . D.control . S.maintainer) %= either (\e -> maybe (Left e) Right currentUser) Right (A.debInfo . D.control . S.maintainer) %= either (\e -> maybe (Left e) Right changelogSignature) Right (A.debInfo . D.control . S.maintainer) %= either (\_ -> Left ("Unable to construct a debian maintainer, using default. Cabal maintainer strings tried:\n " ++ show cabalMaintainerString ++ ", " ++ show cabalMaintainerString' ++ ", " ++ show cabalMaintainerString'' ++ ", currentUser: " ++ show currentUser)) Right (A.debInfo . D.control . S.uploaders) %= whenEmpty uploadersOption -- | If l is the empty list return d, otherwise return l. whenEmpty :: [a] -> [a] -> [a] whenEmpty d [] = d whenEmpty _ l = l finalizeControl :: (MonadFail m) => Maybe NameAddr -> CabalT m () finalizeControl currentUser = do finalizeMaintainer currentUser Just src <- use (A.debInfo . D.sourcePackageName) (A.debInfo . D.control . S.source) .= Just src desc' <- describe (A.debInfo . D.control . S.xDescription) .?= Just desc' -- control %= (\ y -> y { D.source = Just src, D.maintainer = Just maint }) describe :: Monad m => CabalT m Text describe = do p <- use A.packageDescription return $ debianDescriptionBase p {- <> "\n" <> case typ of Just B.Profiling -> Text.intercalate "\n" [" .", " This package provides a library for the Haskell programming language, compiled", " for profiling. See http:///www.haskell.org/ for more information on Haskell."] Just B.Development -> Text.intercalate "\n" [" .", " This package provides a library for the Haskell programming language.", " See http:///www.haskell.org/ for more information on Haskell."] Just B.Documentation -> Text.intercalate "\n" [" .", " This package provides the documentation for a library for the Haskell", " programming language.", " See http:///www.haskell.org/ for more information on Haskell." ] Just B.Exec -> Text.intercalate "\n" [" .", " An executable built from the " <> pack (display (pkgName (Cabal.package p))) <> " package."] {- ServerPackage -> Text.intercalate "\n" [" .", " A server built from the " <> pack (display (pkgName pkgId)) <> " package."] -} _ {-Utilities-} -> Text.intercalate "\n" [" .", " Files associated with the " <> pack (display (pkgName (Cabal.package p))) <> " package."] -- x -> error $ "Unexpected library package name suffix: " ++ show x -} -- | The Cabal package has one synopsis and one description field -- for the entire package, while in a Debian package there is a -- description field (of which the first line is synopsis) in -- each binary package. So the cabal description forms the base -- of the debian description, each of which is amended. debianDescriptionBase :: PackageDescription -> Text debianDescriptionBase p = pack $ List.intercalate "\n " $ (synop' : desc') where -- If we have a one line description and no synopsis, use -- the description as the synopsis. synop' = if List.null synop && length desc' /= 1 then "WARNING: No synopsis available for package " ++ ppShow (package p) else synop synop :: String -- I don't know why (unwords . words) was applied here. Maybe I'll find out when -- this version goes into production. :-/ Ok, now I know, because sometimes the -- short cabal description has more than one line. synop = List.intercalate " " $ fmap (dropWhileEnd isSpace) $ lines $ synopsis p desc' :: [String] desc' = List.map addDot . stripWith List.null $ fmap (dropWhileEnd isSpace) $ lines $ Cabal.description p addDot line = if List.null line then "." else line -- | Make sure there is a changelog entry with the version number and -- source package name implied by the debianization. This means -- either adding an entry or modifying the latest entry (if its -- version number is the exact one in our debianization.) finalizeChangelog :: (Monad m) => String -> Maybe NameAddr -> CabalT m () finalizeChangelog date currentUser = 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" (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. fixLog src ver cmts _maint _ (Just (ChangeLog (entry : older))) | logVersion entry == ver = let entry' = entry { logPackage = show (pretty (PP src)) , logComments = logComments entry ++ "\n" ++ (List.unlines $ List.map ((" * " <>) . List.intercalate "\n " . List.map unpack) (fromMaybe [] cmts)) } in Just (ChangeLog (entry' : older)) -- The newest log entry isn't exactly ver, build a new entry. fixLog src ver cmts maint msg log = let entry = Entry { logPackage = show (pretty (PP src)) , logVersion = ver , logDists = [parseCodename "UNRELEASED"] , logUrgency = "low" , logComments = List.unlines $ List.map ((" * " <>) . List.intercalate "\n " . List.map unpack) (fromMaybe [[msg]] cmts) , logWho = either (\_ -> ppShow maintainerOfLastResort) ppShow maint , logDate = date } in -- Creating new log entry for version Just (ChangeLog (entry : maybe [] (\ (ChangeLog entries) -> entries) log)) -- | Convert the extraLibs field of the cabal build info into debian -- binary package names and make them dependendencies of the debian -- devel package (if there is one.) addExtraLibDependencies :: (Monad m) => CompilerFlavor -> CabalT m () addExtraLibDependencies hc = do pkgDesc <- use A.packageDescription devName <- debianName B.Development hc libMap <- use (A.debInfo . D.extraLibMap) binNames <- List.map (view B.package) <$> use (A.debInfo . D.control . S.binaryPackages) when (any (== devName) binNames) ((A.debInfo . D.binaryDebDescription devName . B.relations . B.depends) %= \ deps -> deps ++ g pkgDesc libMap) where g :: PackageDescription -> Map String Relations -> Relations g pkgDesc libMap = concatMap (devDep libMap) (nub $ concatMap Cabal.extraLibs $ Cabal.allBuildInfo $ pkgDesc) devDep :: Map String Relations -> String -> Relations devDep libMap cab = maybe [[Rel (BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing]] id (Map.lookup cab libMap) -- | Applies a few settings to official packages (unless already set) checkOfficialSettings :: (Monad m) => CompilerFlavor -> CabalT m () checkOfficialSettings flavor = do o <- use (A.debInfo . D.official) when o $ case flavor of GHC -> officialSettings _ -> error $ "There is no official packaging for " ++ show flavor officialSettings :: (Monad m) => CabalT m () officialSettings = do pkgDesc <- use A.packageDescription #if MIN_VERSION_Cabal(2,0,0) let cabal = pkgName (Cabal.package pkgDesc) #else let PackageName cabal = pkgName (Cabal.package pkgDesc) #endif zoom A.debInfo $ do let officialError = error "officialSettings: no sourcePackageName" D.omitProfVersionDeps .= True SrcPkgName src <- fromMaybe officialError <$> use D.sourcePackageName 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") #if MIN_VERSION_Cabal(2,0,0) S.homepage .?= Just ("https://hackage.haskell.org/package/" <> pack (unPackageName cabal)) #else S.homepage .?= Just ("https://hackage.haskell.org/package/" <> pack cabal) #endif S.vcsFields %= Set.union (Set.fromList [ S.VCSBrowser packagesURI , S.VCSGit "https://salsa.debian.org/haskell-team/DHG_packages.git" ]) putBuildDeps :: (MonadIO m) => (Relations -> Relations) -> PackageDescription -> CabalT m () putBuildDeps finalizeRelations pkgDesc = do deps <- debianBuildDeps pkgDesc >>= return . finalizeRelations depsIndep <- debianBuildDepsIndep pkgDesc >>= return . finalizeRelations (A.debInfo . D.control . S.buildDepends) .= deps (A.debInfo . D.control . S.buildDependsIndep) .= depsIndep -- | Filter out any relations that mention any of the bad package names. filterRelations :: [BinPkgName] -> Relations -> Relations filterRelations badNames orRels = List.filter (not . List.null) (List.map filterOrRelation orRels) where filterOrRelation :: [Relation] -> [Relation] filterOrRelation rels = List.filter (\ (Rel name _ _) -> not (elem name badNames)) rels cabalExecBinaryPackage :: Monad m => BinPkgName -> CabalT m () cabalExecBinaryPackage b = do (A.debInfo . D.binaryDebDescription b . B.packageType) .?= Just B.Exec (A.debInfo . D.binaryDebDescription b . B.architecture) .?= Just Any (A.debInfo . D.binaryDebDescription b . B.binarySection) .?= Just (MainSection "misc") (A.debInfo . D.binaryDebDescription b . B.description) .?= Just desc -- yeah, this same line is all over the place. binaryPackageRelations b B.Exec where binaryPackageRelations :: Monad m => BinPkgName -> B.PackageType -> CabalT m () binaryPackageRelations b typ = zoom A.debInfo $ do edds <- use D.extraDevDeps zoom (D.binaryDebDescription b . B.relations) $ do when (typ == B.Development) $ do B.depends %= (edds ++) B.depends %= (anyrel "${shlibs:Depends}" : ) when (typ == B.Utilities) $ B.depends %= (anyrel "${shlibs:Depends}" : ) B.depends %= ([anyrel "${haskell:Depends}", anyrel "${misc:Depends}"] ++) B.recommends %= (anyrel "${haskell:Recommends}" : ) B.suggests %= (anyrel "${haskell:Suggests}" :) B.conflicts %= (anyrel "${haskell:Conflicts}" :) B.preDepends .= [] B.breaks .= [] B.builtUsing .= [] unless (typ == B.Documentation) $ B.provides %= (anyrel "${haskell:Provides}" :) -- | Add the library paragraphs for a particular compiler flavor. librarySpecs :: (Monad m) => PackageDescription -> CompilerFlavor -> CabalT m () librarySpecs pkgDesc hc = do let dev = isJust (Cabal.library pkgDesc) doc <- get >>= return . not . view (A.debInfo . D.noDocumentationLibrary) prof <- get >>= return . not . view (A.debInfo . D.noProfilingLibrary) when dev (librarySpec Any B.Development hc) when (dev && prof && hc == GHC) (librarySpec Any B.Profiling hc) when (dev && doc) (docSpecsParagraph hc) docSpecsParagraph :: (Monad m) => CompilerFlavor -> CabalT m () docSpecsParagraph hc = do b <- debianName B.Documentation hc binaryPackageRelations b B.Documentation (A.debInfo . D.binaryDebDescription b . B.packageType) .?= Just B.Documentation (A.debInfo . D.binaryDebDescription b . B.packageType) .?= Just B.Documentation (A.debInfo . D.binaryDebDescription b . B.architecture) .= Just All (A.debInfo . D.binaryDebDescription b . B.binarySection) .?= Just (MainSection "doc") (A.debInfo . D.binaryDebDescription b . B.description) .?= Just desc librarySpec :: (Monad m) => PackageArchitectures -> B.PackageType -> CompilerFlavor -> CabalT m () librarySpec arch typ hc = do b <- debianName typ hc binaryPackageRelations b typ (A.debInfo . D.binaryDebDescription b . B.packageType) .?= Just typ (A.debInfo . D.binaryDebDescription b . B.packageType) .?= Just typ (A.debInfo . D.binaryDebDescription b . B.architecture) .?= Just arch (A.debInfo . D.binaryDebDescription b . B.description) .?= Just desc -- | This is the standard value for the Description field of a binary -- package control file stanza. desc :: Text desc = Text.intercalate "\n " ["${haskell:ShortDescription}${haskell:ShortBlurb}", "${haskell:LongDescription}", ".", "${haskell:Blurb}"] -- | Make sure all data and executable files are assigned to at least -- one binary package and make sure all binary packages are in the -- package list in the source deb description. If there are left over -- files, assign them to the packages returned by the -- utilsPackageNames lens, and make sure those packages are in the -- source deb description. makeUtilsPackage :: forall m. (Monad m) => PackageDescription -> CompilerFlavor -> CabalT m () makeUtilsPackage pkgDesc hc = do -- Files the cabal package expects to be installed -- Files that are already assigned to any binary deb installedDataMap <- Set.fold (\ x r -> case x of D.Install b src _ -> Map.insertWith Set.union b (singleton src) r D.InstallTo b src _ -> Map.insertWith Set.union b (singleton src) r D.InstallData b src _ -> Map.insertWith Set.union b (singleton src) r _ -> r) mempty <$> use (A.debInfo . D.atomSet) :: CabalT m (Map BinPkgName (Set FilePath)) installedExecMap <- Set.fold (\ x r -> case x of D.InstallCabalExec b name _ -> Map.insertWith Set.union b (singleton name) r D.InstallCabalExecTo b name _ -> Map.insertWith Set.union b (singleton name) r _ -> r) mempty <$> use (A.debInfo . D.atomSet) :: CabalT m (Map BinPkgName (Set String)) -- The names of cabal executables that go into eponymous debs insExecPkg <- use (A.debInfo . D.executable) >>= return . Set.map ename . Set.fromList . elems #if MIN_VERSION_Cabal(2,0,0) let installedData :: Set (FilePath, FilePath) installedData = Set.map (\ a -> (a, a)) $ Set.unions (Map.elems installedDataMap) installedExec :: Set String #else let installedData = Set.map (\ a -> (a, a)) $ Set.unions (Map.elems installedDataMap) #endif installedExec = Set.unions (Map.elems installedExecMap) prefixPath <- dataTop let dataFilePaths = Set.fromList (zip (List.map (prefixPath ) (Cabal.dataFiles pkgDesc)) (Cabal.dataFiles pkgDesc)) :: Set (FilePath, FilePath) #if MIN_VERSION_Cabal(2,0,0) execFilePaths :: Set FilePath execFilePaths = Set.map (unUnqualComponentName . Cabal.exeName) (Set.filter (Cabal.buildable . Cabal.buildInfo) (Set.fromList (Cabal.executables pkgDesc))) :: Set FilePath #else execFilePaths = Set.map Cabal.exeName (Set.filter (Cabal.buildable . Cabal.buildInfo) (Set.fromList (Cabal.executables pkgDesc))) :: Set FilePath #endif let availableData = Set.union installedData dataFilePaths availableExec = Set.union installedExec execFilePaths use (A.debInfo . D.utilsPackageNameBase) >>= \ name -> case name of Nothing -> debianName B.Utilities hc >>= \ (BinPkgName name') -> (A.debInfo . D.utilsPackageNameBase) .= Just name' _ -> return () b <- debianName B.Utilities hc -- Files that are installed into packages other than the utils packages let installedDataOther = Set.map (\ a -> (a, a)) $ Set.unions $ Map.elems $ Map.delete b installedDataMap installedExecOther = Set.union insExecPkg $ Set.unions $ Map.elems $ Map.delete b installedExecMap -- Files that will be in utils packages let utilsData = Set.difference availableData installedDataOther utilsExec = Set.difference availableExec installedExecOther -- Files that still need to be assigned to the utils packages let utilsDataMissing = Set.difference utilsData installedData utilsExecMissing = Set.difference utilsExec installedExec -- If any files belong in the utils packages, make sure they exist when (not (Set.null utilsData && Set.null utilsExec)) $ do (A.debInfo . D.binaryDebDescription b . B.description) .?= Just desc -- This is really for all binary debs except the libraries - I'm not sure why (A.debInfo . D.rulesFragments) %= Set.insert (pack ("build" ppShow b ++ ":: build-ghc-stamp\n")) (A.debInfo . D.binaryDebDescription b . B.architecture) .?= Just (if Set.null utilsExec then All else Any) (A.debInfo . D.binaryDebDescription b . B.binarySection) .?= Just (MainSection "misc") binaryPackageRelations b B.Utilities -- Add the unassigned files to the utils packages mapM_ (\ (foo, bar) -> (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallData b foo bar)) utilsDataMissing mapM_ (\ name -> (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallCabalExec b name "usr/bin")) utilsExecMissing where ename i = case D.sourceDir i of Nothing -> D.execName i Just s -> s D.execName i expandAtoms :: Monad m => CabalT m () -> CabalT m () expandAtoms goodies = do hc <- use (A.debInfo . D.flags . compilerFlavor) case hc of GHC -> (A.debInfo . D.flags . cabalFlagAssignments) %= (Set.union (Set.fromList (flagList "--ghc"))) #if MIN_VERSION_Cabal(1,22,0) GHCJS -> (A.debInfo . D.flags . cabalFlagAssignments) %= (Set.union (Set.fromList (flagList "--ghcjs"))) #endif x -> error $ "Sorry, compiler not supported: " ++ show x builddir <- use (A.debInfo . D.buildDir) >>= return . fromMaybe (case hc of GHC -> "dist-ghc/build" #if MIN_VERSION_Cabal(1,22,0) GHCJS -> "dist-ghcjs/build" #endif _ -> error $ "Unexpected compiler: " ++ show hc) dDest <- dataDest expandApacheSites expandInstallCabalExecs builddir expandInstallCabalExecTo builddir expandInstallData dDest expandInstallTo expandFile #if 1 goodies #else expandWebsite expandServer expandBackups #endif expandExecutable where expandApacheSites :: Monad m => CabalT m () expandApacheSites = do mp <- get >>= return . view (A.debInfo . D.apacheSite) List.mapM_ expandApacheSite (Map.toList mp) where expandApacheSite (b, (dom, log, text)) = do (A.debInfo . D.atomSet) %= (Set.insert $ D.Link b ("/etc/apache2/sites-available/" ++ dom) ("/etc/apache2/sites-enabled/" ++ dom)) (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallDir b log) (A.debInfo . D.atomSet) %= (Set.insert $ D.File b ("/etc/apache2/sites-available" dom) text) -- Turn A.InstallCabalExec into A.Install expandInstallCabalExecs :: Monad m => FilePath -> CabalT m () expandInstallCabalExecs builddir = do hc <- use (A.debInfo . D.flags . compilerFlavor) use (A.debInfo . D.atomSet) >>= mapM_ (doAtom hc) where doAtom :: Monad m => CompilerFlavor -> D.Atom -> CabalT m () doAtom GHC (D.InstallCabalExec b name dest) = (A.debInfo . D.atomSet) %= (Set.insert $ D.Install b (builddir name name) dest) #if MIN_VERSION_Cabal(1,22,0) -- A GHCJS executable is a directory with files, copy them -- all into place. doAtom GHCJS (D.InstallCabalExec b name dest) = (A.debInfo . D.rulesFragments) %= Set.insert (Text.unlines [ pack ("binary-fixup" ppShow b) <> "::" , pack ("\t(cd " <> builddir name <> " && find -L " <> name <.> "jsexe" <> " -type f) |\\\n" <> "\t while read i; do install -Dp " <> builddir name "$$i debian" ppShow b makeRelative "/" dest "$$i; done\n") ]) #endif doAtom _ _ = return () -- Turn A.InstallCabalExecTo into a make rule expandInstallCabalExecTo :: Monad m => FilePath -> CabalT m () expandInstallCabalExecTo builddir = do hc <- use (A.debInfo . D.flags . compilerFlavor) use (A.debInfo . D.atomSet) >>= mapM_ (doAtom hc) where doAtom :: Monad m => CompilerFlavor -> D.Atom -> CabalT m () doAtom GHC (D.InstallCabalExecTo b name dest) = (A.debInfo . D.rulesFragments) %= Set.insert (Text.unlines [ pack ("binary-fixup" ppShow b) <> "::" , "\tinstall -Dps " <> pack (builddir name name) <> " " <> pack ("debian" ppShow b makeRelative "/" dest) ]) doAtom hc (D.InstallCabalExecTo b name dest) = error $ "expandInstallCabalExecTo " ++ show hc ++ " " ++ show (D.InstallCabalExecTo b name dest) doAtom _ _ = return () -- Turn A.InstallData into either an Install or an InstallTo expandInstallData :: Monad m => FilePath -> CabalT m () expandInstallData dDest = use (A.debInfo . D.atomSet) >>= List.mapM_ doAtom . Set.toList where doAtom :: Monad m => D.Atom -> CabalT m () doAtom (D.InstallData b src dest) = if takeFileName src == takeFileName dest then (A.debInfo . D.atomSet) %= (Set.insert $ D.Install b src (dDest makeRelative "/" (takeDirectory dest))) else (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallTo b src (dDest makeRelative "/" dest)) doAtom _ = return () -- Turn A.InstallTo into a make rule expandInstallTo :: Monad m => CabalT m () expandInstallTo = use (A.debInfo . D.atomSet) >>= List.mapM_ doAtom . Set.toList where doAtom :: Monad m => D.Atom -> CabalT m () doAtom (D.InstallTo b src dest) = (A.debInfo . D.rulesFragments) %= Set.insert (Text.unlines [ pack ("binary-fixup" ppShow b) <> "::" , "\tinstall -Dp " <> pack src <> " " <> pack ("debian" ppShow b makeRelative "/" dest) ]) doAtom _ = return () -- Turn A.File into an intermediateFile and an A.Install expandFile :: Monad m => CabalT m () expandFile = use (A.debInfo . D.atomSet) >>= List.mapM_ doAtom . Set.toList where doAtom :: Monad m => D.Atom -> CabalT m () doAtom (D.File b path text) = do let (destDir', destName') = splitFileName path tmpDir = "debian/cabalInstall" show (md5 (fromString (unpack text))) tmpPath = tmpDir destName' (A.debInfo . D.intermediateFiles) %= Set.insert (tmpPath, text) (A.debInfo . D.atomSet) %= (Set.insert $ D.Install b tmpPath destDir') doAtom _ = return () expandExecutable :: Monad m => CabalT m () expandExecutable = do mp <- get >>= return . view (A.debInfo . D.executable) List.mapM_ (\ (b, f) -> modify (execAtoms b f)) (Map.toList mp) -- | Add the normal default values to the rules files. finalizeRules :: (MonadIO m) => CabalT m () finalizeRules = do DebBase b <- debianNameBase hc <- use (A.debInfo . D.flags . compilerFlavor) cpn <- liftIO $ compilerPackageName hc B.Development let BinPkgName hcdeb = fromMaybe (error "No compiler package") cpn (A.debInfo . D.rulesHead) .?= Just "#!/usr/bin/make -f" (A.debInfo . D.rulesSettings) %= (++ ["DEB_CABAL_PACKAGE = " <> pack b]) (A.debInfo . D.rulesSettings) %= (++ ["DEB_DEFAULT_COMPILER = " <> pack hcdeb]) flags <- flagString . Set.toList <$> use (A.debInfo . D.flags . cabalFlagAssignments) unless (List.null flags) ((A.debInfo . D.rulesSettings) %= (++ ["DEB_SETUP_GHC_CONFIGURE_ARGS = " <> pack flags])) (A.debInfo . D.rulesIncludes) %= (++ ["include /usr/share/cdbs/1/rules/debhelper.mk", "include /usr/share/cdbs/1/class/hlibrary.mk"]) data Dependency_ = BuildDepends Dependency | BuildTools Dependency | PkgConfigDepends Dependency | ExtraLibs Relations deriving (Eq, Show) anyrel :: String -> [D.Relation] anyrel x = anyrel' (D.BinPkgName x) anyrel' :: D.BinPkgName -> [D.Relation] anyrel' x = [D.Rel x Nothing Nothing] -- Lifted from Distribution.Simple.Setup, since it's not exported. flagList :: String -> [(FlagName, Bool)] flagList = List.map tagWithValue . words #if MIN_VERSION_Cabal(2,0,0) where tagWithValue ('-':name) = (mkFlagName (List.map toLower name), False) tagWithValue name = (mkFlagName (List.map toLower name), True) #else where tagWithValue ('-':name) = (FlagName (List.map toLower name), False) tagWithValue name = (FlagName (List.map toLower name), True) #endif flagString :: [(FlagName, Bool)] -> String #if MIN_VERSION_Cabal(2,0,0) flagString = unwords . List.map (\ (s, sense) -> "-f" ++ (if sense then "" else "-") ++ unFlagName s) #else flagString = unwords . List.map (\ (FlagName s, sense) -> "-f" ++ (if sense then "" else "-") ++ s) #endif cabal-debian-5.0/src/Debian/Debianize/Optparse.hs0000644000000000000000000006504413530623213020031 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} module Debian.Debianize.Optparse ( CommandLineOptions(..), BehaviorAdjustment, Flags(..), parseProgramArguments, parseProgramArguments', handleBehaviorAdjustment) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>), (<*>), pure) #endif import Control.Applicative (many, (<|>)) import Control.Lens import Control.Monad.State.Class (MonadState) import Control.Monad.Trans import Control.Newtype.Generics import Data.Bifunctor (first) import Data.Char(toUpper) import Data.Foldable (forM_) import Data.Maybe.Extended (fromMaybe) import Data.Maybe.Extended (nothingIf) import Data.Monoid ((<>)) import Debian.Debianize.BasicInfo (EnvSet(EnvSet), cleanOS, dependOS, buildOS, Flags(..)) import Debian.Debianize.DebInfo (TestsStatus(..)) import Debian.Debianize.Monad import Debian.Debianize.Prelude (maybeRead) import Debian.Debianize.VersionSplits import Debian.GHC () import Debian.Policy import Debian.Relation import Debian.Version (DebianVersion, parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..)) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageName, mkPackageName, unPackageName) import Distribution.PackageDescription (FlagName, mkFlagName) #else import Distribution.Package (PackageName(..)) import Distribution.PackageDescription (FlagName(FlagName)) #endif import GHC.Generics import System.Environment (getArgs) import System.FilePath(splitFileName, ()) import System.Process (showCommandForUser) #if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr(..)) #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) #endif import Text.PrettyPrint.ANSI.Leijen (linebreak, (<+>), string, indent) import qualified Debian.Debianize.DebInfo as D import qualified Data.Map as Map import qualified Data.Set as Set import qualified Debian.Debianize.BinaryDebDescription as B import qualified Debian.Debianize.CabalInfo as A import qualified Debian.Debianize.SourceDebDescription as S import qualified Options.Applicative as O data HaddockStatus = HaddockEnabled | HaddockDisabled deriving Eq data ProfilingStatus = ProfilingEnabled | ProfilingDisabled deriving Eq data OfficialStatus = Official| NonOfficial deriving Eq newtype BuildDep = BuildDep Relations deriving Generic instance Newtype BuildDep newtype BuildDepIndep = BuildDepIndep Relations deriving Generic instance Newtype BuildDepIndep newtype DevDep = DevDep Relations deriving Generic instance Newtype DevDep newtype ExtraDepends = ExtraDepends (BinPkgName, Relations) deriving Generic instance Newtype ExtraDepends newtype ExtraConflicts = ExtraConflicts (BinPkgName, Relations) deriving Generic instance Newtype ExtraConflicts newtype ExtraProvides = ExtraProvides (BinPkgName, Relations) deriving Generic instance Newtype ExtraProvides newtype ExtraReplaces = ExtraReplaces (BinPkgName, Relations) deriving Generic instance Newtype ExtraReplaces newtype ExtraRecommends = ExtraRecommends (BinPkgName, Relations) deriving Generic instance Newtype ExtraRecommends newtype ExtraSuggests = ExtraSuggests (BinPkgName, Relations) deriving Generic instance Newtype ExtraSuggests newtype CabalDebMapping = CabalDebMapping (PackageName, Relations) deriving Generic instance Newtype CabalDebMapping newtype ExecDebMapping = ExecDebMapping (String, Relations) deriving Generic instance Newtype ExecDebMapping newtype Revision = Revision String deriving Generic instance Newtype Revision newtype CabalEpochMapping = CabalEpochMapping (PackageName, Int) deriving Generic instance Newtype CabalEpochMapping newtype CabalFlagMapping = CabalFlagMapping (FlagName, Bool) deriving Generic instance Newtype CabalFlagMapping -- | This data type is an abomination. It represent information, -- provided on command line. Part of such information provides -- means to create initial 'CabalT' state and is stored in -- '_flags' field. See 'newCabalInfo'. -- -- Other, much greater part represent changes to already created -- state. They are stored in '_adjustment' field. -- -- All this can be understood from (simplified) types: -- -- > type CabalT m a = StateT CabalInfo m a -- > newCabalInfo :: Flags -> IO CabalInfo -- > handleBehaviorAdjustment :: BehaviorAdjustment -> CabalT IO () data CommandLineOptions = CommandLineOptions { _flags :: Flags, _adjustment :: BehaviorAdjustment } -- | This data type represents changes to 'CabalT' state, -- requested at command line. data BehaviorAdjustment = BehaviorAdjustment { _maintainer :: NameAddr, _uploaders :: [NameAddr], _executable :: [(BinPkgName, D.InstallFile)], _defaultPackage :: Maybe String, _missingDependency :: [BinPkgName], _debianNameBase :: Maybe DebBase, _debianVersion :: Maybe DebianVersion, _revision :: Maybe Revision, _sourcePackageName :: Maybe SrcPkgName, _sourceSection :: Section, _standardsVersion :: StandardsVersion, _buildDep :: [BuildDep], _buildDepIndep :: [BuildDepIndep], _devDep :: [DevDep], _extraDepends :: [ExtraDepends], _extraConflicts :: [ExtraConflicts], _extraProvides :: [ExtraProvides], _extraReplaces :: [ExtraReplaces], _extraRecommends :: [ExtraRecommends], _extraSuggests :: [ExtraSuggests], _cabalDebMapping :: [CabalDebMapping], _cabalEpochMapping :: [CabalEpochMapping], _execDebMapping :: [ExecDebMapping], _profiling :: ProfilingStatus, _haddock :: [HaddockStatus], _official :: OfficialStatus, _sourceFormat :: SourceFormat, _tests :: TestsStatus } -- Brief instruction to save you, dear developer from scrutinizing -- `optparse-applicative` documentation. -- -- There is two main types in command line parsing. -- -- 'ReadM' is description how make object from string. -- For every object of type 'a' with some parsing logic -- we define auxiliary function with 'R' suffix and -- type 'ReadM a'. -- -- 'Parser' is type, containing information about -- which string in command line should be converted -- to object. Every field in 'BehaviorAdjustment' -- and 'Flags' type of type 'b' have corresponding function -- of type 'Parser' with suffix 'P'. -- Here are all 'ReadM' values. executableR :: O.ReadM (BinPkgName, D.InstallFile) executableR = parsePair . span (/= ':') <$> O.str where parsePair :: (String, String) -> (BinPkgName, D.InstallFile) parsePair (sp, md) = let (sd, name) = splitFileName sp in (BinPkgName name, D.InstallFile { D.execName = name, D.destName = name, D.sourceDir = nothingIf ( == "./") sd, D.destDir = case md of (':' : dd) -> Just dd _ -> Nothing }) binPkgNameR :: O.ReadM BinPkgName binPkgNameR = BinPkgName <$> O.str nameAddrR :: O.ReadM NameAddr nameAddrR = either fail return =<< parseMaintainer <$> O.str relationsR :: O.ReadM Relations relationsR = either (fail . show) return =<< parseRelations <$> (O.str :: O.ReadM String) mappingR :: O.ReadM (String, Relations) mappingR = span (/= ':') <$> O.str >>= \case (str, "") -> fail $ "Does not contains colon: `" ++ str ++ "'" (pkgstr, _ : relstr) -> do rels <- either (fail . show) return $ parseRelations relstr return (pkgstr, rels) epochMappingR :: O.ReadM (String, Int) epochMappingR = span (/= '=') <$> O.str >>= \case (pkgstr, '=' : numstr) -> do let epoch = fromMaybe (error ("Invalid epoch: " ++ numstr)) (maybeRead numstr :: Maybe Int) return (pkgstr, epoch) (str, _) -> fail $ "Does not contains equals: `" ++ str ++ "'" extraRelationsR :: O.ReadM (BinPkgName, Relations) extraRelationsR = first BinPkgName <$> mappingR cabalDebMappingR :: O.ReadM CabalDebMapping #if MIN_VERSION_Cabal(2,0,0) cabalDebMappingR = CabalDebMapping . first mkPackageName <$> mappingR #else cabalDebMappingR = CabalDebMapping . first PackageName <$> mappingR #endif cabalEpochMappingR :: O.ReadM CabalEpochMapping #if MIN_VERSION_Cabal(2,0,0) cabalEpochMappingR = CabalEpochMapping . first mkPackageName <$> epochMappingR #else cabalEpochMappingR = CabalEpochMapping . first PackageName <$> epochMappingR #endif cabalFlagMappingR :: O.ReadM CabalFlagMapping cabalFlagMappingR = O.str >>= \case #if MIN_VERSION_Cabal(2,0,0) ('-' : str) -> return $ CabalFlagMapping (mkFlagName str, False) str -> return $ CabalFlagMapping (mkFlagName str, True) #else ('-' : str) -> return $ CabalFlagMapping (FlagName str, False) str -> return $ CabalFlagMapping (FlagName str, True) #endif -- Here are parser for BehaviorAdjustment and next are parsers for -- every field of this data. Please, keep parsers declarations in -- same order, as are fields. behaviorAdjustmentP :: O.Parser BehaviorAdjustment behaviorAdjustmentP = BehaviorAdjustment <$> maintainerP <*> uploadersP <*> executableP <*> defaultPackageP <*> missingDependencyP <*> debianNameBaseP <*> debianVersionP <*> debianRevisionP <*> sourcePackageNameP <*> sourceSectionP <*> standardsVersionP <*> buildDepP <*> buildDepIndepP <*> devDepP <*> extraDependsP <*> extraConflictsP <*> extraProvidesP <*> extraReplacesP <*> extraRecommendsP <*> extraSuggestsP <*> cabalDebMappingP <*> cabalEpochMappingP <*> execDebMappingP <*> profilingP <*> haddockP <*> officialP <*> sourceFormatP <*> testsP maintainerP :: O.Parser NameAddr maintainerP = O.option nameAddrR m where m = O.help helpMsg <> O.long "maintainer" <> O.short 'm' <> O.value (NameAddr (Just "Debian Haskell Group") "pkg-haskell-maintainers@lists.alioth.debian.org") <> O.metavar "'NAME '" helpMsg = "Set the `Maintainer' field in debian/control file." uploadersP :: O.Parser [NameAddr] uploadersP = many $ O.option nameAddrR m where m = O.help helpMsg <> O.long "uploader" <> O.short 'u' <> O.metavar "'NAME '" helpMsg = "Add entry to `Uploaders' field in debian/control file." executableP :: O.Parser [(BinPkgName, D.InstallFile)] executableP = many $ O.option executableR m where m = O.help helpMsg <> O.long "executable" <> O.short 'e' <> O.metavar "SOURCEPATH[:DESTDIR]" helpMsg = unlines [ "Create an individual binary package to hold this executable.", "Other executables and data files are gathered into a single package", "named `haskell-PACKAGENAME-utils'" ] defaultPackageP :: O.Parser (Maybe String) defaultPackageP = O.option (Just <$> O.str) m where m = O.help helpMsg <> O.long "default-package" <> O.short 'd' <> O.value Nothing <> O.metavar "PKGNAME" helpMsg = unlines [ "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'" ] missingDependencyP :: O.Parser [BinPkgName] missingDependencyP = many $ O.option binPkgNameR m where m = O.help helpMsg <> O.long "missing-dependency" <> O.metavar "DEB" helpMsg = unlines [ "This is the counterpart to --disable-haddock. It prevents a package", "from being added to the build dependencies. This is necessary,", "for example, when a dependency package was built with the", "--disable-haddock option, because normally cabal-debian assumes", "that the -doc package exists and adds it as a build dependency." ] debianNameBaseP :: O.Parser (Maybe DebBase) debianNameBaseP = O.option (Just . DebBase <$> O.str) m where m = O.help helpMsg <> O.long "debian-name-base" <> O.short 'b' <> O.value Nothing <> O.metavar "NAME" helpMsg = unlines [ "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." ] debianVersionP :: O.Parser (Maybe DebianVersion) debianVersionP = O.option (Just . parseDebianVersion' <$> (O.str :: O.ReadM String)) m where m = O.help helpMsg <> O.long "deb-version" <> O.metavar "DEBIANVERSION" <> O.value Nothing helpMsg = unlines [ "Specify the version number for the debian package.", "This will pin the version and should be considered dangerous." ] debianRevisionP :: O.Parser (Maybe Revision) debianRevisionP = O.option (Just . Revision <$> O.str) m where m = O.help helpMsg <> O.long "revision" <> O.value Nothing <> O.metavar "DEBIANREVISION" helpMsg = unlines [ "Add this string to the cabal version to get the debian version number.", "Debian policy says this must either be empty (--revision '')", "or begin with a dash." ] sourcePackageNameP :: O.Parser (Maybe SrcPkgName) sourcePackageNameP = O.option (Just . SrcPkgName <$> O.str) m where m = O.help helpMsg <> O.long "source-package-name" <> O.short 's' <> O.value Nothing <> O.metavar "DEBIANNAME" helpMsg = unlines [ "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-,", "where the cabal package name is downcased." ] sourceSectionP :: O.Parser Section sourceSectionP = O.option (MainSection <$> O.str) m where m = O.help helpMsg <> O.long "source-section" <> O.short 'S' <> O.value (MainSection "haskell") <> O.metavar "SECTION" helpMsg = "Set the `Section' field in debian/control file." standardsVersionP :: O.Parser StandardsVersion standardsVersionP = O.option (parseStandardsVersion <$> O.str) m where m = O.help helpMsg <> O.long "standards-version" <> O.value (parseStandardsVersion "4.4.0") <> O.metavar "CABALVERSION" helpMsg = unlines [ "Claim compatibility to this version of the Debian policy", "(i.e. the value of the Standards-Version field)" ] buildDepP :: O.Parser [BuildDep] buildDepP = many $ O.option (BuildDep <$> relationsR) m where m = O.help helpMsg <> O.long "build-dep" <> O.metavar "DEBIANRELATIONS" helpMsg = unlines [ "Add a dependency relation to the `Build-Depends'", "field for this source package." ] buildDepIndepP :: O.Parser [BuildDepIndep] buildDepIndepP = many $ O.option (BuildDepIndep <$> relationsR) m where m = O.help helpMsg <> O.long "build-dep-indep" <> O.metavar "DEBIANRELATIONS" helpMsg = unlines [ "Add a dependency relation to the `Build-Depends-Indep'", "field for this source package." ] devDepP :: O.Parser [DevDep] devDepP = many $ O.option (DevDep <$> relationsR) m where m = O.help helpMsg <> O.long "dev-dep" <> O.metavar "RELATION" helpMsg = "Add an entry to the `Depends' field of the -dev package" -- Since `depends', `conflicts' and so on options are totally same, -- we can avoid code via this function, which, given long option name -- makes correct O.Parser. Newtype around (BinPkgName, Relations) -- is inferred, but there is still some duplication. -- -- Long option name can also be inferred from Typeable instance of -- mentioned newtype, but this would introduce some amount of -- low-level string manipulations. -- -- Nice to know, but now, to me, it would introduce more complexity, -- than eliminate. mkExtraP :: (Newtype n, O n ~ (BinPkgName, Relations)) => String -> O.Parser [n] mkExtraP long@(c:cr) = many $ O.option (pack <$> extraRelationsR) m where fieldName = toUpper c : cr m = O.help helpMsg <> O.long long <> O.metavar "DEB:RELATION" helpMsg = "Add extry to '" ++ fieldName ++ " 'field of DEB binary package" mkExtraP "" = error "mkExtraP: empty long option" extraDependsP :: O.Parser [ExtraDepends] extraDependsP = mkExtraP "depends" extraConflictsP :: O.Parser [ExtraConflicts] extraConflictsP = mkExtraP "conflicts" extraProvidesP :: O.Parser [ExtraProvides] extraProvidesP = mkExtraP "provides" extraReplacesP :: O.Parser [ExtraReplaces] extraReplacesP = mkExtraP "replaces" extraRecommendsP :: O.Parser [ExtraRecommends] extraRecommendsP = mkExtraP "recommends" extraSuggestsP :: O.Parser [ExtraSuggests] extraSuggestsP = mkExtraP "suggests" cabalDebMappingP :: O.Parser [CabalDebMapping] cabalDebMappingP = many $ O.option cabalDebMappingR m where m = O.help helpMsg <> O.long "dep-map" <> O.metavar "CABAL:DEBIANBINARYPACKAGE" helpMsg = unlines [ "Specify what debian package name corresponds with a name that appears", "in the Extra-Library field of a cabal file,", "e.g. --map-dep cryptopp:libcrypto-dev." ] execDebMappingP :: O.Parser [ExecDebMapping] execDebMappingP = many $ O.option (ExecDebMapping <$> mappingR) m where m = O.help helpMsg <> O.long "exec-map" <> O.metavar "CABAL:DEBIANBINARYPACKAGE" helpMsg = unlines [ "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" ] cabalEpochMappingP :: O.Parser [CabalEpochMapping] cabalEpochMappingP = many $ O.option (cabalEpochMappingR) m where m = O.help helpMsg <> O.long "epoch-map" <> O.metavar "CABALPACKAGE=DIGIT" helpMsg = unlines [ "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" ] cabalFlagsP :: O.Parser [CabalFlagMapping] cabalFlagsP = many $ O.option (cabalFlagMappingR) m where m = O.help helpMsg <> O.long "cabal-flags" <> O.long "cabal-flag" <> O.metavar "CABALFLAG or -CABALFLAG" helpMsg = "Flags to pass to cabal configure with the --flags= option" profilingP :: O.Parser ProfilingStatus profilingP = O.flag ProfilingEnabled ProfilingDisabled m where m = O.help helpMsg <> O.long "disable-profiling" helpMsg = unlines [ "Do not generate profiling (-prof) library package, do not", "add -prof packages to the build dependency list." ] haddockP :: O.Parser [HaddockStatus] haddockP = (: []) <$> (O.flag HaddockEnabled HaddockDisabled m) where m = O.help helpMsg <> O.long "disable-haddock" helpMsg = "Do not create a -doc package" officialP :: O.Parser OfficialStatus officialP = O.flag NonOfficial Official m where m = O.help helpMsg <> O.long "official" helpMsg = "Follow guidelines of Debian Haskell Group" sourceFormatP :: O.Parser SourceFormat sourceFormatP = O.flag Quilt3 Native3 m where m = O.help helpMsg <> O.long "native" helpMsg = unlines [ "Package has an no upstream tarball,", "write '3.0 (native)' into source/format." ] testsP :: O.Parser TestsStatus testsP = buildOnlyTestsP <|> disableTestsP disableTestsP :: O.Parser TestsStatus disableTestsP = O.flag TestsRun TestsDisable m where m = O.help "disable test suite" <> O.long "disable-tests" <> O.long "no-tests" buildOnlyTestsP :: O.Parser TestsStatus buildOnlyTestsP = O.flag TestsRun TestsBuild m where m = O.help "build, but do not run test suite" <> O.long "no-run-tests" <> O.long "disable-running-tests" -- Here is 'Flags' parser and parsers for every it's field. flagsP :: O.Parser Flags flagsP = Flags <$> verbosityP <*> dryRunP <*> upgradeP <*> roundtripP <*> pure False -- validate <*> hcFlavorP -- CompilerFlavor <*> (flagSet <$> cabalFlagsP) -- cabalFlagAssignments <*> buildEnvDirP where flagSet cfms = Set.fromList (map (\ (CabalFlagMapping (name, bool)) -> (name, bool)) cfms) verbosityP :: O.Parser Int verbosityP = length <$> many (O.flag' () m) where m = O.help helpMsg <> O.short 'v' <> O.long "verbose" helpMsg = unlines [ "Every instance of this flag increases amount", "of progress messages generated" ] dryRunP :: O.Parser Bool dryRunP = O.switch m where m = O.help helpMsg <> O.short 'n' <> O.long "dry-run" 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." ] -- versionR :: O.ReadM Version -- versionR = (maybe (error "Invalid compiler version") id . parseVersion') <$> O.str hcFlavorP :: O.Parser CompilerFlavor hcFlavorP = O.flag GHC #if MIN_VERSION_Cabal(1,22,0) GHCJS #else GHC #endif m where m = O.help helpMsg <> O.long "ghcjs" helpMsg = "Set compiler flavor to GHCJS." buildEnvDirP :: O.Parser EnvSet buildEnvDirP = O.option ((\s -> EnvSet {cleanOS = s "clean", dependOS = s "depend", buildOS = s "build"}) <$> O.str) m where m = O.help "Directory containing the three build environments, clean, depend, and build." <> O.long "buildenvdir" <> O.value (EnvSet {cleanOS = "/", dependOS = "/", buildOS = "/"}) <> O.metavar "DIR" commandLineOptionsP :: O.Parser CommandLineOptions commandLineOptionsP = CommandLineOptions <$> flagsP <*> behaviorAdjustmentP commandLineOptionsParserInfo :: [String] -> O.ParserInfo CommandLineOptions commandLineOptionsParserInfo args = O.info (O.helper <*> commandLineOptionsP) im where im = O.header "cabal-debian -- create debianization of cabal package" <> O.fullDesc <> O.progDescDoc (Just descDoc) descDoc = "Typical usage is run in unpacked source root directory" <+> linebreak <+> linebreak <+> indent 2 "% cabal-debian --maintainer 'Maintainer Name '" <+> linebreak <+> linebreak <+> (string . unlines $ [ "This will read the package's cabal file and any existing debian/changelog file and", "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.", "", "Arguments: " ++ showCommandForUser "cabal-debian" args ]) -- FIXME: Separation of parsing of `BehaviorAdjustment' and performing -- of corresponding actions is all great, but now it is pretty easy -- to not handle particular field in `BehaviorAdjustment' field and -- ghc will not complain. handleBehaviorAdjustment :: (MonadIO m) => BehaviorAdjustment -> CabalT m () handleBehaviorAdjustment (BehaviorAdjustment {..}) = do forM_ _cabalEpochMapping $ \(CabalEpochMapping (pkg, num)) -> A.epochMap %= Map.insert pkg num zoom A.debInfo $ do forM_ _executable $ (D.executable %=) . uncurry Map.insert forM_ _execDebMapping $ (D.execMap %=) . uncurry Map.insert . unpack forM_ _missingDependency $ (D.missingDependencies %=) . Set.insert D.utilsPackageNameBase .= _defaultPackage D.noDocumentationLibrary .= (HaddockDisabled `elem` _haddock) D.noProfilingLibrary .= (_profiling == ProfilingDisabled) D.overrideDebianNameBase .= _debianNameBase D.sourcePackageName .= _sourcePackageName D.maintainerOption .= Just _maintainer D.sourceFormat .= _sourceFormat D.revision .= unpack `fmap` _revision D.debVersion .= _debianVersion D.uploadersOption %= (++ _uploaders) D.extraDevDeps %= (++ concatMap unpack _devDep) #if MIN_VERSION_Cabal(2,0,0) forM_ _cabalDebMapping $ \(CabalDebMapping (pkg, rels)) -> do D.extraLibMap %= Map.insert (unPackageName pkg) rels #else forM_ _cabalDebMapping $ \(CabalDebMapping (PackageName pkg, rels)) -> do D.extraLibMap %= Map.insert pkg rels #endif addExtra _extraDepends B.depends addExtra _extraConflicts B.conflicts addExtra _extraProvides B.provides addExtra _extraReplaces B.replaces addExtra _extraRecommends B.recommends addExtra _extraSuggests B.suggests D.testsStatus .= _tests D.official .= (_official == Official) zoom D.control $ do S.section .= Just _sourceSection S.standardsVersion .= Just _standardsVersion S.buildDepends %= (++ concatMap unpack _buildDep) S.buildDepends %= (++ concatMap unpack _devDep) S.buildDependsIndep %= (++ concatMap unpack _buildDepIndep) addExtra :: (MonadState D.DebInfo m, Newtype n, O n ~ (BinPkgName, Relations)) => [n] -> Lens' B.PackageRelations Relations -> m () addExtra extra lens' = forM_ extra $ \arg -> do let (pkg, rel) = unpack arg D.binaryDebDescription pkg . B.relations . lens' %= (++ rel) parseProgramArguments' :: [String] -> IO CommandLineOptions parseProgramArguments' args = O.handleParseResult result where prefs = O.prefs O.idm result = O.execParserPure prefs (commandLineOptionsParserInfo args) args parseProgramArguments :: IO CommandLineOptions parseProgramArguments = getArgs >>= parseProgramArguments' . leaveOne "--disable-haddock" where leaveOne :: String -> [String] -> [String] leaveOne s xs = go False xs where go _ [] = [] go False (x : xs') | x == s = x : go True xs' go True (x : xs') | x == s = go True xs' go flag (x : xs') = x : go flag xs' cabal-debian-5.0/src/Debian/Debianize/BinaryDebDescription.hs0000644000000000000000000001174013530623213022271 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, TemplateHaskell #-} {-# OPTIONS -Wall #-} module Debian.Debianize.BinaryDebDescription ( Canonical(canonical) , BinaryDebDescription , newBinaryDebDescription , package , multiArch , description , packageType , architecture , binarySection , binaryPriority , essential , relations , PackageType(..) , PackageRelations , newPackageRelations , depends , recommends , suggests , preDepends , breaks , conflicts , provides , replaces , builtUsing ) where import Data.Function (on) import Data.Generics (Data, Typeable) import Control.Lens.TH (makeLenses) import Data.List (sort, sortBy) import Data.Monoid (Monoid(..)) import Data.Text (Text) import Debian.Policy (PackageArchitectures, PackagePriority, Section, MultiArch) import Debian.Relation (BinPkgName, Relations) import Prelude hiding ((.)) class Canonical a where canonical :: a -> a -- | This type represents a section of the control file other than the -- first, which in turn represent one of the binary packages or debs -- produced by this debianization. data BinaryDebDescription = BinaryDebDescription { _package :: BinPkgName -- ^ , _packageType :: Maybe PackageType , _architecture :: Maybe PackageArchitectures -- ^ , _binarySection :: Maybe Section , _binaryPriority :: Maybe PackagePriority , _multiArch :: Maybe MultiArch , _essential :: Maybe Bool -- ^ , _description :: Maybe Text -- ^ , _relations :: PackageRelations -- ^ } deriving (Eq, Ord, Read, Show, Data, Typeable) -- ^ The different types of binary debs we can produce from a haskell package data PackageType = Development -- ^ The libghc-foo-dev package. | Profiling -- ^ The libghc-foo-prof package. | Documentation -- ^ The libghc-foo-doc package. | Exec -- ^ A package related to a particular executable, perhaps -- but not necessarily a server. | Utilities -- ^ A package that holds the package's data files -- and any executables not assigned to other -- packages. | Source -- ^ The source package (not a binary deb actually.) | HaskellSource -- ^ The source package of a haskell library (add -- prefix haskell- to source package name.) | Cabal -- ^ This is used to construct the value for -- DEB_CABAL_PACKAGE in the rules file deriving (Eq, Ord, Show, Read, Data, Typeable) -- ^ Package interrelationship information. data PackageRelations = PackageRelations { _depends :: Relations , _recommends :: Relations , _suggests :: Relations , _preDepends :: Relations , _breaks :: Relations , _conflicts :: Relations , _provides :: Relations , _replaces :: Relations , _builtUsing :: Relations } deriving (Eq, Ord, Read, Show, Data, Typeable) instance Canonical [BinaryDebDescription] where canonical xs = sortBy (compare `on` _package) (map canonical xs) instance Canonical BinaryDebDescription where canonical x = x {_relations = canonical (_relations x)} instance Canonical PackageRelations where canonical x = x { _depends = canonical (_depends x) , _recommends = canonical (_recommends x) , _suggests = canonical (_suggests x) , _preDepends = canonical (_preDepends x) , _breaks = canonical (_breaks x) , _conflicts = canonical (_conflicts x) , _provides = canonical (_provides x) , _replaces = canonical (_replaces x) , _builtUsing = canonical (_builtUsing x) } instance Canonical Relations where canonical xss = sort xss newBinaryDebDescription :: BinPkgName -> BinaryDebDescription newBinaryDebDescription name = BinaryDebDescription { _package = name , _packageType = Nothing , _architecture = Nothing , _multiArch = Nothing , _binarySection = Nothing , _binaryPriority = Nothing , _essential = Nothing , _description = mempty , _relations = newPackageRelations } newPackageRelations :: PackageRelations newPackageRelations = PackageRelations { _depends = [] , _recommends = [] , _suggests = [] , _preDepends = [] , _breaks = [] , _conflicts = [] , _provides = [] , _replaces = [] , _builtUsing = [] } $(makeLenses ''BinaryDebDescription) $(makeLenses ''PackageRelations) cabal-debian-5.0/src/Debian/Debianize/DebInfo.hs0000644000000000000000000004242613530623213017541 0ustar0000000000000000-- | This module holds a long list of lenses that access the Atoms -- record, the record that holds the input data from which the -- debianization is to be constructed. {-# LANGUAGE CPP, DeriveDataTypeable, Rank2Types, TemplateHaskell #-} {-# OPTIONS_GHC -Wall #-} module Debian.Debianize.DebInfo ( -- * Types #if __HADDOCK__ -- Is this ifdef working? DebInfo(..) #else DebInfo #endif , Atom(File, Install, InstallCabalExec, InstallCabalExecTo, InstallData, InstallDir, InstallTo, Link) , Site(Site, domain, server, serverAdmin) , Server(Server, headerMessage, hostname, installFile, port, retry, serverFlags) , InstallFile(InstallFile, destDir, destName, execName, sourceDir) , TestsStatus(..) -- * Lenses , flags , warning , sourceFormat , watch , rulesHead , rulesSettings , rulesIncludes , rulesFragments , copyright , control , intermediateFiles , compat , changelog , installInit , logrotateStanza , postInst , postRm , preInst , preRm , atomSet , noDocumentationLibrary , noProfilingLibrary , omitProfVersionDeps , omitLTDeps , buildDir , sourcePackageName , overrideDebianNameBase , revision , debVersion , maintainerOption , uploadersOption , utilsPackageNameBase , xDescriptionText , comments , missingDependencies , extraLibMap , execMap , apacheSite , sourceArchitectures , binaryArchitectures , sourcePriority , binaryPriorities , sourceSection , binarySections , executable , serverInfo , website , backups , extraDevDeps , official , testsStatus , allowDebianSelfBuildDeps , binaryDebDescription -- * Atom builders , link , install , installTo , installData , file , installCabalExec , installCabalExecTo , installDir -- * DebInfo Builder , makeDebInfo ) where import Control.Lens import Control.Monad.State (StateT) import Data.Generics (Data, Typeable) import Data.Map as Map (Map) #if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid(..)) #endif import Data.Set as Set (insert, Set) import Data.Text (Text) import Debian.Changes (ChangeLog) import Debian.Debianize.BasicInfo (Flags) import Debian.Debianize.Prelude (listElemLens, maybeLens) import Debian.Debianize.BinaryDebDescription (BinaryDebDescription, Canonical(canonical), newBinaryDebDescription, package) import Debian.Debianize.CopyrightDescription (CopyrightDescription) import qualified Debian.Debianize.SourceDebDescription as S (newSourceDebDescription, SourceDebDescription, binaryPackages) import Debian.Debianize.VersionSplits (DebBase) import Debian.Orphans () import Debian.Policy (PackageArchitectures, PackagePriority, Section, SourceFormat(..)) import Debian.Relation (BinPkgName, Relations, SrcPkgName) import Debian.Version (DebianVersion) import Prelude hiding (init, init, log, log) #if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr) #else import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr) #endif -- | Information required to represent a non-cabal debianization. data DebInfo = DebInfo { _flags :: Flags -- ^ Information regarding mode of operation - verbosity, dry-run, usage, etc , _warning :: Set Text -- ^ A warning to be reported later , _sourceFormat :: SourceFormat -- ^ Write debian/source/format , _watch :: Maybe Text -- ^ the @debian\/watch@ file , _rulesHead :: Maybe Text -- ^ The rules file header , _rulesSettings :: [Text] -- ^ The rules file assignments , _rulesIncludes :: [Text] -- ^ The rules file include directives , _rulesFragments :: Set Text -- ^ Additional fragments of the rules file , _copyright :: Maybe CopyrightDescription -- ^ Override the copyright value computed from the cabal package description. , _control :: S.SourceDebDescription -- ^ The parsed contents of the control file , _intermediateFiles :: Set (FilePath, Text) -- ^ Put this text into a file with the given name in the debianization. , _compat :: Maybe Int -- ^ The debhelper compatibility level, from debian/compat. , _changelog :: Maybe ChangeLog -- ^ The changelog, first entry contains the source package name and version , _installInit :: Map BinPkgName Text -- ^ Add an init.d file to the binary package , _logrotateStanza :: Map BinPkgName (Set Text) -- ^ Add a stanza of a logrotate file to the binary package , _postInst :: Map BinPkgName Text -- ^ Map of @debian/postinst@ scripts - to be run after install, -- should contain #DEBHELPER# line before exit 0 , _postRm :: Map BinPkgName Text -- ^ Map of @debian/postrm@ scripts - scripts to run after -- remove, should contain #DEBHELPER# line before exit 0 , _preInst :: Map BinPkgName Text -- ^ Map of @debian/preinst@ scripts - to be run before install, -- should contain #DEBHELPER# line before exit 0 , _preRm :: Map BinPkgName Text -- ^ Map of @debian/prerm@ scripts - to be run before remove, -- should contain #DEBHELPER# line before exit 0 , _atomSet :: Set Atom -- ^ set of items describing file installation requests , _noDocumentationLibrary :: Bool -- ^ Do not produce a libghc-foo-doc package. , _noProfilingLibrary :: Bool -- ^ Do not produce a libghc-foo-prof package. , _omitProfVersionDeps :: Bool -- ^ If present, Do not put the version dependencies on the prof packages that we put on the dev packages. , _omitLTDeps :: Bool -- ^ If present, don't generate the << dependency when we see a cabal -- equals dependency. (The implementation of this was somehow lost.) , _buildDir :: Maybe FilePath -- ^ The build directory used by cabal, typically dist/build when -- building manually or dist-ghc/build when building using GHC and -- haskell-devscripts. This value is used to locate files -- produced by cabal so we can move them into the deb. Note that -- the --builddir option of runhaskell Setup appends the "/build" -- to the value it receives, so, yes, try not to get confused. -- FIXME: make this FilePath or Maybe FilePath , _sourcePackageName :: Maybe SrcPkgName -- ^ Name to give to the debian source package. If not supplied -- 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. , _overrideDebianNameBase :: Maybe DebBase -- ^ If given, 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. , _revision :: Maybe String -- ^ Specify the revision string to use when converting the -- cabal version to debian. , _debVersion :: Maybe DebianVersion -- ^ Specify the exact debian version of the resulting package, -- including epoch. One use case is to work around the the -- "buildN" versions that are often uploaded to the debian and -- ubuntu repositories. Say the latest cabal version of -- transformers is 0.3.0.0, but the debian repository contains -- version 0.3.0.0-1build3, we need to specify -- debVersion="0.3.0.0-1build3" or the version we produce will -- look older than the one already available upstream. , _maintainerOption :: Maybe NameAddr , _uploadersOption :: [NameAddr] -- ^ Value for the maintainer field in the control file. Note that -- the cabal maintainer field can have multiple addresses, but debian -- only one. If this is not explicitly set, it is obtained from the -- cabal file, and if it is not there then from the environment. As a -- last resort, there is a hard coded string in here somewhere. , _utilsPackageNameBase :: Maybe String -- ^ Name of a package that will get left-over data files and executables. -- If there are more than one, each package will get those files. , _xDescriptionText :: Maybe Text -- ^ The text for the X-Description field of the Source package stanza. , _comments :: Maybe [[Text]] -- ^ Each element is a comment to be added to the changelog, where the -- element's text elements are the lines of the comment. , _missingDependencies :: Set BinPkgName -- ^ Lets cabal-debian know that a package it might expect to exist -- actually does not, so omit all uses in resulting debianization. , _extraLibMap :: Map 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 *and* a regular dependency on @libcrypto-dev@ to -- any package that has @cryptopp@ in its cabal Extra-Library list. , _execMap :: Map 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. , _apacheSite :: Map BinPkgName (String, FilePath, Text) -- ^ Have Apache configure a site using PACKAGE, DOMAIN, LOGDIR, and APACHECONFIGFILE , _sourceArchitectures :: Maybe PackageArchitectures -- ^ Set the Architecture field of the source package , _binaryArchitectures :: Map BinPkgName PackageArchitectures -- ^ Set the Architecture field of a binary package , _sourcePriority :: Maybe PackagePriority -- ^ Set the Priority field of the source package , _binaryPriorities :: Map BinPkgName PackagePriority -- ^ Set the Priority field of a binary package , _sourceSection :: Maybe Section -- ^ Set the Section field of the source package , _binarySections :: Map BinPkgName Section -- ^ Set the Section field of a binary package , _executable :: Map BinPkgName InstallFile -- ^ Create a binary package to hold a cabal executable , _serverInfo :: Map BinPkgName Server -- ^ Like DHExecutable, but configure the executable as a server process , _website :: Map BinPkgName Site -- ^ Like DHServer, but configure the server as a web server , _backups :: Map BinPkgName String -- ^ Configure the executable to do incremental backups , _extraDevDeps :: Relations -- ^ Limited version of Depends, put a dependency on the dev library package. The only -- reason to use this is because we don't yet know the name of the dev library package. , _official :: Bool -- ^ Whether this packaging is created by the Debian Haskell Group , _testsStatus :: TestsStatus -- ^ Whether or not to build and/or run the test suite , _allowDebianSelfBuildDeps :: Bool -- ^ Normally self dependencies are filtered out of the debian -- build dependency list because they usually reflect -- interdependencies between the library and the executable in -- the Cabal packages. This flag turns off that filtering. } deriving (Show, Data, Typeable) data Atom = Link BinPkgName FilePath FilePath -- ^ Create a symbolic link in the binary package | Install BinPkgName FilePath FilePath -- ^ Install a build file into the binary package | InstallTo BinPkgName FilePath FilePath -- ^ Install a build file into the binary package at an exact location | InstallData BinPkgName FilePath FilePath -- ^ DHInstallTo somewhere relative to DataDir (see above) | File BinPkgName FilePath Text -- ^ Create a file with the given text at the given path | InstallCabalExec BinPkgName String FilePath -- ^ Install a cabal executable into the binary package | InstallCabalExecTo BinPkgName String FilePath -- ^ Install a cabal executable into the binary package at an exact location | InstallDir BinPkgName FilePath -- ^ Create a directory in the binary package deriving (Show, Eq, Ord, Data, Typeable) data InstallFile = InstallFile { execName :: String -- ^ The name of the executable file , sourceDir :: Maybe FilePath -- ^ where to find it, default is dist/build// , destDir :: Maybe FilePath -- ^ where to put it, default is usr/bin/ , destName :: String -- ^ name to give installed executable } deriving (Read, Show, Eq, Ord, Data, Typeable) -- | Information about the web site we are packaging. data Site = Site { domain :: String -- ^ The domain name assigned to the server. -- An apache configuration will be generated to -- redirect requests from this domain to hostname:port , serverAdmin :: String -- ^ Apache ServerAdmin parameter , server :: Server -- ^ The hint to install the server job } deriving (Read, Show, Eq, Ord, Data, Typeable) -- | Information about the server we are packaging. data Server = Server { hostname :: String -- ^ Host on which the server will run , port :: Int -- ^ Port on which the server will run. -- Obviously, this must assign each and -- every server package to a different -- port. , headerMessage :: String -- ^ A comment that will be inserted to -- explain how the file was generated , retry :: String -- ^ start-stop-daemon --retry argument , serverFlags :: [String] -- ^ Extra flags to pass to the server via the init script , installFile :: InstallFile -- ^ The hint to install the server executable } deriving (Read, Show, Eq, Ord, Data, Typeable) data TestsStatus = TestsDisable | TestsBuild | TestsRun deriving (Eq, Show, Data, Typeable) makeDebInfo :: Flags -> DebInfo makeDebInfo fs = DebInfo { _flags = fs , _warning = mempty , _sourceFormat = Quilt3 , _watch = Nothing , _rulesHead = Nothing , _rulesSettings = mempty , _rulesIncludes = mempty , _rulesFragments = mempty , _copyright = Nothing , _control = S.newSourceDebDescription , _intermediateFiles = mempty , _compat = Nothing , _changelog = Nothing , _installInit = mempty , _logrotateStanza = mempty , _postInst = mempty , _postRm = mempty , _preInst = mempty , _preRm = mempty , _atomSet = mempty , _noDocumentationLibrary = False , _noProfilingLibrary = False , _omitProfVersionDeps = False , _omitLTDeps = False , _buildDir = Nothing , _sourcePackageName = Nothing , _overrideDebianNameBase = Nothing , _revision = Nothing , _debVersion = Nothing , _maintainerOption = Nothing , _uploadersOption = [] , _utilsPackageNameBase = Nothing , _xDescriptionText = Nothing , _comments = Nothing , _missingDependencies = mempty , _extraLibMap = mempty , _execMap = mempty , _apacheSite = mempty , _sourceArchitectures = Nothing , _binaryArchitectures = mempty , _sourcePriority = Nothing , _binaryPriorities = mempty , _sourceSection = Nothing , _binarySections = mempty , _executable = mempty , _serverInfo = mempty , _website = mempty , _backups = mempty , _extraDevDeps = mempty , _official = False , _testsStatus = TestsRun , _allowDebianSelfBuildDeps = False } instance Canonical DebInfo where canonical x = x {_control = canonical (_control x)} $(makeLenses ''DebInfo) -- We need (%=_) link :: Monad m => BinPkgName -> FilePath -> FilePath -> StateT DebInfo m () link b src dest = atomSet %= (Set.insert $ Link b src dest) >> return () install :: Monad m => BinPkgName -> FilePath -> FilePath -> StateT DebInfo m () install b src dest = atomSet %= (Set.insert $ Install b src dest) >> return () installTo :: Monad m => BinPkgName -> FilePath -> FilePath -> StateT DebInfo m () installTo b src dest = atomSet %= (Set.insert $ InstallTo b src dest) >> return () installData :: Monad m => BinPkgName -> FilePath -> FilePath -> StateT DebInfo m () installData b src dest = atomSet %= (Set.insert $ InstallData b src dest) >> return () file :: Monad m => BinPkgName -> FilePath -> Text -> StateT DebInfo m () file b dest content = atomSet %= (Set.insert $ File b dest content) >> return () installCabalExec :: Monad m => BinPkgName -> String -> FilePath -> StateT DebInfo m () installCabalExec b name dest = atomSet %= (Set.insert $ InstallCabalExec b name dest) >> return () installCabalExecTo :: Monad m => BinPkgName -> String -> FilePath -> StateT DebInfo m () installCabalExecTo b name dest = atomSet %= (Set.insert $ InstallCabalExecTo b name dest) >> return () installDir :: Monad m => BinPkgName -> FilePath -> StateT DebInfo m () installDir b dir = atomSet %= (Set.insert $ InstallDir b dir) >> return () -- | Lens to look up the binary deb description by name and create it if absent. -- binaryDebDescription :: BinPkgName -> Lens' DebInfo BinaryDebDescription binaryDebDescription b = control . S.binaryPackages . listElemLens ((== b) . view package) . maybeLens (newBinaryDebDescription b) (iso id id) cabal-debian-5.0/src/Debian/Debianize/VersionSplits.hs0000644000000000000000000001563413530623213021060 0ustar0000000000000000-- | Convert between cabal and debian package names based on version -- number ranges. {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-} module Debian.Debianize.VersionSplits ( DebBase(DebBase, unDebBase) -- * Combinators for VersionSplits , VersionSplits(..) , makePackage , insertSplit -- * Operators on VersionSplits , cabalFromDebian , cabalFromDebian' , debianFromCabal , packageRangesFromVersionSplits , doSplits ) where import Data.Generics (Data, Typeable) import Data.Map as Map (elems, Map, mapMaybeWithKey) import Data.Set as Set (fromList, Set, toList) import Debian.Debianize.Interspersed (foldTriples, Interspersed(leftmost, pairs, foldInverted)) import Debian.Orphans () import qualified Debian.Relation as D (VersionReq(..)) import Debian.Version (DebianVersion, parseDebianVersion') #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageIdentifier(..), PackageName) import Distribution.Package (mkPackageName) import Distribution.Pretty (prettyShow) import Distribution.Version (Version) #else import Data.Version (Version(Version)) import Distribution.Package (PackageIdentifier(..), PackageName(..)) #endif import Distribution.Version (anyVersion, earlierVersion, intersectVersionRanges, orLaterVersion, VersionRange) import Prelude hiding (init, log, unlines) -- | The base of a debian binary package name, the string that appears -- between "libghc-" and "-dev". newtype DebBase = DebBase {unDebBase :: String} deriving (Eq, Ord, Read, Show, Data, Typeable) -- | Describes a mapping from cabal package name and version to debian -- package names. For example, versions of the cabal QuickCheck -- package less than 2 are mapped to "quickcheck1", while version 2 or -- greater is mapped to "quickcheck2". data VersionSplits = VersionSplits { oldestPackage :: DebBase -- ^ The Debian name given to versions older than the oldest split. , splits :: [(Version, DebBase)] -- ^ Each pair is The version where the split occurs, and the -- name to use for versions greater than or equal to that -- version. This list assumed to be in (must be kept in) -- descending version number order, newest to oldest } deriving (Eq, Ord, Data, Typeable) instance Show VersionSplits where show s = foldr (\ (v, b) r -> ("insertSplit (" ++ show v ++ ") (" ++ show b ++ ") (" ++ r ++ ")")) ("makePackage (" ++ show (oldestPackage s) ++ ")") (splits s) instance Interspersed VersionSplits DebBase Version where leftmost (VersionSplits {oldestPackage = p}) = p pairs (VersionSplits {splits = xs}) = xs -- | Create a version split database that assigns a single debian -- package name base to all cabal versions. makePackage :: DebBase -> VersionSplits makePackage name = VersionSplits {oldestPackage = name, splits = []} -- | Split the version range and give the older packages a new name. insertSplit :: Version -- ^ Where to split the version range -> DebBase -- ^ The name to use for versions older than the split -> VersionSplits -> VersionSplits #if MIN_VERSION_Cabal(2,0,0) insertSplit ver ltname sp@(VersionSplits {}) = #else insertSplit ver@(Version _ _) ltname sp@(VersionSplits {}) = #endif -- (\ x -> trace ("insertSplit " ++ show (ltname, ver, sp) ++ " -> " ++ show x) x) $ case splits sp of -- This is the oldest split, change oldestPackage and insert a new head pair (ver', _) : _ | ver' > ver -> sp {oldestPackage = ltname, splits = (ver, oldestPackage sp) : splits sp} (ver', name) : _ | ver' == ver && name == ltname -> sp [] -> sp {oldestPackage = ltname, splits = [(ver, oldestPackage sp)]} -- Not the oldest split, insert it in its proper place. _ -> sp {splits = reverse (insert (reverse (splits sp)))} where -- Insert our new split into the reversed list insert ((ver', name') : more) = if ver' < ver then (ver, name') : (ver', ltname) : more else (ver', name') : insert more -- ver' is older, change oldestPackage insert [] = [(ver, oldestPackage sp)] -- ltname = base ++ "-" ++ (show (last ns - 1)) packageRangesFromVersionSplits :: VersionSplits -> [(DebBase, VersionRange)] packageRangesFromVersionSplits s = foldInverted (\ older dname newer more -> (dname, intersectVersionRanges (maybe anyVersion orLaterVersion older) (maybe anyVersion earlierVersion newer)) : more) [] s debianFromCabal :: VersionSplits -> PackageIdentifier -> DebBase debianFromCabal s p = doSplits s (Just (D.EEQ debVer)) where debVer = parseDebianVersion' (prettyShow (pkgVersion p)) cabalFromDebian' :: Map PackageName VersionSplits -> DebBase -> Version -> PackageIdentifier cabalFromDebian' mp base ver = PackageIdentifier (cabalFromDebian mp base dver) ver where dver = parseDebianVersion' (prettyShow ver) -- | Brute force implementation - I'm assuming this is not a huge map. cabalFromDebian :: Map PackageName VersionSplits -> DebBase -> DebianVersion -> PackageName cabalFromDebian mp base@(DebBase name) ver = case Set.toList pset of [x] -> x #if MIN_VERSION_Cabal(2,0,0) [] -> mkPackageName name #else [] -> PackageName name #endif l -> error $ "Error, multiple cabal package names associated with " ++ show base ++ ": " ++ show l where -- Look for splits that involve the right DebBase and return the -- associated Cabal package name. It is unlikely that more than -- one Cabal name will be returned - if so throw an exception. pset :: Set PackageName pset = Set.fromList $ Map.elems $ Map.mapMaybeWithKey (\ p s -> if doSplits s (Just (D.EEQ ver)) == base then Just p else Nothing) mp -- | Given a version split database, turn the debian version -- requirements into a debian package name base that ought to satisfy -- them. doSplits :: VersionSplits -> Maybe D.VersionReq -> DebBase doSplits s version = foldTriples' (\ ltName v geName _ -> let split = parseDebianVersion' (prettyShow v) in case version of Nothing -> geName Just (D.SLT v') | v' <= split -> ltName -- Otherwise use ltName only when the split is below v' Just (D.EEQ v') | v' < split -> ltName Just (D.LTE v') | v' < split -> ltName Just (D.GRE v') | v' < split -> ltName Just (D.SGR v') | v' < split -> ltName _ -> geName) (oldestPackage s) s where foldTriples' :: (DebBase -> Version -> DebBase -> DebBase -> DebBase) -> DebBase -> VersionSplits -> DebBase foldTriples' = foldTriples cabal-debian-5.0/src/Debian/Debianize/Bundled.hs0000644000000000000000000002305513530623213017605 0ustar0000000000000000-- | Determine whether a specific version of a Haskell package is -- bundled with into this particular version of the given compiler. -- This is done by getting the "Provides" field from the output of -- "apt-cache showpkg ghc" and -- converting the debian package names back to Cabal package names. -- *That* is done using the debianNameMap of CabalInfo, which is -- built using the mapCabal, splitCabal, and remapCabal functions. {-# LANGUAGE CPP, FlexibleContexts, ScopedTypeVariables #-} module Debian.Debianize.Bundled ( builtIn -- * Utilities , aptCacheShowPkg , aptCacheProvides , aptCacheDepends , aptCacheConflicts , aptVersions , hcVersion , parseVersion' , tests ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>), (<*>)) #endif import Control.Exception (SomeException, try) import Control.Monad ((<=<)) import Data.Char (isAlphaNum, toLower) import Data.List (groupBy, intercalate, isPrefixOf, stripPrefix) import Data.Maybe (listToMaybe, mapMaybe) import Data.Set as Set (difference, fromList) import Debian.GHC ({-instance Memoizable CompilerFlavor-}) import Debian.Relation (BinPkgName(..)) import Debian.Relation.ByteString () import Debian.Version (DebianVersion, parseDebianVersion', prettyDebianVersion) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (mkPackageName, PackageIdentifier(..), unPackageName) import Data.Version (parseVersion) import Distribution.Version(mkVersion, mkVersion', Version) #else import Data.Version (parseVersion, Version(..)) import Distribution.Package (PackageIdentifier(..), PackageName(..)) #endif #if MIN_VERSION_Cabal(1,22,0) import Distribution.Simple.Compiler (CompilerFlavor(GHCJS)) #else import Distribution.Compiler (CompilerFlavor) #endif import System.Process (readProcess, showCommandForUser) import Test.HUnit (assertEqual, Test(TestList, TestCase)) import Text.ParserCombinators.ReadP (char, endBy1, munch1, ReadP, readP_to_S) import Text.Regex.TDFA ((=~)) import UnliftIO.Memoize (memoizeMVar, Memoized, runMemoized) #if MIN_VERSION_base(4,8,0) #if !MIN_VERSION_Cabal(2,0,0) import Data.Version (makeVersion) #else #endif #else import Data.Monoid (mempty) #if !MIN_VERSION_Cabal(1,22,0) unPackageName :: PackageName -> String unPackageName (PackageName s) = s #endif makeVersion :: [Int] -> Version makeVersion ns = Version ns [] #endif -- | Find out what version, if any, of a cabal library is built into -- the newest version of haskell compiler hc in environment root. -- This is done by looking for .conf files beneath a package.conf.d -- directory and parsing the name. (Probably better to actually read -- the .conf file.) builtIn :: CompilerFlavor -> IO [PackageIdentifier] builtIn hc = do Just hep <- hcExecutablePath hc >>= runMemoized Just hcname <- hcBinPkgName hep >>= runMemoized runMemoized =<< aptCacheProvides hcname -- | Convert CompilerFlavor to an executable name in a way that works -- for at least the cases we are interested in. This might need to be -- fudged or replaced as more cases become interesting. hcExecutable :: CompilerFlavor -> String hcExecutable = map toLower . show -- | Use which(1) to determine full path name to haskell compiler executable hcExecutablePath :: CompilerFlavor -> IO (Memoized (Maybe FilePath)) hcExecutablePath hc = memoizeMVar (listToMaybe . lines <$> readProcess "which" [hcExecutable hc] "") hcVersion :: CompilerFlavor -> IO (Maybe Version) hcVersion hc = do Just hcpath <- runMemoized =<< hcExecutablePath hc ver <- readProcess hcpath [case hc of #if MIN_VERSION_Cabal(1,22,0) GHCJS -> "--numeric-ghc-version" #endif _ -> "--numeric-version"] "" return $ maybe Nothing parseVersion' (listToMaybe (lines ver)) -- | Use dpkg -S to convert the executable path to a debian binary -- package name. hcBinPkgName :: FilePath -> IO (Memoized (Maybe BinPkgName)) hcBinPkgName path = memoizeMVar $ do s <- readProcess "dpkg" ["-S", path] "" return $ case map (takeWhile (/= ':')) (lines s) of [] -> Nothing [name] -> Just (BinPkgName name) _ -> error $ "Unexpected output from " ++ showCommandForUser "dpkg" ["-S", path] ++ ": ++ " ++ show s -- | What built in libraries does this haskell compiler provide? aptCacheProvides :: BinPkgName -> IO (Memoized [PackageIdentifier]) aptCacheProvides = memoizeMVar . packageIdentifiers packageIdentifiers :: BinPkgName -> IO [PackageIdentifier] packageIdentifiers hcname = mapMaybe parsePackageIdentifier' . mapMaybe (dropRequiredSuffix ".conf" . last) . filter (elem "package.conf.d") . map (groupBy (\a b -> (a == '/') == (b == '/'))) <$> binPkgFiles hcname dropRequiredSuffix :: String -> String -> Maybe String dropRequiredSuffix suff x = let (x', suff') = splitAt (length x - length suff) x in if suff == suff' then Just x' else Nothing -- | A list of the files in a binary deb binPkgFiles :: BinPkgName -> IO [FilePath] binPkgFiles hcname = lines <$> readProcess "dpkg" ["-L", unBinPkgName hcname] "" aptCacheConflicts :: String -> DebianVersion -> IO [BinPkgName] aptCacheConflicts hcname ver = either (const []) (mapMaybe doLine . lines) <$> (runMemoized =<< aptCacheDepends hcname (show (prettyDebianVersion ver))) where doLine s = case s =~ "^[ ]*Conflicts:[ ]*<(.*)>$" :: (String, String, String, [String]) of (_, _, _, [name]) -> Just (BinPkgName name) _ -> Nothing aptCacheDepends :: String -> String -> IO (Memoized (Either SomeException String)) aptCacheDepends hcname ver = memoizeMVar (try (readProcess "apt-cache" ["depends", hcname ++ "=" ++ ver] "")) aptVersions :: BinPkgName -> IO [DebianVersion] aptVersions = return . either (const []) (map parseDebianVersion' . filter (/= "") . map (takeWhile (/= ' ')) . takeWhile (not . isPrefixOf "Reverse Depends:") . drop 1 . dropWhile (not . isPrefixOf "Versions:") . lines) <=< (runMemoized <=< aptCacheShowPkg) aptCacheShowPkg :: BinPkgName -> IO (Memoized (Either SomeException String)) aptCacheShowPkg hcname = memoizeMVar (try (readProcess "apt-cache" ["showpkg", unBinPkgName hcname] "")) -- | A package identifier is a package name followed by a dash and -- then a version number. A package name, according to the cabal -- users guide "can use letters, numbers and hyphens, but not spaces." -- So be it. parsePackageIdentifier :: ReadP PackageIdentifier parsePackageIdentifier = #if MIN_VERSION_Cabal(2,0,0) makeId <$> ((,) <$> endBy1 (munch1 isAlphaNum) (char '-') <*> parseCabalVersion) where makeId :: ([String], Version) -> PackageIdentifier makeId (xs, v) = PackageIdentifier {pkgName = mkPackageName (intercalate "-" xs), pkgVersion = v} #else makeId <$> ((,) <$> endBy1 (munch1 isAlphaNum) (char '-') <*> parseVersion) where makeId :: ([String], Version) -> PackageIdentifier makeId (xs, v) = PackageIdentifier {pkgName = PackageName (intercalate "-" xs), pkgVersion = v} #endif parseMaybe :: ReadP a -> String -> Maybe a parseMaybe p = listToMaybe . map fst . filter ((== "") . snd) . readP_to_S p parseVersion' :: String -> Maybe Version #if MIN_VERSION_Cabal(2,0,0) parseVersion' = parseMaybe parseCabalVersion parseCabalVersion :: ReadP Version parseCabalVersion = fmap mkVersion' parseVersion #else parseVersion' = parseMaybe parseVersion #endif parsePackageIdentifier' :: String -> Maybe PackageIdentifier parsePackageIdentifier' = parseMaybe parsePackageIdentifier tests :: Test tests = TestList [ TestCase (assertEqual "Bundled1" #if MIN_VERSION_Cabal(2,0,0) (Just (PackageIdentifier (mkPackageName "HUnit") (mkVersion [1,2,3]))) #else (Just (PackageIdentifier (PackageName "HUnit") (makeVersion [1,2,3]))) #endif (parseMaybe parsePackageIdentifier "HUnit-1.2.3")) , TestCase (assertEqual "Bundled2" Nothing (parseMaybe parsePackageIdentifier "HUnit-1.2.3 ")) , TestCase $ do ghc <- head . lines <$> readProcess "which" ["ghc"] "" let ver = fmap (takeWhile (/= '/')) (stripPrefix "/opt/ghc/" ghc) acp <- runMemoized =<< aptCacheProvides (BinPkgName ("ghc" ++ maybe "" ("-" ++) ver)) let expected = Set.fromList -- This is the package list for ghc-7.10.3 ["array", "base", "binary", "bin-package-db", "bytestring", "Cabal", "containers", "deepseq", "directory", "filepath", "ghc", "ghc-prim", "haskeline", "hoopl", "hpc", "integer-gmp", "pretty", "process", "template-haskell", "terminfo", "time", "transformers", "unix", "xhtml"] actual = Set.fromList (map (unPackageName . pkgName) acp) missing (Just "8.0.1") = Set.fromList ["bin-package-db"] missing (Just "8.0.2") = Set.fromList ["bin-package-db"] missing _ = mempty extra (Just "7.8.4") = Set.fromList ["haskell2010","haskell98","old-locale","old-time"] extra (Just "8.0.1") = Set.fromList ["ghc-boot","ghc-boot-th","ghci"] extra (Just "8.0.2") = Set.fromList ["ghc-boot","ghc-boot-th","ghci"] extra _ = mempty assertEqual "Bundled4" (missing ver, extra ver) (Set.difference expected actual, Set.difference actual expected) ] cabal-debian-5.0/src/Debian/Debianize/Details.hs0000644000000000000000000000702213530623213017611 0ustar0000000000000000-- | Detailed information about the specific repositories such as -- debian or seereason - in particular how cabal names are mapped to -- debian. {-# LANGUAGE CPP #-} {-# OPTIONS -Wall #-} module Debian.Debianize.Details ( debianDefaults ) where import Control.Lens import Data.Map as Map (insert) import Debian.Debianize.DebianName (mapCabal, splitCabal) import Debian.Debianize.Monad (CabalT) import Debian.Debianize.CabalInfo as A (epochMap, debInfo) import Debian.Debianize.DebInfo as D (execMap) import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel)) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (mkPackageName) import Distribution.Version (mkVersion) #else import Data.Version (Version(Version)) import Distribution.Package (PackageName(PackageName)) #endif -- | Update the CabalInfo value in the CabalT state with some details about -- the debian repository - special cases for how some cabal packages -- are mapped to debian package names. 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]]) ["ghc", "happy", "alex", "hsx2hs"] -- 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-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 cabal-debian-5.0/src/Debian/Debianize/Files.hs0000644000000000000000000003011713530623213017267 0ustar0000000000000000-- | Convert a Debianization into a list of files that can then be -- written out. {-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TupleSections #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Debian.Debianize.Files ( debianizationFileMap ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) import Data.Monoid (mempty) #endif import Control.Lens import Control.Monad.Fail (MonadFail) import Control.Monad.Trans (lift) import Control.Monad.Writer (execWriterT, tell, WriterT) import Data.Char (isSpace) import Data.List as List (dropWhile, dropWhileEnd, map) import Data.Map as Map (fromListWithKey, insertWith, map, Map, mapKeys, toList) import Data.Maybe (fromMaybe) import Data.Monoid ((<>)) import Data.Set as Set (fold, member, toList) import Data.Text as Text (dropWhile, dropWhileEnd, intercalate, lines, null, pack, strip, Text, unlines, unpack) import Debian.Control (Control'(Control, unControl), Field'(Field), Paragraph'(Paragraph)) import Debian.Control.Common () 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, 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) import Debian.Pretty (PP(..), ppShow, prettyText, ppText, ppPrint) import Debian.Relation (BinPkgName(BinPkgName), Relations) import Distribution.PackageDescription (PackageDescription) import Prelude hiding (dropWhile, init, log, unlines, writeFile) import System.FilePath (()) import Text.PrettyPrint.HughesPJClass (empty, text) import Distribution.Pretty (Pretty(pretty)) type FilesT m = WriterT [(FilePath, Text)] (DebianT m) instance Pretty (PP Bool) where pretty = text . show . unPP -- | Turn the Debianization into a list of files, making sure the text -- associated with each path is unique. Assumes that -- finalizeDebianization has already been called. (Yes, I'm -- considering building one into the other, but it is handy to look at -- the Debianization produced by finalizeDebianization in the unit -- tests.) debianizationFileMap :: (MonadFail m) => DebianT m (Map FilePath Text) debianizationFileMap = fmap (Map.fromListWithKey (\ k a b -> error $ "Multiple values for " ++ k ++ ":\n " ++ show a ++ "\n" ++ show b)) $ execWriterT $ do -- here <- liftIO getCurrentDirectory tell =<< control tell =<< changelog tell =<< rules tell =<< compat tell =<< copyright tell =<< sourceFormatFiles tell =<< watchFile tell =<< installs tell =<< dirs tell =<< init tell =<< logrotate tell =<< links tell =<< postinstFiles tell =<< postrmFiles tell =<< preinstFiles tell =<< prermFiles tell =<< intermediates sourceFormatFiles :: (Monad m) => FilesT m [(FilePath, Text)] sourceFormatFiles = do fmt <- lift $ use D.sourceFormat return $ [("debian/source/format", pack . ppShow $ fmt)] watchFile :: (Monad m) => FilesT m [(FilePath, Text)] watchFile = maybe [] (\ x -> [("debian/watch", x)]) <$> (lift $ use D.watch) intermediates :: (Monad m) => FilesT m [(FilePath, Text)] intermediates = Set.toList <$> (lift $ use D.intermediateFiles) installs :: (Monad m) => FilesT m [(FilePath, Text)] installs = (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ use (D.atomSet)) where doAtom (D.Install b frm dst) mp = Map.insertWith (++) (pathf b) [pack (escapeDebianWildcards frm <> " " <> dst)] mp doAtom _ mp = mp pathf name = "debian" show (ppPrint name) ++ ".install" dirs :: (Monad m) => FilesT m [(FilePath, Text)] dirs = (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ use D.atomSet) where doAtom (D.InstallDir b dir) mp = Map.insertWith (++) (pathf b) [pack dir] mp doAtom _ mp = mp pathf name = "debian" show (ppPrint name) ++ ".dirs" init :: (Monad m) => FilesT m [(FilePath, Text)] init = (Map.toList . mapKeys pathf) <$> (lift $ use D.installInit) where pathf name = "debian" show (ppPrint name) ++ ".init" -- FIXME - use a map and insertWith, check for multiple entries logrotate :: (Monad m) => FilesT m [(FilePath, Text)] logrotate = (Map.toList . Map.map (\ stanzas -> Text.unlines (Set.toList stanzas)) . mapKeys pathf) <$> (lift $ use D.logrotateStanza) where pathf name = "debian" show (ppPrint name) ++ ".logrotate" -- | Assemble all the links by package and output one file each links :: (Monad m) => FilesT m [(FilePath, Text)] links = (Map.toList . Map.map unlines . Set.fold doAtom mempty) <$> (lift $ use D.atomSet) where doAtom (D.Link b loc t) mp = Map.insertWith (++) (pathf b) [pack loc <> " " <> pack t] mp doAtom _ mp = mp pathf name = "debian" show (ppPrint name) ++ ".links" postinstFiles :: (Monad m) => FilesT m [(FilePath, Text)] postinstFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.postInst) where pathf (BinPkgName name) = "debian" name <> ".postinst" postrmFiles :: (Monad m) => FilesT m [(FilePath, Text)] postrmFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.postRm) where pathf name = "debian" show (ppPrint name) ++ ".postrm" preinstFiles :: (Monad m) => FilesT m [(FilePath, Text)] preinstFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.preInst) where pathf name = "debian" show (ppPrint name) ++ ".preinst" prermFiles :: (Monad m) => FilesT m [(FilePath, Text)] prermFiles = (Map.toList . mapKeys pathf) <$> (lift $ use D.preRm) where pathf name = "debian" show (ppPrint name) ++ ".prerm" rules :: (MonadFail m) => FilesT m [(FilePath, Text)] rules = do Just rh <- lift (use (D.rulesHead)) rassignments <- lift (use (D.rulesSettings)) >>= return . intercalate "\n" rincludes <- lift (use (D.rulesIncludes)) >>= return . intercalate "\n" rl <- (reverse . Set.toList) <$> lift (use (D.rulesFragments)) return [("debian/rules", intercalate "\n\n" (filter (not . Text.null) (List.map strip (rh : rassignments : rincludes : rl))) <> "\n")] changelog :: (Monad m) => FilesT m [(FilePath, Text)] changelog = do log <- lift $ use D.changelog return [("debian/changelog", pack (show (ppPrint (fromMaybe (error "No changelog in debianization") log))))] control :: (Monad m) => FilesT m [(FilePath, Text)] control = do d <- lift $ use D.control return [("debian/control", prettyText (controlFile d))] compat :: (Monad m) => FilesT m [(FilePath, Text)] compat = do t <- lift $ use D.compat return [("debian/compat", pack (show (fromMaybe (error "Missing DebCompat atom - is debhelper installed?") $ t) <> "\n"))] copyright :: (Monad m) => FilesT m [(FilePath, Text)] copyright = do copyrt <- lift $ use (D.copyright) return $ maybe [] (\ x -> [("debian/copyright", prettyText x)]) copyrt instance Pretty (PP (PackageDescription -> IO CopyrightDescription)) where pretty _ = text "" controlFile :: S.SourceDebDescription -> Control' String controlFile src = Control { unControl = (Paragraph ([Field ("Source", " " ++ (show . maybe empty ppPrint . view S.source $ src)), Field ("Maintainer", " " <> (ppShow . either (const maintainerOfLastResort) id . view S.maintainer $ src))] ++ lField "Uploaders" (view S.uploaders src) ++ (case view S.dmUploadAllowed src of True -> [Field ("DM-Upload-Allowed", " yes")]; False -> []) ++ mField "Priority" (view S.priority src) ++ mField "Section" (view S.section src) ++ depField "Build-Depends" (view S.buildDepends src) ++ depField "Build-Depends-Indep" (view S.buildDependsIndep src) ++ depField "Build-Conflicts" (view S.buildConflicts src) ++ depField "Build-Conflicts-Indep" (view S.buildConflictsIndep src) ++ mField "Standards-Version" (view S.standardsVersion src) ++ mField "Homepage" (view S.homepage src) ++ List.map vcsField (Set.toList (view S.vcsFields src)) ++ List.map xField (Set.toList (view S.xFields src)) ++ mField "X-Description" (view S.xDescription src)) : List.map binary (view S.binaryPackages src)) } where binary :: B.BinaryDebDescription -> Paragraph' String binary bin = 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) ++ relFields (view B.relations bin) ++ [Field ("Description", " " ++ (unpack . ensureDescription . fromMaybe mempty . view B.description $ bin))]) where ensureDescription t = case List.dropWhileEnd Text.null (List.dropWhile Text.null (List.map (Text.dropWhileEnd isSpace) (Text.lines t))) of [] -> "WARNING: No description available for package " <> ppText (view B.package bin) (short : long) -> Text.intercalate "\n" ((if Text.null (Text.dropWhile isSpace short) then ("WARNING: No short description available for package " <> ppText (view B.package bin)) else short) : long) mField tag = maybe [] (\ x -> [Field (tag, " " <> (show . ppPrint $ x))]) lField _ [] = [] lField tag xs = [Field (tag, " " <> (show . ppPrint $ xs))] vcsField (S.VCSBrowser t) = Field ("Vcs-Browser", " " ++ unpack t) vcsField (S.VCSArch t) = Field ("Vcs-Arch", " " ++ unpack t) vcsField (S.VCSBzr t) = Field ("Vcs-Bzr", " " ++ unpack t) vcsField (S.VCSCvs t) = Field ("Vcs-Cvs", " " ++ unpack t) vcsField (S.VCSDarcs t) = Field ("Vcs-Darcs", " " ++ unpack t) vcsField (S.VCSGit t) = Field ("Vcs-Git", " " ++ unpack t) vcsField (S.VCSHg t) = Field ("Vcs-Hg", " " ++ unpack t) vcsField (S.VCSMtn t) = Field ("Vcs-Mtn", " " ++ unpack t) vcsField (S.VCSSvn t) = Field ("Vcs-Svn", " " ++ unpack t) xField (S.XField dests tag t) = Field (unpack ("X" <> showDests dests <> "-" <> tag), unpack (" " <> t)) showDests s = if member S.B s then "B" else "" <> if member S.S s then "S" else "" <> if member S.C s then "C" else "" relFields :: B.PackageRelations -> [Field' [Char]] relFields rels = depField "Depends" (view B.depends rels) ++ depField "Recommends" (view B.recommends rels) ++ depField "Suggests" (view B.suggests rels) ++ depField "Pre-Depends" (view B.preDepends rels) ++ depField "Breaks" (view B.breaks rels) ++ depField "Conflicts" (view B.conflicts rels) ++ depField "Provides" (view B.provides rels) ++ depField "Replaces" (view B.replaces rels) ++ depField "Built-Using" (view B.builtUsing rels) depField :: [Char] -> Relations -> [Field' [Char]] depField tag rels = case rels of [] -> []; _ -> [Field (tag, " " ++ showDeps' rels)] cabal-debian-5.0/src/Debian/Debianize/InputCabal.hs0000644000000000000000000001141513530623213020247 0ustar0000000000000000-- | Input the Cabal package description. {-# LANGUAGE CPP, DeriveDataTypeable, ScopedTypeVariables, TemplateHaskell #-} module Debian.Debianize.InputCabal ( inputCabalization ) where import Control.Exception (bracket) import Control.Lens (view) import Control.Monad (when) import Control.Monad.Trans (MonadIO, liftIO) #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) #endif import Data.Set as Set (toList) import Debian.Debianize.BasicInfo (Flags, verbosity, compilerFlavor, cabalFlagAssignments) import Debian.Debianize.Prelude (intToVerbosity') #if MIN_VERSION_Cabal(1,22,0) import Debian.GHC (getCompilerInfo) #else import Debian.GHC (newestAvailableCompilerId) #endif import Debian.Orphans () #if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (CompilerInfo) #else import Distribution.Compiler (CompilerId) #endif import Distribution.Package (Package(packageId)) import Distribution.PackageDescription as Cabal (PackageDescription) #if MIN_VERSION_Cabal(2,2,0) import Distribution.PackageDescription.Configuration (finalizePD) import Distribution.PackageDescription.Parsec (readGenericPackageDescription) import Distribution.Types.ComponentRequestedSpec (ComponentRequestedSpec(ComponentRequestedSpec)) #else import Distribution.PackageDescription.Configuration (finalizePackageDescription) #if MIN_VERSION_Cabal(2,0,0) import Distribution.PackageDescription.Parse (readGenericPackageDescription) #else import Distribution.PackageDescription.Parse (readPackageDescription) #endif #endif import Distribution.Simple.Utils (defaultPackageDesc, die, setupMessage) import Distribution.System as Cabal (buildArch, Platform(..)) import qualified Distribution.System as Cabal (buildOS) #if MIN_VERSION_Cabal(2,2,0) import Distribution.Types.GenericPackageDescription (mkFlagAssignment) #endif import Distribution.Verbosity (Verbosity) import Prelude hiding (break, lines, log, null, readFile, sum) import System.Directory (doesFileExist, getCurrentDirectory) import System.Exit (ExitCode(..)) import System.Posix.Files (setFileCreationMask) import System.Process (system) #if !MIN_VERSION_Cabal(1,22,0) type CompilerInfo = CompilerId #endif -- | Load a PackageDescription using the information in the Flags record - -- in particular, using the dependency environment in the EnvSet, find -- the newest available compiler of the requested compiler flavor and -- use that information load the configured PackageDescription. inputCabalization :: forall m. (MonadIO m) => Flags -> m (Either String PackageDescription) inputCabalization flags = getCompInfo flags >>= either (return . Left) (\cinfo -> Right <$> doCompInfo cinfo) where doCompInfo :: CompilerInfo -> m PackageDescription doCompInfo cinfo = do -- Load a GenericPackageDescription from the current directory -- and from that create a finalized PackageDescription for the -- given CompilerId. #if MIN_VERSION_Cabal(2,0,0) genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readGenericPackageDescription vb #else genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readPackageDescription vb #endif #if MIN_VERSION_Cabal(2,2,0) let finalized = finalizePD (mkFlagAssignment (toList fs)) (ComponentRequestedSpec True False) (const True) (Platform buildArch Cabal.buildOS) cinfo [] genPkgDesc #else let finalized = finalizePackageDescription (toList fs) (const True) (Platform buildArch Cabal.buildOS) cinfo [] genPkgDesc #endif ePkgDesc <- either (return . Left) (\ (pkgDesc, _) -> do liftIO $ bracket (setFileCreationMask 0o022) setFileCreationMask $ \ _ -> autoreconf vb pkgDesc return (Right pkgDesc)) finalized either (\ deps -> liftIO getCurrentDirectory >>= \ here -> error $ "Missing dependencies in cabal package at " ++ here ++ ": " ++ show deps) return ePkgDesc vb = intToVerbosity' $ view verbosity flags fs = view cabalFlagAssignments flags getCompInfo :: MonadIO m => Flags -> m (Either String CompilerInfo) getCompInfo flags = #if MIN_VERSION_Cabal(1,22,0) getCompilerInfo (view compilerFlavor flags) #else return $ newestAvailableCompilerId (view compilerFlavor flags) #endif -- | Run the package's configuration script. autoreconf :: Verbosity -> Cabal.PackageDescription -> IO () autoreconf verbose pkgDesc = do ac <- doesFileExist "configure.ac" when ac $ do c <- doesFileExist "configure" when (not c) $ do setupMessage verbose "Running autoreconf" (packageId pkgDesc) ret <- system "autoreconf" case ret of ExitSuccess -> return () ExitFailure n -> die ("autoreconf failed with status " ++ show n) cabal-debian-5.0/src/Debian/Debianize/InputDebian.hs0000644000000000000000000004671013530623213020435 0ustar0000000000000000-- | Read an existing Debianization from a directory file. {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables, TypeSynonymInstances #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Debianize.InputDebian ( inputDebianization , inputDebianizationFile , inputChangeLog , loadChangeLog , dataDest , dataTop ) where import Debug.Trace import Control.Lens import Control.Monad (filterM) import Control.Monad.State (put) import Control.Monad.Trans (liftIO, MonadIO) import Data.Char (isSpace) import Data.Map as Map (insert, insertWith) import Data.Maybe (fromMaybe) import Data.Monoid ((<>)) #if !MIN_VERSION_base(4,8,0) import Data.Monoid (mappend) #endif import Data.Set as Set (fromList, insert, singleton) import Data.Text (break, lines, null, pack, strip, Text, unpack, words) import Data.Text.IO (readFile) import Debian.Changes (ChangeLog, parseChangeLog) import Debian.Control (Control'(unControl), ControlFunctions, Field, Field'(..), Paragraph'(..), parseControlFromFile, stripWS) import Debian.Debianize.DebInfo (changelog, compat, control, copyright, install, installDir, installInit, intermediateFiles, link, logrotateStanza, postInst, postRm, preInst, preRm, rulesHead, sourceFormat, warning, watch) import qualified Debian.Debianize.DebInfo as T (flags, makeDebInfo) 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, 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, 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, readMultiArch, readSourceFormat, Section(..)) import Debian.Relation (BinPkgName(..), parseRelations, Relations, SrcPkgName(..)) --import Debug.Trace (trace) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageIdentifier(..), unPackageName) #else import Distribution.Package (PackageIdentifier(..), PackageName(..)) #endif import qualified Distribution.PackageDescription as Cabal (dataDir, PackageDescription(package)) import Prelude hiding (break, lines, log, null, readFile, sum, words) import System.Directory (doesFileExist) import System.FilePath ((), dropExtension, takeExtension) import System.IO.Error (catchIOError, isDoesNotExistError, tryIOError) -- import System.Unix.Chroot (useEnv) -- import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr) inputDebianization :: MonadIO m => DebianT m () inputDebianization = do -- Erase any the existing information fs <- use T.flags put $ T.makeDebInfo fs (ctl, _) <- inputSourceDebDescription inputCabalInfoFromDirectory control .= ctl -- | Try to input a file and if successful add it to the -- debianization's list of "intermediate" files, files which will -- simply be added to the final debianization without any -- understanding of their contents or purpose. inputDebianizationFile :: MonadIO m => FilePath -> DebianT m () inputDebianizationFile path = do inputCabalInfoFromDirectory liftIO (readFileMaybe path) >>= maybe (return ()) (\ text -> intermediateFiles %= Set.insert (path, text)) inputSourceDebDescription :: MonadIO m => DebianT m (S.SourceDebDescription, [Field]) inputSourceDebDescription = do paras <- liftIO $ parseControlFromFile "debian/control" >>= either (error . show) (return . unControl) case paras of [] -> error "Missing source paragraph" [_] -> error "Missing binary paragraph" (hd : tl) -> return $ parseSourceDebDescription hd tl parseSourceDebDescription :: Paragraph' String -> [Paragraph' String] -> (S.SourceDebDescription, [Field]) parseSourceDebDescription (Paragraph fields) binaryParagraphs = foldr readField (src, []) fields' where fields' = map stripField fields src = set S.binaryPackages bins (S.newSourceDebDescription' findSource findMaint) findSource = findMap "Source" SrcPkgName fields' findMaint = findMap "Maintainer" (\ m -> either (\ e -> error $ "Failed to parse maintainer field " ++ show m ++ ": " ++ show e) id . parseMaintainer $ m) fields' -- findStandards = findMap "Standards-Version" parseStandardsVersion fields' (bins, _extra) = unzip $ map parseBinaryDebDescription binaryParagraphs readField :: Field -> (S.SourceDebDescription, [Field]) -> (S.SourceDebDescription, [Field]) -- Mandatory readField (Field ("Source", _)) x = x readField (Field ("Maintainer", _)) x = x -- readField (Field ("Standards-Version", _)) x = x -- Recommended readField (Field ("Standards-Version", value)) (desc, unrecognized) = (set S.standardsVersion (Just (parseStandardsVersion value)) desc, unrecognized) readField (Field ("Priority", value)) (desc, unrecognized) = (set S.priority (Just (readPriority value)) desc, unrecognized) readField (Field ("Section", value)) (desc, unrecognized) = (set S.section (Just (MainSection value)) desc, unrecognized) -- Optional readField (Field ("Homepage", value)) (desc, unrecognized) = (set S.homepage (Just (strip (pack value))) desc, unrecognized) readField (Field ("Uploaders", value)) (desc, unrecognized) = (set S.uploaders (either (const []) id (parseUploaders value)) desc, unrecognized) readField (Field ("DM-Upload-Allowed", value)) (desc, unrecognized) = (set S.dmUploadAllowed (yes value) desc, unrecognized) readField (Field ("Build-Depends", value)) (desc, unrecognized) = (set S.buildDepends (rels value) desc, unrecognized) readField (Field ("Build-Conflicts", value)) (desc, unrecognized) = (set S.buildConflicts (rels value) desc, unrecognized) readField (Field ("Build-Depends-Indep", value)) (desc, unrecognized) = (set S.buildDependsIndep (rels value) desc, unrecognized) readField (Field ("Build-Conflicts-Indep", value)) (desc, unrecognized) = (set S.buildConflictsIndep (rels value) desc, unrecognized) readField (Field ("Vcs-Browser", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSBrowser (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Arch", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSArch (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Bzr", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSBzr (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Cvs", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSCvs (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Darcs", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSDarcs (pack s)) vcsFields) desc, unrecognized) readField (Field ("Vcs-Git", s)) (desc, unrecognized) = (over S.vcsFields (\ vcsFields -> Set.insert (S.VCSGit (pack s)) vcsFields) desc, unrecognized) 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) _ -> (desc, field : unrecognized) readField field (desc, unrecognized) = (desc, field : unrecognized) parseBinaryDebDescription :: Paragraph' String -> (BinaryDebDescription, [Field]) parseBinaryDebDescription (Paragraph fields) = foldr readField (bin, []) fields' where fields' = map stripField fields bin = set B.architecture (Just arch) (newBinaryDebDescription b) b :: BinPkgName b = findMap "Package" BinPkgName fields' arch = findMap "Architecture" parsePackageArchitectures fields' {- (BinPkgName (fromJust (fieldValue "Package" bin))) (read' (fromJust (fieldValue "Architecture" bin))) , [] foldr readField (newBinaryDebDescription (BinPkgName (fromJust (fieldValue "Package" bin))) (read' (fromJust (fieldValue "Architecture" bin))), []) (map stripField fields) -} 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) readField (Field ("Depends", x)) (desc, unrecognized) = (set (B.relations . B.depends) (rels x) desc, unrecognized) readField (Field ("Recommends", x)) (desc, unrecognized) = (set (B.relations . B.recommends) (rels x) desc, unrecognized) readField (Field ("Suggests", x)) (desc, unrecognized) = (set (B.relations . B.suggests) (rels x) desc, unrecognized) readField (Field ("Pre-Depends", x)) (desc, unrecognized) = (set (B.relations . B.preDepends) (rels x) desc, unrecognized) readField (Field ("Breaks", x)) (desc, unrecognized) = (set (B.relations . B.breaks) (rels x) desc, unrecognized) readField (Field ("Conflicts", x)) (desc, unrecognized) = (set (B.relations . B.conflicts) (rels x) desc, unrecognized) readField (Field ("Provides", x)) (desc, unrecognized) = (set (B.relations . B.provides) (rels x) desc, unrecognized) readField (Field ("Replaces", x)) (desc, unrecognized) = (set (B.relations . B.replaces) (rels x) desc, unrecognized) readField (Field ("Built-Using", x)) (desc, unrecognized) = (set (B.relations . B.builtUsing) (rels x) desc, unrecognized) readField (Field ("Description", x)) (desc, unrecognized) = (set B.description (Just (pack x)) desc, unrecognized) readField field (desc, unrecognized) = (desc, field : unrecognized) -- | Look for a field and apply a function to its value findMap :: String -> (String -> a) -> [Field] -> a findMap field f fields = fromMaybe (error $ "Missing " ++ show field ++ " field in " ++ show fields) (foldr findMap' Nothing fields) where findMap' (Field (fld, val)) x = if fld == field then Just (f val) else x findMap' _ x = x stripField :: ControlFunctions a => Field' a -> Field' a stripField (Field (a, b)) = Field (a, stripWS b) stripField x = x rels :: String -> Relations rels s = either (\ e -> error ("Relations field error: " ++ show e ++ "\n " ++ s)) id (parseRelations s) yes :: String -> Bool yes "yes" = True yes "no" = False yes x = error $ "Expecting yes or no: " ++ x -- | Look in several places for a debian changelog inputChangeLog :: MonadIO m => DebianT m () inputChangeLog = do log <- liftIO loadChangeLog changelog .?= log -- | Look in several places for a debian changelog loadChangeLog :: IO (Maybe ChangeLog) loadChangeLog = doPaths ["CHANGELOG", "ChangeLog", "changelog", "debian/changelog"] where doPaths :: [FilePath] -> IO (Maybe ChangeLog) doPaths (p : ps) = doPath p >>= maybe (doPaths ps) (\log -> {-putStrLn ("Found valid changelog at " ++ p) >>-} return (Just log)) doPaths [] = return Nothing doPath :: FilePath -> IO (Maybe ChangeLog) doPath p = do t <- tryIOError (readFile p) either doExn doParse t where doParse :: Text -> IO (Maybe ChangeLog) doParse t = do return $ either (const Nothing) Just (parseChangeLog (unpack t)) doExn :: IOError -> IO (Maybe ChangeLog) doExn e | isDoesNotExistError e = return Nothing doExn e = error ("inputChangelog: " ++ show e) inputCabalInfoFromDirectory :: MonadIO m => DebianT m () -- .install files, .init files, etc. inputCabalInfoFromDirectory = do findChangeLog -- Look for changelog in unconventional locations findFiles -- If debian/changelog is found it will replace what we found above doFiles ("./debian/cabalInstall") where -- Find regular files in the debian/ or in debian/source/format/ and -- add them to the debianization. findFiles :: MonadIO m => DebianT m () findFiles = liftIO (getDirectoryContents' ("debian")) >>= return . (++ ["source/format"]) >>= liftIO . filterM (doesFileExist . (("debian") )) >>= \ names -> mapM_ (inputCabalInfo ("debian")) names findChangeLog :: MonadIO m => DebianT m () findChangeLog = filterM (liftIO . doesFileExist) ["changelog", "ChangeLog", "CHANGELOG"] >>= \names -> mapM_ (inputCabalInfo ".") names doFiles :: MonadIO m => FilePath -> DebianT m () doFiles tmp = do sums <- liftIO $ getDirectoryContents' tmp `catchIOError` (\ _ -> return []) paths <- liftIO $ mapM (\ sum -> getDirectoryContents' (tmp sum) >>= return . map (sum )) sums >>= return . filter ((/= '~') . last) . concat files <- liftIO $ mapM (readFile . (tmp )) paths mapM_ (\ x -> intermediateFiles %= Set.insert x) (zip (map ("debian/cabalInstall" ) paths) files) -- | Construct a file path from the debian directory and a relative -- path, read its contents and add the result to the debianization. -- This may mean using a specialized parser from the debian package -- (e.g. parseChangeLog), and some files (like control) are ignored -- here, though I don't recall why at the moment. inputCabalInfo :: MonadIO m => FilePath -> FilePath -> DebianT m () inputCabalInfo _ path | elem path ["control"] = return () inputCabalInfo debian name@"source/format" = liftIO (readFile (debian name)) >>= \ text -> either (\ x -> warning %= Set.insert x) ((sourceFormat .=)) (readSourceFormat text) inputCabalInfo debian name@"watch" = liftIO (readFile (debian name)) >>= \ text -> watch .= Just text inputCabalInfo debian name@"rules" = liftIO (readFile (debian name)) >>= \ text -> rulesHead .= (Just $ strip text <> pack "\n") inputCabalInfo debian name@"compat" = liftIO (readFile (debian name)) >>= \ text -> compat .= Just (read' (\ s -> error $ "compat: " ++ show s) (unpack text)) inputCabalInfo debian name@"copyright" = liftIO (readFile (debian name)) >>= \ text -> copyright .= Just (readCopyrightDescription text) -- The normal position for a debian changelog is debian/changelog, but -- we also look for it in changelog, ChangeLog, and CHANGELOG because -- hackage looks for it in those places and the debianization is -- better off with those entries than without. inputCabalInfo debian name@"changelog" = do log <- liftIO (readFile (debian name)) >>= return . either (const Nothing) Just . parseChangeLog . unpack changelog .= log inputCabalInfo debian name = case (BinPkgName (dropExtension name), takeExtension name) of (p, ".install") -> liftIO (readFile (debian name)) >>= \ text -> mapM_ (readInstall p) (lines text) (p, ".dirs") -> liftIO (readFile (debian name)) >>= \ text -> mapM_ (readDir p) (lines text) (p, ".init") -> liftIO (readFile (debian name)) >>= \ text -> installInit %= Map.insert p text (p, ".logrotate") -> liftIO (readFile (debian name)) >>= \ text -> logrotateStanza %= Map.insertWith mappend p (singleton text) (p, ".links") -> liftIO (readFile (debian name)) >>= \ text -> mapM_ (readLink p) (lines text) (p, ".postinst") -> liftIO (readFile (debian name)) >>= \ text -> postInst %= Map.insert p text (p, ".postrm") -> liftIO (readFile (debian name)) >>= \ text -> postRm %= Map.insert p text (p, ".preinst") -> liftIO (readFile (debian name)) >>= \ text -> preInst %= Map.insert p text (p, ".prerm") -> liftIO (readFile (debian name)) >>= \ text -> preRm %= Map.insert p text (_, ".log") -> return () -- Generated by debhelper (_, ".debhelper") -> return () -- Generated by debhelper (_, ".hs") -> return () -- Code that uses this library (_, ".setup") -> return () -- Compiled Setup.hs file (_, ".substvars") -> return () -- Unsupported (_, "") -> return () -- File with no extension (_, x) | last x == '~' -> return () -- backup file _ -> liftIO (putStrLn $ "Ignored debianization file: " ++ debian name) -- | Read a line from a debian .links file readLink :: Monad m => BinPkgName -> Text -> DebianT m () readLink p line = case words line of [a, b] -> link p (unpack a) (unpack b) [] -> return () _ -> trace ("Unexpected value passed to readLink: " ++ show line) (return ()) -- | Read a line from a debian .install file readInstall :: Monad m => BinPkgName -> Text -> DebianT m () readInstall p line = case break isSpace line of (_, b) | null b -> error $ "readInstall: syntax error in .install file for " ++ show p ++ ": " ++ show line (a, b) -> install p (unpack (strip a)) (unpack (strip b)) -- | Read a line from a debian .dirs file readDir :: Monad m => BinPkgName -> Text -> DebianT m () readDir p line = installDir p (unpack line) -- chroot :: NFData a => FilePath -> IO a -> IO a -- chroot "/" task = task -- chroot root task = useEnv root (return . force) task -- | Where to put the installed data files. Computes the destination -- directory from a Cabal package description. This needs to match -- the path cabal assigns to datadir in the -- dist/build/autogen/Paths_packagename.hs module, or perhaps the path -- in the CABAL_DEBIAN_DATADIR environment variable. dataDest :: Monad m => CabalT m FilePath dataDest = do d <- use packageDescription #if MIN_VERSION_Cabal(2,0,0) return $ "usr/share" (unPackageName $ pkgName $ Cabal.package d) #else return $ "usr/share" ((\ (PackageName x) -> x) $ pkgName $ Cabal.package d) #endif -- | Where to look for the data-files dataTop :: Monad m => CabalT m FilePath dataTop = do d <- use packageDescription return $ case Cabal.dataDir d of "" -> "." x -> x cabal-debian-5.0/src/Debian/Debianize/DebianName.hs0000644000000000000000000001433713530623213020216 0ustar0000000000000000-- | How to name the debian packages based on the cabal package name and version number. {-# LANGUAGE CPP, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TypeFamilies #-} {-# OPTIONS -Wall -Wwarn -fno-warn-name-shadowing -fno-warn-orphans #-} module Debian.Debianize.DebianName ( debianName , debianNameBase , mkPkgName , mkPkgName' , mapCabal , splitCabal , remapCabal ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) #endif import Control.Lens import Data.Char (toLower) import Data.Map as Map (alter, lookup) import Debian.Debianize.Monad (CabalT) import Debian.Debianize.CabalInfo as A (debianNameMap, packageDescription, debInfo) import Debian.Debianize.BinaryDebDescription as Debian (PackageType(..)) import Debian.Debianize.DebInfo as D (overrideDebianNameBase, utilsPackageNameBase) import Debian.Debianize.VersionSplits (DebBase(DebBase, unDebBase), doSplits, insertSplit, makePackage, VersionSplits(oldestPackage, splits)) import Debian.Orphans () import Debian.Relation (PkgName(..), Relations) import qualified Debian.Relation as D (VersionReq(EEQ)) import Debian.Version (parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..)) #if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, unPackageName) import Distribution.Version (Version) #else import Data.Version (showVersion, Version) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName)) #endif import qualified Distribution.PackageDescription as Cabal (PackageDescription(package)) import Distribution.Pretty (prettyShow) import Prelude hiding (unlines) data Dependency_ = BuildDepends Dependency | BuildTools Dependency | PkgConfigDepends Dependency | ExtraLibs Relations deriving (Eq, Show) -- | Build the Debian package name for a given package type. debianName :: (Monad m, PkgName name) => PackageType -> CompilerFlavor -> CabalT m name debianName typ hc = do base <- case (typ, hc) of (Utilities, GHC) -> use (debInfo . utilsPackageNameBase) >>= maybe (((\ base -> "haskell-" ++ base ++ "-utils") . unDebBase) <$> debianNameBase) return (Utilities, _) -> use (debInfo . utilsPackageNameBase) >>= maybe (((\ base -> base ++ "-utils") . unDebBase) <$> debianNameBase) return _ -> unDebBase <$> debianNameBase return $ mkPkgName' hc typ (DebBase base) -- | Function that applies the mapping from cabal names to debian -- names based on version numbers. If a version split happens at v, -- this will return the ltName if < v, and the geName if the relation -- is >= v. debianNameBase :: Monad m => CabalT m DebBase debianNameBase = do nameBase <- use (debInfo . D.overrideDebianNameBase) pkgDesc <- use packageDescription let pkgId = Cabal.package pkgDesc nameMap <- use A.debianNameMap #if MIN_VERSION_Cabal(2,0,0) let pname = pkgName pkgId #else let pname@(PackageName _) = pkgName pkgId #endif version = (Just (D.EEQ (parseDebianVersion' (prettyShow (pkgVersion pkgId))))) case (nameBase, Map.lookup (pkgName pkgId) nameMap) of (Just base, _) -> return base (Nothing, Nothing) -> return $ debianBaseName pname (Nothing, Just splits) -> return $ doSplits splits version -- | Build a debian package name from a cabal package name and a -- debian package type. Unfortunately, this does not enforce the -- correspondence between the PackageType value and the name type, so -- it can return nonsense like (SrcPkgName "libghc-debian-dev"). mkPkgName :: PkgName name => CompilerFlavor -> PackageName -> PackageType -> name mkPkgName hc pkg typ = mkPkgName' hc typ (debianBaseName pkg) mkPkgName' :: PkgName name => CompilerFlavor -> PackageType -> DebBase -> name mkPkgName' hc typ (DebBase base) = pkgNameFromString $ case typ of Documentation -> prefix ++ base ++ "-doc" Development -> prefix ++ base ++ "-dev" Profiling -> prefix ++ base ++ "-prof" Utilities -> base {- ++ case hc of GHC -> "" _ -> "-" ++ map toLower (show hc) -} Exec -> base Source -> base HaskellSource -> "haskell-" ++ base Cabal -> base where prefix = "lib" ++ map toLower (show hc) ++ "-" debianBaseName :: PackageName -> DebBase #if MIN_VERSION_Cabal(2,0,0) debianBaseName p = DebBase (map (fixChar . toLower) (unPackageName p)) #else debianBaseName (PackageName name) = DebBase (map (fixChar . toLower) name) #endif where -- Underscore is prohibited in debian package names. fixChar :: Char -> Char fixChar '_' = '-' fixChar c = toLower c -- | Map all versions of Cabal package pname to Debian package dname. -- Not really a debian package name, but the name of a cabal package -- that maps to the debian package name we want. (Should this be a -- SrcPkgName?) mapCabal :: Monad m => PackageName -> DebBase -> CabalT m () mapCabal pname dname = debianNameMap %= Map.alter f pname where f :: Maybe VersionSplits -> Maybe VersionSplits f Nothing = Just (makePackage dname) f (Just sp) | any (== dname) (oldestPackage sp : map snd (splits sp)) = Just sp f (Just sp) = error $ "mapCabal " ++ show pname ++ " " ++ show dname ++ ": - already mapped: " ++ show sp -- | Map versions less than ver of Cabal Package pname to Debian package ltname splitCabal :: Monad m => PackageName -> DebBase -> Version -> CabalT m () splitCabal pname ltname ver = debianNameMap %= Map.alter f pname where f :: Maybe VersionSplits -> Maybe VersionSplits f Nothing = error $ "splitCabal - not mapped: " ++ show pname f (Just sp) = Just (insertSplit ver ltname sp) -- | Replace any existing mapping of the cabal name 'pname' with the -- debian name 'dname'. (Use case: to change the debian package name -- so it differs from the package provided by ghc.) remapCabal :: Monad m => PackageName -> DebBase -> CabalT m () remapCabal pname dname = do debianNameMap %= Map.alter (const Nothing) pname mapCabal pname dname cabal-debian-5.0/src/Debian/Debianize/Prelude.hs0000644000000000000000000003375013530623213017633 0ustar0000000000000000-- | Functions and instances used by but not related to cabal-debian. -- These could conceivably be moved into more general libraries. {-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, Rank2Types, ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Debianize.Prelude ( curry3 , DebMap , buildDebVersionMap , (!) , strip , stripWith , strictReadF , replaceFile , modifyFile , diffFile , removeIfExists , dpkgFileMap , debOfFile , cond , readFile' , readFileMaybe , showDeps , showDeps' , withCurrentDirectory , getDirectoryContents' , setMapMaybe , zipMaps , foldEmpty , maybeL , indent , maybeRead , read' , modifyM , intToVerbosity' , listElemLens , maybeLens , fromEmpty , 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 import Control.Applicative ((<$>)) import Control.Exception as E (bracket, catch, throw, try) import Control.Lens import Control.Monad (when) 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.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.IO (hGetContents) import Debian.Control (Field'(Field), lookupP, parseControl, stripWS, unControl) import Debian.Orphans () import Debian.Pretty (PP(PP)) import qualified Debian.Relation as D (BinPkgName(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 System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory, getDirectoryContents, removeDirectory, removeFile, renameFile, setCurrentDirectory) import System.FilePath ((), dropExtension) import System.IO (hSetBinaryMode, IOMode(ReadMode), openFile, withFile) import System.IO.Error (catchIOError, isDoesNotExistError) import System.Process (readProcessWithExitCode, showCommandForUser) import Text.PrettyPrint.HughesPJClass as PP (text) curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d curry3 f a b c = f (a, b, c) type DebMap = Map D.BinPkgName (Maybe DebianVersion) -- | Read and parse the status file for installed debian packages: @/var/lib/dpkg/status@ 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 (!) :: 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) strip :: String -> String strip = stripWith isSpace stripWith :: (a -> Bool) -> [a] -> [a] stripWith f = dropWhile f . dropWhileEnd f strictReadF :: (Text -> r) -> FilePath -> IO r strictReadF f path = withFile path ReadMode (\h -> hGetContents h >>= (\x -> return $! f x)) -- strictRead = strictReadF id -- | Write a file which we might still be reading from in -- order to compute the text argument. replaceFile :: FilePath -> String -> IO () replaceFile path s = do removeFile back `E.catch` (\ (e :: IOException) -> when (not (isDoesNotExistError e)) (ioError e)) renameFile path back `E.catch` (\ (e :: IOException) -> when (not (isDoesNotExistError e)) (ioError e)) writeFile path s where back = path ++ "~" -- | Compute the new file contents from the old. If f returns Nothing -- do not write. modifyFile :: FilePath -> (String -> IO (Maybe String)) -> IO () modifyFile path f = do removeFile back `E.catch` (\ (e :: IOException) -> when (not (isDoesNotExistError e)) (ioError e)) try (renameFile path back) >>= either (\ (e :: IOException) -> if not (isDoesNotExistError e) then ioError e else f "" >>= maybe (return ()) (writeFile path)) (\ () -> readFile back >>= f >>= maybe (return ()) (writeFile path)) where back = path ++ "~" diffFile :: FilePath -> Text -> IO (Maybe String) diffFile path s = readProcessWithExitCode cmd args (unpack s) >>= \ (code, out, _err) -> case code of ExitSuccess -> return Nothing ExitFailure 1 -> return (Just out) _ -> error (showCommandForUser cmd args {- ++ " < " ++ show s -} ++ " -> " ++ show code) where cmd = "diff" args = ["-ruw", path, "-"] removeFileIfExists :: FilePath -> IO () removeFileIfExists x = doesFileExist x >>= (`when` (removeFile x)) removeDirectoryIfExists :: FilePath -> IO () removeDirectoryIfExists x = doesDirectoryExist x >>= (`when` (removeDirectory x)) removeIfExists :: FilePath -> IO () removeIfExists x = removeFileIfExists x >> removeDirectoryIfExists x -- |Create a map from pathname to the names of the packages that contains that pathname using the -- contents of the debian package info directory @/var/lib/dpkg/info@. 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) -- |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) where -- testPath :: Maybe (Set FilePath) -> Maybe FilePath testPath Nothing = Nothing testPath (Just s) = case Set.size s of 1 -> Just (Set.findMin s) _ -> Nothing cond :: t -> t -> Bool -> t cond ifF _ifT False = ifF cond _ifF ifT True = ifT readFile' :: FilePath -> IO Text readFile' path = do file <- openFile path ReadMode hSetBinaryMode file True hGetContents file readFileMaybe :: FilePath -> IO (Maybe Text) readFileMaybe path = (Just <$> readFile' path) `catchIOError` (\ _ -> return Nothing) showDeps :: D.Relations -> String showDeps = show . pretty . PP showDeps' :: D.Relations -> String showDeps' xss = show $ mconcat $ intersperse (text "\n ") $ [pretty (PP xs) <> text "," | xs <- xss ] -- | From Darcs.Utils - set the working directory and run an IO operation. withCurrentDirectory :: FilePath -> IO a -> IO a withCurrentDirectory path m = E.bracket (do oldwd <- getCurrentDirectory let newwd = oldwd path setCurrentDirectory' newwd return oldwd) (\oldwd -> setCurrentDirectory' oldwd {- `catchall` return () -}) (\_oldwd -> m) setCurrentDirectory' :: FilePath -> IO () setCurrentDirectory' dir = try (setCurrentDirectory dir) >>= either handle return where handle e@(IOError {ioe_type = NoSuchThing}) = throw $ e {ioe_description = ioe_description e ++ ": " ++ show dir} handle e@(IOError {ioe_type = InappropriateType}) = throw $ e {ioe_description = ioe_description e ++ ": " ++ show dir} handle e@(IOError {ioe_type = typ}) = throw $ e {ioe_description = ioe_description e ++ " unexpected ioe_type: " ++ show typ} {- catchall :: IO a -> IO a -> IO a a `catchall` b = a `catchNonSignal` (\_ -> b) -- catchNonSignal is a drop-in replacement for Control.Exception.catch, which allows -- us to catch anything but a signal. Useful for situations where we want -- don't want to inhibit ctrl-C. catchNonSignal :: IO a -> (E.SomeException -> IO a) -> IO a catchNonSignal comp handler = catch comp handler' where handler' se = case fromException se :: Maybe SignalException of Nothing -> handler se Just _ -> E.throw se newtype SignalException = SignalException Signal deriving (Show, Typeable) instance Exception SignalException where toException e = SomeException e fromException (SomeException e) = cast e -} -- | Get directory contents minus dot files. getDirectoryContents' :: FilePath -> IO [FilePath] getDirectoryContents' dir = getDirectoryContents dir >>= return . filter (not . dotFile) where dotFile "." = True dotFile ".." = True dotFile _ = False setMapMaybe :: ({-Ord a,-} Ord b) => (a -> Maybe b) -> Set a -> Set b setMapMaybe p = Set.fromList . mapMaybe p . toList 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 where g k a r = case f k (Just a) (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 Nothing -> case f k Nothing (Just b) of Just c -> Map.insert k c r -- Only n has an entry for k Nothing -> r Just _ -> r foldEmpty :: r -> ([a] -> r) -> [a] -> r foldEmpty r _ [] = r foldEmpty _ f l = f l -- | If the current value of view x is Nothing, replace it with f. maybeL :: Lens' a (Maybe b) -> Maybe b -> a -> a maybeL l mb x = over l (maybe mb Just) x indent :: [Char] -> String -> String indent prefix s = unlines (List.map (prefix ++) (List.lines s)) maybeRead :: Read a => String -> Maybe a maybeRead = fmap fst . listToMaybe . reads read' :: Read a => (String -> a) -> String -> a read' f s = fromMaybe (f s) (maybeRead s) -- modifyM :: (Monad m, MonadTrans t, MonadState a (t m)) => (a -> m a) -> t m () -- modifyM f = get >>= lift . f >>= put -- modifyM :: (Monad m, MonadTrans t, MonadState a (t m)) => (a -> m a) -> t m () modifyM :: MonadState a m => (a -> m a) -> m () modifyM f = get >>= f >>= put -- read' :: Read a => String -> a -- read' s = trace ("read " ++ show s) (read s) -- | Version of 'Distribution.Verbosity.intToVerbosity' that first -- clamps its argument to the acceptable range (0-3). intToVerbosity' :: Int -> Verbosity intToVerbosity' n = fromJust (intToVerbosity (max 0 (min 3 n))) listElemLens :: (a -> Bool) -> Lens' [a] (Maybe a) listElemLens p = lens lensGet lensPut where lensGet xs = case span (not . p) xs of (_, x : _) -> Just x _ -> Nothing lensPut xs Nothing = case span (not . p) xs of (before, _ : after) -> before ++ after _ -> xs lensPut xs (Just x) = case span (not . p) xs of (before, _ : after) -> before ++ (x : after) _ -> xs ++ [x] maybeLens :: a -> Lens' a b -> Lens' (Maybe a) b maybeLens def l = lens (\ x -> (fromMaybe def x) ^. l) (\ b a -> case (a, b) of (_, Nothing) -> Just (l .~ a $ def) (_, Just b') -> Just (l .~ a $ b')) fromEmpty :: Set a -> Set a -> Set a fromEmpty d s | Set.null s = d fromEmpty _ s = s fromSingleton :: a -> ([a] -> a) -> Set a -> a fromSingleton e multiple s = case toList s of [x] -> x [] -> e xs -> multiple xs instance Pretty (PP PackageIdentifier) where 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 -- 2. Nothing happens if the current value isJust (.?=) :: Monad m => Lens' a (Maybe b) -> Maybe b -> StateT a m () l .?= mx = use l >>= assign l . maybe mx Just -- | This should probably be used in a lot of places. escapeDebianWildcards :: String -> String 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 cabal-debian-5.0/src/System/0000755000000000000000000000000013530623213014077 5ustar0000000000000000cabal-debian-5.0/src/System/Git.hs0000644000000000000000000000406213530623213015160 0ustar0000000000000000-- | Git related functions that belong in some other package. {-# LANGUAGE CPP, ScopedTypeVariables #-} module System.Git ( gitResetHard , gitResetSubdir , gitUnclean , gitIsClean , withCleanRepo ) where #if !MIN_VERSION_base(4,8,0) import Control.Applicative (pure, (<$>)) #endif import Control.Exception (catch, SomeException, throw) import System.Directory (getCurrentDirectory) import System.Exit (ExitCode(ExitSuccess, ExitFailure)) import System.IO (hPutStrLn, stderr) import System.Process (readProcessWithExitCode, readProcess) -- | Do a hard reset of all the files of the repository containing the -- working directory. gitResetHard :: IO () gitResetHard = do (code, _out, _err) <- readProcessWithExitCode "git" ["reset", "--hard"] "" case code of ExitSuccess -> pure () ExitFailure _n -> error "gitResetHard" -- | Do a hard reset of all the files of a subdirectory within a git -- repository. (Does this every throw an exception?) gitResetSubdir :: FilePath -> IO () gitResetSubdir dir = do (readProcess "git" ["checkout", "--", dir] "" >> readProcess "git" ["clean", "-f", dir] "" >> pure ()) `catch` \(e :: SomeException) -> hPutStrLn stderr ("gitResetSubdir " ++ show dir ++ " failed: " ++ show e) >> throw e -- | Determine whether the repository containing the working directory -- is in a modified state, if so return the messages. gitUnclean :: IO (Maybe String) gitUnclean = do here <- getCurrentDirectory hPutStrLn stderr ("here: " ++ show here) (code, out, _err) <- readProcessWithExitCode "git" ["status", "--porcelain"] "" case code of ExitFailure _ -> error "gitCheckClean failure" ExitSuccess | all unmodified (lines out) -> pure Nothing ExitSuccess -> pure $ Just out where unmodified (a : b : _) = elem a "?! " && elem b "?! " unmodified _ = False gitIsClean :: IO Bool gitIsClean = maybe True (const False) <$> gitUnclean withCleanRepo :: IO a -> IO a withCleanRepo action = do gitUnclean >>= maybe action (\s -> error $ "withCleanRepo: please commit or revert changes:\n" ++ s) cabal-debian-5.0/debian/0000755000000000000000000000000013530623213013246 5ustar0000000000000000cabal-debian-5.0/debian/cabal-debian.10000644000000000000000000000422713530623213015617 0ustar0000000000000000.\"Original page generated by txt2man and then hacked extensively. .TH CABAL-DEBIAN 1 "May 10, 2010" .SH NAME cabal-debian \- create Debian package meta data from a Haskell cabal file. .SH SYNOPSIS .B cabal-debian .RI [flags] .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 .cabal file in the directory from which it was run. .TP .B \fB--prefix=PATH\fP Pass this prefix if we need to configure the package .TP .B \fB--ghc\fP Compile with GHC. .TP .B \fB--hugs\fP Compile with HUGS. .TP .B \fB--jhc\fP Compile with JHC. .TP .B \fB--nhc\fP Compile with NHC. .TP .B \fB-h, -?, \-\-help\fP Show this help text. .TP .B \fB--name\fP=NAME Override the default package name. .TP .B \fB--disable-haddock\fP Don't generate API docs. .TP .B \fB--disable-library-profiling\fP Don't generate profiling libraries. .TP .B \fB--disable-optimization\fP Don't generate optimised code. .TP .B \fB--disable-split-objs\fP Don't split object files to save space. .TP .B \fB-f\fP FLAGS, \fB--flags\fP=FLAGS Set given flags in Cabal conditionals. .TP .B \fB--release\fP=RELEASE Override the default package release. .TP .B \fB--debdir\fP=DEBDIR Override the default output directory ("./debian"). .TP .B \fB-v n,q \fB--verbose=n\fP Change build verbosity. .TP .B \fB--version\fP=VERSION Override the default package version. .TP .B \fB--maintainer\fP=Maintainer Name Override the Maintainer name and email in $DEBEMAIL/$EMAIL/$DEBFULLNAME/$FULLNAME. .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. .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. .TP .B \fB--update-debianization\fP Update an existing debianization. .SH AUTHOR This manual page was originally written by Erik de Castro Lopo for the Debian GNU/Linux system (but may be used by others). cabal-debian-5.0/debian/rules0000755000000000000000000000042213530623213014324 0ustar0000000000000000#!/usr/bin/make -f DEB_ENABLE_TESTS = yes DEB_SETUP_BIN_NAME = debian/hlibrary.setup DEB_CABAL_PACKAGE = cabal-debian DEB_DEFAULT_COMPILER = ghc include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk build/cabal-debian:: build-ghc-stamp cabal-debian-5.0/debian/watch0000644000000000000000000000020413530623213014273 0ustar0000000000000000version=3 https://hackage.haskell.org/package/cabal-debian/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) cabal-debian-5.0/debian/control0000644000000000000000000000760713530623213014663 0ustar0000000000000000Source: haskell-cabal-debian Maintainer: Debian Haskell Group Priority: optional Section: haskell Build-Depends: debhelper (>= 9), haskell-devscripts-minimal | haskell-devscripts (>= 0.8), cdbs, ghc, ghc-prof, libghc-cabal-dev (>= 1.18) | ghc, libghc-cabal-prof (>= 1.18) | ghc-prof, libghc-diff-dev (>= 0.3.1), libghc-diff-prof (>= 0.3.1), libghc-hunit-dev, libghc-hunit-prof, libghc-unixutils-dev (>= 1.53), libghc-unixutils-prof (>= 1.53), libghc-ansi-wl-pprint-dev (>= 0.6), libghc-ansi-wl-pprint-dev (<< 0.7), libghc-ansi-wl-pprint-prof (>= 0.6), libghc-ansi-wl-pprint-prof (<< 0.7), libghc-bifunctors-dev, libghc-bifunctors-prof, libghc-data-default-dev, libghc-data-default-prof, libghc-debian-dev (>= 3.91), libghc-debian-prof (>= 3.91), libghc-exceptions-dev, libghc-exceptions-prof, libghc-hsemail-dev, libghc-hsemail-prof, libghc-lens-dev, libghc-lens-prof, libghc-memoize-dev (>= 0.7), libghc-memoize-prof (>= 0.7), libghc-network-uri-dev, libghc-network-uri-prof, libghc-newtype-generics-dev (>= 0.4), libghc-newtype-generics-prof (>= 0.4), libghc-optparse-applicative-dev (>= 0.11), libghc-optparse-applicative-prof (>= 0.11), libghc-puremd5-dev, libghc-puremd5-prof, libghc-regex-tdfa-dev, libghc-regex-tdfa-prof, libghc-set-extra-dev, libghc-set-extra-prof, libghc-syb-dev, libghc-syb-prof, libghc-utf8-string-dev, libghc-utf8-string-prof, libghc-cabal-dev (>= 1.16) | ghc, libghc-cabal-prof (>= 1.16) | ghc-prof, Build-Depends-Indep: ghc-doc, libghc-cabal-doc | ghc-doc, libghc-diff-doc, libghc-hunit-doc, libghc-unixutils-doc, libghc-ansi-wl-pprint-doc, libghc-bifunctors-doc, libghc-data-default-doc, libghc-debian-doc, libghc-exceptions-doc, libghc-hsemail-doc, libghc-lens-doc, libghc-memoize-doc, libghc-network-uri-doc, libghc-newtype-generics-doc, libghc-optparse-applicative-doc, libghc-puremd5-doc, libghc-regex-tdfa-doc, libghc-set-extra-doc, libghc-syb-doc, libghc-utf8-string-doc, Standards-Version: 3.9.6 Homepage: https://github.com/ddssff/cabal-debian X-Description: Create a Debianization for a Cabal package This package supports the generation of a package Debianization (i.e. the files in the @debian@ subdirectory) for a cabal package, either through a library API or using the cabal-debian executable. For documentation of the executable, run @cabal-debian --help@, for documentation of the library API follow the link to the @Debian.Debianize@ module below. Package: cabal-debian Architecture: any Section: misc Depends: ${haskell:Depends}, ${misc:Depends}, apt-file, debian-policy, debhelper, haskell-devscripts (>= 0.8.19), Recommends: ${haskell:Recommends}, Suggests: ${haskell:Suggests}, Conflicts: ${haskell:Conflicts}, Provides: ${haskell:Provides}, Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-cabal-debian-dev Architecture: any Depends: ${haskell:Depends}, ${misc:Depends}, ${shlibs:Depends}, debian-policy, Recommends: ${haskell:Recommends}, Suggests: ${haskell:Suggests}, Conflicts: ${haskell:Conflicts}, Provides: ${haskell:Provides}, Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-cabal-debian-prof Architecture: any Depends: ${haskell:Depends}, ${misc:Depends}, Recommends: ${haskell:Recommends}, Suggests: ${haskell:Suggests}, Conflicts: ${haskell:Conflicts}, Provides: ${haskell:Provides}, Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-cabal-debian-doc Architecture: all Section: doc Depends: ${haskell:Depends}, ${misc:Depends}, Recommends: ${haskell:Recommends}, Suggests: ${haskell:Suggests}, Conflicts: ${haskell:Conflicts}, Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} cabal-debian-5.0/debian/Debianize.hs0000644000000000000000000000551413530623213015501 0ustar0000000000000000-- To run the test: runhaskell --ghc-arg=-package-db=dist/package.conf.inplace debian/Debianize.hs --dry-run import Control.Exception (throw) import Control.Lens import Control.Monad.State (evalStateT) import Data.Map as Map (insert) import Data.Set as Set (insert) import Data.Text as Text (pack) import Data.Version (Version(Version)) import Debian.Debianize import Debian.Debianize.Output (performDebianization) import Debian.Debianize.Optparse (parseProgramArguments, CommandLineOptions(..)) import Debian.Relation (BinPkgName(BinPkgName), Relations, parseRelations) import Distribution.Package (PackageName(PackageName)) main :: IO () main = performDebianization customize where customize :: Monad m => CabalT m () customize = do debianDefaults -- Some obsolete fiddling around with mapping from cabal -- to debian package names. This would let you create -- Debian package names like libghc-cabal-122-dev, which -- can co-exist with the standard libghc-cabal-dev package. -- mapCabal (PackageName "Cabal") (DebBase "cabal-122") -- splitCabal (PackageName "Cabal") (DebBase "cabal") (Version [1,22] []) -- Force some values so they match the expected results rather than -- changing as new package versions arrive. (debInfo . control . maintainer) .= parseMaintainer "David Fox " (debInfo . sourceFormat) .= Native3 (debInfo . control . standardsVersion) .= Just (StandardsVersion 3 9 3 Nothing) (debInfo . compat) .= Just 9 (debInfo . control . homepage) .= Just (pack "https://github.com/ddssff/cabal-debian") -- Any left over files that need to be included will go into -- haskell-cabal-debian-utils. But in this case there -- should be none, so the package will not be created. (debInfo . utilsPackageNameBase) .= Just "cabal-debian" -- Add dependencies to the binary debs. (debInfo . binaryDebDescription (BinPkgName "cabal-debian") . relations . depends) %= (++ (rels "apt-file, debian-policy, debhelper, haskell-devscripts (>= 0.8.19)")) (debInfo . binaryDebDescription (BinPkgName "libghc-cabal-debian-dev") . relations . depends) %= (++ (rels "debian-policy")) -- Install the executable named in an Executable section of -- the cabal file into a the binary deb named cabal-debian, -- giving it the path /usr/bin/cabal-debian. (debInfo . atomSet) %= (Set.insert $ InstallCabalExec (BinPkgName "cabal-debian") "cabal-debian" "usr/bin") -- | Turn a string into a relation list on binary debs. rels :: String -> Relations rels = either (throw . userError . show) id . parseRelations cabal-debian-5.0/debian/cabal-debian.manpages0000644000000000000000000000001313530623213017237 0ustar0000000000000000debian/*.1 cabal-debian-5.0/debian/compat0000644000000000000000000000000213530623213014444 0ustar00000000000000009 cabal-debian-5.0/debian/copyright0000644000000000000000000000377513530623213015215 0ustar0000000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: cabal-debian Upstream-Contact: David Fox Source: https://hackage.haskell.org/package/cabal-debian Files: * Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw License: BSD3 Files: debian/* Copyright: held by the contributors mentioned in debian/changelog License: BSD3 License: BSD3 The packageing was adjusted to Debian conventions by Joachim Breitner on Sat, 01 May 2010 21:16:18 +0200, and is licenced under the same terms as the package itself. . Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * The names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cabal-debian-5.0/debian/cabal-debian.install0000644000000000000000000000006113530623213017115 0ustar0000000000000000dist-ghc/build/cabal-debian/cabal-debian usr/bin cabal-debian-5.0/debian/source/0000755000000000000000000000000013530623213014546 5ustar0000000000000000cabal-debian-5.0/debian/source/format0000644000000000000000000000001513530623213015755 0ustar00000000000000003.0 (native)