libreoffice: write a whole, batteries included updateScript
This commit is contained in:
parent
90160e5fe3
commit
582e1924c9
@ -1,19 +0,0 @@
|
||||
LibreOffice
|
||||
===========
|
||||
|
||||
Here are instructions how to update libreoffice. In the below commands and
|
||||
instructions, $VARIANT is either `still` or `fresh`.
|
||||
|
||||
1. Update the necessary version parts in `src-$VARIANT/primary.nix`.
|
||||
2. Run the following command:
|
||||
|
||||
```bash
|
||||
nix-shell gen-shell.nix --argstr variant VARIANT --run generate
|
||||
```
|
||||
|
||||
3. It will fail initially, due to hash mismatch in the main `src` attribute.
|
||||
Fix the hash according to the failure.
|
||||
4. Run the command from step 2 again, now it will take a while.
|
||||
5. Zero-out the hashes of the translations and help attributes in
|
||||
`src-$VARIANT/primary.nix`.
|
||||
6. Update the hashes above by building `libreoffice-$VARIANT`.
|
@ -145,29 +145,33 @@ let
|
||||
};
|
||||
|
||||
importVariant = f: import (./. + "/src-${variant}/${f}");
|
||||
|
||||
primary-src = importVariant "primary.nix" { inherit fetchurl; };
|
||||
|
||||
inherit (primary-src) major minor version;
|
||||
|
||||
langsSpaces = concatStringsSep " " langs;
|
||||
|
||||
# Update these files with:
|
||||
# nix-shell maintainers/scripts/update.nix --argstr package libreoffice-$VARIANT.unwrapped
|
||||
version = importVariant "version.nix";
|
||||
srcsAttributes = {
|
||||
main = importVariant "main.nix";
|
||||
help = importVariant "help.nix";
|
||||
translations = importVariant "translations.nix";
|
||||
deps = (importVariant "deps.nix") ++ [
|
||||
# TODO: Why is this needed?
|
||||
(rec {
|
||||
name = "unowinreg.dll";
|
||||
url = "https://dev-www.libreoffice.org/extern/${md5name}";
|
||||
sha256 = "1infwvv1p6i21scywrldsxs22f62x85mns4iq8h6vr6vlx3fdzga";
|
||||
md5 = "185d60944ea767075d27247c3162b3bc";
|
||||
md5name = "${md5}-${name}";
|
||||
})
|
||||
];
|
||||
};
|
||||
srcs = {
|
||||
primary = primary-src;
|
||||
third_party =
|
||||
map (x: ((fetchurl { inherit (x) url sha256 name; }) // { inherit (x) md5name md5; }))
|
||||
(importVariant "download.nix" ++ [
|
||||
(rec {
|
||||
name = "unowinreg.dll";
|
||||
url = "https://dev-www.libreoffice.org/extern/${md5name}";
|
||||
sha256 = "1infwvv1p6i21scywrldsxs22f62x85mns4iq8h6vr6vlx3fdzga";
|
||||
md5 = "185d60944ea767075d27247c3162b3bc";
|
||||
md5name = "${md5}-${name}";
|
||||
})
|
||||
]);
|
||||
|
||||
translations = primary-src.translations;
|
||||
help = primary-src.help;
|
||||
third_party = map (x:
|
||||
(fetchurl {
|
||||
inherit (x) url sha256 name;
|
||||
}) // {
|
||||
inherit (x) md5name md5;
|
||||
}) srcsAttributes.deps;
|
||||
translations = fetchurl srcsAttributes.translations;
|
||||
help = fetchurl srcsAttributes.help;
|
||||
};
|
||||
|
||||
# See `postPatch` for details
|
||||
@ -188,8 +192,7 @@ let
|
||||
in stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libreoffice";
|
||||
inherit version;
|
||||
|
||||
inherit (primary-src) src;
|
||||
src = fetchurl srcsAttributes.main;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString ([
|
||||
"-I${librdf_rasqal}/include/rasqal" # librdf_redland refers to rasqal.h instead of rasqal/rasqal.h
|
||||
@ -276,7 +279,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
preConfigure = ''
|
||||
configureFlagsArray=(
|
||||
"--with-parallelism=$NIX_BUILD_CORES"
|
||||
"--with-lang=${langsSpaces}"
|
||||
"--with-lang=${concatStringsSep " " langs}"
|
||||
);
|
||||
|
||||
chmod a+x ./bin/unpack-sources
|
||||
@ -609,6 +612,13 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
passthru = {
|
||||
inherit srcs;
|
||||
jdk = jre';
|
||||
updateScript = [
|
||||
./update.sh
|
||||
# Pass it this file name as argument
|
||||
(builtins.unsafeGetAttrPos "pname" finalAttrs.finalPackage).file
|
||||
# And the variant
|
||||
variant
|
||||
];
|
||||
inherit kdeIntegration;
|
||||
# For the wrapper.nix
|
||||
inherit gtk3;
|
||||
|
@ -1,4 +0,0 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
|
||||
tar --extract --file=$src libreoffice-$version/download.lst -O > $out
|
@ -1,29 +0,0 @@
|
||||
{ pkgs ? (import <nixpkgs> {}), variant }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
|
||||
primary-src = callPackage (./. + "/src-${variant}/primary.nix") {};
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "generate-libreoffice-srcs-shell";
|
||||
|
||||
buildCommand = "exit 1";
|
||||
|
||||
downloadList = stdenv.mkDerivation {
|
||||
name = "libreoffice-${primary-src.version}-download-list";
|
||||
inherit (primary-src) src version;
|
||||
builder = ./download-list-builder.sh;
|
||||
};
|
||||
|
||||
buildInputs = [ python3 ];
|
||||
|
||||
shellHook = ''
|
||||
function generate {
|
||||
python3 generate-libreoffice-srcs.py ${variant} > src-${variant}/download.nix
|
||||
}
|
||||
'';
|
||||
}
|
4
pkgs/applications/office/libreoffice/src-fresh/help.nix
Normal file
4
pkgs/applications/office/libreoffice/src-fresh/help.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
sha256 = "sha256-qQ+THdMjjrZOb2WWTqj5DlrM2a0Qkl1aYMevaqWFwfE=";
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/7.5.4/libreoffice-help-7.5.4.2.tar.xz";
|
||||
}
|
4
pkgs/applications/office/libreoffice/src-fresh/main.nix
Normal file
4
pkgs/applications/office/libreoffice/src-fresh/main.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
sha256 = "sha256-dWE7yXldkiEnsJOxfxyZ9p05eARqexgRRgNV158VVF4=";
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/7.5.4/libreoffice-7.5.4.2.tar.xz";
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
{ fetchurl }:
|
||||
|
||||
rec {
|
||||
fetchSrc = {name, hash}: fetchurl {
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${name}-${version}.tar.xz";
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
major = "7";
|
||||
minor = "5";
|
||||
patch = "4";
|
||||
tweak = "1";
|
||||
|
||||
subdir = "${major}.${minor}.${patch}";
|
||||
|
||||
version = "${subdir}${if tweak == "" then "" else "."}${tweak}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${version}.tar.xz";
|
||||
hash = "sha256-dWE7yXldkiEnsJOxfxyZ9p05eARqexgRRgNV158VVF4=";
|
||||
};
|
||||
|
||||
# FIXME rename
|
||||
translations = fetchSrc {
|
||||
name = "translations";
|
||||
hash = "sha256-dv3L8DtdxZcwmeXnqtTtwIpOvwZg3aH3VvJBiiZzbh0=";
|
||||
};
|
||||
|
||||
# the "dictionaries" archive is not used for LO build because we already build hunspellDicts packages from
|
||||
# it and LibreOffice can use these by pointing DICPATH environment variable at the hunspell directory
|
||||
|
||||
help = fetchSrc {
|
||||
name = "help";
|
||||
hash = "sha256-2CrGEyK5AQEAo1Qz1ACmvMH7BaOubW5BNLWv3fDEdOY=";
|
||||
};
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
sha256 = "sha256-frJkws1m8CiDFTW+wNP837aH+uTet30gDP5ANMo6EK0=";
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/7.5.4/libreoffice-translations-7.5.4.2.tar.xz";
|
||||
}
|
@ -0,0 +1 @@
|
||||
"7.5.4.2"
|
4
pkgs/applications/office/libreoffice/src-still/help.nix
Normal file
4
pkgs/applications/office/libreoffice/src-still/help.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
sha256 = "sha256-vcQWE3mBZx2sBQ9KzTh6zM7277mK9twfvyESTzTiII8=";
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/7.4.7/libreoffice-help-7.4.7.2.tar.xz";
|
||||
}
|
4
pkgs/applications/office/libreoffice/src-still/main.nix
Normal file
4
pkgs/applications/office/libreoffice/src-still/main.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
sha256 = "sha256-dD2R8qE4png4D6eo7LWyQB2ZSwZ7MwdQ8DrY9SOi+yA=";
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/7.4.7/libreoffice-7.4.7.2.tar.xz";
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
{ fetchurl }:
|
||||
|
||||
rec {
|
||||
fetchSrc = {name, hash}: fetchurl {
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${name}-${version}.tar.xz";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
major = "7";
|
||||
minor = "4";
|
||||
patch = "7";
|
||||
tweak = "2";
|
||||
|
||||
subdir = "${major}.${minor}.${patch}";
|
||||
|
||||
version = "${subdir}${if tweak == "" then "" else "."}${tweak}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${version}.tar.xz";
|
||||
hash = "sha256-dD2R8qE4png4D6eo7LWyQB2ZSwZ7MwdQ8DrY9SOi+yA=";
|
||||
};
|
||||
|
||||
# FIXME rename
|
||||
translations = fetchSrc {
|
||||
name = "translations";
|
||||
hash = "sha256-7wea0EClmvwcPvgQDGagkOF7eBVvYTZScCEEpirdXnE=";
|
||||
};
|
||||
|
||||
# the "dictionaries" archive is not used for LO build because we already build hunspellDicts packages from
|
||||
# it and LibreOffice can use these by pointing DICPATH environment variable at the hunspell directory
|
||||
|
||||
help = fetchSrc {
|
||||
name = "help";
|
||||
hash = "sha256-vcQWE3mBZx2sBQ9KzTh6zM7277mK9twfvyESTzTiII8=";
|
||||
};
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
sha256 = "sha256-7wea0EClmvwcPvgQDGagkOF7eBVvYTZScCEEpirdXnE=";
|
||||
url = "https://download.documentfoundation.org/libreoffice/src/7.4.7/libreoffice-translations-7.4.7.2.tar.xz";
|
||||
}
|
@ -0,0 +1 @@
|
||||
"7.4.7.1"
|
74
pkgs/applications/office/libreoffice/update.sh
Executable file
74
pkgs/applications/office/libreoffice/update.sh
Executable file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p python3 pup curl jq nix
|
||||
|
||||
set -euo pipefail
|
||||
echoerr() { echo "$@" 1>&2; }
|
||||
|
||||
fname="$1"
|
||||
echoerr got fname $fname
|
||||
shift
|
||||
|
||||
variant="$1"
|
||||
# See comment near version_major variable
|
||||
if [[ $variant == fresh ]]; then
|
||||
head_tail=head
|
||||
elif [[ $variant == still ]]; then
|
||||
head_tail=tail
|
||||
else
|
||||
echoerr got unknown variant $variant
|
||||
exit 3
|
||||
fi
|
||||
echoerr got variant $variant
|
||||
shift
|
||||
|
||||
# Not totally needed, but makes it easy to run the update in case tis folder is
|
||||
# deleted.
|
||||
mkdir -p "$(dirname $fname)/src-$variant"
|
||||
cd "$(dirname $fname)/src-$variant"
|
||||
|
||||
# The pup command prints both fresh and still versions one after another, and
|
||||
# we use either head -1 or tail -1 to get the right version, per the if elif
|
||||
# above.
|
||||
version_major="$(curl --silent https://www.libreoffice.org/download/download-libreoffice/ |\
|
||||
pup '.dl_version_number text{}' | $head_tail -1)"
|
||||
echoerr got from website ${variant}_version $version_major
|
||||
baseurl=https://download.documentfoundation.org/libreoffice/src/$version_major
|
||||
tarballs=($(curl --silent $baseurl/ |\
|
||||
pup 'table json{}' |\
|
||||
jq --raw-output '.. | .href? | strings' |\
|
||||
grep "$version_major.*.tar.xz$"))
|
||||
|
||||
full_version="$(echo ${tarballs[0]} | sed -e 's/^libreoffice-//' -e 's/.tar.xz$//')"
|
||||
echoerr full version is $full_version
|
||||
echo \"$full_version\" > version.nix
|
||||
|
||||
for t in help translations; do
|
||||
echo "{" > $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
|
||||
done
|
||||
|
||||
# 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 "{" > main.nix
|
||||
echo " sha256 = "\"${main_path_hash[0]}'";' >> main.nix
|
||||
echo " url = "\"$baseurl/libreoffice-$full_version.tar.xz'";' >> main.nix
|
||||
echo "}" >> main.nix
|
||||
echoerr got filename ${main_path_hash[1]}
|
||||
|
||||
# Environment variable required by ../generate-libreoffice-srcs.py
|
||||
export downloadList=/tmp/nixpkgs-libreoffice-update-download-$full_version.lst
|
||||
# Need to extract the file only if it doesn't exist, otherwise spare time be
|
||||
# skipping this.
|
||||
if [[ ! -f "$downloadList" ]]; then
|
||||
tar --extract \
|
||||
--file=${main_path_hash[1]} \
|
||||
libreoffice-$full_version/download.lst \
|
||||
-O > $downloadList
|
||||
else
|
||||
echoerr relying on previously downloaded downloadList file
|
||||
fi
|
||||
cd ..
|
||||
python3 ./generate-libreoffice-srcs.py > src-$variant/deps.nix
|
@ -19,7 +19,9 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (unwrapped.srcs.primary) major minor;
|
||||
inherit (unwrapped) version;
|
||||
major = lib.versions.major version;
|
||||
minor = lib.versions.minor version;
|
||||
|
||||
makeWrapperArgs = builtins.concatStringsSep " " ([
|
||||
"--set" "GDK_PIXBUF_MODULE_FILE" "${librsvg}/${gdk-pixbuf.moduleDir}.cache"
|
||||
|
Loading…
Reference in New Issue
Block a user