Hello community,

here is the log from the commit of package ghc-gitrev for openSUSE:Factory 
checked in at 2017-08-31 20:51:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-gitrev (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-gitrev.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-gitrev"

Thu Aug 31 20:51:08 2017 rev:3 rq:513254 version:1.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-gitrev/ghc-gitrev.changes    2016-07-20 
09:21:35.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-gitrev.new/ghc-gitrev.changes       
2017-08-31 20:51:09.940067520 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:06:02 UTC 2017 - [email protected]
+
+- Update to version 1.3.1.
+
+-------------------------------------------------------------------

Old:
----
  gitrev-1.2.0.tar.gz

New:
----
  gitrev-1.3.1.tar.gz

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

Other differences:
------------------
++++++ ghc-gitrev.spec ++++++
--- /var/tmp/diff_new_pack.nIZOVt/_old  2017-08-31 20:51:11.147897974 +0200
+++ /var/tmp/diff_new_pack.nIZOVt/_new  2017-08-31 20:51:11.151897413 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-gitrev
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,22 +18,21 @@
 
 %global pkg_name gitrev
 Name:           ghc-%{pkg_name}
-Version:        1.2.0
+Version:        1.3.1
 Release:        0
 Summary:        Compile git revision info into Haskell projects
 License:        BSD-3-Clause
-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
 BuildRequires:  ghc-Cabal-devel
-# Begin cabal-rpm deps:
+BuildRequires:  ghc-base-compat-devel
 BuildRequires:  ghc-directory-devel
 BuildRequires:  ghc-filepath-devel
 BuildRequires:  ghc-process-devel
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-template-haskell-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
 
 %description
 Some handy Template Haskell splices for including the current git hash and
@@ -54,15 +53,12 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
-
 %post devel
 %ghc_pkg_recache
 

++++++ gitrev-1.2.0.tar.gz -> gitrev-1.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gitrev-1.2.0/gitrev.cabal 
new/gitrev-1.3.1/gitrev.cabal
--- old/gitrev-1.2.0/gitrev.cabal       2016-01-11 23:53:59.000000000 +0100
+++ new/gitrev-1.3.1/gitrev.cabal       2017-03-17 03:34:52.000000000 +0100
@@ -1,5 +1,5 @@
 name:                gitrev
-version:             1.2.0
+version:             1.3.1
 synopsis:            Compile git revision info into Haskell projects
 homepage:            https://github.com/acfoltzer/gitrev
 license:             BSD3
@@ -9,6 +9,7 @@
 category:            Development
 build-type:          Simple
 cabal-version:       >=1.10
+tested-with:         GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2
 description:         Some handy Template Haskell splices for including the 
current git hash and branch in the code of your project. Useful for including 
in panic messages, @--version@ output, or diagnostic info for more informative 
bug reports.
 
 source-repository head
@@ -17,10 +18,12 @@
 
 library
   build-depends:       base >= 4.6 && < 5,
+                       base-compat >= 0.6.0,
                        directory,
                        filepath,
                        template-haskell,
                        process
   hs-source-dirs:      src
+  ghc-options:         -Wall
   default-language:    Haskell2010
   exposed-modules:     Development.GitRev
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gitrev-1.2.0/src/Development/GitRev.hs 
new/gitrev-1.3.1/src/Development/GitRev.hs
--- old/gitrev-1.2.0/src/Development/GitRev.hs  2016-01-11 23:53:59.000000000 
+0100
+++ new/gitrev-1.3.1/src/Development/GitRev.hs  2017-03-17 03:34:52.000000000 
+0100
@@ -1,3 +1,6 @@
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE MultiWayIf #-}
+
 -- |
 -- Module      :  $Header$
 -- Copyright   :  (c) 2015 Adam C. Foltzer
@@ -29,9 +32,16 @@
 -- > % cabal exec runhaskell Example.hs
 -- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon 
Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] 
oh no!
 
-module Development.GitRev (gitHash, gitBranch, gitDirty, gitCommitCount, 
gitCommitDate) where
+module Development.GitRev
+  ( gitBranch
+  , gitCommitCount
+  , gitCommitDate
+  , gitDescribe
+  , gitDirty
+  , gitDirtyTracked
+  , gitHash
+  ) where
 
-import Control.Applicative
 import Control.Exception
 import Control.Monad
 import Data.Maybe
@@ -42,6 +52,9 @@
 import System.FilePath
 import System.Process
 
+import Prelude ()
+import Prelude.Compat
+
 -- | Run git with the given arguments and no stdin, returning the
 -- stdout output. If git isn't available or something goes wrong,
 -- return the second argument.
@@ -53,7 +66,7 @@
   if gitFound
     then do
       -- a lot of bookkeeping to record the right dependencies
-      pwd <- runIO getCurrentDirectory
+      pwd <- runIO getDotGit
       let hd         = pwd </> ".git" </> "HEAD"
           index      = pwd </> ".git" </> "index"
           packedRefs = pwd </> ".git" </> "packed-refs"
@@ -61,8 +74,7 @@
       when hdExists $ do
         -- the HEAD file either contains the hash of a detached head
         -- or a pointer to the file that contains the hash of the head
-        hdRef <- runIO $ readFile hd
-        case splitAt 5 hdRef of
+        splitAt 5 `fmap` runIO (readFile hd) >>= \case
           -- pointer to ref
           ("ref: ", relRef) -> do
             let ref = pwd </> ".git" </> relRef
@@ -85,6 +97,36 @@
           ExitFailure _ -> return def
     else return def
 
+-- | Determine where our @.git@ directory is, in case we're in a
+-- submodule.
+getDotGit :: IO FilePath
+getDotGit = do
+  pwd <- getGitRoot
+  let dotGit = pwd </> ".git"
+      oops = return dotGit -- it's gonna fail, that's fine
+  isDir <- doesDirectoryExist dotGit
+  isFile <- doesFileExist dotGit
+  if | isDir -> return dotGit
+     | not isFile -> oops
+     | isFile ->
+         splitAt 8 `fmap` readFile dotGit >>= \case
+           ("gitdir: ", relDir) -> do
+             isRelDir <- doesDirectoryExist relDir
+             if isRelDir
+               then return relDir
+               else oops
+           _ -> oops
+
+-- | Get the root directory of the Git repo.
+getGitRoot :: IO FilePath
+getGitRoot = do
+  pwd <- getCurrentDirectory
+  (code, out, _) <-
+    readProcessWithExitCode "git" ["rev-parse", "--show-toplevel"] ""
+  case code of
+    ExitSuccess   -> return $ takeWhile (/= '\n') out
+    ExitFailure _ -> return pwd -- later steps will fail, that's fine
+
 -- | Type to flag if the git index is used or not in a call to runGit
 data IndexUsed = IdxUsed -- ^ The git index is used
                | IdxNotUsed -- ^ The git index is /not/ used
@@ -103,6 +145,12 @@
 gitBranch =
   stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
 
+-- | Return the long git description for the current git commit, or
+-- @UNKNOWN@ if not in a git repository.
+gitDescribe :: ExpQ
+gitDescribe =
+  stringE =<< runGit ["describe", "--long", "--always"] "UNKNOWN" IdxNotUsed
+
 -- | Return @True@ if there are non-committed files present in the
 -- repository
 gitDirty :: ExpQ
@@ -111,6 +159,15 @@
   case output of
     "" -> conE falseName
     _  -> conE trueName
+
+-- | Return @True@ if there are non-commited changes to tracked files
+-- present in the repository
+gitDirtyTracked :: ExpQ
+gitDirtyTracked = do
+  output <- runGit ["status", "--porcelain","--untracked-files=no"] "" IdxUsed
+  case output of
+    "" -> conE falseName
+    _  -> conE trueName
 
 -- | Return the number of commits in the current head
 gitCommitCount :: ExpQ


Reply via email to