diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3dcc1a60..a83e7916 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -211,28 +211,28 @@ jobs: SKIP_CABAL_BUILD: true ################################################################################ - # Lint with cabal-fmt + # Lint with cabal-gild ################################################################################ - lint-cabal-fmt: - name: Lint with cabal-fmt + lint-cabal-gild: + name: Lint with cabal-gild runs-on: ubuntu-latest steps: - name: 📥 Checkout repository uses: actions/checkout@v6 - - name: 🛠️ Setup cabal-fmt - uses: jorisdral/actions/setup-cabal-fmt@main + - name: 🛠️ Setup cabal-gild + uses: jorisdral/actions/setup-cabal-gild@cabal-gild-v0.0.1 with: - cabal-fmt-version: "0.1.12" + cabal-gild-version: "1.5.0.1" ghc-version: "9.6" - cabal-version: "3.12" + cabal-version: "3.16" # The index-state is fixed to enable caching and ensure that the version # regardless of the current state of Hackage head. - # If you want a newer version of cabal-fmt, use a more recent time. - hackage-index-state: "2025-09-15T11:44:03Z" + # If you want a newer version of cabal-gild, use a more recent time. + hackage-index-state: "2025-12-08T00:00:00Z" - - name: 🎗️ Lint with cabal-fmt - run: ./scripts/format-cabal-fmt.sh && git diff --exit-code + - name: 🎗️ Lint with cabal-gild + run: ./scripts/format-cabal-gild.sh && git diff --exit-code ################################################################################ # Lint with cabal diff --git a/botan-bindings/botan-bindings.cabal b/botan-bindings/botan-bindings.cabal index 30d22a3c..62aa5cdf 100644 --- a/botan-bindings/botan-bindings.cabal +++ b/botan-bindings/botan-bindings.cabal @@ -1,7 +1,7 @@ -cabal-version: 3.0 -name: botan-bindings -version: 0.1.0.0 -synopsis: Raw Botan bindings +cabal-version: 3.0 +name: botan-bindings +version: 0.1.0.0 +synopsis: Raw Botan bindings description: Welcome to botan-bindings @@ -14,48 +14,54 @@ description: For more information, see the [README on Github](https://github.com/haskellfoundation/botan) -author: Leo D. -maintainer: joris@well-typed.com, leo@apotheca.io -license: BSD-3-Clause -license-file: LICENSE +author: Leo D. +maintainer: joris@well-typed.com, leo@apotheca.io +license: BSD-3-Clause +license-file: LICENSE copyright: Copyright (c) 2023-2024, Apotheca Labs Copyright (c) 2024-2025, Haskell Foundation -build-type: Simple -category: Cryptography +build-type: Simple +category: Cryptography extra-doc-files: CHANGELOG.md README.md -tested-with: GHC ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12 +tested-with: ghc ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12 source-repository head - type: git + type: git location: https://github.com/haskellfoundation/botan - subdir: botan-bindings + subdir: botan-bindings source-repository this - type: git + type: git location: https://github.com/haskellfoundation/botan - subdir: botan-bindings - tag: botan-bindings-0.1.0.0 + subdir: botan-bindings + tag: botan-bindings-0.1.0.0 flag pkg-config - default: True - manual: False + default: True + manual: False description: Use @pkg-config(1)@ to locate foreign @botan-3@ library. common warnings ghc-options: - -Wall -Wcompat -Wincomplete-uni-patterns - -Wincomplete-record-updates -Wpartial-fields -Widentities - -Wredundant-constraints -Wmissing-export-lists - -Wno-unticked-promoted-constructors -Wunused-packages + -Wall + -Wcompat + -Wincomplete-uni-patterns + -Wincomplete-record-updates + -Wpartial-fields + -Widentities + -Wredundant-constraints + -Wmissing-export-lists + -Wno-unticked-promoted-constructors + -Wunused-packages -Wmissing-deriving-strategies common language - default-language: GHC2021 + default-language: GHC2021 default-extensions: DerivingStrategies PatternSynonyms @@ -63,8 +69,8 @@ common language RoleAnnotations library - import: warnings, language - hs-source-dirs: src + import: warnings, language + hs-source-dirs: src default-extensions: NoImplicitPrelude OverloadedStrings @@ -75,17 +81,17 @@ library Botan.Bindings.Cipher Botan.Bindings.Error Botan.Bindings.FPE - Botan.Bindings.Hash Botan.Bindings.HOTP + Botan.Bindings.Hash Botan.Bindings.KDF Botan.Bindings.KeyWrap Botan.Bindings.MAC Botan.Bindings.MPI Botan.Bindings.Prelude Botan.Bindings.PubKey - Botan.Bindings.PubKey.Decrypt Botan.Bindings.PubKey.DH Botan.Bindings.PubKey.DSA + Botan.Bindings.PubKey.Decrypt Botan.Bindings.PubKey.ECDH Botan.Bindings.PubKey.ECDSA Botan.Bindings.PubKey.Ed25519 @@ -94,8 +100,8 @@ library Botan.Bindings.PubKey.KeyAgreement Botan.Bindings.PubKey.KeyEncapsulation Botan.Bindings.PubKey.RSA - Botan.Bindings.PubKey.Sign Botan.Bindings.PubKey.SM2 + Botan.Bindings.PubKey.Sign Botan.Bindings.PubKey.Verify Botan.Bindings.PubKey.X25519 Botan.Bindings.PwdHash @@ -108,14 +114,13 @@ library Botan.Bindings.X509 Botan.Bindings.ZFEC - other-modules: Paths_botan_bindings - autogen-modules: Paths_botan_bindings - build-depends: base >=4.16 && <4.22 - includes: botan/ffi.h + other-modules: Paths_botan_bindings + autogen-modules: Paths_botan_bindings + build-depends: base >=4.16 && <4.22 + includes: botan/ffi.h if flag(pkg-config) -- NB: pkg-config is available on windows as well when using msys2 pkgconfig-depends: botan-3 >=3.0.0 - else extra-libraries: botan-3 diff --git a/botan-low/botan-low.cabal b/botan-low/botan-low.cabal index 3978e12b..e450a59b 100644 --- a/botan-low/botan-low.cabal +++ b/botan-low/botan-low.cabal @@ -1,7 +1,7 @@ -cabal-version: 3.0 -name: botan-low -version: 0.0.2.0 -synopsis: Low-level Botan bindings +cabal-version: 3.0 +name: botan-low +version: 0.0.2.0 +synopsis: Low-level Botan bindings description: Welcome to botan-low @@ -14,17 +14,16 @@ description: For more information, see the [README on Github](https://github.com/haskellfoundation/botan) -author: Leo D. -maintainer: joris@well-typed.com, leo@apotheca.io -license: BSD-3-Clause -license-file: LICENSE +author: Leo D. +maintainer: joris@well-typed.com, leo@apotheca.io +license: BSD-3-Clause +license-file: LICENSE copyright: Copyright (c) 2023-2024, Apotheca Labs Copyright (c) 2024-2025, Haskell Foundation -build-type: Simple -category: Cryptography - +build-type: Simple +category: Cryptography -- NOTE: Use data-files instead, if this is inappropriate -- NOTE: This causes a soft error: -- Ignoring trailing fields after sections: "extra-source-files" @@ -40,29 +39,35 @@ extra-doc-files: README.md tested-with: - GHC ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12 + ghc ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12 source-repository head - type: git + type: git location: https://github.com/haskellfoundation/botan - subdir: botan-low + subdir: botan-low source-repository this - type: git + type: git location: https://github.com/haskellfoundation/botan - subdir: botan-low - tag: botan-low-0.0.2.0 + subdir: botan-low + tag: botan-low-0.0.2.0 common warnings ghc-options: - -Wall -Wcompat -Wincomplete-uni-patterns - -Wincomplete-record-updates -Wpartial-fields -Widentities - -Wredundant-constraints -Wmissing-export-lists - -Wno-unticked-promoted-constructors -Wunused-packages + -Wall + -Wcompat + -Wincomplete-uni-patterns + -Wincomplete-record-updates + -Wpartial-fields + -Widentities + -Wredundant-constraints + -Wmissing-export-lists + -Wno-unticked-promoted-constructors + -Wunused-packages -Wmissing-deriving-strategies common language - default-language: GHC2021 + default-language: GHC2021 default-extensions: DerivingStrategies LambdaCase @@ -72,8 +77,8 @@ common language ViewPatterns library - import: warnings, language - hs-source-dirs: src + import: warnings, language + hs-source-dirs: src default-extensions: NoImplicitPrelude OverloadedStrings @@ -84,16 +89,16 @@ library Botan.Low.Cipher Botan.Low.Error Botan.Low.FPE - Botan.Low.Hash Botan.Low.HOTP + Botan.Low.Hash Botan.Low.KDF Botan.Low.KeyWrap Botan.Low.MAC Botan.Low.MPI Botan.Low.PubKey - Botan.Low.PubKey.Decrypt Botan.Low.PubKey.DH Botan.Low.PubKey.DSA + Botan.Low.PubKey.Decrypt Botan.Low.PubKey.ECDH Botan.Low.PubKey.ECDSA Botan.Low.PubKey.Ed25519 @@ -102,8 +107,8 @@ library Botan.Low.PubKey.KeyAgreement Botan.Low.PubKey.KeyEncapsulation Botan.Low.PubKey.RSA - Botan.Low.PubKey.Sign Botan.Low.PubKey.SM2 + Botan.Low.PubKey.Sign Botan.Low.PubKey.Verify Botan.Low.PubKey.X25519 Botan.Low.PwdHash @@ -122,48 +127,48 @@ library Botan.Low.Remake Paths_botan_low - autogen-modules: Paths_botan_low + autogen-modules: Paths_botan_low build-depends: - , base >=4.16 && <4.22 - , botan-bindings ^>=0.0 || ^>=0.1 - , bytestring >=0.11 && <0.13 - , deepseq >=1.1 && <2 - , text >=1.2 && <1.3 || >=2.0 && <2.2 + base >=4.16 && <4.22, + botan-bindings ^>=0.0 || ^>=0.1, + bytestring >=0.11 && <0.13, + deepseq >=1.1 && <2, + text >=1.2 && <1.3 || >=2.0 && <2.2, test-suite test - import: warnings, language - type: exitcode-stdio-1.0 - main-is: Main.hs - hs-source-dirs: test/ + import: warnings, language + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: test/ build-depends: - , async - , base - , botan-bindings - , botan-low - , bytestring - , containers - , hspec - , QuickCheck - , tasty - , tasty-hspec - , tasty-hunit - , text + QuickCheck, + async, + base, + botan-bindings, + botan-low, + bytestring, + containers, + hspec, + tasty, + tasty-hspec, + tasty-hunit, + text, other-modules: Test.Botan.Low.Bcrypt Test.Botan.Low.BlockCipher Test.Botan.Low.Cipher Test.Botan.Low.FPE - Test.Botan.Low.Hash Test.Botan.Low.HOTP + Test.Botan.Low.Hash Test.Botan.Low.KDF Test.Botan.Low.KeyWrap Test.Botan.Low.MAC Test.Botan.Low.MPI Test.Botan.Low.PubKey - Test.Botan.Low.PubKey.Decrypt Test.Botan.Low.PubKey.DH Test.Botan.Low.PubKey.DSA + Test.Botan.Low.PubKey.Decrypt Test.Botan.Low.PubKey.ECDH Test.Botan.Low.PubKey.ECDSA Test.Botan.Low.PubKey.Ed25519 @@ -172,8 +177,8 @@ test-suite test Test.Botan.Low.PubKey.KeyAgreement Test.Botan.Low.PubKey.KeyEncapsulation Test.Botan.Low.PubKey.RSA - Test.Botan.Low.PubKey.Sign Test.Botan.Low.PubKey.SM2 + Test.Botan.Low.PubKey.Sign Test.Botan.Low.PubKey.Verify Test.Botan.Low.PubKey.X25519 Test.Botan.Low.PwdHash @@ -187,26 +192,26 @@ test-suite test Test.Util.ByteString Test.Util.Hspec - other-modules: Paths_botan_low + other-modules: Paths_botan_low autogen-modules: Paths_botan_low benchmark botan-low-bench - import: warnings, language - hs-source-dirs: bench - main-is: Bcrypt.hs - type: exitcode-stdio-1.0 + import: warnings, language + hs-source-dirs: bench + main-is: Bcrypt.hs + type: exitcode-stdio-1.0 build-depends: - , base - , botan-low - , bytestring - , crypton - , tasty-bench + base, + botan-low, + bytestring, + crypton, + tasty-bench, default-extensions: NoImplicitPrelude OverloadedStrings - ghc-options: -with-rtsopts=-A32m + ghc-options: -with-rtsopts=-A32m if impl(ghc >=8.6) ghc-options: -fproc-alignment=64 diff --git a/botan/botan.cabal b/botan/botan.cabal index c552cc28..4a9ddd9c 100644 --- a/botan/botan.cabal +++ b/botan/botan.cabal @@ -1,7 +1,7 @@ -cabal-version: 3.0 -name: botan -version: 0.1.0.0 -synopsis: High-level Botan bindings +cabal-version: 3.0 +name: botan +version: 0.1.0.0 +synopsis: High-level Botan bindings description: Welcome to botan @@ -14,53 +14,59 @@ description: For more information, see the [README on Github](https://github.com/haskellfoundation/botan) -author: Leo D. -maintainer: joris@well-typed.com, leo@apotheca.io -license: BSD-3-Clause -license-file: LICENSE +author: Leo D. +maintainer: joris@well-typed.com, leo@apotheca.io +license: BSD-3-Clause +license-file: LICENSE copyright: Copyright (c) 2023-2024, Apotheca Labs Copyright (c) 2024-2025, Haskell Foundation -build-type: Simple -category: Cryptography +build-type: Simple +category: Cryptography extra-doc-files: CHANGELOG.md README.md -tested-with: GHC ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12 +tested-with: ghc ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12 flag mtl - default: True - manual: True + default: True + manual: True description: Enable @mtl@ package dependency. flag random - default: True - manual: True + default: True + manual: True description: Enable @random@ package dependency. source-repository head - type: git + type: git location: https://github.com/haskellfoundation/botan - subdir: botan + subdir: botan source-repository this - type: git + type: git location: https://github.com/haskellfoundation/botan - subdir: botan - tag: botan-0.1.0.0 + subdir: botan + tag: botan-0.1.0.0 common warnings ghc-options: - -Wall -Wcompat -Wincomplete-uni-patterns - -Wincomplete-record-updates -Wpartial-fields -Widentities - -Wredundant-constraints -Wmissing-export-lists - -Wno-unticked-promoted-constructors -Wunused-packages + -Wall + -Wcompat + -Wincomplete-uni-patterns + -Wincomplete-record-updates + -Wpartial-fields + -Widentities + -Wredundant-constraints + -Wmissing-export-lists + -Wno-unticked-promoted-constructors + -Wunused-packages -Wmissing-deriving-strategies common language - default-language: GHC2021 + default-language: GHC2021 default-extensions: DerivingStrategies PatternSynonyms @@ -68,8 +74,8 @@ common language RoleAnnotations library - import: warnings, language - hs-source-dirs: src + import: warnings, language + hs-source-dirs: src default-extensions: NoImplicitPrelude OverloadedStrings @@ -80,17 +86,17 @@ library Botan.BlockCipher.AES Botan.BlockCipher.ARIA Botan.BlockCipher.Blowfish - Botan.BlockCipher.Camellia Botan.BlockCipher.CAST + Botan.BlockCipher.Camellia Botan.BlockCipher.Class Botan.BlockCipher.DES Botan.BlockCipher.GOST Botan.BlockCipher.IDEA Botan.BlockCipher.Noekeon Botan.BlockCipher.SEED - Botan.BlockCipher.Serpent Botan.BlockCipher.SHALCAL Botan.BlockCipher.SM4 + Botan.BlockCipher.Serpent Botan.BlockCipher.Threefish Botan.BlockCipher.Twofish Botan.Checksum.Adler @@ -100,6 +106,7 @@ library Botan.Cipher.Class Botan.Easy Botan.Error + Botan.HOTP Botan.Hash Botan.Hash.BLAKE Botan.Hash.Class @@ -112,17 +119,16 @@ library Botan.Hash.SHA2 Botan.Hash.SHA3 Botan.Hash.SHAKE - Botan.Hash.Skein Botan.Hash.SM3 + Botan.Hash.Skein Botan.Hash.Streebog Botan.Hash.Whirlpool - Botan.HOTP Botan.KDF Botan.KeySpec Botan.KeyWrap Botan.MAC - Botan.MAC.Class Botan.MAC.CMAC + Botan.MAC.Class Botan.OneTimeAuth.Class Botan.OneTimeAuth.Poly1305 Botan.Padding @@ -147,18 +153,18 @@ library Botan.Prelude Paths_botan - autogen-modules: Paths_botan + autogen-modules: Paths_botan build-depends: - , base >=4.16 && <4.22 - , botan-low ^>=0.0 - , bytestring >=0.11 && <0.13 - , deepseq >=1.1 && <2 - , text >=1.2 && <1.3 || >=2.0 && <2.2 + base >=4.16 && <4.22, + botan-low ^>=0.0, + bytestring >=0.11 && <0.13, + deepseq >=1.1 && <2, + text >=1.2 && <1.3 || >=2.0 && <2.2, if flag(mtl) build-depends: mtl >=2.2 && <2.4 - cpp-options: -DHS_BOTAN_HAS_MTL + cpp-options: -DHS_BOTAN_HAS_MTL if flag(random) build-depends: random >=1.2 && <1.3 - cpp-options: -DHS_BOTAN_HAS_RANDOM + cpp-options: -DHS_BOTAN_HAS_RANDOM diff --git a/scripts/format-cabal-fmt.sh b/scripts/format-cabal-fmt.sh deleted file mode 100755 index a791bc6f..00000000 --- a/scripts/format-cabal-fmt.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -export LC_ALL=C.UTF-8 - -# POSIX compliant method for 'pipefail': -warn=$(mktemp) - -# Check cabal-fmt version -cabal_fmt_expect_version="0.1.12" -if [ "${cabal_fmt}" = "" ]; then - cabal_fmt=$(which "cabal-fmt") - if [ "${cabal_fmt}" = "" ]; then - echo "Requires cabal-fmt ${cabal_fmt_expect_version}; no version found" - exit 1 - fi -fi -cabal_fmt_actual_version="$($cabal_fmt --version | head -n 1 | cut -d' ' -f2)" -if [ ! "${cabal_fmt_actual_version}" = "${cabal_fmt_expect_version}" ]; then - echo "Expected cabal-fmt ${cabal_fmt_expect_version}; version ${cabal_fmt_actual_version} found" - echo > "$warn" -fi - -# Format Cabal files with cabal-fmt -echo "Formatting Cabal source files with cabal-fmt version ${cabal_fmt_actual_version}" -# shellcheck disable=SC2016 -if ! git ls-files --exclude-standard --no-deleted --deduplicate '*.cabal' | xargs -L 1 sh -c 'echo "$0" && cabal-fmt -c "$0" 2>/dev/null || (cabal-fmt -i "$0" && exit 1)'; then - exit 1 -fi - -# Check whether any warning was issued; on CI, warnings are errors -if [ "${CI}" = "true" ] && [ -s "$warn" ]; then - rm "$warn" - exit 1 -else - rm "$warn" - exit 0 -fi diff --git a/scripts/format-cabal-gild.sh b/scripts/format-cabal-gild.sh new file mode 100755 index 00000000..b5f6b14a --- /dev/null +++ b/scripts/format-cabal-gild.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +export LC_ALL=C.UTF-8 + +# POSIX compliant method for 'pipefail': +warn=$(mktemp) + +# Check cabal-gild version +cabal_gild_expect_version="1.5.0.1" +if [ "${cabal_gild}" = "" ]; then + cabal_gild=$(which "cabal-gild") + if [ "${cabal_gild}" = "" ]; then + echo "Requires cabal-gild ${cabal_gild_expect_version}; no version found" + exit 1 + fi +fi +cabal_gild_actual_version="$($cabal_gild --version | head -n 1 | cut -d' ' -f2)" +if [ ! "${cabal_gild_actual_version}" = "${cabal_gild_expect_version}" ]; then + echo "Expected cabal-gild ${cabal_gild_expect_version}; version ${cabal_gild_actual_version} found" + echo > "$warn" +fi + +# Format Cabal files with cabal-gild +echo "Formatting Cabal source files with cabal-gild version ${cabal_gild_actual_version}" +# shellcheck disable=SC2016 +if ! git ls-files --exclude-standard --no-deleted --deduplicate '*.cabal' | xargs -L 1 sh -c 'echo "$0" && cabal-gild -mcheck -i "$0" 2>/dev/null || (cabal-gild -i "$0" -o "$0" && exit 1)'; then + exit 1 +fi + +# Check whether any warning was issued; on CI, warnings are errors +if [ "${CI}" = "true" ] && [ -s "$warn" ]; then + rm "$warn" + exit 1 +else + rm "$warn" + exit 0 +fi