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

llvm: TODO: Update maintainers and add an update script #100725

Closed
primeos opened this issue Oct 16, 2020 · 4 comments
Closed

llvm: TODO: Update maintainers and add an update script #100725

primeos opened this issue Oct 16, 2020 · 4 comments
Assignees

Comments

@primeos
Copy link
Member

primeos commented Oct 16, 2020

@ggreif @DieGoldeneEnte would you be interested to add yourself as maintainers for LLVM? IMO that would make sense since you've e.g. taken care of adding LLVM 10 and 11 and might be interested to get notified of changes from other users. Though in case you don't want to quickly review PRs or be cc'ed on issues it would make less sense (but being in meta.maintainers doesn't require that much commitment). I'll probably add myself as maintainer as well so that I get notified of new PRs (due to Chromium I often have to review/merge them anyway; at least in the case of new releases).

And I was wondering if there's already a way to automatically update the hashes after new releases. If not that would be great to have. I could probably extend my hacky script to verify the hashes so that it can update them as well.

@primeos primeos self-assigned this Oct 16, 2020
@ggreif
Copy link
Contributor

ggreif commented Oct 16, 2020

There is a way to update hashes:

$ cat fix-wanted.awk
# hash mismatch in fixed-output derivation '/nix/store/gkixca1c9jcqs0qwj0pns4gfkycjn117-Xlldb-11-init.tar.gz':
#   wanted: sha256:02gb3fbz09kyw8n71218v5v77ip559x3gqbcp8y3w6n3jpbryywa
#   got:    sha256:1cjsvyrq759hmp4cki2l2q62pdasqmjcpqkb5rdgx0rpmnrja1i2

# invoke `awk -f fix-wanted.awk -F: <mismatch-log>` > script.sh && sh script.sh
# or build like this: `nix-build -j8 -A llvmPackages_10 |& tee /dev/tty | awk -f fix-wanted.awk -F: | sh`

/wanted: / { wanted = $3 }
/got: / { got = $3; print "git grep", wanted, "|", "awk -F: '{print $1}' | xargs perl -pi -e s/"wanted"/"got"/g" }

and then I build like this:

nix-build -j8 -A llvmPackages_11 --keep-going |& tee /dev/tty | awk -f fix-wanted.awk -F: | sh

The first build fails but the second try sees the updated hashes in the repo, so it passes.

@DieGoldeneEnte
Copy link
Contributor

Becoming maintainer might make sense. I wanted to take a look at packaging llvm using the monorepo, since this is is default now and should be less error-prone regarding cmake-flags.

Regarding the hash updates: I think if you can get something to work easily it would be nice, but all major updates required some kind of manual intervention, so the script above should be sufficient in most cases.

primeos added a commit that referenced this issue Nov 4, 2020
Because I maintain Chromium which always requires the most recent LLVM
release (would be good to get notified on any PRs/issues, especially
since I seem to end up merging most of the PRs anyway).

See #100725.
@primeos
Copy link
Member Author

primeos commented Feb 18, 2021

I could probably extend my hacky script to verify the hashes so that it can update them as well.

I didn't have time to extend/improve it but here is my script in case anyone ever needs to verify (or manually update) the LLVM source hashes (e.g. #110631 (comment)):

#!/usr/bin/env bash

# Usage example: ./llvm.sh 11

set -eu

export VERSION="$1"
export ATTRSET="llvmPackages_$VERSION"

export SOURCES=(
  "clang-unwrapped.src"
  "compiler-rt.src"
  "clang-unwrapped.clang-tools-extra_src"
  "libcxx.src"
  "libcxxabi.src"
  "libunwind.src"
  "lld.src"
  "lldb.src"
  "llvm.src"
  "llvm.polly_src"
  "openmp.src"
)

for SOURCE in "${SOURCES[@]}"; do
  nix-build -A "$ATTRSET.$SOURCE"
  nix-build -A "$ATTRSET.$SOURCE" --check
done

echo OK

Note: This isn't ideal though as it e.g. should still be susceptible to MITM attacks (using nix-prefetch-url would be better and should be used for an automatic update script). Anyway, this should find all hashes that didn't get updated or did change (note: using nix-build -A "$ATTRSET.$SOURCE" --check || nix-build -A "$ATTRSET.$SOURCE" should also properly work in all cases and be more efficient but it was simply a quick hack and is already fast enough).

primeos added a commit that referenced this issue Apr 1, 2021
This is based on a combination of Gabor Greif's update script [0] and my
script to verify the hashes [1]. It's a bit hacky / unconventional but
it should be very useful and worked fine so far (but it might require
changes for some edge-cases).

[0]: #100725 (comment)
[1]: #100725 (comment)
@primeos
Copy link
Member Author

primeos commented Apr 1, 2021

I've pushed an update script in 493131d. Hopefully that should work well (I tested it with 12.0.0-rc3 and 12.0.0-rc4). We can close this issue then (@ggreif @DieGoldeneEnte just open a PR to add yourself as maintainers if you want).

@primeos primeos closed this as completed Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants