Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor embedded files #2350

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

thomie
Copy link
Contributor

@thomie thomie commented Mar 9, 2025

The goal of this refactoring is to remove the symlinks from hledger/embeddedfiles to hledger-ui and hledger-web:

iff --git a/hledger/hledger.cabal b/hledger/hledger.cabal
index 93e034184..b25ed804b 100644
--- a/hledger/hledger.cabal
+++ b/hledger/hledger.cabal
@@ -46,18 +46,10 @@ extra-source-files:
     embeddedfiles/hledger-import.md
     embeddedfiles/hledger-incomestatement.md
     embeddedfiles/hledger-print.md
-    embeddedfiles/hledger-ui.md
-    embeddedfiles/hledger-web.md
     embeddedfiles/hledger.md
     embeddedfiles/hledger.1
     embeddedfiles/hledger.txt
     embeddedfiles/hledger.info
-    embeddedfiles/hledger-ui.1
-    embeddedfiles/hledger-ui.txt
-    embeddedfiles/hledger-ui.info
-    embeddedfiles/hledger-web.1
-    embeddedfiles/hledger-web.txt
-    embeddedfiles/hledger-web.info
     Hledger/Cli/Commands/Accounts.txt
     Hledger/Cli/Commands/Activity.txt

I recently caught the Nix bug, and those symlinks across cabal projects are causing problems when trying to build hledger from inside a git repository (as mentioned in #2063, and #2044 is relevant).

This refactoring:

  • moves the helper functions printHelpForTopic', runManForTopic', runInfoForTopic', runPagerForTopic and runTldrForPage' to hledger-lib:Hledger.Utils.Docfiles.
  • adds the modules Hledger.Web.DocFiles to hledger-web and Hledger.UI.DocFIles to hledger-ui, which now embed their own info/man/tldr pages directly
  • removes symlinks from hledger/embeddedfiles to hledger-ui and hledger-web

There are still symlinks to ../../docs/utils, also outside of the cabal project, but those are less problematic.

I tested the builds both with nix and cabal. There should not be any user visible changes.

@@ -31,9 +31,10 @@ tested-with:
extra-source-files:
CHANGES.md
README.md
Copy link
Contributor Author

@thomie thomie Mar 9, 2025

Choose a reason for hiding this comment

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

Hmm, changing the location of the man pages (from ./hledger-ui.1 to ./embeddedfiles/hledger-ui.1) will probably cause busy work for package maintainers.

Perhaps I should just leave the files where they were.

Copy link
Owner

Choose a reason for hiding this comment

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

FWIW I suspect the majority of packagers get man pages from a github or hackage tarball.

Copy link
Owner

Choose a reason for hiding this comment

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

Or at least, I'm not too worried about this. Will look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, so this changes the hackage tarball I believe.

Compare
hledger: https://hackage.haskell.org/package/hledger-1.42/src/
hledger-ui: https://hackage.haskell.org/package/hledger-ui-1.42/src/

The man pages in the hledger tarball are inside the subdirectory embeddedfiles, and so package maintainers have to find them there, while the man pages in hledger-ui are currently in the toplevel directory.

We should probably not change this setup without a good reason.

@simonmichael
Copy link
Owner

Thank you! I hope to look at this soon.

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.

2 participants