Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-hslua-module-system for 
openSUSE:Factory checked in at 2025-07-31 17:45:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hslua-module-system (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-hslua-module-system.new.1944 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-hslua-module-system"

Thu Jul 31 17:45:34 2025 rev:16 rq:1296440 version:1.2.1.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-hslua-module-system/ghc-hslua-module-system.changes
  2025-07-02 12:09:40.299150886 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-hslua-module-system.new.1944/ghc-hslua-module-system.changes
        2025-07-31 17:46:29.736889856 +0200
@@ -1,0 +2,18 @@
+Wed Jul 23 17:22:10 UTC 2025 - Peter Simons <[email protected]>
+
+- Update hslua-module-system to version 1.2.1.1.
+  ## hslua-module-system-1.2.1.1
+
+  Released 2025-07-23.
+
+  -   Fixed the docstring of `exists`.
+
+  ## hslua-module-system-1.2.1
+
+  Released 2025-07-23.
+
+  -   Add new function `exists`, which allows to check the existance
+      and, optionally, type of a filesystem object at the given
+      path.
+
+-------------------------------------------------------------------

Old:
----
  hslua-module-system-1.2.0.tar.gz

New:
----
  hslua-module-system-1.2.1.1.tar.gz

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

Other differences:
------------------
++++++ ghc-hslua-module-system.spec ++++++
--- /var/tmp/diff_new_pack.YVDxX6/_old  2025-07-31 17:46:30.352915460 +0200
+++ /var/tmp/diff_new_pack.YVDxX6/_new  2025-07-31 17:46:30.356915625 +0200
@@ -20,7 +20,7 @@
 %global pkgver %{pkg_name}-%{version}
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        1.2.0
+Version:        1.2.1.1
 Release:        0
 Summary:        Lua module wrapper around Haskell's System module
 License:        MIT

++++++ hslua-module-system-1.2.0.tar.gz -> hslua-module-system-1.2.1.1.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-system-1.2.0/CHANGELOG.md 
new/hslua-module-system-1.2.1.1/CHANGELOG.md
--- old/hslua-module-system-1.2.0/CHANGELOG.md  2001-09-09 03:46:40.000000000 
+0200
+++ new/hslua-module-system-1.2.1.1/CHANGELOG.md        2001-09-09 
03:46:40.000000000 +0200
@@ -2,6 +2,20 @@
 
 `hslua-module-system` uses [PVP Versioning][].
 
+## hslua-module-system-1.2.1.1
+
+Released 2025-07-23.
+
+-   Fixed the docstring of `exists`.
+
+## hslua-module-system-1.2.1
+
+Released 2025-07-23.
+
+-   Add new function `exists`, which allows to check the existance
+    and, optionally, type of a filesystem object at the given
+    path.
+
 ## hslua-module-system-1.2.0
 
 Released 2025-06-23.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-system-1.2.0/hslua-module-system.cabal 
new/hslua-module-system-1.2.1.1/hslua-module-system.cabal
--- old/hslua-module-system-1.2.0/hslua-module-system.cabal     2001-09-09 
03:46:40.000000000 +0200
+++ new/hslua-module-system-1.2.1.1/hslua-module-system.cabal   2001-09-09 
03:46:40.000000000 +0200
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 name:                hslua-module-system
-version:             1.2.0
+version:             1.2.1.1
 synopsis:            Lua module wrapper around Haskell's System module.
 
 description:         Provides access to system information and
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-system-1.2.0/src/HsLua/Module/System.hs 
new/hslua-module-system-1.2.1.1/src/HsLua/Module/System.hs
--- old/hslua-module-system-1.2.0/src/HsLua/Module/System.hs    2001-09-09 
03:46:40.000000000 +0200
+++ new/hslua-module-system-1.2.1.1/src/HsLua/Module/System.hs  2001-09-09 
03:46:40.000000000 +0200
@@ -25,6 +25,7 @@
   , cp
   , cputime
   , env
+  , exists
   , getenv
   , getwd
   , ls
@@ -84,6 +85,7 @@
       , cp
       , cputime
       , env
+      , exists
       , getenv
       , getwd
       , ls
@@ -233,6 +235,40 @@
         "A table mapping environment variable names to their value."
   #? "Retrieves the entire environment as a string-indexed table."
 
+-- | Check the existence of a file path.
+exists :: LuaError e => DocumentedFunction e
+exists = defun "exists"
+  ### (\fp mbType -> do
+          case T.toLower <$> mbType of
+            Nothing ->
+              -- any file type is fine
+              ioToLua $ Directory.doesPathExist fp
+            Just "directory" ->
+              -- must be a directory or a symlink pointing to one
+              ioToLua $ Directory.doesDirectoryExist fp
+            Just "file" ->
+              -- must be a file or a symlink pointing to one
+              ioToLua $ Directory.doesFileExist fp
+            Just "symlink" ->
+              -- must exist and be a symlink
+              ioToLua $ (&&) <$> Directory.doesPathExist fp
+                             <*> Directory.pathIsSymbolicLink fp
+            Just otherType ->
+              failLua $
+              "Unsupported filesystem object type: " <> T.unpack otherType)
+  <#> filepathParam "path" "file path to check"
+  <#> opt (textParam "type" "the required type of the filesystem object")
+  =#> functionResult pushBool "boolean"
+        "whether a filesystem object of type `type` exists at `path`."
+  #? T.unlines
+     [ "Check whether there exists a filesystem object at the given path."
+     , "If `type` is given and either *directory* or *file*, then the"
+     , "function returns `true` if and only if the file system object has"
+     , "the given type, or if it's a symlink pointing to an object of that"
+     , "type. Passing *symlink* as type requires the path itself to be a"
+     , "symlink. Types other than those will cause an error."
+     ]
+
 -- | Return the current working directory as an absolute path.
 getwd :: LuaError e => DocumentedFunction e
 getwd = defun "getwd"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-system-1.2.0/test/test-system.lua 
new/hslua-module-system-1.2.1.1/test/test-system.lua
--- old/hslua-module-system-1.2.0/test/test-system.lua  2001-09-09 
03:46:40.000000000 +0200
+++ new/hslua-module-system-1.2.1.1/test/test-system.lua        2001-09-09 
03:46:40.000000000 +0200
@@ -95,6 +95,48 @@
     end)
   },
 
+  group 'exists' {
+    test('returns `false` if the path does not exist', in_tmpdir(function ()
+      -- the temporary dir should be empty
+      assert.is_falsy(system.exists('does-not-exist.txt'))
+    end)),
+    test('returns `true` if the path does not exist', in_tmpdir(function ()
+      io.open('README.md', 'w'):close()
+      assert.is_truthy(system.exists('README.md'))
+    end)),
+    test('returns `false` for non-existing files', in_tmpdir(function ()
+      assert.is_falsy(system.exists('README.md', 'file'))
+    end)),
+    test('returns `true` for existing files', in_tmpdir(function ()
+      io.open('README.md', 'w'):close()
+      assert.is_truthy(system.exists('README.md', 'file'))
+    end)),
+    test('returns `false` for missing directories', in_tmpdir(function ()
+      assert.is_falsy(system.exists('folder', 'directory'))
+    end)),
+    test('returns `true` for existing directories', in_tmpdir(function ()
+      system.mkdir 'folder'
+      assert.is_truthy(system.exists('folder', 'directory'))
+    end)),
+    test('returns `false` for missing directories', in_tmpdir(function ()
+      assert.is_falsy(system.exists('folder', 'directory'))
+    end)),
+    test('returns `false` for file when checking for dir', in_tmpdir(function 
()
+      io.open('folder', 'w'):close()
+      assert.is_falsy(system.exists('folder', 'directory'))
+    end)),
+    test('returns `true` for dir when checking for file', in_tmpdir(function ()
+      system.mkdir 'README.md'
+      assert.is_falsy(system.exists('README.md', 'file'))
+    end)),
+    test('errors for unknown type', in_tmpdir(function ()
+      assert.error_matches(
+        function () system.exists('x', 'device') end,
+        'Unsupported filesystem object'
+      )
+    end)),
+  },
+
   group 'ls' {
     test('returns a table', function ()
       assert.are_equal(type(system.ls('.')), 'table')

Reply via email to