https://github.com/berberman/uusi
Tweak package description
https://github.com/berberman/uusi
cabal
Last synced: about 1 year ago
JSON representation
Tweak package description
- Host: GitHub
- URL: https://github.com/berberman/uusi
- Owner: berberman
- License: mit
- Created: 2020-09-24T01:04:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-18T06:15:27.000Z (over 2 years ago)
- Last Synced: 2025-03-26T22:23:05.745Z (about 1 year ago)
- Topics: cabal
- Language: Haskell
- Homepage:
- Size: 68.4 KB
- Stars: 5
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# uusi
[](https://github.com/berberman/uusi/actions)
[](https://hackage.haskell.org/package/uusi)
[](LICENSE)
`uusi` is a simple command-line program to tweak [Package Description](https://cabal.readthedocs.io/en/latest/cabal-package.html#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](https://www.archlinux.org/packages/community/x86_64/uusi/) 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 `` or `:`. 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. **_\(:з」∠)\_**