#!/bin/bash # Put this script in a subfolder (e.g. gpwc) # of the guix source # And install sharness in it # https://github.com/chriscool/sharness # Install prove as well # https://linux.die.net/man/1/prove # To run the tests, invoke # prove gpwc.t # Fill in the names of the packages you've been meddling with # In my case it was python-prompt-toolkit PACKAGES=(python-prompt-toolkit python-ipywidgets) test_description="Checking my meddling with ${PACKAGES[*]} did not break anything" . ./sharness.sh # Check that the new packages themselves are OK for package in "${PACKAGES[@]}" do test_expect_success "Build $package" " guix environment guix --pure -- ${SHARNESS_BUILD_DIRECTORY}/pre-inst-env guix build $package " test_expect_success "Lint $package" " guix environment guix --pure -- ${SHARNESS_BUILD_DIRECTORY}/pre-inst-env guix lint $package " test_expect_success "See if $package is reproducible" " guix environment guix --pure -- ${SHARNESS_BUILD_DIRECTORY}/pre-inst-env guix build --rounds=2 python-websockets " test_expect_success "Install $package" " guix environment guix --pure -- ${SHARNESS_BUILD_DIRECTORY}/pre-inst-env \ guix install --profile=./${package}-tmp-profile ${package} " done # Check the consequences of having meddled with the new packages dependents(){ guix environment guix --pure -- "${SHARNESS_BUILD_DIRECTORY}"/pre-inst-env \ guix graph --type=reverse-bag "$1" | \ grep @ | sed 's/.*\"\(.*\)@.*/\1/' } # Union of all the dependents for package in "${PACKAGES[@]}" do dependents "$package" done | sort -u > dependents.txt for package in $(cat dependents.txt) do test_expect_success "Build dependent $package" " guix environment guix --pure -- \"${SHARNESS_BUILD_DIRECTORY}\"/pre-inst-env guix build $package " profile="$SHARNESS_TRASH_DIRECTORY/$(echo $package | sed 's/\(.*\)@/\1'/)-tmp-profile" test_expect_success "Install dependent $package" " guix environment guix --pure -- ${SHARNESS_BUILD_DIRECTORY}/pre-inst-env \ guix install --profile=\"${profile}\" ${package} " done test_done