Merge pull request #330510 from xzfc/cool-libreoffice

libreoffice-collabora: fix Hydra failure by splitting src derivation
This commit is contained in:
7c6f434c 2024-07-27 22:48:52 +00:00 committed by GitHub
commit 6d4350b123
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 57 additions and 24 deletions

View File

@ -200,9 +200,8 @@ let
}) // {
inherit (x) md5name md5;
}) srcsAttributes.deps;
} // optionalAttrs (variant != "collabora") {
translations = fetchurl srcsAttributes.translations;
help = fetchurl srcsAttributes.help;
translations = srcsAttributes.translations { inherit fetchurl fetchgit; };
help = srcsAttributes.help { inherit fetchurl fetchgit; };
};
qtMajor = lib.versions.major qtbase.version;
@ -235,14 +234,17 @@ in stdenv.mkDerivation (finalAttrs: {
ln -sfv ${f} $sourceRoot/${tarballPath}/${f.md5name}
ln -sfv ${f} $sourceRoot/${tarballPath}/${f.name}
'')}
'' + optionalString (variant != "collabora") ''
'' + (if (variant != "collabora") then ''
ln -sv ${srcs.help} $sourceRoot/${tarballPath}/${srcs.help.name}
ln -svf ${srcs.translations} $sourceRoot/${tarballPath}/${srcs.translations.name}
tar -xf ${srcs.help}
tar -xf ${srcs.translations}
'';
'' else ''
cp -r --no-preserve=mode ${srcs.help}/. $sourceRoot/helpcontent2/
cp -r --no-preserve=mode ${srcs.translations}/. $sourceRoot/translations/
'');
patches = [
# Skip some broken tests:

View File

@ -0,0 +1,6 @@
{ fetchgit, ... }:
fetchgit {
url = "https://gerrit.libreoffice.org/help";
rev = "27f62cdb52fe23f6090a3249fcd1433777b2598d";
hash = "sha256-lyBuj7FI1jwVLLBkB6JJcmQVtm1FKExYWvRUoGqRbJ0=";
}

View File

@ -2,6 +2,6 @@
fetchgit {
url = "https://gerrit.libreoffice.org/core";
rev = "refs/tags/cp-24.04.5-4";
hash = "sha256-27uLK1u8XWNigxZUCUu8nNZP3p5eFUsS2gCcfSYJK2k=";
fetchSubmodules = true;
hash = "sha256-OJ3R8qs8/R8QnXGCRgn/ZJK7Nn8cWwYbZxjEWg0VpBc=";
fetchSubmodules = false;
}

View File

@ -0,0 +1,6 @@
{ fetchgit, ... }:
fetchgit {
url = "https://gerrit.libreoffice.org/translations";
rev = "5fd34a953e6861cb8e392363c0a3500059ed6b01";
hash = "sha256-1j0kTvPbytsCWszXz+xFE+n53zPkR8gNgVaawn+rjfI=";
}

View File

@ -1,4 +1,5 @@
{
{ fetchurl, ... }:
fetchurl {
sha256 = "090pi8dnj5izpvng94hgmjid14n7xvy3rlqqvang3pqdn35xnpsl";
url = "https://download.documentfoundation.org/libreoffice/src/24.2.5/libreoffice-help-24.2.5.2.tar.xz";
}

View File

@ -1,4 +1,5 @@
{
{ fetchurl, ... }:
fetchurl {
sha256 = "0fri41y59zhm8lq0kh6hvf5rpdjdqx0lg1sl40mhh1d6lf1izc1w";
url = "https://download.documentfoundation.org/libreoffice/src/24.2.5/libreoffice-translations-24.2.5.2.tar.xz";
}

View File

@ -1,4 +1,5 @@
{
{ fetchurl, ... }:
fetchurl {
sha256 = "1l543k603mbr3rnwlnv9j52mblmvkgj9y49w4v7w3xm8b15331rs";
url = "https://download.documentfoundation.org/libreoffice/src/7.6.7/libreoffice-help-7.6.7.2.tar.xz";
}

View File

@ -1,4 +1,5 @@
{
{ fetchurl, ... }:
fetchurl {
sha256 = "1bzmpa04bv8afhl3p68dlicamh0zyckmbdgqb3v72fjmx2h8i64a";
url = "https://download.documentfoundation.org/libreoffice/src/7.6.7/libreoffice-translations-7.6.7.2.tar.xz";
}

View File

@ -47,7 +47,8 @@ case $variant in
echo \"$full_version\" > version.nix
for t in help translations; do
echo "{" > $t.nix
echo "{ fetchurl, ... }:" > $t.nix
echo "fetchurl {" >> $t.nix
echo " sha256 = "\"$(nix-prefetch-url $baseurl/libreoffice-$t-$full_version.tar.xz)'";' >> $t.nix
echo " url = "\"$baseurl/libreoffice-$t-$full_version.tar.xz'";' >> $t.nix
echo "}" >> $t.nix
@ -56,7 +57,7 @@ case $variant in
# Out of loop nix-prefetch-url, because there is no $t, and we want the output
# path as well, to get the download.lst file from there afterwards.
main_path_hash=($(nix-prefetch-url --print-path $baseurl/libreoffice-$full_version.tar.xz))
echo "{ fetchurl, ...}:" > main.nix
echo "{ fetchurl, ... }:" > main.nix
echo "fetchurl {" >> main.nix
echo " sha256 = "\"${main_path_hash[0]}'";' >> main.nix
echo " url = "\"$baseurl/libreoffice-$full_version.tar.xz'";' >> main.nix
@ -78,27 +79,41 @@ case $variant in
;;
(collabora)
full_version=$(git ls-remote --tags --sort -v:refname https://gerrit.libreoffice.org/core | grep -Pom1 'refs/tags/cp-\K\d+\.\d+\.\d+-\d+$')
all_tags=$(git ls-remote --tags --sort -v:refname https://gerrit.libreoffice.org/core)
rev=$(grep --perl-regexp --only-matching --max-count=1 \
'\Krefs/tags/cp-\d+\.\d+\.\d+-\d+$' <<< "$all_tags")
full_version=${rev#refs/tags/cp-}
echoerr full version is $full_version
echo \"$full_version\" > version.nix
rev="refs/tags/cp-$full_version"
# The full checkout including the submodules is too big for Hydra, so we fetch
# submodules separately.
declare -A dirnames=([help]=helpcontent2 [translations]=translations)
for t in help translations; do
sub_rev=$(curl --silent "https://git.libreoffice.org/core/+/$rev/${dirnames[$t]}" |\
pup '.gitlink-detail text{}' |\
sed -n 's/^Submodule link to \([0-9a-f]\{40\}\) of .*/\1/p')
echoerr got rev $sub_rev for $t
prefetch_output=$(nix-prefetch-git "https://gerrit.libreoffice.org/$t" --rev "$sub_rev")
echo "{ fetchgit, ... }:" > $t.nix
echo "fetchgit {" >> $t.nix
echo " url = \"$(jq -r '.url' <<< "$prefetch_output")\";" >> $t.nix
echo " rev = \"$rev\";" >> $t.nix
echo " hash = \"$(jq -r '.hash' <<< "$prefetch_output")\";" >> $t.nix
echo "}"
done
prefetch_output=$(nix-prefetch-git https://gerrit.libreoffice.org/core --rev "$rev" --fetch-submodules)
fetched_git_path=$(echo "$prefetch_output" | jq -r '.path')
hash=$(echo "$prefetch_output" | jq -r '.hash')
# Generate main.nix
local prefetch_output=$(nix-prefetch-git "https://gerrit.libreoffice.org/core" --rev "$rev")
echo "{ fetchgit, ... }:" > main.nix
echo "fetchgit {" >> main.nix
echo " url = \"https://gerrit.libreoffice.org/core\";" >> main.nix
echo " url = \"$(jq -r '.url' <<< "$prefetch_output")\";" >> main.nix
echo " rev = \"$rev\";" >> main.nix
echo " hash = \"$hash\";" >> main.nix
echo " fetchSubmodules = true;" >> main.nix
echo " hash = \"$(jq -r '.hash' <<< "$prefetch_output")\";" >> main.nix
echo " fetchSubmodules = false;" >> main.nix
echo "}" >> main.nix
# Environment variable required by ../generate-libreoffice-srcs.py
export downloadList="$fetched_git_path/download.lst"
export downloadList=$(jq -r '.path' <<< "$prefetch_output")/download.lst
esac
cd ..