Skip to content
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

texlive: 2017 -> 2017-final #40826

Merged
merged 3 commits into from Aug 10, 2018
Merged

texlive: 2017 -> 2017-final #40826

merged 3 commits into from Aug 10, 2018

Conversation

bhipple
Copy link
Contributor

@bhipple bhipple commented May 20, 2018

This commit rebuilds texlive 2017 with the final release of 2017. As described
in these issues [1][2][3], the upstream CTAN mirrors are a continuously moving
rolling release without historical archives.

This particular FTP server is also a rolling release folling CTAN for the latest
version, but it has snapshots of the final texlive releases; it appears that the
2017 distribution has been unmodified since texlive-2018 was released earlier
this year.

Along the way, we needed to fix several issues:

  • xindy: if $HOME is unset, it will try to mkdir /homeless-shelter, which fails
    due to insufficient permissions.
  • scheme-infraonly: this scheme had symlinks into other releases that were
    read-only, so it couldn't patch and modify the scripts. This commit removes it
    for now, but that's not a particularly satisfying solution. Ideas?

This also adds some documentation on the upgrade process to prepare for
texlive-2018 [4].

This commit also replaces the sha1 hashes with upstream's standard sha512 hashes.
It appears the motivation for the shorter hashes was to save disk space in the
derivations; in master, the size of this directory is 1012K; in this commit it
is 1600K. The difference is not particularly large, and the downsides to using
our own sha1 hashes are:

  • More nix code to maintain
  • Multi-step upgrade process for maintainers: the maintainer first has to
    download all upstream tarballs by sha512 hash, then run the fix script, then
    rebuild with sha1 hashes.
  • Less transparent. If we use the upstream sha512 hashes, any user can
    immediately verify that the hashes we're providing match upstream, or match
    the snapshot in time.
  • Easier to debug. Since upstream is rolling and packages may disappear or fail
    to build, it's useful to be able to determine if the sha mismatch is because
    of an update or not; if we have a sha1 mismatch and no tarball to pull, we
    can't figure out which sha512sum would have produced that sha1.
  • Less trust required. Due to the above, users don't have to trust the
    content-addressed mirrors on IPFS and @veprbl's servers as much.
  • Easier to cobble together a source distribution from a variety of sources. It
    seems some FTP servers have more/less than others, or older/newer packages. If
    we know what we're looking for beforehand and we're just missing a few
    packages whose hashes match the advertised hashes upstream, it's easier to find.

[1] #24683
[2] #10026
[3] #34490
[4] #40232

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@bhipple
Copy link
Contributor Author

bhipple commented May 20, 2018

CC @vcunat @veprbl I've tested this and built it on NixOS and on a single-user enterprise linux installation with a non-standard nix-store path; both appear to be working. I was initially trying to just go straight to texlive-2018 with a full pkgs upgrade, but ran into a bunch of problems and figured I'd get texlive-2017 building from source again to shore up my knowledge on this process.

I can understand not wanting to upgrade it and instead just going straight to texlive-2018; now that I have 2017 working I may give 2018 another shot, but without a stable mirror I'd need some help/coordination on pinning the source packages from CTAN.

@@ -309,6 +309,10 @@ xindy = stdenv.mkDerivation {
name = "texlive-xindy.bin-${version}";

inherit (common) src;

# If unset, xindy will try to mkdir /homeless-shelter
HOME = "/tmp/homeless-shelter";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is sandbox-friendly. Perhaps it would be better to patch the build scripts to not do the funny business.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively (although avoiding it might be better) can probably do something like setting HOME=$(mktemp -d) in preConfigure or something.

Copy link
Member

@lukateras lukateras May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always do HOME = "."; in such cases.

@veprbl
Copy link
Member

veprbl commented May 20, 2018

Did you check that this evaluates on nix 1.11? We had problems with that last time.

@pSub
Copy link
Member

pSub commented May 22, 2018

I think this should first go into staging.

@pSub pSub changed the base branch from master to staging May 30, 2018 20:04
@lukateras lukateras self-assigned this Jun 15, 2018
@dtzWill
Copy link
Member

dtzWill commented Jul 29, 2018

Ping! It'd be great to get this (if not 2018!) in before 18.09!

@pSub
Copy link
Member

pSub commented Aug 1, 2018

@yegortimoshenko Is there anything left to do, before this can be merged?

@bhipple
Copy link
Contributor Author

bhipple commented Aug 1, 2018

I've been using this locally for the past few months without issue; I can rebase this on staging and set the HOME = "." fix, but I haven't had time to try getting texlive-2018 working properly. Some of the core tools have changed their inter-dependencies, I think, so the split of the output packages has to proceed in a different order (maybe).

We'd also want to mirror those tarballs to the content-addressed cache and/or IPFS and/or @veprbl's server, since I doubt math.utah.edu has a ton of bandwidth.

@bhipple
Copy link
Contributor Author

bhipple commented Aug 2, 2018

@GrahamcOfBorg build texlive.scheme-basic

@GrahamcOfBorg
Copy link

Success on aarch64-linux

Attempted: texlive.scheme-basic

No partial log is available.

@GrahamcOfBorg
Copy link

Success on x86_64-linux

Attempted: texlive.scheme-basic

No partial log is available.

@bhipple
Copy link
Contributor Author

bhipple commented Aug 2, 2018

@GrahamcOfBorg build texlive.bin

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: texlive.bin

Partial log (click to expand)

/nix/store/w0c26rd3zmfx1caqvrkvvilfgnnf362m-texlive-bin-2017
/nix/store/hwb1wv5m7wf6kscs7hk076b34g60qww7-texlive-core-big.bin-2017
/nix/store/34bqdgk878jjdj00dfzb6z1i93kpknrs-texlive-dvipng.bin-2017
/nix/store/7mr47f3y0mwim8x1qzngavsxrz0p76m5-texlive-dvisvgm.bin-2017
/nix/store/p34alm98yrjc5nsdsx680rcqbj3wrwdm-texlive-core-big.bin-2017-luatex
/nix/store/xmvjcp1nlf5bznhar1rr7qgf9fg9yw3v-texlive-core-big.bin-2017-metafont
/nix/store/hjmdp3k2zf13yzald64ls18h3rj4y876-texlive-core-big.bin-2017-metapost
/nix/store/pmcf8gfngrr7f2wkrln57l6z5lb49ykw-texlive-xdvi.bin-2017
/nix/store/bq5mqiw4zylp949ig3qsniwm0qnvcr16-texlive-core-big.bin-2017-xetex
/nix/store/pnyrl26yajxvz7lxh4bwkknrd8i4rjh5-texlive-xindy.bin-2017

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: texlive.bin

Partial log (click to expand)

'/nix/store/baij7ryp2a5yrglhmgppwd1yzh5qj15q-texlive-combined-2017/bin/updmap-sys' -> '/nix/store/nmgd8svnvcxszxfxznc3424ch1kmk6xv-texlive-tetex-3.0/scripts/texlive/updmap-sys.sh'
'/nix/store/baij7ryp2a5yrglhmgppwd1yzh5qj15q-texlive-combined-2017/bin/updmap-user' -> '/nix/store/nmgd8svnvcxszxfxznc3424ch1kmk6xv-texlive-tetex-3.0/scripts/texlive/updmap-user.sh'
Wrapping './bin/fmtutil-user' and patching shebang '/bin/sh'
Wrapping './bin/mptopdf' and patching weird perl shebang
Wrapping './bin/pdfatfi' and patching shebang '/usr/bin/env perl'
Wrapping './bin/rungs' and patching shebang '/usr/bin/env texlua'
Wrapping './bin/simpdftex' and patching shebang '/bin/sh'
Wrapping './bin/updmap-user' and patching shebang '/bin/sh'
cannot build derivation '/nix/store/dfjd3kwxb6pkasqrph3d22w0p5wj5dnb-texlive-xindy.bin-2017.drv': 1 dependencies couldn't be built
error: build of '/nix/store/dfjd3kwxb6pkasqrph3d22w0p5wj5dnb-texlive-xindy.bin-2017.drv' failed

@xeji
Copy link
Contributor

xeji commented Aug 6, 2018

Runs fine on my x86_64-linux box. aarch64 error looks unrelated.
@yegortimoshenko I think this is ready. Let's get this merged so we can give 2018 a try.

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

will merge in a day unless someone objects

@dotlambda
Copy link
Member

dotlambda commented Aug 9, 2018

I'm getting

INFO - This is Biber 2.7
INFO - Logfile is 'main.blg'
INFO - Reading 'main.bcf'
ERROR - Error: Found biblatex control file version 3.4, expected version 3.3.
This means that your biber (2.7) and biblatex (3.10) versions are incompatible.
See compat matrix in biblatex or biber PDF documentation.
INFO - ERRORS: 1

That's strange because

./result/bin/biber --version
biber version: 2.7

but
https://github.com/NixOS/nixpkgs/blob/8f739f601f1763d7746effff75eee8fcae6cfe28/pkgs/tools/typesetting/tex/texlive/pkgs.nix#L2224-L2229

"biber" = {
  sha512.run = "dec41092568e614d3366ca63dd4edbaf8ac602844bd8c1cfe1f7a294e701947a9da0dffa461b8b4adafd2f31ab7ac7afd8f6519afef2ed2c8d51ce60422e58fc";
  sha512.doc = "d0d069a387b31f773ec2616a6f934138fef3029a3dad1f7fd3a49ca30d7c3177db3cd9aa5eff4b67e76092fabf1e1ce98afc3a0f4ce7800665fda818329621c6";
  sha512.source = "a80f6a79d32f90aaf62c06535766209ff4942e950315b2c9bb3890abd2f3e06b28d3042b9e7bbc744ebc57e87c2d401f78628cabedb131d3b6169126b4fdddcd";
  version = "2.10";
};

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

Maybe biber (which is packaged separately) needs an upgrade?

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

@dotlambda
Copy link
Member

If I do

diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix
index 8e7551b4e41..a302729aca8 100644
--- a/pkgs/tools/typesetting/tex/texlive/bin.nix
+++ b/pkgs/tools/typesetting/tex/texlive/bin.nix
@@ -4,7 +4,7 @@
 , freetype, gd, libXaw, icu, ghostscript, libXpm, libXmu, libXext
 , perl, pkgconfig
 , poppler, libpaper, graphite2, zziplib, harfbuzz, potrace, gmp, mpfr
-, cairo, pixman, xorg, clisp, biber
+, cairo, pixman, xorg, clisp
 , makeWrapper
 }:
 
@@ -261,7 +261,6 @@ dvipng = stdenv.mkDerivation {
 };
 
 
-inherit biber;
 bibtexu = bibtex8;
 bibtex8 = stdenv.mkDerivation {
   name = "texlive-bibtex-x.bin-${version}";

I no longer have biber in my path. Why?
So, it seems like we need to update pkgs/tools/typesetting/biber/default.nix.

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

Yes, texlive seems to use the separately packaged biber. Will push an update here shortly.

@dotlambda
Copy link
Member

Will push an update here shortly.

That won't be that easy. Seems like we need to package File::Slurper, which is now used by biber as a replacement for File::Slurp.

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

we do have perlPackages.FileSlurper. Not sure if that's the same though.

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

Seems to build and run at least.
@dotlambda can you please test if this fixes your issue, I don't use biber and lack a test case.

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

Rebased on current staging.

@xeji
Copy link
Contributor

xeji commented Aug 9, 2018

BTW: I could reproduce the issue with texlive 2017 and biber 2.7 on my 18.03 system. So it seems older and unrelated to this PR. Good we'll fix it soon 😄

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-linux (full log)

Attempted: biber

Partial log (click to expand)

cannot build derivation ‘/nix/store/7l2ixqk8j4aahqb0c04rab857cr8m5fd-perl5.28.0-Package-DeprecationManager-0.17.drv’: 9 dependencies couldn't be built
cannot build derivation ‘/nix/store/sb2nkbr9dkw6dpw4hyz771jkz366rm7i-perl5.28.0-namespace-autoclean-0.28.drv’: 6 dependencies couldn't be built
cannot build derivation ‘/nix/store/pjvakppi4zyb31yswrc8y5zmizz1sjxa-perl5.28.0-DateTime-Locale-1.22.drv’: 15 dependencies couldn't be built
cannot build derivation ‘/nix/store/xp7yfcrgzwc1s4b8avw1gf1yzla7lb1r-perl5.28.0-DateTime-TimeZone-2.19.drv’: 9 dependencies couldn't be built
cannot build derivation ‘/nix/store/x426kdgn4mzdkyb3dijz06nbkxbck8pf-perl5.28.0-DateTime-1.49.drv’: 8 dependencies couldn't be built
cannot build derivation ‘/nix/store/57npad4vl0jqga9gnp1fz0zb8djz1kgw-perl5.28.0-DateTime-Calendar-Julian-0.04.drv’: 4 dependencies couldn't be built
cannot build derivation ‘/nix/store/41f12389bbdkysv97xdidaisqwvm5l1q-perl5.28.0-DateTime-Format-Strptime-1.75.drv’: 7 dependencies couldn't be built
cannot build derivation ‘/nix/store/lydcb9bpg4g0sg6z1nsrqys0vdj85ay3-perl5.28.0-DateTime-Format-Builder-0.81.drv’: 6 dependencies couldn't be built
cannot build derivation ‘/nix/store/xk75r8xnrq3wmyga0j5z4pw5zld2y4n1-perl5.28.0-biber-2.10.drv’: 46 dependencies couldn't be built
error: build of ‘/nix/store/xk75r8xnrq3wmyga0j5z4pw5zld2y4n1-perl5.28.0-biber-2.10.drv’ failed

@GrahamcOfBorg
Copy link

Timed out, unknown build status on aarch64-linux (full log)

Attempted: biber

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/yydyhbq49fgm1aaiz26mq2l303bimvy7-perl5.28.0-DateTime-Format-Builder-0.81/lib
patching script interpreter paths in /nix/store/yydyhbq49fgm1aaiz26mq2l303bimvy7-perl5.28.0-DateTime-Format-Builder-0.81
checking for references to /build in /nix/store/yydyhbq49fgm1aaiz26mq2l303bimvy7-perl5.28.0-DateTime-Format-Builder-0.81...
shrinking RPATHs of ELF executables and libraries in /nix/store/2b4l9l4xc96cg905k72k2vzw7l868kyp-perl5.28.0-DateTime-Format-Builder-0.81-devdoc
gzipping man pages under /nix/store/2b4l9l4xc96cg905k72k2vzw7l868kyp-perl5.28.0-DateTime-Format-Builder-0.81-devdoc/share/man/
strip is /nix/store/4md2i310zklkkl5j41yw70gcwgn4kav5-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/2b4l9l4xc96cg905k72k2vzw7l868kyp-perl5.28.0-DateTime-Format-Builder-0.81-devdoc
checking for references to /build in /nix/store/2b4l9l4xc96cg905k72k2vzw7l868kyp-perl5.28.0-DateTime-Format-Builder-0.81-devdoc...
cannot build derivation '/nix/store/mppi6wcz546vx59crs4rn6fwr3ln69j3-perl5.28.0-biber-2.10.drv': 4 dependencies couldn't be built
error: build of '/nix/store/mppi6wcz546vx59crs4rn6fwr3ln69j3-perl5.28.0-biber-2.10.drv' failed

@xeji
Copy link
Contributor

xeji commented Aug 10, 2018

@dotlambda after last rebase on newer staging, biber-2.10 is now built with perl 5.28 and seems to work fine. No further fixes required 😄

@xeji xeji merged commit b9c8d68 into NixOS:staging Aug 10, 2018
@dotlambda
Copy link
Member

Works perfectly. Thank you!

@timokau
Copy link
Member

timokau commented Aug 22, 2018

This breaks the cddlib build:

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /nix/store/za3bgc284grda71f0kjkzln24mp1lb0h-texlive-combined-small-2017/share/texmf/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /homeless-shelter/.texlive2017/texmf-config/web2c/fmtutil.cnf
/nix/store/za3bgc284grda71f0kjkzln24mp1lb0h-texlive-combined-small-2017/bin/mktexfmt: mkdir(/homeless-shelter/) failed, goodbye: Permission denied
I can't find the format file `pdflatex.fmt'!

Is that expected? Could that be a more general issue?

@timokau timokau mentioned this pull request Aug 22, 2018
9 tasks
@vcunat
Copy link
Member

vcunat commented Aug 22, 2018

It's a more general issue – I've seen a few other TeX homeless-shelter errors in this staging-next iteration. Some not-too-long regression list of that iteration: https://hydra.nixos.org/eval/1474723?compare=1474536

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

I'm not sure this can be fixed in texlive.
TeX generates some files in $HOME/.texlive2017 at runtime, so the package using it to generate documentation will have to provide a temporary $HOME within the sandbox.
Maybe HOME = "."; helps here.

@vcunat
Copy link
Member

vcunat commented Aug 22, 2018

Yes, I think I've seen some HOME=$TMPDIR fix some TeX problems.

@timokau
Copy link
Member

timokau commented Aug 22, 2018

Yes that may fix it, but it would be something everybody using texlive now or in the future in builds has to keep in mind. What is the .texlive2017 file used for? Can it be avoided? Or maybe a wrapper to tell it to use another location?

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

Main reason is that TeX builds fonts from font descriptions on-demand at runtime and caches them and some format data in ~/.texlive2017, so it needs a writable location within the sandbox.

But there may be a bug here: some format data should already be generated in ./share/texmf-var within the texlive.combined.scheme-xxx package at buildtime, and if this is sufficient to compile a document nothing should be written to ~/.texlive2017 at runtime.

However, ./share/texmf-var is currently empty in the combined packages. I'll look into it because that is also relevant for texlive 2018 (#45432)

@timokau
Copy link
Member

timokau commented Aug 22, 2018

Thank you for looking into it! A bug also seems likely because the issue didn't exist in the previous version.

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

The weird thing is that the code generating the combined packages wasn't changed. But it uses a lot of perl scripts, and the update to perl 5.28 in the same staging iteration may be a factor too.

@timokau
Copy link
Member

timokau commented Aug 22, 2018

If you can't find the issue, maybe you can file an issue on upstream's bug tracker (assuming such a thing exists).

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

Sure, but I don't think it's an upstream issue.

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

According to git bisect , 7c5fd68 (this PR) made ./share/texmv-var empty in the texlive.combined packages. But that commit doesn't change how we build the combined packages, so maybe there was an upstream change that we need to adapt to (or, less likely, an upstream bug).

@xeji xeji mentioned this pull request Aug 22, 2018
6 tasks
@timokau
Copy link
Member

timokau commented Aug 22, 2018

For others reading: @dtzWill apparently found the problem.

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

@timokau the fix by @dtzWill applies to texlive 2017 as well and fixes the cddlib build. I will cherry-pick it to master in a separate PR.

@vcunat
Copy link
Member

vcunat commented Aug 22, 2018

I should state there's been a misunderstanding about the main purpose of fixedHashes, resulting into removal of one property I personally consider(ed) important.

I can't blame anyone, as I didn't review this PR, knowingly focusing my energy to other nix* parts. I almost don't use TeX anymore these years, so I "can't" really maintain it well, given my priorities around here... so it's more up to "you".

The point was the fixed keyword – they were making the non-binary TeX packages fixed-output, so they stayed on the same nix store paths regardless of any mass rebuilds. Yes, it's a little harder to update for the maintainer, etc. but at that moment I wanted to save space, and this was a rather important part of that.

When upstream switched hashes (from md5), I chose to stay with sha1 at that moment, as it seemed sufficient (and this choice actually had a line of explanation in the comments; we had quite some discussions about git repo size blowup around that time as well), but I personally consider the hash choice a nitpick, really.

Well, you can consider getting this property back, e.g. with the 2018 update...

@xeji
Copy link
Contributor

xeji commented Aug 22, 2018

@vcunat I understand your concerns. Making the packages fixed-output does save space (and, less importantly, a little time on rebuilds ). But the method implemented here also has its advantages as described above in terms of maintainability and transparency, so I don't think we should just go back to the previous solution either. Maybe we can find a "best of" solution for 2018. Let's take that discussion to #45432 .

xeji added a commit to xeji/nixpkgs that referenced this pull request Aug 29, 2018
This reverts a part of the changes made in NixOS#40826.
Fixed-output derivations save time and space on rebuilds.
xeji added a commit that referenced this pull request Sep 4, 2018
This reverts a part of the changes made in #40826.
Fixed-output derivations save time and space on rebuilds.

(cherry picked from commit 738bae4)
@bhipple bhipple deleted the u/texlive-2017-final branch September 22, 2018 14:33
@veprbl veprbl added the 6.topic: TeX Issues regarding texlive and TeX in general label Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: TeX Issues regarding texlive and TeX in general 10.rebuild-darwin: 501+ 10.rebuild-linux: 501+
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants