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

vala_0_38, vala_0_40, vala_0_42: add configuration to disable graphviz (to reduce closure size) #53000

Merged
merged 1 commit into from Jan 15, 2019

Conversation

andrew-d
Copy link
Contributor

Motivation for this change

This allows building Vala without support for Graphviz; useful for more minimal installs where we don't want to pull it (and transitively, pango, gd, etc.) in as a dependency.

As an example with vala 0.38:

# with Graphviz
$ nix path-info -S /nix/store/wy3ajrqhplx7lnh4gnqv2pwd6w7insml-vala-0.38.9
/nix/store/wy3ajrqhplx7lnh4gnqv2pwd6w7insml-vala-0.38.9	  195998064

# without
$ nix path-info -S /nix/store/1nalx8vpq6hzsp40x83wwqqaw8aa3di7-vala-0.38.9   
/nix/store/1nalx8vpq6hzsp40x83wwqqaw8aa3di7-vala-0.38.9	   55116152

Or, from ~187MiB to ~53MiB! TBD on whether we want to enable this by default; I've left it as-is for now, and will defer on whether to enable this in more places, or create valaMinimal, etc. to any reviewers. At the very least, we probably want to use this for libsecret, which is how I originally noticed this; building libsecret from scratch required building all of X11, since there was the following chain of dependencies:

vala ➡️ graphviz ➡️ libXpm ➡️ xproto ➡️ libX11

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

r? @antono @jtojnar @lethalman @peterhoeg (maintainers)

@jtojnar
Copy link
Contributor

jtojnar commented Dec 28, 2018

cc @hedning

Also, was there ever an attempt to get this patch upstream?

@andrew-d
Copy link
Contributor Author

@jtojnar - Following the chain of bug links, I found this, which doesn't really solve the problem; they added support for disabling the build of valadoc entirely, but not building without graphviz. It looks like someone (@albfan ?) asked about using valadoc without graphviz, but there has been no reply yet.

@jtojnar
Copy link
Contributor

jtojnar commented Dec 28, 2018

If https://gitlab.gnome.org/GNOME/gitg/merge_requests/16#note_345578 is correct and gitg is the only program using valadoc, we should be able to disable it outright, since we do not build gitg docs.

@albfan
Copy link

albfan commented Dec 28, 2018

Here is the patch to build vala with valadoc without graphviz avaliable

https://gitlab.gnome.org/GNOME/gitg/commit/0cfd07f8ab8b2c9e210bb537ac15283ce8c746c2

We use it for a while but finally remove it as we want to keep in sync with fixes and improvements on vala, and there's no interest to maintain that upstream.

Makes sense as build a project and build docs for a project can be done in different jobs. Our idea is to use a docker image with a recent distro to build docs.

From a distro perspective not sure what is the correct approach

@andrew-d
Copy link
Contributor Author

I just force-pushed another iteration of this that avoids checking in the patches, and instead fetches the ones used by openembedded-core plus a small additional patch. OpenEmbedded a relatively well-supported project, so I'm pretty confident that we'll continue to have additional patches from them, but if not, the patches are relatively trivial and I'm happy to own forward-porting.

@jtojnar - As for just disabling valadoc, it looks like libhttpseverywhere uses it, so I don't think we can get away with just disabling it right now. I like the approach in this PR because docs will still mostly work - the only thing that changes is that graphs that would have been rendered with Graphviz are instead just not rendered, but everything else functions as intended.

@andrew-d
Copy link
Contributor Author

Oh, and one more question: this PR looks like it should go to staging; does anyone know the right way to do this? Last time that I changed the PR's base branch, I ended up ccing like 15 people as reviewers because this PR suddenly had a bunch of commits in it.

@jtojnar
Copy link
Contributor

jtojnar commented Dec 28, 2018 via email

@andrew-d andrew-d changed the base branch from master to staging December 28, 2018 20:22
@andrew-d
Copy link
Contributor Author

andrew-d commented Jan 6, 2019

@jtojnar - Any suggestions on how to move this forward? It's been rebased on staging.

@hedning
Copy link
Contributor

hedning commented Jan 7, 2019

I'd say we merge this, and if it becomes a pain to maintain down the road we can look at disabling valadoc altogether. Does that sound reasonable?

@jtojnar
Copy link
Contributor

jtojnar commented Jan 7, 2019

Fine with me.

@jtojnar
Copy link
Contributor

jtojnar commented Jan 7, 2019

@GrahamcOfBorg build vala_0_38 vala_0_40 vala_0_42

@hedning
Copy link
Contributor

hedning commented Jan 8, 2019

Ah, wait, we should turn this on by default, no? Not much point in doing this without actually using it.

@worldofpeace
Copy link
Contributor

Ah, wait, we should turn this on by default, no? Not much point in doing this without actually using it.

I'd very much like to enable this by default 👍

@andrew-d
Copy link
Contributor Author

andrew-d commented Jan 8, 2019 via email

@andrew-d
Copy link
Contributor Author

andrew-d commented Jan 9, 2019

A bit closer to 15 hours than 15 minutes, but... @worldofpeace and @hedning, enabled by default now!

@hedning
Copy link
Contributor

hedning commented Jan 9, 2019

👍

@GrahamcOfBorg build vala_0_38 vala_0_40 vala_0_42

@hedning
Copy link
Contributor

hedning commented Jan 9, 2019

patch failed to apply for 0.40

Edit: also fails for 0.42

@andrew-d
Copy link
Contributor Author

@hedning - Okay, the failure on 0.42 was legit; upstream just released 0.42.4 and the patch fails to apply; I've updated the PR to fix that. The failure on 0.40 looks like a build timeout on the Darwin builder.

@worldofpeace
Copy link
Contributor

@GrahamcOfBorg build vala_0_38 vala_0_40 vala_0_42

@andrew-d
Copy link
Contributor Author

The 0.42.4 build failure appears unrelated? Error shows as:

warning: unable to download 'https://cache.nixos.org/nar/1mrdj0g4q5zq83jz88dapj47xj47nzkvsg4i7sjamh7p9di3x34x.nar.xz': HTTP error 503; retrying in 331 ms
error 7 while decompressing xz file

As for the 0.40.12 build failure, that's legit; upstream made the same changes as 0.42, so I did the same thing and fixed the patch merge conflict and just force-pushed.

All three versions build successfully when I build them locally with the new versions/hashes from master.

@worldofpeace
Copy link
Contributor

Patches for 0.40 and 0.42 don't apply for me locally.

For 0.40 I get

applying patch /nix/store/qpwxga9bxbh7935zkxfazrf00ch0b3nj-disable-graphviz-0.40.12.patch
patching file configure.ac
patching file libvaladoc/Makefile.am
Hunk #1 succeeded at 126 (offset -2 lines).
Hunk #2 succeeded at 152 (offset -2 lines).
Hunk #3 FAILED at 191.
Hunk #4 succeeded at 218 (offset -6 lines).
Hunk #5 succeeded at 228 (offset -6 lines).
1 out of 5 hunks FAILED -- saving rejects to file libvaladoc/Makefile.am.rej
patching file libvaladoc/html/basicdoclet.vala
Hunk #3 succeeded at 1031 (offset -1 lines).
Hunk #4 succeeded at 1051 (offset -1 lines).
patching file libvaladoc/html/htmlmarkupwriter.vala
builder for '/nix/store/fzz0gyiy93fpx2ygxljrli824dx2q9gj-vala-0.40.11.drv' failed with exit code 1

and for 0.42

patching sources
applying patch /nix/store/fdpwlhbq7fwphz450rak888hs09zwqn5-disable-graphviz-0.42.4.patch
patching file configure.ac
patching file libvaladoc/Makefile.am
Hunk #1 succeeded at 126 (offset -2 lines).
Hunk #2 succeeded at 152 (offset -2 lines).
Hunk #3 FAILED at 191.
Hunk #4 succeeded at 218 (offset -6 lines).
Hunk #5 succeeded at 228 (offset -6 lines).
1 out of 5 hunks FAILED -- saving rejects to file libvaladoc/Makefile.am.rej
patching file libvaladoc/html/basicdoclet.vala
Hunk #3 succeeded at 1031 (offset -1 lines).
Hunk #4 succeeded at 1051 (offset -1 lines).
patching file libvaladoc/html/htmlmarkupwriter.vala
builder for '/nix/store/cg0zf21bslzqjyg0413byyyf2s8glxvj-vala-0.42.3.drv' failed with exit code 1

This allows building Vala without support for Graphviz; useful for more
minimal installs where we don't want to pull it (and transitively,
pango, gd, etc.) in as a dependency.
@andrew-d
Copy link
Contributor Author

@worldofpeace - Yeah, that's because this branch wasn't rebased on latest master/staging, which has upgraded Vala to 0.42.4 and 0.40.12; I tested by changing the versions locally because I'm afraid of rebasing 😛 Just rebased on staging with the new versions and force-pushed.

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

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

très bien @andrew-d 👍

@hedning
Copy link
Contributor

hedning commented Jan 14, 2019

@GrahamcOfBorg build vala_0_38 vala_0_40 vala_0_42

@worldofpeace worldofpeace merged commit 263bc89 into NixOS:staging Jan 15, 2019
@jtojnar jtojnar mentioned this pull request Jul 4, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants