diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 8b063ad6c70e..d5d48219beb7 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -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: diff --git a/pkgs/applications/office/libreoffice/src-collabora/help.nix b/pkgs/applications/office/libreoffice/src-collabora/help.nix new file mode 100644 index 000000000000..fc5d4a3fa2a0 --- /dev/null +++ b/pkgs/applications/office/libreoffice/src-collabora/help.nix @@ -0,0 +1,6 @@ +{ fetchgit, ... }: +fetchgit { + url = "https://gerrit.libreoffice.org/help"; + rev = "27f62cdb52fe23f6090a3249fcd1433777b2598d"; + hash = "sha256-lyBuj7FI1jwVLLBkB6JJcmQVtm1FKExYWvRUoGqRbJ0="; +} diff --git a/pkgs/applications/office/libreoffice/src-collabora/main.nix b/pkgs/applications/office/libreoffice/src-collabora/main.nix index 7e4bf5f4fdd0..ef4d5d77bfc1 100644 --- a/pkgs/applications/office/libreoffice/src-collabora/main.nix +++ b/pkgs/applications/office/libreoffice/src-collabora/main.nix @@ -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; } diff --git a/pkgs/applications/office/libreoffice/src-collabora/translations.nix b/pkgs/applications/office/libreoffice/src-collabora/translations.nix new file mode 100644 index 000000000000..06f5fe5a3624 --- /dev/null +++ b/pkgs/applications/office/libreoffice/src-collabora/translations.nix @@ -0,0 +1,6 @@ +{ fetchgit, ... }: +fetchgit { + url = "https://gerrit.libreoffice.org/translations"; + rev = "5fd34a953e6861cb8e392363c0a3500059ed6b01"; + hash = "sha256-1j0kTvPbytsCWszXz+xFE+n53zPkR8gNgVaawn+rjfI="; +} diff --git a/pkgs/applications/office/libreoffice/src-fresh/help.nix b/pkgs/applications/office/libreoffice/src-fresh/help.nix index 164121f06165..0f9f54905270 100644 --- a/pkgs/applications/office/libreoffice/src-fresh/help.nix +++ b/pkgs/applications/office/libreoffice/src-fresh/help.nix @@ -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"; } diff --git a/pkgs/applications/office/libreoffice/src-fresh/translations.nix b/pkgs/applications/office/libreoffice/src-fresh/translations.nix index 82291fab8326..b96943060182 100644 --- a/pkgs/applications/office/libreoffice/src-fresh/translations.nix +++ b/pkgs/applications/office/libreoffice/src-fresh/translations.nix @@ -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"; } diff --git a/pkgs/applications/office/libreoffice/src-still/help.nix b/pkgs/applications/office/libreoffice/src-still/help.nix index f9e71ea79936..8bdc4617e148 100644 --- a/pkgs/applications/office/libreoffice/src-still/help.nix +++ b/pkgs/applications/office/libreoffice/src-still/help.nix @@ -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"; } diff --git a/pkgs/applications/office/libreoffice/src-still/translations.nix b/pkgs/applications/office/libreoffice/src-still/translations.nix index 9604ad622e21..fffb89108f09 100644 --- a/pkgs/applications/office/libreoffice/src-still/translations.nix +++ b/pkgs/applications/office/libreoffice/src-still/translations.nix @@ -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"; } diff --git a/pkgs/applications/office/libreoffice/update.sh b/pkgs/applications/office/libreoffice/update.sh index 6f9612dd7090..9f7a580ad56e 100755 --- a/pkgs/applications/office/libreoffice/update.sh +++ b/pkgs/applications/office/libreoffice/update.sh @@ -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 ..