-
Notifications
You must be signed in to change notification settings - Fork 292
CP-51479: Optimize 'make install' #5982
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
CP-51479: Optimize 'make install' #5982
Conversation
8c6884a to
b8387ca
Compare
e5d4412 to
7cc042f
Compare
d3d0ef2 to
137753f
Compare
Good to know, with many packages being changed, I would have expected that the rpm packages would have to change as well |
899ce3e to
f9764d0
Compare
…l.in ./configure generates api_version.ml from api_version.ml.in, but their comments didn't match. Synchronize them, such that running ./configure doesn't result in committable changes. Also ignore the api_version.ml.in2 file that gets created. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
We cannot prevent dune from building them at the moment (`nodynlink` is disabled, and doesn't work with PIE executables). However disable installing all these files to avoid the .spec file complaining about additional cmxs files appearing when opam packages are reorganized. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
'update-dm-lifecycle' and 'python' only exists in a single directory,
tell 'dune' exactly where to look.
This speeds up incremental builds:
```
dune build @ocaml/xapi-storage/python/xapi/storage/api/v5/python --profile=release ran
3.41 ± 0.18 times faster than dune build @python --profile=release
dune build @ocaml/idl/update-dm-lifecycle -j 8 --profile=release ran
2.13 ± 0.19 times faster than dune build @update-dm-lifecycle -j 8 --profile=release --auto-promote
```
```
Benchmark 2: dune build @ocaml/xapi-storage/python/xapi/storage/api/v5/python --profile=release
Time (mean ± σ): 288.7 ms ± 3.7 ms [User: 229.5 ms, System: 58.9 ms]
Range (min … max): 282.5 ms … 293.5 ms 10 runs
Benchmark 2: dune build @ocaml/idl/update-dm-lifecycle -j 8 --profile=release
Time (mean ± σ): 581.4 ms ± 15.8 ms [User: 442.5 ms, System: 175.8 ms]
Range (min … max): 550.5 ms … 602.2 ms 10 runs
```
Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Use `opam-dune-lint`. This will make it easier to later merge opam packages and keep the merged package updated correctly. Although `opam-dune-lint` doesn't find all problems yet, see: ocurrent/opam-dune-lint#71 Signed-off-by: Edwin Török <edwin.torok@cloud.com>
`set -x` is only needed when debugging the script. Don't flood 'make install' output. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
…ucceed Previously it failed because the symlink already existed. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
…re writing files When run inside Dune's sandbox you cannot rely on another rule having created the empty directories for you. Ensure that we create parent directories before we write a new file, otherwise we fail with a `Sys_error` about `No such file or directory`. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Also add an 'alias generate' for the csharp/autogen/LICENSE file. All other sdk subdirs have a 'generate' alias in 'autogen', except for 'csharp', and without it 'make sdk' would fail to build due to the missing file. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Avoid copying twice, get dune to install the files to the correct destination in one go. Also add a copy of XE_SR_ERRORCODES.xml, by default 'make install' would look for this in /opt/xensource, and writing there requires root. (This can be overriden with `./configure --share`). Since we are using `dune` to install the files now we need the file to always be present. Had to adjust the paths used by the CI. Uses dune directory targets, and the directory must be entirely under the control of these rules. There are some static files in autogen/ though, so move the generated ones to autogen-out, and then use 'cp -r' to copy over the static ones (there is no builtin dune action for the copy, there are individual copy actions, or a copy_files rule, but neither is suitable here) Signed-off-by: Edwin Török <edwin.torok@cloud.com>
To avoid the .spec build complaining about newly installed files. These aren't used outside of XAPI anyway. Remove test on xenopsd.cmxs, which is no longer built (there is still a test on the simulator and main XAPI). Signed-off-by: Edwin Török <edwin.torok@cloud.com>
…i-doc rule More efficient than install.sh. Also enables merging opam packages more easily, as it makes it clearer which package installs files where. 'xapi' and 'xe' are special cases because they install to /opt/xensource, so add a separate line with a different --prefix for them. We need a new xapi-debug package to install to /opt/xensource/debug which is a non-FHS compliant path, and we override its bindir to be /opt/xensource/debug. `vhd-tool` is special too, since it installs some files to /usr/libexec/xapi, but xapi itself is in /opt/xensource and its libexec would be /opt/xensource/libexec. Dune doesn't support installing to arbitrary directories, there is a 'misc' rule for that, but it is deprecated so I wouldn't start using it now. These rules generate multiple files in a directory, use dune's directory target support. Previously we would've copied the files multiple times. This is quite difficult to review, I suggest reviewing the outcome of the PR: On b123832 (do not installs cmxs commit): ``` rm /tmp/inst/1 -rf; make build install DESTDIR=/tmp/inst/1 && (cd /tmp/inst/1 && find ! -type d -printf '%p %M\n' ) >|ref ``` On the final commit of this PR: ``` rm /tmp/inst/2 -rf; make build install DESTDIR=/tmp/inst/2 && (cd /tmp/inst/2 && find ! -type d -printf '%p %M\n' ) >|this && sort -u ref >|refs && sort -u this >|thiss && diff -wu refs thiss ``` Signed-off-by: Edwin Török <edwin.torok@cloud.com>
compare with: ``` rm /tmp/inst/2 -rf; make build install DESTDIR=/tmp/inst/2 && (cd /tmp/inst/2 && find ! -type d -printf '%p %M %8s\n' ) >|this && sort -u ref >|refs && sort -u this >|thiss && diff -wu refs thiss && echo OK ``` Signed-off-by: Edwin Török <edwin.torok@cloud.com>
The dune build runs can't be parallelized, but the python and install.sh invocations and the `dune install` invocations can. Also remove the dependency between 'build' and 'install', if desired during development one can run `make build install`, however for the .spec build it is better to have a strict separation between build and install phases (this ensures that the install phase doesn't rebuild things by accident). Signed-off-by: Edwin Török <edwin.torok@cloud.com>
…i-rrdd-plugin They use the same install destination. xapi-rrdd-plugin was never installed, so remove the public-name and opam package (but keep the sources, they might be useful as an example). TODO: opam dune lint Signed-off-by: Edwin Török <edwin.torok@cloud.com>
These weren't being installed previously during a spec build, and had to be 'rm'-ed in the Makefile. Join them into a single package instead to reduce the number of opam files. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Improves: 1bb4543 ("CP-51479: [maintenance]: install SDK files using dune rules") Signed-off-by: Edwin Török <edwin.torok@cloud.com>
xs-opam build was failing due to missing dep between ezxenstore and xapi-stext-unix. opam-dune-lint didn't spot this one. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
f9764d0 to
0a8fc6e
Compare
This doesn't appear to be epoll related but causes an xs-opam failure. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
85ffeb4 to
48f12a7
Compare
|
The earlier dependency failure here was because newly added packages get a version of Although next time we update xs-opam we should see whether using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to wait to merge this after the epoll version has been tagged
We spend quite a lot of time here because dune is invoked multiple times from different makefile rules, also install.sh was very verbose.
Draft PR to check github CI.
Running
make build installwith no changes to the code is ~3x faster now:20s for a noop incremental build was too slow, 6s is still slow, but better.
And running just
make installwhen there are no changes is about ~7x faster now:Koji build times are slightly improved too (~3m44s for buildArch phase vs ~4m06s).
There are some changes in file permissions, but they look OK (e.g. having execute permissions on the manpages was wrong to begin with):
Permission changes
``` --- refs 2024-09-16 09:24:17.408911755 +0100 +++ thiss 2024-09-16 09:24:17.415912441 +0100 @@ -1404,7 +1404,7 @@ ./opt/xensource/bin/rrd2csv -rwxr-xr-x ./opt/xensource/bin/static-vdis -rwxr-xr-x ./opt/xensource/bin/update-ca-bundle.sh -rwxr-xr-x -./opt/xensource/bin/xapi -r-xr-xr-x +./opt/xensource/bin/xapi -rwxr-xr-x ./opt/xensource/bin/xapi-autostart-vms -rwxr-xr-x ./opt/xensource/bin/xapi-db-process -rwxr-xr-x ./opt/xensource/bin/xapi-wait-init-complete -rwxr-xr-x @@ -1422,13 +1422,13 @@ ./opt/xensource/bin/xe-switch-network-backend -rwxr-xr-x ./opt/xensource/bin/xe-toolstack-restart -rwxr-xr-x ./opt/xensource/bin/xe-xentrace -rwxr-xr-x -./opt/xensource/bin/xsh -r-xr-xr-x +./opt/xensource/bin/xsh -rwxr-xr-x ./opt/xensource/debug/debug_ha_query_liveset -rwxr-xr-x ./opt/xensource/debug/event_listen -rwxr-xr-x ./opt/xensource/debug/import-update-key -rwxr-xr-x ./opt/xensource/debug/perftest -rwxr-xr-x ./opt/xensource/debug/quicktest -rwxr-xr-x -./opt/xensource/debug/quicktestbin -r-xr-xr-x +./opt/xensource/debug/quicktestbin -rwxr-xr-x ./opt/xensource/debug/rbac_static.csv -rw-r--r-- ./opt/xensource/debug/suspend-image-viewer -rwxr-xr-x ./opt/xensource/debug/vncproxy -rwxr-xr-x @@ -1459,7 +1459,7 @@ ./opt/xensource/libexec/network-init -rwxr-xr-x ./opt/xensource/libexec/pbis-force-domain-leave -rwxr-xr-x ./opt/xensource/libexec/print-custom-templates -rwxr-xr-x -./opt/xensource/libexec/python_nbd_client.py -rw-r--r-- +./opt/xensource/libexec/python_nbd_client.py -rwxr-xr-x ./opt/xensource/libexec/reset-and-reboot -rwxr-xr-x ./opt/xensource/libexec/restore-sr-metadata.py -rwxr-xr-x ./opt/xensource/libexec/save-boot-info -rwxr-xr-x @@ -1705,9 +1705,9 @@ ./usr/sbin/xenopsd-simulator -rwxr-xr-x ./usr/sbin/xenopsd-xc -rwxr-xr-x ./usr/share/man/man1/xcp-networkd.1 -rw-r--r-- -./usr/share/man/man1/xenops-cli.1.gz -rwxr-xr-x -./usr/share/man/man1/xenopsd-simulator.1.gz -rwxr-xr-x -./usr/share/man/man1/xenopsd-xc.1.gz -rwxr-xr-x +./usr/share/man/man1/xenops-cli.1.gz -rw-r--r-- +./usr/share/man/man1/xenopsd-simulator.1.gz -rw-r--r-- +./usr/share/man/man1/xenopsd-xc.1.gz -rw-r--r-- ./usr/share/man/man8/xapi-storage-script.8 -rw-r--r-- ./usr/share/xapi/doc/classes.dot -rw-r--r-- ./usr/share/xapi/doc/doc-convert.sh -rwxr-xr-x @@ -2034,7 +2034,7 @@ ./usr/share/xapi/doc/markdown/class-vtpm.md -rw-r--r-- ./usr/share/xapi/doc/markdown/class-vusb.md -rw-r--r-- ./usr/share/xapi/doc/markdown/classes.md -rw-r--r-- -./usr/share/xapi/doc/markdown/management-api.md -r--r--r-- +./usr/share/xapi/doc/markdown/management-api.md -rw-r--r-- ./usr/share/xapi/doc/markdown/relationships-between-classes.md -rw-r--r-- ./usr/share/xapi/doc/markdown/toc.yml -rw-r--r-- ./usr/share/xapi/doc/markdown/types.md -rw-r--r-- ```