nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 59 lines 2.2 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p bundler bundix nixfmt 3# shellcheck shell=bash 4 5set -euf -o pipefail 6 7self="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")" 8 9getSpecifiedGems() { 10 grep '^\s*gem' "$1" | cut -d"'" -f2 11} 12 13cd pkgs/development/ruby-modules/with-packages 14 15# Cleanup possible leftovers from a failed run. 16rm -f gemset.nix Gemfile.lock 17 18# Since bundler 2+, the lock command generates a platform-dependent 19# Gemfile.lock, hence causing to bundix to generate a gemset tied to the 20# platform from where it was executed. 21BUNDLE_FORCE_RUBY_PLATFORM=1 bundle lock 22bundix 23nixfmt gemset.nix 24 25# Run checks against the update. 26if ! \ 27 nix-instantiate --eval --strict \ 28 --argstr specifiedGems "$(getSpecifiedGems Gemfile)"\ 29 --arg old ../../../top-level/ruby-packages.nix \ 30 --arg new ./gemset.nix \ 31 "$self/update-ruby-packages.checks.nix" 32then 33 ( 34 echo "" 35 echo "NOTE: The Gemfile.lock and gemset.nix files were left intact for comparison." 36 echo "" 37 echo "Do not simply continue through with the update." 38 echo "Make sure to get the Ruby maintainers involved in finding a solution to this problem." 39 echo "" 40 echo "The non-specified gems listed are generally not at fault." 41 echo "Regressions likely come from specified gems getting updated and having clashing requirements." 42 echo "" 43 echo "Start by pessimistically pinning (~>) specified gems to their current full version that look like they could be the cause." 44 echo "Then once only non-specified gems are regressed, pessimistically pin the leftover ones." 45 echo "Once this passes with pessimistic pinning of gems, try reducing specificity in pessimistic bounds, then try using minimum version bounds (>=)." 46 echo "At some point bundler will tell you why it can't give you the bounds being asked for." 47 echo "" 48 echo "Don't forget to re-generate the ruby-packages.nix nix from scratch for the proper report once the minimum required set of pins is known!" 49 echo "" 50 ) >&2 51 exit 1 52fi 53 54{ 55 echo "# This file is generated and should be updated with maintainers/scripts/update-ruby-packages." 56 echo "" 57 cat gemset.nix 58} > ../../../top-level/ruby-packages.nix 59rm -v -f gemset.nix Gemfile.lock