uusi: Tweak .cabal files

[ distribution, library, mit, program ] [ Propose Tags ]

uusi is a command-line program to tweak .cabal files. It is used in distribution packaging. See README for details.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.0.0, 0.0.1.0, 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.3.0.0, 0.3.1.0, 0.4.0.0, 0.4.1.0, 0.4.2.0, 0.4.3.0 (info)
Change log CHANGELOG.md
Dependencies base (>=4.8 && <5), Cabal (>=3.2 && <3.3 || >=3.4 && <3.5 || ==3.6.3 || >=3.8 && <3.9 || >=3.10 && <3.11), directory, filepath, text, uusi [details]
License MIT
Copyright 2020-2023 berberman
Author berberman
Maintainer berberman <berberman@yandex.com>
Category Distribution
Home page https://github.com/berberman/uusi
Bug tracker https://github.com/berberman/uusi/issues
Source repo head: git clone https://github.com/berberman/uusi.git
Uploaded by berberman at 2023-09-08T02:51:27Z
Distributions Arch:0.4.3.0
Executables gen-setup, uusi
Downloads 2119 total (42 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-09-08 [all 1 reports]

Readme for uusi-0.4.3.0

[back to package description]

uusi

GitHub CI Hackage MIT license

uusi is a simple command-line program to tweak Package Description. In distribution packaging, sometimes we need modify the version range of dependencies. Usually, this can be done by some *nix text processing utilities, such as awk, sed, etc. However, these tools process cabal files as plain text, not considering the semantics. Thus, it might be pesky or elusive to conver the entire cases. uusi has almost no extra dependencies, so it's safe to introduce uusi as build-depends of the target, which packagers can use to manipulate target's dependencies. Currently, uusi works in Arch Linux packaging, and you may find out that it has been required by many haskell packages. In most cases, it is used to loose the version constraint of a dependency when building a package, because the dependent haskell package provided by system may be too new to fit the constraints, whereas this package can be built against the newer dependency successfully.

Installation

# pacman -S uusi

Install it via pacman.

Build

$ git clone https://github.com/berberman/uusi

If you choose to use dynamic haskell packages provided by Arch Linux, run to configure the project locally:

$ cabal configure --disable-library-vanilla --enable-shared --enable-executable-dynamic --ghc-options=-dynamic

Then build it:

$ cabal build

Usage

uusi will replace the text in .cabal file inplace. uusi supports four kinds of actions:

  • remove all version constraints of dependencies

  • overwrite a version range of a specific dependency

  • remove a dependency

  • replace a dependency with given packages

  • set the buildable of a component

  • modify ghc-options of a component

If no option is specified, uusi will use --all, removing all version constraints.

uusi provides an executable gen-setup to generate a boilerplate Setup.hs.

Examples

  • Set all dependencies' version ranges to any version:
$ uusi foo.cabal
  • Replace old-time with time:
$ uusi -rold-time:time foo.cabal
  • Remove semigroup:
$ uusi -dsemigroup foo.cabal
  • Overwrite base:
$ uusi -ubase: >=4.14 foo.cabal

Packages have pattern <pkgname> or <pkgname>:<version>. Run this program, and see help message for details.

  • Together:
$ uusi -ubar:2999.20.1.0 -dbase --all foo.cabal
  • Do not build foo-test:
$ uusi -nb foo-test foo.cabal
  • Add dynamic to ghc-options of foo-test:
$ uusi --add-options foo-test:-dynamic foo.cabal
  • Add -dynamic to ghc-options of all components:
$ uusi --add-options-all -dynamic foo.cabal
  • Remove -Wall and -dynamic from ghc-options of all components:
$ uusi --remove-options-all -Wall,-dynamic 

Contributing

Issues and PRs are always welcome. _(:з」∠)_