cryptpad: verify that we've installed the correct versions of OnlyOffice

With this change, I saw the following when I built cryptpad:

```
$ nix build .#cryptpad
...
       > v1 was up to date
       > v2b was up to date
       > v4 was up to date
       > v5 was up to date
       > v6 was up to date
       > Wrong commit of /nix/store/1m2d8c4fppfav7n2s4fvali3iira2ky2-cryptpad-2024.9.1/lib/node_modules/cryptpad/www/common/onlyoffice/dist/v7 found. Expected: e1267803. Actual: 9d8b914a
```

This reproduces the issue @martinetd noticed in
<https://github.com/NixOS/nixpkgs/pull/365126#discussion_r1885015234>.

I then addressed these issue by fixing the commit we use for `v7` of
OnlyOffice.
This commit is contained in:
Jeremy Fleischman 2024-12-15 22:41:05 -08:00
parent 613302db1f
commit ca965ec64f
No known key found for this signature in database
GPG Key ID: 19319CD8416A642B

View File

@ -1,6 +1,8 @@
{
bash,
buildNpmPackage,
fetchFromGitHub,
fetchpatch,
fetchurl,
lib,
makeBinaryWrapper,
@ -56,8 +58,8 @@ let
}
{
subdir = "v7";
rev = "9d8b914a";
hash = "sha256-M+rPJ/Xo2olhqB5ViynGRaesMLLfG/1ltUoLnepMPnM=";
rev = "e1267803";
hash = "sha256-iIds0GnCHAyeIEdSD4aCCgDtnnwARh3NE470CywseS0=";
}
];
@ -90,12 +92,19 @@ buildNpmPackage {
makeBinaryWrapper
rdfind
unzip
bash
];
patches = [
# fix httpSafePort setting
# https://github.com/cryptpad/cryptpad/pull/1571
./0001-env.js-fix-httpSafePort-handling.patch
# https://github.com/cryptpad/cryptpad/pull/1740
(fetchpatch {
name = "Add `--check`, `--rdfind`, `--no-rdfind` options to `install-onlyoffice.sh`";
url = "https://github.com/cryptpad/cryptpad/commit/f38668735e777895db2eadd3413cff386fb12c0c.patch";
hash = "sha256-J4AK1XIa3q+/lD74p2c9O7jt0VEtofTmfAaQNU71sp8=";
})
];
# cryptpad build tries to write in cache dir
@ -121,7 +130,11 @@ buildNpmPackage {
mkdir -p "$out_cryptpad/www/common/onlyoffice/dist"
${lib.concatMapStringsSep "\n" onlyoffice_install onlyoffice_versions}
${x2t_install}
rdfind -makehardlinks true -makeresultsfile false "$out_cryptpad/www/common/onlyoffice/dist"
# Run upstream's `install-onlyoffice.sh` script in `--check` mode to
# verify that we've installed the correct versions of the various
# OnlyOffice components.
patchShebangs --build $out_cryptpad/install-onlyoffice.sh
$out_cryptpad/install-onlyoffice.sh --accept-license --check --rdfind
# cryptpad assumes it runs in the source directory and also outputs
# its state files there, which is not exactly great for us.