Hello community,

here is the log from the commit of package ghc-cabal-helper for 
openSUSE:Factory checked in at 2016-10-22 13:20:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cabal-helper (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-cabal-helper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-cabal-helper"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cabal-helper/ghc-cabal-helper.changes        
2016-07-21 08:02:15.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-cabal-helper.new/ghc-cabal-helper.changes   
2016-10-22 13:20:03.000000000 +0200
@@ -1,0 +2,5 @@
+Thu Sep 15 06:36:32 UTC 2016 - [email protected]
+
+- Update to version 0.7.2.0 revision 0 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  1.cabal
  cabal-helper-0.6.3.1.tar.gz

New:
----
  cabal-helper-0.7.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-cabal-helper.spec ++++++
--- /var/tmp/diff_new_pack.ODIgG1/_old  2016-10-22 13:20:04.000000000 +0200
+++ /var/tmp/diff_new_pack.ODIgG1/_new  2016-10-22 13:20:04.000000000 +0200
@@ -19,16 +19,14 @@
 %global pkg_name cabal-helper
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.6.3.1
+Version:        0.7.2.0
 Release:        0
 Summary:        Simple interface to some of Cabal's configuration state used 
by ghc-mod
 License:        AGPL-3.0+
-Group:          System/Libraries
+Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-Source1:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal
 BuildRequires:  ghc-Cabal-devel
-# Begin cabal-rpm deps:
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-directory-devel
 BuildRequires:  ghc-filepath-devel
@@ -44,10 +42,9 @@
 BuildRequires:  ghc-extra-devel
 BuildRequires:  ghc-unix-devel
 %endif
-# End cabal-rpm deps
 
 %description
-'cabal-helper' provides a library which wraps the internal use of anexecutable
+'cabal-helper' provides a library which wraps the internal use of an executable
 to lift the restrictions imposed by linking against versions of GHC before
 '7.10'. This has the pleasant side effect of isolating the user from having to
 deal with Cabal version changes manually as 'cabal-helper' can simply recompile
@@ -84,23 +81,16 @@
 
 %prep
 %setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
-
 
 %build
 %define cabal_configure_options --libexecdir=%{_libexecdir}
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
-
 %check
-%if %{with tests}
-%{cabal} test
-%endif
-
+%cabal_test
 
 %post devel
 %ghc_pkg_recache
@@ -111,7 +101,7 @@
 %files -f %{name}.files
 %defattr(-,root,root,-)
 %doc LICENSE
-%{_libexecdir}/cabal-helper-wrapper
+%{_libexecdir}/cabal-helper-wrapper-v0.7
 
 %files devel -f %{name}-devel.files
 %defattr(-,root,root,-)

++++++ cabal-helper-0.6.3.1.tar.gz -> cabal-helper-0.7.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/CabalHelper/Compile.hs 
new/cabal-helper-0.7.2.0/CabalHelper/Compile.hs
--- old/cabal-helper-0.6.3.1/CabalHelper/Compile.hs     2016-01-14 
19:19:13.000000000 +0100
+++ new/cabal-helper-0.7.2.0/CabalHelper/Compile.hs     2016-07-29 
15:03:02.000000000 +0200
@@ -51,7 +51,7 @@
       compCabalHelperSourceDir :: FilePath,
       compCabalSourceDir :: Maybe FilePath,
       compPackageDb      :: Maybe FilePath,
-      compCabalVersion   :: Version,
+      compCabalVersion   :: Either String Version,
       compPackageDeps    :: [String]
     }
 
@@ -86,9 +86,6 @@
    -- | Check if this version is globally available
    compileGlobal :: FilePath -> MaybeT IO (Either ExitCode FilePath)
    compileGlobal chdir = do
-      -- TODO: add option to let user specify custom package-db, relevant when
-      -- using a Cabal compiled from git!
-
        ver <- MaybeT $ find (== cabalVer) <$> listCabalVersions opts
        vLog opts $ logMsg ++ "user/global package-db"
        liftIO $ compileWithPkg chdir Nothing ver
@@ -111,7 +108,7 @@
        case db_exists of
          False -> mzero
          True -> do
-             db <- liftIO $ getPrivateCabalPkgDb opts cabalVer
+             db <- liftIO $ getPrivateCabalPkgDb opts (showVersion cabalVer)
              vLog opts $ logMsg ++ "private package-db in " ++ db
              liftIO $ compileWithPkg chdir (Just db) cabalVer
 
@@ -143,10 +140,10 @@
        compileWithPkg chdir (Just db) cabalVer
 
    compileWithCabalTree chdir ver srcDir =
-       compile distdir opts $ Compile chdir (Just srcDir) Nothing ver []
+       compile distdir opts $ Compile chdir (Just srcDir) Nothing (Right ver) 
[]
 
    compileWithPkg chdir mdb ver =
-       compile distdir opts $ Compile chdir Nothing mdb ver [cabalPkgId ver]
+       compile distdir opts $ Compile chdir Nothing mdb (Right ver) 
[cabalPkgId ver]
 
    cabalPkgId v = "Cabal-" ++ showVersion v
 
@@ -167,7 +164,9 @@
     vLog opts $ "outdir: " ++ outdir
     vLog opts $ "exedir: " ++ exedir
 
-    let Version (mj:mi:_) _ = compCabalVersion
+    let (mj:mi:_) = case compCabalVersion of
+                     Left _commitid -> [1, 10000]
+                     Right (Version vs _) -> vs
     let ghc_opts =
              concat [
           [ "-outputdir", outdir
@@ -204,12 +203,15 @@
                ExitSuccess -> Right exe
                e@(ExitFailure _) -> Left e
 
-exePath :: Version -> IO FilePath
+exePath :: Either String Version -> IO FilePath
 exePath compCabalVersion = do
     exePath' compCabalVersion <$> appDataDir
 
-exePath' :: Version-> FilePath -> FilePath
-exePath' compCabalVersion outdir =
+exePath' :: Either String Version -> FilePath -> FilePath
+exePath' (Left commitid) outdir =
+    outdir </> "cabal-helper-" ++ showVersion version -- our ver
+            ++ "-Cabal-HEAD-" ++ commitid
+exePath' (Right compCabalVersion) outdir =
     outdir </> "cabal-helper-" ++ showVersion version -- our ver
             ++ "-Cabal-" ++ showVersion compCabalVersion
 
@@ -255,12 +257,20 @@
         mpatch :: Maybe (FilePath -> IO ())
         mpatch = snd <$> find ((ver`elem`) . fst) patchyCabalVersions
     msrcdir <- sequenceA $ unpackPatchedCabal opts ver tmpdir <$> mpatch
-    db <- createPkgDb opts ver
-    cabalInstall opts db ver msrcdir
+    db <- createPkgDb opts (showVersion ver)
+    cabalInstall opts db (maybe (Right ver) Left msrcdir)
     return db
 
-cabalInstall :: Options -> FilePath -> Version -> Maybe FilePath -> IO ()
-cabalInstall opts db ver msrcdir = do
+installCabalHEAD :: Options -> IO (FilePath, String)
+installCabalHEAD opts = do
+  withSystemTempDirectory "cabal-helper" $ \tmpdir -> do
+    (srcdir, commit) <- unpackCabalHEAD tmpdir
+    db <- createPkgDb opts commit
+    cabalInstall opts db (Left srcdir)
+    return (db, commit)
+
+cabalInstall :: Options -> FilePath -> Either FilePath Version -> IO ()
+cabalInstall opts db e_ver_msrcdir = do
   cabalInstallVer <- cabalInstallVersion opts
   cabal_opts <- return $ concat
       [
@@ -277,12 +287,12 @@
             then [ "--with-ghc-pkg=" ++ ghcPkgProgram opts ]
             else []
         ,
-          case msrcdir of
-            Nothing ->
+          case e_ver_msrcdir of
+            Right ver ->
                 [ "install", "Cabal"
                 , "--constraint", "Cabal == " ++ showVersion ver
                 ]
-            Just srcdir ->
+            Left srcdir ->
                 [ "install", srcdir ]
       ]
 
@@ -340,14 +350,26 @@
 unpackPatchedCabal ::
     Options -> Version -> FilePath -> (FilePath -> IO ()) -> IO FilePath
 unpackPatchedCabal opts cabalVer tmpdir patch = do
+  dir <- unpackCabal opts cabalVer tmpdir
+  patch dir
+  return dir
+
+unpackCabal ::
+    Options -> Version -> FilePath -> IO FilePath
+unpackCabal opts cabalVer tmpdir = do
   let cabal = "Cabal-" ++ showVersion cabalVer
       dir = tmpdir </> cabal
-
   callProcessStderr (Just tmpdir) (cabalProgram opts) [ "get", cabal ]
-
-  patch dir
   return dir
 
+unpackCabalHEAD :: FilePath -> IO (FilePath, String)
+unpackCabalHEAD tmpdir = do
+  let dir = tmpdir </> "cabal-head.git"
+      url = "https://github.com/haskell/cabal.git";
+  ExitSuccess <- rawSystem "git" [ "clone", "--depth=1", url, dir]
+  commit <- trim <$> readProcess "git" ["-C", dir, "rev-parse", "HEAD"] ""
+  return (dir </> "Cabal", commit)
+
 errorInstallCabal :: Version -> FilePath -> a
 errorInstallCabal cabalVer _distdir = panic $ printf "\
 \Installing Cabal version %s failed.\n\
@@ -385,7 +407,7 @@
 
 cachedExe :: Version -> IO (Maybe FilePath)
 cachedExe compCabalVersion = do
-   exe <- exePath compCabalVersion
+   exe <- exePath (Right compCabalVersion)
    exists <- doesFileExist exe
    return $ if exists then Just exe else Nothing
 
@@ -403,7 +425,7 @@
 
 cabalPkgDbExists :: Options -> Version -> IO Bool
 cabalPkgDbExists opts ver = do
-  db <- getPrivateCabalPkgDb opts ver
+  db <- getPrivateCabalPkgDb opts (showVersion ver)
   dexists <- doesDirectoryExist db
   case dexists of
     False -> return False
@@ -427,18 +449,18 @@
 trim :: String -> String
 trim = dropWhileEnd isSpace
 
-createPkgDb :: Options -> Version -> IO FilePath
+createPkgDb :: Options -> String -> IO FilePath
 createPkgDb opts@Options {..} ver = do
   db <- getPrivateCabalPkgDb opts ver
   exists <- doesDirectoryExist db
   when (not exists) $ callProcessStderr Nothing ghcPkgProgram ["init", db]
   return db
 
-getPrivateCabalPkgDb :: Options -> Version -> IO FilePath
+getPrivateCabalPkgDb :: Options -> String -> IO FilePath
 getPrivateCabalPkgDb opts ver = do
   appdir <- appDataDir
   ghcVer <- ghcVersion opts
-  return $ appdir </> "Cabal-" ++ showVersion ver ++ "-db-" ++ showVersion 
ghcVer
+  return $ appdir </> "Cabal-" ++ ver ++ "-db-" ++ showVersion ghcVer
 
 -- | Find @version: XXX@ delcaration in a cabal file
 cabalFileVersion :: String -> Version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/CabalHelper/Licenses.hs 
new/cabal-helper-0.7.2.0/CabalHelper/Licenses.hs
--- old/cabal-helper-0.6.3.1/CabalHelper/Licenses.hs    2015-10-30 
20:09:31.000000000 +0100
+++ new/cabal-helper-0.7.2.0/CabalHelper/Licenses.hs    2016-07-29 
15:03:02.000000000 +0200
@@ -1,5 +1,9 @@
 {-# LANGUAGE CPP #-}
-module CabalHelper.Licenses where
+module CabalHelper.Licenses (
+    displayDependencyLicenseList
+  , groupByLicense
+  , getDependencyInstalledPackageInfos
+  ) where
 
 -- Copyright (c) 2014, Jasper Van der Jeugt <[email protected]>
 
@@ -23,9 +27,12 @@
 import Distribution.Simple.LocalBuildInfo
 import Distribution.Simple.PackageIndex
 import Distribution.Text
+import Distribution.ModuleName
 
--------------------------------------------------------------------------------
 
-#if CABAL_MAJOR == 1 && CABAL_MINOR >  22
+
+
+#if CABAL_MAJOR == 1 && CABAL_MINOR > 22
 type CPackageIndex a = PackageIndex (InstalledPackageInfo)
 #elif CABAL_MAJOR == 1 && CABAL_MINOR >= 22
 type CPackageIndex a = PackageIndex (InstalledPackageInfo_ a)
@@ -33,15 +40,20 @@
 type CPackageIndex a = PackageIndex
 #endif
 
-#if CABAL_MAJOR == 1 && CABAL_MINOR > 22
+#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23
+type CInstalledPackageId = UnitId
+lookupInstalledPackageId' :: PackageIndex a -> UnitId -> Maybe a
+lookupInstalledPackageId' = lookupUnitId
+#elif CABAL_MAJOR == 1 && CABAL_MINOR > 22
 type CInstalledPackageId = ComponentId
-lookupInstalledPackageId = lookupComponentId
+lookupInstalledPackageId' = lookupComponentId
 #else
 type CInstalledPackageId = InstalledPackageId
+lookupInstalledPackageId' = lookupInstalledPackageId
 #endif
 
 findTransitiveDependencies
-    :: CPackageIndex a
+    :: CPackageIndex Distribution.ModuleName.ModuleName
     -> Set CInstalledPackageId
     -> Set CInstalledPackageId
 findTransitiveDependencies pkgIdx set0 = go Set.empty (Set.toList set0)
@@ -50,7 +62,7 @@
     go set (q : queue)
         | q `Set.member` set = go set queue
         | otherwise          =
-            case lookupInstalledPackageId pkgIdx q of
+            case lookupInstalledPackageId' pkgIdx q of
                 Nothing  ->
                     -- Not found can mean that the package still needs to be
                     -- installed (e.g. a component of the target cabal 
package).
@@ -62,7 +74,7 @@
 
 
--------------------------------------------------------------------------------
 getDependencyInstalledPackageIds
-    :: LocalBuildInfo -> Set InstalledPackageId
+    :: LocalBuildInfo -> Set CInstalledPackageId
 getDependencyInstalledPackageIds lbi =
     findTransitiveDependencies (installedPkgs lbi) $
       Set.fromList $ map fst $ externalPackageDeps lbi
@@ -71,7 +83,7 @@
 getDependencyInstalledPackageInfos
     :: LocalBuildInfo -> [InstalledPackageInfo]
 getDependencyInstalledPackageInfos lbi = catMaybes $
-    map (lookupInstalledPackageId pkgIdx) $
+    map (lookupInstalledPackageId' pkgIdx) $
     Set.toList (getDependencyInstalledPackageIds lbi)
   where
     pkgIdx = installedPkgs lbi
@@ -82,16 +94,16 @@
     :: [InstalledPackageInfo]
     -> [(License, [InstalledPackageInfo])]
 groupByLicense = foldl'
-    (\assoc ipi -> insert (license ipi) ipi assoc) []
+    (\assoc ipi -> insertAList (license ipi) ipi assoc) []
   where
     -- 'Cabal.License' doesn't have an 'Ord' instance so we need to use an
     -- association list instead of 'Map'. The number of licenses probably won't
     -- exceed 100 so I think we're alright.
-    insert :: Eq k => k -> v -> [(k, [v])] -> [(k, [v])]
-    insert k v []   = [(k, [v])]
-    insert k v ((k', vs) : kvs)
+    insertAList :: Eq k => k -> v -> [(k, [v])] -> [(k, [v])]
+    insertAList k v []   = [(k, [v])]
+    insertAList k v ((k', vs) : kvs)
         | k == k'   = (k, v : vs) : kvs
-        | otherwise = (k', vs) : insert k v kvs
+        | otherwise = (k', vs) : insertAList k v kvs
 
 
 
--------------------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/CabalHelper/Main.hs 
new/cabal-helper-0.7.2.0/CabalHelper/Main.hs
--- old/cabal-helper-0.6.3.1/CabalHelper/Main.hs        2015-11-25 
23:51:20.000000000 +0100
+++ new/cabal-helper-0.7.2.0/CabalHelper/Main.hs        2016-07-29 
15:03:02.000000000 +0200
@@ -14,7 +14,7 @@
 -- You should have received a copy of the GNU Affero General Public License
 -- along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-{-# LANGUAGE CPP, BangPatterns, RecordWildCards #-}
+{-# LANGUAGE CPP, BangPatterns, RecordWildCards, RankNTypes #-}
 {-# OPTIONS_GHC -fno-warn-deprecations #-}
 import Distribution.Simple.Utils (cabalVersion)
 import Distribution.Simple.Configure
@@ -48,10 +48,10 @@
                                            externalPackageDeps,
                                            withComponentsLBI,
                                            withLibLBI)
-#if CABAL_MAJOR == 1 && CABAL_MINOR <= 22
+#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23
+import Distribution.Simple.LocalBuildInfo (localUnitId)
+#elif CABAL_MAJOR == 1 && CABAL_MINOR <= 22
 import Distribution.Simple.LocalBuildInfo (inplacePackageId)
-#else
-import Distribution.Simple.LocalBuildInfo (localComponentId)
 #endif
 
 import Distribution.Simple.GHC (componentGhcOptions)
@@ -204,8 +204,7 @@
       return $ Just $ ChResponseFlags $ sort nonDefaultFlags
 
     "write-autogen-files":[] -> do
-       -- calls writeAutogenFiles
-      initialBuildSteps distdir pd lbi v
+      initialBuildStepsForAllComponents distdir pd lbi v
       return Nothing
 
     "compiler-version":[] -> do
@@ -307,10 +306,10 @@
   readIORef lr
 
 getLibraryClbi pd lbi = unsafePerformIO $ do
-  lr <- newIORef (error "getLibraryClbi: empty IORef")
+  lr <- newIORef Nothing
 
   withLibLBI pd lbi $ \ lib clbi ->
-      writeIORef lr (lib,clbi)
+      writeIORef lr $ Just (lib,clbi)
 
   readIORef lr
 
@@ -328,6 +327,8 @@
 
     lr <- newIORef []
 
+    -- withComponentsLBI is deprecated but also exists in very old versions
+    -- it's equivalent to withAllComponentsInBuildOrder in newer versions
     withComponentsLBI pd lbi $ \c clbi -> do
         let bi = componentBuildInfo c
             name = componentNameFromComponent c
@@ -354,12 +355,20 @@
 componentOptions (lbi, v, distdir) inplaceFlag flags f =
     componentOptions' (lbi, v, distdir) inplaceFlag flags renderGhcOptions' f
 
-componentNameToCh CLibName = ChLibName
+#if CABAL_MAJOR == 1 && CABAL_MINOR < 25
+componentNameToCh CLibName = ChLibName ""
+#elif CABAL_MAJOR == 1 && CABAL_MINOR >= 25
+componentNameToCh (CLibName n) = ChLibName n
+#endif
 componentNameToCh (CExeName n) = ChExeName n
 componentNameToCh (CTestName n) = ChTestName n
 componentNameToCh (CBenchName n) = ChBenchName n
 
+#if CABAL_MAJOR == 1 && CABAL_MINOR < 25
 componentNameFromComponent (CLib Library {}) = CLibName
+#elif CABAL_MAJOR == 1 && CABAL_MINOR >= 25
+componentNameFromComponent (CLib Library {..}) = CLibName libName
+#endif
 componentNameFromComponent (CExe Executable {..}) = CExeName exeName
 componentNameFromComponent (CTest TestSuite {..}) = CTestName testName
 componentNameFromComponent (CBench Benchmark {..}) = CBenchName benchmarkName
@@ -408,28 +417,34 @@
                   -> ComponentLocalBuildInfo
                   -> (ComponentLocalBuildInfo, GhcOptions)
 removeInplaceDeps v lbi pd clbi = let
-    (lib, libclbi) = getLibraryClbi pd lbi
-    libbi = libBuildInfo lib
-    liboutdir = componentOutDir lbi (CLib lib)
-    libopts = (componentGhcOptions normal lbi libbi libclbi liboutdir) {
-                                      ghcOptPackageDBs = []
-#if CABAL_MAJOR == 1 && CABAL_MINOR > 22
-                                    , ghcOptComponentId = NoFlag
-#endif
-                                  }
-
     (ideps, deps) = partition isInplaceDep (componentPackageDeps clbi)
     hasIdeps = not $ null ideps
+    libopts =
+      case getLibraryClbi pd lbi of
+        Just (lib, libclbi) | hasIdeps ->
+          let
+            libbi = libBuildInfo lib
+            liboutdir = componentOutDir lbi (CLib lib)
+          in
+            (componentGhcOptions normal lbi libbi libclbi liboutdir) {
+                ghcOptPackageDBs = []
+#if CABAL_MAJOR == 1 && CABAL_MINOR > 22 && CABAL_MINOR < 23
+              , ghcOptComponentId = NoFlag
+#endif
+
+            }
+        _ -> mempty
     clbi' = clbi { componentPackageDeps = deps }
 
-  in (clbi', if hasIdeps then libopts else mempty)
+  in (clbi', libopts)
 
  where
    isInplaceDep :: (InstalledPackageId, PackageId) -> Bool
-#if CABAL_MAJOR == 1 && CABAL_MINOR <= 22
+#if CABAL_MAJOR == 1 && CABAL_MINOR >= 23
+   isInplaceDep (ipid, pid) = localUnitId lbi == ipid
+#elif CABAL_MAJOR == 1 && CABAL_MINOR <= 22
    isInplaceDep (ipid, pid) = inplacePackageId pid == ipid
-#else
-   isInplaceDep (ipid, pid) = localComponentId lbi == ipid
+
 #endif
 
 
@@ -440,11 +455,29 @@
 nubPackageFlags opts = opts { ghcOptPackages = nub $ ghcOptPackages opts }
 #endif
 
+renderGhcOptions' :: LocalBuildInfo
+                  -> Verbosity
+                  -> GhcOptions
+                  -> IO [String]
 renderGhcOptions' lbi v opts = do
 #if CABAL_MAJOR == 1 && CABAL_MINOR < 20
   (ghcProg, _) <- requireProgram v ghcProgram (withPrograms lbi)
   let Just ghcVer = programVersion ghcProg
   return $ renderGhcOptions ghcVer opts
-#else
+#elif CABAL_MAJOR == 1 && CABAL_MINOR >= 20 && CABAL_MINOR < 24
+-- && CABAL_MINOR < 24
   return $ renderGhcOptions (compiler lbi) opts
+#elif CABAL_MAJOR == 1 && CABAL_MINOR >= 24
+--  CABAL_MAJOR == 1 && CABAL_MINOR >= 24
+  return $ renderGhcOptions (compiler lbi) (hostPlatform lbi) opts
+#endif
+
+
+#if CABAL_MAJOR == 1 && CABAL_MINOR < 25
+initialBuildStepsForAllComponents distdir pd lbi v =
+  initialBuildSteps distdir pd lbi v
+#elif CABAL_MAJOR == 1 && CABAL_MINOR >= 25
+initialBuildStepsForAllComponents distdir pd lbi v =
+  withComponentsLBI pd lbi $ \_c clbi ->
+    initialBuildSteps distdir pd lbi clbi v
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/CabalHelper/Types.hs 
new/cabal-helper-0.7.2.0/CabalHelper/Types.hs
--- old/cabal-helper-0.6.3.1/CabalHelper/Types.hs       2015-09-23 
11:08:31.000000000 +0200
+++ new/cabal-helper-0.7.2.0/CabalHelper/Types.hs       2016-07-29 
15:03:02.000000000 +0200
@@ -24,7 +24,7 @@
     deriving (Eq, Ord, Read, Show, Generic)
 
 data ChComponentName = ChSetupHsName
-                     | ChLibName
+                     | ChLibName String
                      | ChExeName String
                      | ChTestName String
                      | ChBenchName String
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/Distribution/Helper.hs 
new/cabal-helper-0.7.2.0/Distribution/Helper.hs
--- old/cabal-helper-0.6.3.1/Distribution/Helper.hs     2016-01-17 
21:26:39.000000000 +0100
+++ new/cabal-helper-0.7.2.0/Distribution/Helper.hs     2016-07-29 
15:03:02.000000000 +0200
@@ -95,7 +95,7 @@
 import GHC.Generics
 import Prelude
 
-import Paths_cabal_helper (getLibexecDir)
+import Paths_cabal_helper (getLibexecDir, version)
 import CabalHelper.Types hiding (Options(..))
 import CabalHelper.Sandbox
 
@@ -295,7 +295,7 @@
                  , "--with-ghc-pkg=" ++ ghcPkgProgram qePrograms
                  , "--with-cabal="   ++ cabalProgram qePrograms
                  ]
-  exe  <- findLibexecExe "cabal-helper-wrapper"
+  exe  <- findLibexecExe
   let args' = progArgs ++ qeProjectDir:qeDistDir:args
   out <- qeReadProcess exe args' ""
   (Right <$> evaluate out) `E.catch` \(SomeException _) ->
@@ -353,7 +353,7 @@
         -> FilePath
         -> m ()
 prepare readProc projdir distdir = liftIO $ do
-  exe  <- findLibexecExe "cabal-helper-wrapper"
+  exe  <- findLibexecExe
   void $ readProc exe [projdir, distdir] ""
 
 {-# DEPRECATED prepare
@@ -374,7 +374,7 @@
                   -- ^ Path to the @dist/@ directory
                   -> m ()
 writeAutogenFiles readProc projdir distdir = liftIO $ do
-  exe  <- findLibexecExe "cabal-helper-wrapper"
+  exe  <- findLibexecExe
   void $ readProc exe [projdir, distdir, "write-autogen-files"] ""
 
 {-# DEPRECATED writeAutogenFiles
@@ -398,7 +398,7 @@
 
 buildPlatform :: (FilePath -> [String] -> String -> IO String) -> IO String
 buildPlatform readProc = do
-  exe  <- findLibexecExe "cabal-helper-wrapper"
+  exe  <- findLibexecExe
   CabalHelper.Sandbox.dropWhileEnd isSpace <$> readProc exe 
["print-build-platform"] ""
 
 -- | This exception is thrown by all 'runQuery' functions if the internal
@@ -412,10 +412,11 @@
   show (LibexecNotFoundError exe dir) =
     libexecNotFoundError exe dir 
"https://github.com/DanielG/cabal-helper/issues";
 
-findLibexecExe :: String -> IO FilePath
-findLibexecExe "cabal-helper-wrapper" = do
+findLibexecExe :: IO FilePath
+findLibexecExe = do
     libexecdir <- getLibexecDir
-    let exeName = "cabal-helper-wrapper"
+    let Version (mj:mi:_) _ = version
+        exeName = "cabal-helper-wrapper-v" ++ show mj ++ "." ++ show mi
         exe = libexecdir </> exeName <.> exeExtension'
 
     exists <- doesFileExist exe
@@ -429,7 +430,6 @@
                error $ throw $ LibexecNotFoundError exeName libexecdir
            Just dir ->
                return $ dir </> "dist" </> "build" </> exeName </> exeName
-findLibexecExe exe = error $ "findLibexecExe: Unknown executable: " ++ exe
 
 tryFindCabalHelperTreeLibexecDir :: IO (Maybe FilePath)
 tryFindCabalHelperTreeLibexecDir = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/cabal-helper.cabal 
new/cabal-helper-0.7.2.0/cabal-helper.cabal
--- old/cabal-helper-0.6.3.1/cabal-helper.cabal 2016-01-18 20:53:46.000000000 
+0100
+++ new/cabal-helper-0.7.2.0/cabal-helper.cabal 2016-07-29 15:03:02.000000000 
+0200
@@ -1,9 +1,9 @@
 name:                cabal-helper
-version:             0.6.3.1
+version:             0.7.2.0
 synopsis:            Simple interface to some of Cabal's configuration state 
used by ghc-mod
 description:
-    @cabal-helper@ provides a library which wraps the internal use of
-    anexecutable to lift the restrictions imposed by linking against versions 
of
+    @cabal-helper@ provides a library which wraps the internal use of an
+    executable to lift the restrictions imposed by linking against versions of
     GHC before @7.10@. This has the pleasant side effect of isolating the user
     from having to deal with Cabal version changes manually as @cabal-helper@
     can simply recompile it's helper program automatically as needed.
@@ -48,16 +48,16 @@
                      , CabalHelper.Sandbox
   default-language:    Haskell2010
   GHC-Options:         -Wall
-  Build-Depends:       base >= 4.5 && < 5
-                     , Cabal >= 1.14 && < 1.23
-                     , directory
-                     , filepath
-                     , transformers
-                     , mtl
-                     , process
+  Build-Depends:       base          < 5    && >= 4.5
+                     , Cabal         < 1.26 && >= 1.14
+                     , directory     < 1.3  && >= 1.1.0.2
+                     , filepath      < 1.5  && >= 1.3.0.0
+                     , transformers  < 0.6  && >= 0.3.0.0
+                     , mtl           < 2.3  && >= 2.0
+                     , process       < 1.5  && >= 1.1.0.1
                      , ghc-prim
 
-Executable cabal-helper-wrapper
+Executable cabal-helper-wrapper-v0.7
   Default-Language:    Haskell2010
   Other-Extensions:    TemplateHaskell
   Main-Is:             CabalHelper/Wrapper.hs
@@ -71,16 +71,18 @@
                        CabalHelper.Sandbox
   GHC-Options:         -Wall
   X-Install-Target:    $libexecdir
-  Build-Depends:       base >= 4.5 && < 5
-                     , bytestring
-                     , Cabal >= 1.14 && < 1.23
-                     , directory
-                     , filepath
-                     , process
-                     , transformers
+  Build-Depends:       base             < 5    && >= 4.5
+                     , Cabal            < 1.26 && >= 1.14
+                     , bytestring       < 0.11 && >= 0.9.2.1
+                     , directory        < 1.3  && >= 1.1.0.2
+                     , filepath         < 1.5  && >= 1.3.0.0
+                     , transformers     < 0.6  && >= 0.3.0.0
+                     , mtl              < 2.3  && >= 2.0
+                     , process          < 1.5  && >= 1.1.0.1
+                     , temporary        < 1.3  && >= 1.2.0.4
+                     , utf8-string      < 1.1  && >= 1.0.1.1
+
                      , template-haskell
-                     , temporary
-                     , utf8-string
                      , ghc-prim
 
 Test-Suite spec
@@ -98,18 +100,54 @@
   Hs-Source-Dirs:      tests, .
   GHC-Options:         -Wall
   Build-Tools:         cabal
-  Build-Depends:       base >= 4.5 && < 5
-                     , cabal-helper
-                     , extra
-                     , unix
-                     , Cabal >= 1.14 && < 1.23
-                     , directory
-                     , filepath
-                     , transformers
-                     , mtl
-                     , process
-                     , ghc-prim
-                     , bytestring
-                     , utf8-string
+  Build-Depends:       base             < 5    && >= 4.5
+                     , Cabal            < 1.26 && >= 1.14
+                     , bytestring       < 0.11 && >= 0.9.2.1
+                     , directory        < 1.3  && >= 1.1.0.2
+                     , filepath         < 1.5  && >= 1.3.0.0
+                     , transformers     < 0.6  && >= 0.3.0.0
+                     , mtl              < 2.3  && >= 2.0
+                     , process          < 1.5  && >= 1.1.0.1
+                     , temporary        < 1.3  && >= 1.2.0.4
+                     , utf8-string      < 1.1  && >= 1.0.1.1
+
+                     -- additional test deps
+                     , extra            < 1.5  && >= 1.4.10
+                     , unix             < 2.8  && >= 2.5.1.0
+
                      , template-haskell
-                     , temporary
+                     , ghc-prim
+                     , cabal-helper
+
+
+
+
+-- custom-setup
+--   setup-depends: base,
+--                  Cabal,
+--                  filepath
+
+-- TODO: Use cabal_macros.h to replace -D flags by including it in
+-- CabalHelper.Data
+--
+-- Executable cabal-helper-main
+--   if flag(dev)
+--     Buildable:         True
+--   else
+--     Buildable:         False
+--   Default-Language:    Haskell2010
+--   Default-Extensions:  NondecreasingIndentation
+--   Main-Is:             CabalHelper/Main.hs
+--   Other-Modules:
+--   GHC-Options:         -Wall -fno-warn-unused-imports -optP-DCABAL_MAJOR=1 
-optP-DCABAL_MINOR=25 -optP-DCABAL_HELPER=1 -optP-DCABAL_HELPER_DEV=1
+--   Build-Depends:       base
+--                      , Cabal
+--                      , containers
+--                      , bytestring
+--                      , filepath
+--                      , directory
+--
+-- flag dev
+--   description: Build development components
+--   default:     False
+--   manual:      True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-helper-0.6.3.1/tests/Spec.hs 
new/cabal-helper-0.7.2.0/tests/Spec.hs
--- old/cabal-helper-0.6.3.1/tests/Spec.hs      2016-01-17 22:21:02.000000000 
+0100
+++ new/cabal-helper-0.7.2.0/tests/Spec.hs      2016-07-29 15:03:02.000000000 
+0200
@@ -14,6 +14,7 @@
 import CabalHelper.Compile
 import CabalHelper.Types
 
+
 main :: IO ()
 main = do
   flip (setEnv "HOME") True =<< fromMaybe "/tmp" <$> lookupEnv "TMPDIR"
@@ -21,8 +22,11 @@
 
   writeAutogenFiles' $ defaultQueryEnv "." "./dist"
 
-  let vers :: [(Version, [Version])]
-      vers = map (parseVer *** map parseVer) [
+  let parseVer' "HEAD" = Left HEAD
+      parseVer' v = Right $ parseVer v
+
+  let vers :: [(Version, [Either HEAD Version])]
+      vers = map (parseVer *** map parseVer') [
                ("7.4", [ -- "1.14.0" -- not supported at runtime
                        ]),
 
@@ -57,14 +61,18 @@
                        , "1.22.4.0"
                        , "1.22.5.0"
                        , "1.22.6.0"
+                       , "1.22.7.0"
+                       , "1.22.8.0"
                        ]),
                ("8.0", [
+                         "1.24.0.0"
+                       , "HEAD"
                        ])
              ]
 
   ghcVer <- majorVer <$> ghcVersion defaultOptions
 
-  let cabalVers = concat $ map snd $ dropWhile ((<ghcVer) . fst)  vers
+  let cabalVers = reverse $ concat $ map snd $ dropWhile ((<ghcVer) . fst) vers
 
   rvs <- mapM compilePrivatePkgDb cabalVers
 
@@ -75,16 +83,28 @@
    isLeft' (Left _) = True
    isLeft' (Right _) = False
 
-compilePrivatePkgDb :: Version -> IO (Either ExitCode FilePath)
-compilePrivatePkgDb cabalVer = do
-    _ <- rawSystem "rm" [ "-r", "/tmp/.ghc-mod" ]
-    db <- installCabal defaultOptions cabalVer `E.catch`
-          \(SomeException _) -> errorInstallCabal cabalVer "dist"
-    compileWithPkg "." (Just db) cabalVer
+data HEAD = HEAD deriving (Show)
 
-compileWithPkg :: FilePath -> Maybe FilePath -> Version -> IO (Either ExitCode 
FilePath)
+compilePrivatePkgDb :: Either HEAD Version -> IO (Either ExitCode FilePath)
+compilePrivatePkgDb (Left HEAD) = do
+    _ <- rawSystem "rm" [ "-r", "/tmp/.ghc-mod" ]
+    (db, commit) <- installCabalHEAD defaultOptions { verbose = True } 
`E.catch`
+        \(SomeException ex) -> error $ "Installing cabal HEAD failed: " ++ 
show ex
+    compileWithPkg "." (Just db) (Left commit)
+compilePrivatePkgDb (Right cabalVer) = do
+    _ <- rawSystem "rm" [ "-r", "/tmp/.ghc-mod" ]
+    db <- installCabal defaultOptions { verbose = True } cabalVer `E.catch`
+        \(SomeException _) -> errorInstallCabal cabalVer "dist"
+    compileWithPkg "." (Just db) (Right cabalVer)
+
+compileWithPkg :: FilePath
+               -> Maybe FilePath
+               -> Either String Version
+               -> IO (Either ExitCode FilePath)
 compileWithPkg chdir mdb ver =
-    compile "dist" defaultOptions $ Compile chdir Nothing mdb ver [cabalPkgId 
ver]
+    compile "dist" defaultOptions { verbose = True } $
+      Compile chdir Nothing mdb ver [cabalPkgId ver]
 
-cabalPkgId :: Version -> String
-cabalPkgId v = "Cabal-" ++ showVersion v
+cabalPkgId :: Either String Version -> String
+cabalPkgId (Left _commitid) = "Cabal"
+cabalPkgId (Right v) = "Cabal-" ++ showVersion v


Reply via email to