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