Hello,
I wonder what is the workflow of people contributing on guix as I would
like to improve mine. What is yours?
I like (git) worktrees as a clear separation between personnal
projects. What is annoying is that I have to recompile on each new
worktree. I often hesitated given up on starting a new project because
of this. I'm probably too impatient. I talked with janneke and futurile
on irc about this. At least I'm not the only one who's annoyed ;).
What follows is what I tried and where I am. Disclaimer : that's
probably boring and dirty.
* hack 1 (interpreted diffs)
You have a worktree at master in $MASTER. you want to fix package
hello.
1. create a new worktree.
2. run "./bootstrap && ./configure" in it.
3. in pre-inst-env, replace in GUILE_LOAD_COMPILED_PATH
$abs_top_builddir with $MASTER.
4. in $MASTER run make --touch.
5. edit package definition (e.g. "Example GNU package FIXED!").
6. run ./pre-inst-env guix search hello
** why its wrong?
1. Linked to exterior worktree. What if working on multiple (that's
the goal)? Can't be on different "base" HEAD. Can't mess with
COMPILED. etc.
2. Works only for guile code.
* hack 2 (copy artifacts)
The script below is invoked in the master worktree, that is an already
compiled worktree, with the path to the to be created worktree as
argument. I put it in ~/.local/bin
--8<---------------cut here---------------start------------->8---
#!/bin/sh -eu
if [ ! "$#" -eq 1 ]; then
echo "Usage: $0 PATH"
exit 1;
fi
if [ -e "$1" ]; then
echo "$1 already exists"
exit 1;
fi
set -o xtrace
: "Make sure it is built"
guix shell -CPW -m manifest.scm -- bash -c make
: "Create the worktree"
git worktree add "$1"
: "Initialize the new worktree"
MASTER=`pwd`
cd "$1"
guix shell -CPW -m manifest.scm -- bash -c "./bootstrap && ./configure"
: "Compute the list of artifacts in $1 (./bootstrap && ./configure)"
worktree_artifacts=`mktemp`
git status --ignored -u -s | sed -En 's/^\!\! (.*)$/\1/p' | sort >
"${worktree_artifacts}"
: "Compute the list of artifacts in ${MASTER} (./bootstrap && ./configure &&
make)"
cd "${MASTER}"
master_artifacts=`mktemp`
git status --ignored -u -s | sed -En 's/^\!\! (.*)$/\1/p' | sort >
"${master_artifacts}"
: "Compute the the artifacts in ${MASTER} not in $1"
artifacts_to_copy=`mktemp`
comm -23 "${master_artifacts}" "${worktree_artifacts}" > "${artifacts_to_copy}"
: "Copy the artifacts"
xargs -a "${artifacts_to_copy}" cp --parents -t "$1"
: "Set all files to the same timestamp"
NOW=`date +%s`
find "$1" -path .git -prune -o -print0 | xargs -0 touch -d "@${NOW}"
: "scripts/guix needs to be rebuilt, final touch"
cd "$1"
touch scripts/guix.in
guix shell -CPW -m manifest.scm -- bash -c make
--8<---------------cut here---------------end--------------->8---
Seems to work. got a worktree ready in 20 secs.
It's preferable if not necessary that the master be clean. you clone it
(or made a fresh worktree) and ran "./bootstrap && ./configure && make"
(probably inside a guix shell) in it and that's all, no edits.
WDYT? Am I wrong? Is there a known (not to me) solution?
Yarl