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

Allow building out-of-tree #514

Closed
3 tasks
ISSOtm opened this issue Nov 30, 2023 · 2 comments · Fixed by #523
Closed
3 tasks

Allow building out-of-tree #514

ISSOtm opened this issue Nov 30, 2023 · 2 comments · Fixed by #523
Labels

Comments

@ISSOtm
Copy link
Member

ISSOtm commented Nov 30, 2023

This was requested by @mid-kid, who packages Pan Docs as a Gentoo package for offline viewing. Currently, this chokes by default because we expect to be able to call git show to retrieve the commit info for the front page.

To do:

  • Figure out what to display on the front page when building out-of-tree
  • Decide on an interface to enable out-of-tree builds
  • Figure out a good place to document that last item

For the second bullet, I think we can rely on a key in mdBook's output.pandocs table, which would disable Git scanning if set to true. This can even be configured via environment variables e.g. MDBOOK_output__pandocs__out_of_tree=true mdbook build to avoid patching the sources.

For the last item, I think DEPLOY.md is the best place?

@mid-kid
Copy link

mid-kid commented Nov 30, 2023

The third item is very quickly gonna be noticed by simply the build failing. I don't think you need to do much more with regards to that, other than either making a descriptive error, or expecting the builder to dig into the code for it (as I did, long enough to know that it wasn't gonna be a simple sed :))

@ISSOtm
Copy link
Member Author

ISSOtm commented Nov 30, 2023

That special configuration is needed can be made obvious, sure; however, that the option exists at all may be less so! It seems likely to me that a packager will sooner reach for patch -p0 than digging through the configuration.

Then there's the issue of detection; I'd assume that ".git does not exist" should be the correct basis, but maybe I'm missing something?

Additionally, you remarked via IM that we ought to pass the --git-dir argument to git show to ensure that we don't accidentally pick up a parent Git dir. (I'm not sure if that plays nice with submodules, but my intuition says that it should.)

As for the patch, well, I think patch is indeed more appropriate than sed, yes :P
But you will have to update that patch now that #513 has landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants