Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-hslua-cli for openSUSE:Factory 
checked in at 2023-04-14 13:12:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hslua-cli (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-hslua-cli.new.19717 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-hslua-cli"

Fri Apr 14 13:12:59 2023 rev:2 rq:1079181 version:1.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-hslua-cli/ghc-hslua-cli.changes      
2023-04-04 21:20:39.557278165 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-hslua-cli.new.19717/ghc-hslua-cli.changes   
2023-04-14 13:13:07.651580808 +0200
@@ -1,0 +2,31 @@
+Thu Apr 13 17:19:32 UTC 2023 - Peter Simons <[email protected]>
+
+- Update hslua-cli to version 1.4.1.
+  ## hslua-cli-1.4.1
+
+  Released 2023-03-18.
+
+  -   Always start the REPL if the `-i` parameter is given on the
+      command line. This fixes a bug where the REPL would not start
+      if `-v`, `-e` or `-l` where given.
+
+  ## hslua-cli-1.4.0.1
+
+  Released 2023-03-17.
+
+  -   Fix building on Windows.
+
+  ## hslua-cli-1.4.0
+
+  Released 2023-03-16.
+
+  -   Isocline-based REPL: interactive mode is now supported with
+      the help of a new repl built with the isocline library.
+
+  ## hslua-cli-1.3.0
+
+  Released 2023-03-13.
+
+  -   Require hslua-core 2.3.
+
+-------------------------------------------------------------------

Old:
----
  hslua-cli-1.2.0.tar.gz

New:
----
  hslua-cli-1.4.1.tar.gz

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

Other differences:
------------------
++++++ ghc-hslua-cli.spec ++++++
--- /var/tmp/diff_new_pack.LR0bks/_old  2023-04-14 13:13:08.651586527 +0200
+++ /var/tmp/diff_new_pack.LR0bks/_new  2023-04-14 13:13:08.699586801 +0200
@@ -19,7 +19,7 @@
 %global pkg_name hslua-cli
 %global pkgver %{pkg_name}-%{version}
 Name:           ghc-%{pkg_name}
-Version:        1.2.0
+Version:        1.4.1
 Release:        0
 Summary:        Command-line interface for Lua
 License:        MIT
@@ -34,11 +34,15 @@
 BuildRequires:  ghc-hslua-core-prof
 BuildRequires:  ghc-hslua-marshalling-devel
 BuildRequires:  ghc-hslua-marshalling-prof
+BuildRequires:  ghc-hslua-repl-devel
+BuildRequires:  ghc-hslua-repl-prof
 BuildRequires:  ghc-lua-devel
 BuildRequires:  ghc-lua-prof
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-text-devel
 BuildRequires:  ghc-text-prof
+BuildRequires:  ghc-unix-devel
+BuildRequires:  ghc-unix-prof
 ExcludeArch:    %{ix86}
 
 %description

++++++ hslua-cli-1.2.0.tar.gz -> hslua-cli-1.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-cli-1.2.0/CHANGELOG.md 
new/hslua-cli-1.4.1/CHANGELOG.md
--- old/hslua-cli-1.2.0/CHANGELOG.md    2001-09-09 03:46:40.000000000 +0200
+++ new/hslua-cli-1.4.1/CHANGELOG.md    2001-09-09 03:46:40.000000000 +0200
@@ -2,6 +2,33 @@
 
 `hslua-cli` uses [PVP Versioning](https://pvp.haskell.org).
 
+## hslua-cli-1.4.1
+
+Released 2023-03-18.
+
+-   Always start the REPL if the `-i` parameter is given on the
+    command line. This fixes a bug where the REPL would not start
+    if `-v`, `-e` or `-l` where given.
+
+## hslua-cli-1.4.0.1
+
+Released 2023-03-17.
+
+-   Fix building on Windows.
+
+## hslua-cli-1.4.0
+
+Released 2023-03-16.
+
+-   Isocline-based REPL: interactive mode is now supported with
+    the help of a new repl built with the isocline library.
+
+## hslua-cli-1.3.0
+
+Released 2023-03-13.
+
+-   Require hslua-core 2.3.
+
 ## hslua-cli-1.2.0
 
 Released 2022-09-27.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-cli-1.2.0/LICENSE new/hslua-cli-1.4.1/LICENSE
--- old/hslua-cli-1.2.0/LICENSE 2001-09-09 03:46:40.000000000 +0200
+++ new/hslua-cli-1.4.1/LICENSE 2001-09-09 03:46:40.000000000 +0200
@@ -1,7 +1,7 @@
 Copyright © 1994-2022 Lua.org, PUC-Rio.
 Copyright © 2007-2012 Gracjan Polak
 Copyright © 2012-2015 Ömer Sinan Ağacan
-Copyright © 2016-2022 Albert Krewinkel
+Copyright © 2016-2023 Albert Krewinkel
 
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-cli-1.2.0/app/hslua.hs 
new/hslua-cli-1.4.1/app/hslua.hs
--- old/hslua-cli-1.2.0/app/hslua.hs    2001-09-09 03:46:40.000000000 +0200
+++ new/hslua-cli-1.4.1/app/hslua.hs    2001-09-09 03:46:40.000000000 +0200
@@ -2,9 +2,9 @@
 {-# LANGUAGE TypeApplications  #-}
 {- |
 Module      : Main
-Copyright   : © 2022 Albert Krewinkel
+Copyright   : © 2022-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <[email protected]>
+Maintainer  : Albert Krewinkel <[email protected]>
 
 Re-implementation of the standard Lua interpreter.
 -}
@@ -26,6 +26,7 @@
               setfield registryindex "LUA_NOENV"
             openlibs
             action
+        , settingsHistory = Just ".hslua-history"
         }
   prg  <- getProgName
   args <- getArgs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-cli-1.2.0/hslua-cli.cabal 
new/hslua-cli-1.4.1/hslua-cli.cabal
--- old/hslua-cli-1.2.0/hslua-cli.cabal 2001-09-09 03:46:40.000000000 +0200
+++ new/hslua-cli-1.4.1/hslua-cli.cabal 2001-09-09 03:46:40.000000000 +0200
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 name:                hslua-cli
-version:             1.2.0
+version:             1.4.1
 synopsis:            Command-line interface for Lua
 description:         Provides an embeddable command-line interface for Lua.
                      The interface is compatible with the standard Lua
@@ -11,20 +11,19 @@
 license:             MIT
 license-file:        LICENSE
 author:              Albert Krewinkel
-maintainer:          Albert Krewinkel <[email protected]>
-copyright:           © 2022 Albert Krewinkel
+maintainer:          Albert Krewinkel <[email protected]>
+copyright:           © 2022-2023 Albert Krewinkel
 category:            Foreign
 build-type:          Simple
 extra-doc-files:     README.md
                      CHANGELOG.md
-tested-with:         GHC == 8.0.2
-                   , GHC == 8.2.2
-                   , GHC == 8.4.4
+tested-with:         GHC == 8.4.4
                    , GHC == 8.6.5
                    , GHC == 8.8.4
                    , GHC == 8.10.7
                    , GHC == 9.0.2
-                   , GHC == 9.2.3
+                   , GHC == 9.2.5
+                   , GHC == 9.4.4
 
 source-repository head
   type:                git
@@ -38,7 +37,7 @@
 common common-options
   build-depends:       base              >= 4.9.1  && < 5
                      , bytestring
-                     , hslua-core        >= 2.1    && < 2.3
+                     , hslua-core        >= 2.3    && < 2.4
 
   ghc-options:         -Wall
                        -Wcompat
@@ -59,10 +58,15 @@
   import:              common-options
   hs-source-dirs:      src
   exposed-modules:     HsLua.CLI
-  build-depends:       base              >= 4.9.1  && < 5
-                     , hslua-marshalling >= 2.1    && < 2.3
-                     , lua               >= 2.1    && < 2.3
+  build-depends:       base              >= 4.11   && < 5
+                     , hslua-marshalling >= 2.2    && < 2.4
+                     , hslua-repl        >= 0.1    && < 0.2
+                     , lua               >= 2.3    && < 2.4
                      , text              >= 1.2    && < 2.1
+  if !os(windows)
+    build-depends:     unix              >= 2.7    && < 2.9
+  if os(windows)
+    cpp-options:         -D_WINDOWS
 
 executable hslua
   import:              common-options
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-cli-1.2.0/src/HsLua/CLI.hs 
new/hslua-cli-1.4.1/src/HsLua/CLI.hs
--- old/hslua-cli-1.2.0/src/HsLua/CLI.hs        2001-09-09 03:46:40.000000000 
+0200
+++ new/hslua-cli-1.4.1/src/HsLua/CLI.hs        2001-09-09 03:46:40.000000000 
+0200
@@ -2,10 +2,10 @@
 {-# LANGUAGE LambdaCase        #-}
 {-# LANGUAGE OverloadedStrings #-}
 {- |
-Module      : Text.Pandoc.Lua
-Copyright   : Copyright © 2017-2022 Albert Krewinkel
+Module      : HsLua.CLI
+Copyright   : Copyright © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <[email protected]>
+Maintainer  : Albert Krewinkel <[email protected]>
 
 Embeddable Lua interpreter interface.
 -}
@@ -16,28 +16,38 @@
   , EnvBehavior (..)
   ) where
 
-import Control.Monad (unless, when, zipWithM_)
+import Control.Monad (unless, void, when, zipWithM_)
 import Data.Bifunctor (first)
 import Data.ByteString (ByteString)
 import Data.Foldable (foldl')
 import Data.Maybe (listToMaybe)
 import Data.Text (Text)
 import Foreign.C.String (withCString)
-import Foreign.Ptr (nullPtr)
 import HsLua.Core (LuaE, LuaError)
+import HsLua.REPL (Config (..), defaultConfig, repl, setup)
 import System.Console.GetOpt
 import System.Environment (lookupEnv)
-import System.IO (hPutStrLn, stderr)
-import qualified Lua.Auxiliary as Lua
 import qualified Lua.Constants as Lua
 import qualified Lua.Primary as Lua
 import qualified HsLua.Core as Lua
-import qualified HsLua.Core.Types as Lua
 import qualified HsLua.Marshalling as Lua
 import qualified Data.Text as T
 import qualified Data.Text.IO as T
 import qualified HsLua.Core.Utf8 as UTF8
 
+#ifndef _WINDOWS
+import System.Posix.IO (stdOutput)
+import System.Posix.Terminal (queryTerminal)
+#endif
+
+-- | Whether the program is connected to a terminal
+istty :: IO Bool
+#ifdef _WINDOWS
+istty = pure True
+#else
+istty = queryTerminal stdOutput
+#endif
+
 -- | Settings for the Lua command line interface.
 --
 -- If env vars should be ignored, and the interpreter invokes
@@ -53,9 +63,12 @@
 --
 data Settings e = Settings
   { settingsVersionInfo :: Text
+    -- ^ Additional version info to present to the user. The current
+    -- Lua version will always be printed.
   , settingsRunner      :: EnvBehavior -> LuaE e () -> IO ()
     -- ^ The Lua interpreter to be used; the first argument indicates
     -- whether environment variables should be consulted or ignored.
+  , settingsHistory     :: Maybe FilePath
   }
 
 -- | Whether environment variables should be consulted or ignored.
@@ -84,7 +97,7 @@
 showVersion :: LuaError e => Text -> LuaE e ()
 showVersion extraInfo = do
   _ <- Lua.getglobal "_VERSION"
-  versionString <- Lua.forcePeek $ Lua.peekText Lua.top
+  versionString <- Lua.forcePeek $ Lua.peekText Lua.top `Lua.lastly` Lua.pop 1
   Lua.liftIO . T.putStrLn $ versionString `T.append` extraInfo
 
 -- | Runs code given on the command line
@@ -102,6 +115,10 @@
       then Lua.setglobal g
       else Lua.throwErrorAsException
 
+--
+-- Standalone
+--
+
 -- | Uses the first command line argument as the name of a script file
 -- and tries to run that script in Lua. Falls back to stdin if no file
 -- is given. Any remaining args are passed to Lua via the global table
@@ -117,11 +134,8 @@
                   then IgnoreEnvVars
                   else ConsultEnvVars
   settingsRunner settings envVarOpt $ do
-    let putErr = Lua.liftIO . hPutStrLn stderr
     -- print version info
     when (optVersion opts) (showVersion $ settingsVersionInfo settings)
-    when (optInteractive opts) $
-      putErr "[WARNING] Flag `-i` is not supported yet."
 
     -- push `arg` table
     case optScript opts of
@@ -137,18 +151,16 @@
         Lua.rawseti (Lua.nth 2) 0
     Lua.setglobal "arg"
 
-#if MIN_VERSION_lua(2,2,1)
     when (optWarnings opts) $ do
       l <- Lua.state
       -- turn warnings on
       Lua.liftIO $ withCString "@on" $ \w -> Lua.lua_warning l w Lua.FALSE
-#endif
 
     -- Run init code.
     unless (optNoEnv opts) $ do
       init' <- Lua.liftIO $ lookupEnv "LUA_INIT"
       (case init' of
-         Just ('@' : filename) -> Lua.dofileTrace filename
+         Just ('@' : filename) -> Lua.dofileTrace (Just filename)
          Just cmd              -> Lua.dostring (UTF8.fromString cmd)
          Nothing               -> return Lua.OK)
         >>= \case
@@ -159,27 +171,37 @@
     mapM_ runCode (reverse $ optExecute opts)
 
     let nargs = fromIntegral . length $ optScriptArgs opts
-    result <- case optScript opts of
-      -- `dofileTrace` should really accept a (Maybe FilePath)
-      Just script | script /= "-" -> do
-        Lua.loadfile script >>= \case
+    let startREPL = do
+          setup defaultConfig
+            { replHistory = settingsHistory settings
+            , replInfo = replInfo defaultConfig `T.append`
+                         settingsVersionInfo settings
+            }
+          void repl
+    let handleScriptResult = \case
           Lua.OK -> do
             mapM_ Lua.pushString (optScriptArgs opts)
-            Lua.pcallTrace nargs Lua.multret
-          s      -> pure s
-      Nothing | optVersion opts || not (null (optExecute opts)) ->
-        pure Lua.OK
+            status <- Lua.pcallTrace nargs Lua.multret
+            when (status /= Lua.OK)
+              Lua.throwErrorAsException
+            when (optInteractive opts)
+              startREPL
+          _      -> Lua.throwErrorAsException
+    tty <- Lua.liftIO istty
+    case optScript opts of
+      Just "-" ->  -- load from stdin
+        Lua.loadfile Nothing >>= handleScriptResult
+      Just script ->
+        Lua.loadfile (Just script) >>= handleScriptResult
+      _ | optInteractive opts -> do
+        startREPL
+      _ | optVersion opts || not (null (optExecute opts)) ->
+        pure ()
+      _ | tty -> do
+        startREPL
       _ -> do
         -- load script from stdin
-        l <- Lua.state
-        Lua.liftIO (Lua.luaL_loadfile l nullPtr) >>= \case
-          Lua.LUA_OK -> do
-            mapM_ Lua.pushString (optScriptArgs opts)
-            Lua.pcallTrace nargs Lua.multret
-          s          -> pure $ Lua.toStatus s
-
-    when (result /= Lua.OK)
-      Lua.throwErrorAsException
+        Lua.loadfile Nothing >>= handleScriptResult
 
 -- | Code to execute on startup.
 data LuaCode =

Reply via email to