Compare commits
2 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| bdd70ab8a2 | |||
| 9bde387b82 |
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Jan 5 17:51:34 UTC 2025 - Peter Simons <psimons@suse.com>
|
||||
|
||||
- Update lukko to version 0.1.2 revision 1.
|
||||
Upstream has revised the Cabal build instructions on Hackage.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 5 12:42:08 UTC 2024 - Peter Simons <psimons@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ghc-lukko
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -26,6 +26,7 @@ Summary: File locking
|
||||
License: GPL-2.0-or-later AND 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-base-devel
|
||||
BuildRequires: ghc-base-prof
|
||||
@@ -114,6 +115,7 @@ This package provides the Haskell %{pkg_name} profiling library.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{pkg_name}-%{version}
|
||||
cp -p %{SOURCE1} %{pkg_name}.cabal
|
||||
|
||||
%build
|
||||
%ghc_lib_build
|
||||
|
||||
163
lukko.cabal
Normal file
163
lukko.cabal
Normal file
@@ -0,0 +1,163 @@
|
||||
cabal-version: 2.2
|
||||
name: lukko
|
||||
version: 0.1.2
|
||||
x-revision: 1
|
||||
synopsis: File locking
|
||||
category: System, Concurrency
|
||||
description:
|
||||
This package provides access to platform dependent file locking APIs:
|
||||
.
|
||||
* <https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html Open file descriptor locking> on Linux ("Lukko.OFD")
|
||||
* BSD-style @flock(2)@ locks on UNIX platforms ("Lukko.FLock")
|
||||
* Windows locking via <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-lockfilee LockFileEx> ("Lukko.Windows")
|
||||
* No-op locking, which throws exceptions ("Lukko.NoOp")
|
||||
* "Lukko" module exports the best option for the target platform with uniform API.
|
||||
.
|
||||
There are alternative file locking packages:
|
||||
.
|
||||
* "GHC.IO.Handle.Lock" in @base >= 4.10@ is good enough for most use cases.
|
||||
However, uses only 'Handle's so these locks cannot be used for intra-process locking.
|
||||
(You should use e.g. 'MVar' in addition).
|
||||
.
|
||||
* <https://hackage.haskell.org/package/filelock filelock> doesn't support OFD locking.
|
||||
.
|
||||
/Lukko/ means lock in Finnish.
|
||||
.
|
||||
Submodules "Lukko.OFD", "Lukko.Windows" etc are available based on following conditions.
|
||||
.
|
||||
@
|
||||
if os(windows)
|
||||
\ cpp-options: -DHAS_WINDOWS_LOCK
|
||||
.
|
||||
elif (os(linux) && flag(ofd-locking))
|
||||
\ cpp-options: -DHAS_OFD_LOCKING
|
||||
\ cpp-options: -DHAS_FLOCK
|
||||
.
|
||||
elif !(os(solaris) || os(aix))
|
||||
\ cpp-options: -DHAS_FLOCK
|
||||
@
|
||||
.
|
||||
"Lukko.FLock" is available on not (Windows or Solaris or AIX).
|
||||
"Lukko.NoOp" is always available.
|
||||
|
||||
maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
|
||||
license: GPL-2.0-or-later AND BSD-3-Clause
|
||||
license-files:
|
||||
LICENSE
|
||||
LICENSE.GPLv2
|
||||
LICENSE.GPLv3
|
||||
|
||||
build-type: Simple
|
||||
extra-source-files: CHANGELOG.md
|
||||
tested-with:
|
||||
GHC ==8.6.5
|
||||
|| ==8.8.4
|
||||
|| ==8.10.7
|
||||
|| ==9.0.2
|
||||
|| ==9.2.8
|
||||
|| ==9.4.8
|
||||
|| ==9.6.6
|
||||
|| ==9.8.4
|
||||
|| ==9.10.1
|
||||
|| ==9.12.1
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
location: https://github.com/haskellari/lukko/
|
||||
|
||||
flag ofd-locking
|
||||
default: True
|
||||
manual: True
|
||||
description:
|
||||
Enable open file descriptor locking. Available on Linux (kernel 3.15, released Jun 8, 2014).
|
||||
|
||||
library
|
||||
default-language: Haskell2010
|
||||
hs-source-dirs: src
|
||||
build-depends: base >=4.12.0.0 && <4.22
|
||||
build-tool-depends: hsc2hs:hsc2hs >=0.68.5 && <0.69
|
||||
|
||||
-- Main library module
|
||||
exposed-modules:
|
||||
Lukko
|
||||
Lukko.NoOp
|
||||
|
||||
if os(windows)
|
||||
hs-source-dirs: src-windows
|
||||
cpp-options: -DUSE_WINDOWS_LOCK
|
||||
exposed-modules: Lukko.Windows
|
||||
c-sources: cbits/windows.c
|
||||
|
||||
elif (os(linux) && flag(ofd-locking))
|
||||
hs-source-dirs: src-ofd
|
||||
hs-source-dirs: src-flock
|
||||
hs-source-dirs: src-unix
|
||||
cpp-options: -DUSE_OFD_LOCKING
|
||||
exposed-modules: Lukko.OFD
|
||||
|
||||
elif !(os(solaris) || os(aix))
|
||||
hs-source-dirs: src-flock
|
||||
hs-source-dirs: src-unix
|
||||
cpp-options: -DUSE_FLOCK
|
||||
|
||||
else
|
||||
hs-source-dirs: src-unix
|
||||
cpp-options: -DUSE_NOOP
|
||||
|
||||
-- Cabal check is silly
|
||||
if (!os(windows) && !(os(solaris) || os(aix)))
|
||||
exposed-modules: Lukko.FLock
|
||||
|
||||
other-modules:
|
||||
Lukko.Internal.FD
|
||||
Lukko.Internal.FillBytes
|
||||
Lukko.Internal.HandleToFD
|
||||
Lukko.Internal.Types
|
||||
|
||||
test-suite test-thread
|
||||
default-language: Haskell2010
|
||||
type: exitcode-stdio-1.0
|
||||
hs-source-dirs: test
|
||||
main-is: Tests.hs
|
||||
ghc-options: -threaded
|
||||
build-depends:
|
||||
, async ^>=2.2.2
|
||||
, base
|
||||
, filepath ^>=1.4.2.1 || ^>=1.5.2.0
|
||||
, lukko
|
||||
, singleton-bool ^>=0.1.8
|
||||
, tasty ^>=1.5
|
||||
, tasty-expected-failure ^>=0.12.3
|
||||
, tasty-hunit ^>=0.10.0.2
|
||||
, temporary ^>=1.3
|
||||
|
||||
if os(windows)
|
||||
cpp-options: -DHAS_WINDOWS_LOCK
|
||||
|
||||
elif (os(linux) && flag(ofd-locking))
|
||||
cpp-options: -DHAS_OFD_LOCKING
|
||||
cpp-options: -DHAS_FLOCK
|
||||
|
||||
elif !(os(solaris) || os(aix))
|
||||
cpp-options: -DHAS_FLOCK
|
||||
|
||||
test-suite test-process
|
||||
default-language: Haskell2010
|
||||
type: exitcode-stdio-1.0
|
||||
hs-source-dirs: test
|
||||
main-is: TestProcess.hs
|
||||
ghc-options: -threaded
|
||||
build-depends:
|
||||
, base
|
||||
, bytestring >=0.10.8.2 && <0.13
|
||||
, lukko
|
||||
|
||||
if os(windows)
|
||||
cpp-options: -DHAS_WINDOWS_LOCK
|
||||
|
||||
elif (os(linux) && flag(ofd-locking))
|
||||
cpp-options: -DHAS_OFD_LOCKING
|
||||
cpp-options: -DHAS_FLOCK
|
||||
|
||||
elif !(os(solaris) || os(aix))
|
||||
cpp-options: -DHAS_FLOCK
|
||||
Reference in New Issue
Block a user