[pkg-haskell-tools] 03/03: dht make-all: Get rid of "--distribution" parameter and derive it from the changelog, working around sbuild bug #529281

Joachim Breitner nomeata at moszumanska.debian.org
Fri Aug 28 21:11:24 UTC 2015


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

nomeata pushed a commit to branch master
in repository pkg-haskell-tools.

commit 74d69da46babba96bff3a5d2aaace04c3fedebdd
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Aug 28 23:09:43 2015 +0200

    dht make-all: Get rid of "--distribution" parameter and derive it from the changelog, working around sbuild bug #529281
---
 debian/changelog |  2 ++
 src/make-all.hs  | 40 ++++++++++++++++++++++++++++------------
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 86a90b3..6503df1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ pkg-haskell-tools (0.9) UNRELEASED; urgency=medium
   * New script: dch (wrapper around debchange)
   * dht upload: If no changes file is given, derive from the current directory
     (like debrelease does).
+  * dht make-all: Get rid of "--distribution" parameter and derive it from the
+    changelog, working around sbuild bug #529281
 
  -- Joachim Breitner <nomeata at debian.org>  Thu, 20 Aug 2015 10:09:40 +0200
 
diff --git a/src/make-all.hs b/src/make-all.hs
index fa9f9b2..a610917 100644
--- a/src/make-all.hs
+++ b/src/make-all.hs
@@ -36,8 +36,7 @@ import Link
 
 -- Option parsing
 data Conf = Conf
-    { distribution :: String
-    , excludedPackages :: [String]
+    { excludedPackages :: [String]
     , targetDir :: FilePath
     , bindMountDir :: FilePath
     , jobs :: Int
@@ -50,15 +49,7 @@ data Conf = Conf
 
 confSpec :: O.Parser Conf
 confSpec = Conf
- <$> strOption (
-    long "distribution" <>
-    short 'd' <>
-    metavar "DIST" <>
-    help "Distribution to build for (passed to sbuild)" <>
-    showDefault <>
-    value "unstable"
-    )
- <*> option parseCommaOrSpace (
+ <$> option parseCommaOrSpace (
     long "excluded-packages" <>
     metavar "PKG,PKG,..." <>
     help "comma or space separated list of source package names to ignore" <>
@@ -153,6 +144,24 @@ versionOfSource s = do
         char ')'
         return (removeEpoch v)
 
+distributionOfSource :: String -> Action String
+distributionOfSource s = do
+    let f = "p" </> s </> "debian" </> "changelog"
+    need [f]
+    ret <- liftIO $ parseFromFile p f
+    case ret of
+        Left e -> fail (show e)
+        Right s -> return s
+  where
+    p = do
+        many $ noneOf "("
+        char '('
+        many1 $ noneOf ")"
+        char ')'
+        char ' '
+        many1 $ noneOf " ;\n"
+
+
 -- Splits the filename of a .deb, .changes or .build file into version, source
 -- and architecture
 splitDebName :: String -> (String, String, String)
@@ -513,6 +522,13 @@ shakeMain conf@(Conf {..}) = do
             unit $ cmd (Cwd repoDir)  (EchoStderr False) (FileStdout (repoDir </> "Packages"))
                 ["dpkg-scanpackages", "."]
 
+            -- Always pass the distribution in the changelog to sbuild, otherwise
+            -- sbuild will put "unstable" into the changes file, even if we do
+            -- not build for unstable.
+            -- See https://bugs.debian.org/529281 for why sbuild doesn't do it
+            -- for us.
+            dist <- distributionOfSource source
+
             -- Run sbuild
             Exit c <- cmd (Cwd targetDir) (EchoStdout False) $
                 ["sbuild"
@@ -520,7 +536,7 @@ shakeMain conf@(Conf {..}) = do
                 , "-A"
                 , "--no-source"
                 , "--no-apt-update"
-                , "--dist", distribution
+                , "--dist", dist
                 , "--chroot-setup-commands=bash " ++ fixup
                 , "--extra-repository=deb [trusted=yes] file://" ++ repoDir ++ " ./"
                 , dsc

-- 
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