guix-shell-export-manifest.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # GNU Guix --- Functional package management for GNU
  2. # Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
  3. #
  4. # This file is part of GNU Guix.
  5. #
  6. # GNU Guix is free software; you can redistribute it and/or modify it
  7. # under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # GNU Guix is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. # Test 'guix shell --export-manifest'.
  20. #
  21. guix shell --version
  22. tmpdir="t-guix-manifest-$$"
  23. trap 'rm -r "$tmpdir"' EXIT
  24. mkdir "$tmpdir"
  25. manifest="$tmpdir/manifest.scm"
  26. # Basics.
  27. guix shell --export-manifest guile-bootstrap > "$manifest"
  28. test "$(guix build -m "$manifest")" = "$(guix build guile-bootstrap)"
  29. guix shell -m "$manifest" --bootstrap -- \
  30. "$SHELL" -c 'guix package --export-manifest -p "$GUIX_ENVIRONMENT"' > \
  31. "$manifest.second"
  32. for m in "$manifest" "$manifest.second"
  33. do
  34. grep -v '^;' < "$m" > "$m.new" # filter out comments
  35. mv "$m.new" "$m"
  36. done
  37. cat "$manifest"
  38. cat "$manifest.second"
  39. cmp "$manifest" "$manifest.second"
  40. # Manifest for a profile.
  41. guix shell --bootstrap guile-bootstrap -r "$tmpdir/profile" -- \
  42. guile --version
  43. test -x "$tmpdir/profile/bin/guile"
  44. guix shell -p "$tmpdir/profile" --export-manifest > "$manifest.second"
  45. guix shell --export-manifest guile-bootstrap > "$manifest"
  46. cat "$manifest.second"
  47. cmp "$manifest" "$manifest.second"
  48. rm "$tmpdir/profile"
  49. # Combining manifests.
  50. guix shell --export-manifest -m "$manifest" gash gash-utils \
  51. > "$manifest.second"
  52. guix build -m "$manifest.second" -d | \
  53. grep "$(guix build guile-bootstrap -d)"
  54. guix build -m "$manifest.second" -d | \
  55. grep "$(guix build gash -d)"
  56. # Package transformation option.
  57. guix shell --export-manifest guile guix \
  58. --with-input=guile-json@3=guile-json > "$manifest"
  59. grep 'options->transformation' "$manifest"
  60. grep '(with-input . "guile-json@3=guile-json")' "$manifest"
  61. # Development manifest.
  62. guix shell --export-manifest -D guile git > "$manifest"
  63. grep 'package->development-manifest' "$manifest"
  64. grep '"guile"' "$manifest"
  65. guix build -m "$manifest" -d | \
  66. grep "$(guix build -e '(@@ (gnu packages commencement) gcc-final)' -d)"
  67. guix build -m "$manifest" -d | \
  68. grep "$(guix build git -d)"
  69. guix shell --export-manifest -D guile -D python-itsdangerous > "$manifest"
  70. guix build -m "$manifest" -d | grep "$(guix build libffi -d)"
  71. guix build -m "$manifest" -d | \
  72. grep "$(guix build -e '(@ (gnu packages python) python)' -d)"
  73. # Test various combinations to make sure generated code uses interfaces
  74. # correctly.
  75. for options in \
  76. "coreutils grep sed" \
  77. "gsl openblas gcc-toolchain --tune" \
  78. "guile -m $manifest.previous" \
  79. "git:send-email gdb guile:debug" \
  80. "git -D coreutils"
  81. do
  82. guix shell --export-manifest $options > "$manifest"
  83. cat "$manifest"
  84. guix shell -m "$manifest" -n
  85. mv "$manifest" "$manifest.previous"
  86. done