unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Edouard Klein <edk@beaver-labs.com>
To: guix-devel@gnu.org
Subject: Re: A script to check an edit does not break anything
Date: Thu, 11 Jun 2020 17:41:06 +0200	[thread overview]
Message-ID: <87mu59r4od.fsf@alice.lan> (raw)
In-Reply-To: <87sgf1r5nk.fsf@alice.lan>

[-- Attachment #1: Type: text/plain, Size: 29 bytes --]

An now with the attachment.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gpwc.t --]
[-- Type: text/x-shellscript, Size: 2151 bytes --]

#!/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

[-- Attachment #3: Type: text/plain, Size: 1837 bytes --]


Edouard Klein writes:

> Dear Guixers,
>
> I recently broke jupyter while updating python-prompt-toolkit (a mistake
> I'm still trying to fix...) despite doing my best to follow the
> instructions of the manual:
> https://guix.gnu.org/manual/en/html_node/Packaging-Guidelines.html
> https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html#Submitting-Patches
>
> Because of the subtle consequences of editing a package are hard to keep
> track of, I wrote the attached script (you need sharness to run it, but
> with slight modification it can become a standalone script).
>
> This script goes beyond the instructions of the manual on two fronts:
> - First, it not only tries to build the packages, but also to install
> them,
> - Secondly, it does not limit itself to the dependents (as listed by
> guix refresh --list-dependents) of the packages one is meddling with,
> but to the whole reverse bags (as listed by guix graph
> --type=reverse-bag).
>
> Both these extensions are necessary to discover that my update broke the
> jupyter package:
> - jupyter builds, so if you don't try to install it you won't discover
> it's broken
> - the leafs of the dependency graph that depend on jupyter fail to build
> for reasons unrelated to python-prompt-toolkit, so by just building the
> leafs (which are what is being returned by guix refresh
> --list-dependents) you can't discover jupyter's broken status.
>
> I think an update of the manual is in order (I've added it to my own
> TODO queue, but I have no idea when I'll be able to get to it) but I
> first wanted to share my script in case it may be useful to someone
> else, and gather some feedback as to whether other developers have
> encountered these kind of errors, and the way seasoned developers make
> sure they don't push breaking changes.
>
> Cheers,
>
> Edouard.


  reply	other threads:[~2020-06-11 15:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 15:19 A script to check an edit does not break anything Edouard Klein
2020-06-11 15:41 ` Edouard Klein [this message]
2020-06-11 17:55   ` Vincent Legoll
2020-06-12 16:41     ` Edouard Klein
2020-06-13 21:15 ` Ludovic Courtès
2020-06-14 15:27   ` Checking for profile collisions with ‘guix lint’ Ludovic Courtès
2020-06-15  8:50   ` A script to check an edit does not break anything Edouard Klein
2020-06-16 10:01     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mu59r4od.fsf@alice.lan \
    --to=edk@beaver-labs.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).