guix-build-branch.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # GNU Guix --- Functional package management for GNU
  2. # Copyright © 2018, 2019, 2020, 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 build --with-branch'.
  20. #
  21. guix build --version
  22. # 'guix build --with-branch' requires access to the network to clone the
  23. # Git repository below.
  24. if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
  25. then
  26. # Skipping.
  27. exit 77
  28. fi
  29. orig_drv="`guix build guile-gcrypt -d`"
  30. latest_drv="`guix build guile-gcrypt --with-branch=guile-gcrypt=master -d`"
  31. test -n "$latest_drv"
  32. test "$orig_drv" != "$latest_drv"
  33. # FIXME: '-S' currently doesn't work with non-derivation source.
  34. # checkout="`guix build guile-gcrypt --with-branch=guile-gcrypt=master -S`"
  35. checkout="`guix gc --references "$latest_drv" | grep guile-gcrypt | grep -v -E '(-builder|\.drv)'`"
  36. test -d "$checkout"
  37. test -f "$checkout/COPYING"
  38. orig_drv="`guix build guix -d`"
  39. latest_drv="`guix build guix --with-branch=guile-gcrypt=master -d`"
  40. guix gc -R "$latest_drv" | grep guile-gcrypt-git.master
  41. test "$orig_drv" != "$latest_drv"
  42. v0_1_0_drv="`guix build guix --with-commit=guile-gcrypt=9e3eacdec1d -d`"
  43. guix gc -R "$v0_1_0_drv" | grep guile-gcrypt-git.9e3eacd
  44. test "$v0_1_0_drv" != "$latest_drv"
  45. test "$v0_1_0_drv" != "$orig_drv"
  46. v0_1_0_drv="`guix build guix --with-commit=guile-gcrypt=v0.1.0 -d`"
  47. guix gc -R "$v0_1_0_drv" | grep guile-gcrypt-0.1.0
  48. guix gc -R "$v0_1_0_drv" | grep guile-gcrypt-9e3eacd
  49. test "$v0_1_0_drv" != "$latest_drv"
  50. test "$v0_1_0_drv" != "$orig_drv"
  51. guix build guix --with-commit=guile-gcrypt=000 -d && false
  52. exit 0