Skip to content

Decomission v1-register --gen-script and v1-unregister --gen-script#11834

Open
Bodigrim wants to merge 1 commit into
masterfrom
decomission-v1-register-gen-script
Open

Decomission v1-register --gen-script and v1-unregister --gen-script#11834
Bodigrim wants to merge 1 commit into
masterfrom
decomission-v1-register-gen-script

Conversation

@Bodigrim
Copy link
Copy Markdown
Collaborator

@Bodigrim Bodigrim commented May 15, 2026

The v1 commands v1-register and v1-unregister are obsolete by now, but even in their prime time - as witnessed by comments - their usage with --gen-script was not well attested or understood. Pruning this mode leads to surprising reduction of rather hairy code.

By default v1-register just goes ahead and registers a package. It also has a mode --gen-pkg-config to generate a .conf file, which a user can manually register by running ghc-pkg register.

Now --gen-script mode used to generate a shell script, which would run ghc-pkg register on the same .conf file (embedded). Why would anyone really want that? I have no idea and the comment quietly recognises that "In practice this aspect was not especially popular" and "The script generation [is] not well used or tested".

The v2 commands never use --gen-script feature.

The documentation (unchanged since 1658ad8 in 2005) used to claim that package distributors should be using register --gen-script and unregister --gen-script to generate register.sh and unregister.sh to be included in their packages. This does not seem to reflect the reality.

E. g., https://packages.debian.org/trixie/amd64/libghc-tasty-dev/filelist does not contain any shell scripts, only tasty-*.conf file. Same on Fedora: https://packages.fedoraproject.org/pkgs/ghc-tasty/ghc-tasty-devel/fedora-rawhide.html#files

Indeed inspecting build logs such as https://kojipkgs.fedoraproject.org//packages/ghc-tasty/1.5.3/28.fc44/data/logs/x86_64/build.log confirms that package distributors use v1-register --gen-pkg-config and don't use --gen-script.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

Copy link
Copy Markdown
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the well-articulated argument. Someone will certainly come complaining but I'm of the opinion that we should have long started ripping out the v1 machinery. Also someone will argue for a deprecation procedure. But I don't see a point to do that for such esoteric parts of the interface.

@Bodigrim Bodigrim force-pushed the decomission-v1-register-gen-script branch 2 times, most recently from f8db15f to 030981d Compare May 16, 2026 17:20
The v1 commands `v1-register` and `v1-unregister` are obsolete by now,
but even in their prime time - as witnessed by comments - their usage
with `--gen-script` was not well attested or understood. Pruning this mode
leads to surprising reduction of rather hairy code.

By default `v1-register` just goes ahead and registers a package.
It also has a mode `--gen-pkg-config` to generate a `.conf` file,
which a user can manually register by running `ghc-pkg register`.

Now `--gen-script` mode used to generate a shell script,
which would run `ghc-pkg register` on the same `.conf` file (embedded).
Why would anyone really want that? I have no idea and the comment quietly
recognises that "In practice this aspect was not especially popular" and
"The script generation [is] not well used or tested".

The v2 commands never use `--gen-script` feature.

The documentation (unchanged since 1658ad8 in 2005) used to claim
that package distributors should be using `register --gen-script` and `unregister --gen-script`
to generate `register.sh` and `unregister.sh` to be included in their packages.
This does not seem to reflect the reality.

E. g., https://packages.debian.org/trixie/amd64/libghc-tasty-dev/filelist
does not contain any shell scripts, only `tasty-*.conf` file.
Same on Fedora: https://packages.fedoraproject.org/pkgs/ghc-tasty/ghc-tasty-devel/fedora-rawhide.html#files

Indeed inspecting build logs such as https://kojipkgs.fedoraproject.org//packages/ghc-tasty/1.5.3/28.fc44/data/logs/x86_64/build.log
confirms that package distributors use `v1-register --gen-pkg-config` and don't use `--gen-script`.
@Bodigrim Bodigrim force-pushed the decomission-v1-register-gen-script branch from 030981d to af7a5e9 Compare May 16, 2026 17:22
@Bodigrim
Copy link
Copy Markdown
Collaborator Author

Can I have more reviews please? ;)

Copy link
Copy Markdown
Collaborator

@philderbeast philderbeast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to move the motivation to a separate issue so discussion could happen there.

In reviewing this, I tried to exercise the --gen-script and --gen-pkg-config to see concretely what we'd be removing. I wasn't successful within the time I gave to it. This is an area of Cabal I'm not too familiar with. I also tried spying on cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs with --keep-tmp-files without much success either.

I don't feel I'm familiar enough with this feature to approve its removal.

There may still be some use of --gen-script in the wild, searching GitHub for "gen-script" with Haskell, in particular with cblrepo:

The goal of cblrepo is to aid in maintaining a consistent set of Haskell packages, e.g. for a Linux distribution. Currently it's heavily influenced by the work required to maintain Haskell packages for Arch Linux, but it's proven useful also for other distributions.

@Mikolaj
Copy link
Copy Markdown
Member

Mikolaj commented May 21, 2026

Also, how do we plan to decomission it? A longer deprecation period to let people get in contact with us if they still need it?

@ulysses4ever
Copy link
Copy Markdown
Collaborator

i think @jappeace mentioned a brilliant idea in one of the previous calls: if we know that the feature is broken, there's no reason to use the deprecation procedure. The reasoning is that the deprecation procedure is supposed to help the users of the features, but a broken feature has none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants