Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-th-compat for openSUSE:Factory 
checked in at 2022-10-13 15:43:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-th-compat (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-th-compat.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-th-compat"

Thu Oct 13 15:43:12 2022 rev:7 rq:1008526 version:0.1.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-th-compat/ghc-th-compat.changes      
2022-08-01 21:31:05.805776583 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-th-compat.new.2275/ghc-th-compat.changes    
2022-10-13 15:43:26.750890267 +0200
@@ -1,0 +2,10 @@
+Sat Jul 23 18:06:54 UTC 2022 - Peter Simons <[email protected]>
+
+- Update th-compat to version 0.1.4.
+  ### 0.1.4 [2022.07.23]
+  * Backport the `getPackageRoot` and `makeRelativeToProject` functions
+    introduced in `template-haskell-2.19.0.0` (GHC 9.4).
+  * Implement `qGetPackageRoot` in the `Quasi` instance for `QuoteToQuasi` when
+    building with `template-haskell-2.19.0.0` (GHC 9.4) or later.
+
+-------------------------------------------------------------------

Old:
----
  th-compat-0.1.3.tar.gz
  th-compat.cabal

New:
----
  th-compat-0.1.4.tar.gz

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

Other differences:
------------------
++++++ ghc-th-compat.spec ++++++
--- /var/tmp/diff_new_pack.JWeOem/_old  2022-10-13 15:43:27.274891290 +0200
+++ /var/tmp/diff_new_pack.JWeOem/_new  2022-10-13 15:43:27.282891305 +0200
@@ -19,14 +19,15 @@
 %global pkg_name th-compat
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1.3
+Version:        0.1.4
 Release:        0
 Summary:        Backward- (and forward-)compatible Quote and Code types
 License:        BSD-3-Clause
 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#/%{pkg_name}.cabal
 BuildRequires:  ghc-Cabal-devel
+BuildRequires:  ghc-directory-devel
+BuildRequires:  ghc-filepath-devel
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-template-haskell-devel
 ExcludeArch:    %{ix86}
@@ -39,10 +40,11 @@
 %description
 This package defines a "Language.Haskell.TH.Syntax.Compat" module, which
 backports the 'Quote' and 'Code' types to work across a wide range of
-'template-haskell' versions. On recent versions of 'template-haskell' (2.17.0.0
-or later), this module simply reexports 'Quote' and 'Code' from
-"Language.Haskell.TH.Syntax". Refer to the Haddocks for
-"Language.Haskell.TH.Syntax.Compat" for examples of how to use this module.
+'template-haskell' versions. The 'makeRelativeToProject' utility is also
+backported. On recent versions of 'template-haskell' (2.17.0.0 or later), this
+module simply reexports definitions from "Language.Haskell.TH.Syntax".
+Refer to the Haddocks for "Language.Haskell.TH.Syntax.Compat" for examples of
+how to use this module.
 
 %package devel
 Summary:        Haskell %{pkg_name} library development files
@@ -56,7 +58,6 @@
 
 %prep
 %autosetup -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
 
 %build
 %ghc_lib_build

++++++ th-compat-0.1.3.tar.gz -> th-compat-0.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/th-compat-0.1.3/CHANGELOG.md 
new/th-compat-0.1.4/CHANGELOG.md
--- old/th-compat-0.1.3/CHANGELOG.md    2001-09-09 03:46:40.000000000 +0200
+++ new/th-compat-0.1.4/CHANGELOG.md    2001-09-09 03:46:40.000000000 +0200
@@ -1,3 +1,9 @@
+### 0.1.4 [2022.07.23]
+* Backport the `getPackageRoot` and `makeRelativeToProject` functions
+  introduced in `template-haskell-2.19.0.0` (GHC 9.4).
+* Implement `qGetPackageRoot` in the `Quasi` instance for `QuoteToQuasi` when
+  building with `template-haskell-2.19.0.0` (GHC 9.4) or later.
+
 ### 0.1.3 [2021.08.29]
 * Implement `qGetDoc` and `qPutDoc` in the `Quasi` instance for `QuoteToQuasi`.
 * Add `expToSplice`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/th-compat-0.1.3/src/Language/Haskell/TH/Syntax/Compat.hs 
new/th-compat-0.1.4/src/Language/Haskell/TH/Syntax/Compat.hs
--- old/th-compat-0.1.3/src/Language/Haskell/TH/Syntax/Compat.hs        
2001-09-09 03:46:40.000000000 +0200
+++ new/th-compat-0.1.4/src/Language/Haskell/TH/Syntax/Compat.hs        
2001-09-09 03:46:40.000000000 +0200
@@ -6,6 +6,7 @@
 {-# LANGUAGE KindSignatures #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE UndecidableInstances #-}
 
 #if __GLASGOW_HASKELL__ >= 702
@@ -29,6 +30,8 @@
 --
 -- * The 'Code' type
 --
+-- * The 'getPackageRoot' and 'makeRelativeToProject' utility functions
+--
 -- Refer to the Haddocks below for examples of how to use each of these in a
 -- backwards-compatible way.
 module Language.Haskell.TH.Syntax.Compat (
@@ -82,6 +85,10 @@
   , unTypeSplice
   , expToSplice
 #endif
+
+  -- * Package root functions
+  , getPackageRoot
+  , makeRelativeToProject
   ) where
 
 import qualified Control.Monad.Fail as Fail
@@ -109,6 +116,13 @@
 import Language.Haskell.TH (Name)
 #endif
 
+#if MIN_VERSION_template_haskell(2,19,0)
+import Language.Haskell.TH.Syntax (getPackageRoot, makeRelativeToProject)
+#else
+import System.FilePath (isRelative, takeExtension, takeDirectory, (</>))
+import System.Directory (getDirectoryContents, canonicalizePath)
+#endif
+
 -------------------------------------------------------------------------------
 -- Quote
 -------------------------------------------------------------------------------
@@ -446,6 +460,9 @@
   qGetDoc             = qtqError "qGetDoc"
   qPutDoc             = qtqError "qPutDoc"
 #endif
+#if MIN_VERSION_template_haskell(2,19,0)
+  qGetPackageRoot     = qtqError "qGetPackageRoot"
+#endif
 
 -------------------------------------------------------------------------------
 -- Code
@@ -864,7 +881,7 @@
 --      'examineSplice' [|| sum $$(expToSplice (listTE ints)) ||]
 -- @
 --
--- @since ????.??.??
+-- @since 0.1.3
 expToSplice :: Applicative m => Syntax.TExp a -> Splice m a
 expToSplice a = liftSplice $ pure a
 
@@ -1055,3 +1072,61 @@
 unTypeSplice = unTypeQQuote
 # endif
 #endif
+
+-------------------------------------------------------------------------------
+-- Package root
+-------------------------------------------------------------------------------
+
+#if !MIN_VERSION_template_haskell(2,19,0)
+
+-- | Get the package root for the current package which is being compiled.
+-- This can be set explicitly with the -package-root flag but is normally
+-- just the current working directory.
+--
+-- The motivation for this flag is to provide a principled means to remove the
+-- assumption from splices that they will be executed in the directory where 
the
+-- cabal file resides. Projects such as haskell-language-server can't and don't
+-- change directory when compiling files but instead set the -package-root flag
+-- appropiately.
+--
+-- This is best-effort compatibility implementation.
+-- This function looks at the source location of the Haskell file calling it,
+-- finds the first parent directory with a @.cabal@ file, and uses that as the
+-- root directory for fixing the relative path.
+--
+getPackageRoot :: Q FilePath
+getPackageRoot = getPackageRootPredicate $ (==) ".cabal" . takeExtension
+
+-- The implementation is modified from the makeRelativeToLocationPredicate
+-- function in the file-embed package
+-- Copyright 2008, Michael Snoyman. All rights reserved.
+-- under BSD-2-Clause license.
+getPackageRootPredicate :: (FilePath -> Bool) -> Q FilePath
+getPackageRootPredicate isTargetFile = do
+    loc <- qLocation
+    (srcFP, mdir) <- Syntax.runIO $ do
+        srcFP <- canonicalizePath $ Syntax.loc_filename loc
+        mdir <- findProjectDir srcFP
+        return (srcFP, mdir)
+    case mdir of
+        Nothing  -> fail $ "Could not find .cabal file for path: " ++ srcFP
+        Just dir -> return dir
+  where
+    findProjectDir x = do
+        let dir = takeDirectory x
+        if dir == x
+        then return Nothing
+        else do
+            contents <- getDirectoryContents dir
+            if any isTargetFile contents
+            then return (Just dir)
+            else findProjectDir dir
+
+-- | The input is a filepath, which if relative is offset by the package root.
+makeRelativeToProject :: FilePath -> Q FilePath
+makeRelativeToProject fp | isRelative fp = do
+  root <- getPackageRoot
+  return (root </> fp)
+makeRelativeToProject fp = return fp
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/th-compat-0.1.3/th-compat.cabal 
new/th-compat-0.1.4/th-compat.cabal
--- old/th-compat-0.1.3/th-compat.cabal 2001-09-09 03:46:40.000000000 +0200
+++ new/th-compat-0.1.4/th-compat.cabal 2001-09-09 03:46:40.000000000 +0200
@@ -1,12 +1,13 @@
 cabal-version:       >=1.10
 name:                th-compat
-version:             0.1.3
+version:             0.1.4
 synopsis:            Backward- (and forward-)compatible Quote and Code types
 description:         This package defines a "Language.Haskell.TH.Syntax.Compat"
                      module, which backports the @Quote@ and @Code@ types to
                      work across a wide range of @template-haskell@ versions.
+                     The @makeRelativeToProject@ utility is also backported.
                      On recent versions of @template-haskell@ (2.17.0.0 or
-                     later), this module simply reexports @Quote@ and @Code@
+                     later), this module simply reexports definitions
                      from "Language.Haskell.TH.Syntax". Refer to the Haddocks
                      for "Language.Haskell.TH.Syntax.Compat" for examples of
                      how to use this module.
@@ -31,8 +32,9 @@
                    , GHC == 8.6.5
                    , GHC == 8.8.4
                    , GHC == 8.10.7
-                   , GHC == 9.0.1
-                   , GHC == 9.2.*
+                   , GHC == 9.0.2
+                   , GHC == 9.2.3
+                   , GHC == 9.4.1
 extra-source-files:  CHANGELOG.md, README.md
 
 source-repository head
@@ -42,10 +44,13 @@
 library
   exposed-modules:     Language.Haskell.TH.Syntax.Compat
   build-depends:       base             >= 4.3 && < 5
-                     , template-haskell >= 2.5 && < 2.19
+                     , template-haskell >= 2.5 && < 2.20
   if !impl(ghc >= 8.0)
     build-depends:     fail             == 4.9.*
-                     , transformers     >= 0.2 && < 0.6
+                     , transformers     >= 0.2 && < 0.7
+  if !impl(ghc >= 9.4)
+    build-depends:     filepath         >= 1.2.0.0 && < 1.5
+                     , directory        >= 1.1.0.0 && < 1.4
   hs-source-dirs:      src
   default-language:    Haskell2010
   ghc-options:         -Wall
@@ -60,8 +65,8 @@
   build-depends:       base             >= 4.3 && < 5
                      , base-compat      >= 0.6 && < 0.13
                      , hspec            >= 2   && < 3
-                     , mtl              >= 2.1 && < 2.3
-                     , template-haskell >= 2.5 && < 2.19
+                     , mtl              >= 2.1 && < 2.4
+                     , template-haskell >= 2.5 && < 2.20
                      , th-compat
   build-tool-depends:  hspec-discover:hspec-discover >= 2
   hs-source-dirs:      tests

Reply via email to