guix-shell-export-manifest.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. # Combining manifests.
  41. guix shell --export-manifest -m "$manifest" gash gash-utils \
  42. > "$manifest.second"
  43. guix build -m "$manifest.second" -d | \
  44. grep "$(guix build guile-bootstrap -d)"
  45. guix build -m "$manifest.second" -d | \
  46. grep "$(guix build gash -d)"
  47. # Package transformation option.
  48. guix shell --export-manifest guile guix \
  49. --with-input=guile-json@3=guile-json > "$manifest"
  50. grep 'options->transformation' "$manifest"
  51. grep '(with-input . "guile-json@3=guile-json")' "$manifest"
  52. # Development manifest.
  53. guix shell --export-manifest -D guile git > "$manifest"
  54. grep 'package->development-manifest' "$manifest"
  55. grep '"guile"' "$manifest"
  56. guix build -m "$manifest" -d | \
  57. grep "$(guix build -e '(@@ (gnu packages commencement) gcc-final)' -d)"
  58. guix build -m "$manifest" -d | \
  59. grep "$(guix build git -d)"
  60. # Test various combinations to make sure generated code uses interfaces
  61. # correctly.
  62. for options in \
  63. "coreutils grep sed" \
  64. "gsl openblas gcc-toolchain --tune" \
  65. "guile -m $manifest.previous" \
  66. "git:send-email gdb guile:debug" \
  67. "git -D coreutils"
  68. do
  69. guix shell --export-manifest $options > "$manifest"
  70. cat "$manifest"
  71. guix shell -m "$manifest" -n
  72. mv "$manifest" "$manifest.previous"
  73. done