[pkg-haskell-tools] 01/01: There are now targets for plain package names.

Sven Bartscher svenb-guest at moszumanska.debian.org
Wed Aug 19 17:45:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

svenb-guest pushed a commit to branch short-names
in repository pkg-haskell-tools.

commit 383a042bd3ea14f17688c5ff49c2e2501cbfbaa8
Author: Sven Bartscher <sven.bartscher at weltraumschlangen.de>
Date:   Wed Aug 19 19:38:30 2015 +0200

    There are now targets for plain package names.
---
 dht.cabal       |  3 ++-
 src/make-all.hs | 26 ++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/dht.cabal b/dht.cabal
index 31ab870..b70661a 100644
--- a/dht.cabal
+++ b/dht.cabal
@@ -28,6 +28,7 @@ executable make-all
     debian == 3.87.*,
     optparse-applicative == 0.11.*,
     split == 0.2.*,
-    MissingH >= 1.3.0.1 && < 1.4
+    MissingH >= 1.3.0.1 && < 1.4,
+    pretty >= 1.1.1
   hs-source-dirs:      src
   default-language:    Haskell2010
diff --git a/src/make-all.hs b/src/make-all.hs
index f3fdefd..028fcf8 100644
--- a/src/make-all.hs
+++ b/src/make-all.hs
@@ -27,10 +27,14 @@ import Development.Shake.FilePath
 import Debian.Relation.Common
 import Debian.Control.String
 import Debian.Control.Policy
+import qualified Debian.Changes as DC
+import qualified Debian.Version.Common as DC
 
 import Text.Parsec hiding (option, oneOf)
 import Text.Parsec.String
 
+import Text.PrettyPrint.HughesPJ (render)
+
 import Utils
 
 -- Option parsing
@@ -250,6 +254,15 @@ checkArch should is full = unless (  (should `isPrefixOf` is)
                                   || ("all"  `isPrefixOf` is)) $
                            fail $ "Can't build this file " ++ full ++ " with schroot with architecture " ++ should
 
+getPkgVersion :: String -> Action String
+getPkgVersion package = do
+  let changesFile = "p" </> package </> "debian/changelog"
+  rawChanges <- readFile' changesFile
+  either (fail . unlines) (\(entry, _) ->
+                           return $ showV $ DC.logVersion entry)
+                        $ DC.parseEntry rawChanges
+      where showV = render . DC.prettyDebianVersion
+
 manpage :: String
 manpage = unlines [ "TODO" ]
 
@@ -267,7 +280,9 @@ main = do
        <> progDesc "Rebuilds a set of packages"
        <> header "make-all - Rebuilds a set of packages" )
 
-    run conf = shake (makeShakeOptions conf) (shakeMain conf)
+    run conf = do
+         packages <- System.Directory.getDirectoryContents "p"
+         shake (makeShakeOptions conf) (shakeMain conf packages)
 
 makeShakeOptions :: Conf -> ShakeOptions
 makeShakeOptions Conf{..} = shakeOptions
@@ -279,7 +294,7 @@ makeShakeOptions Conf{..} = shakeOptions
     , shakeProgress = progressSimple
     }
 
-shakeMain conf@(Conf {..}) = do
+shakeMain conf@(Conf {..}) packages = do
     if null targets then want ["all"] else want targets
 
     getExcludedSources <- addOracle $ \GetExcludedSources{} ->
@@ -475,3 +490,10 @@ shakeMain conf@(Conf {..}) = do
         sourceFiles <- getDirectoryFiles ("p" </> source) ["debian//*"]
         need [ "p" </> source </> f | f <- sourceFiles]
         unit $ cmd  (EchoStdout False) (Traced "debian2dsc") "dht" "debian2dsc" "-o" targetDir ("p" </> source </> "debian")
+
+    phonys $ \package -> if package `elem` packages
+                         then Just $ do
+                           version <- getPkgVersion package
+                           Arch arch <- getArch ()
+                           need [targetDir </> changesFileName package version arch]
+                         else Nothing

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git



More information about the Pkg-haskell-commits mailing list