Updating a package in the Guix archive and sending the contribution
Package update:
Inputs & native-inputs
Build system
Build phases
Stacked Git
(stgit)
Modified Package Contribution
Git
worktrees
send-email
Package
Structure
Source &
Origin
Advanced References
Building Guix from Source
Tools
bts & b4
Package Patch
Review
Shell
Command
Build
Command
Package
Transforms
Manifests
Transforms in Manifests
Build Guix from source
Send the updated package
Alter the package we want to change
Build Guix from source
A series of
manual steps
Alter the package we want to change and verify to project standards
Send the updated package as a patch by email
Build Guix from source
A series of involved
manual steps
Alter the package we want to change and verify to project standards
Send the updated package as a patch by email
Guix source
Ability to send email using git send-email
guix package: git:send-email
Tool - Stacked Git
Deals with patches in git as a stack
How we develop and how a Maintainer applies the patches is the same with the system
guix package: stgit@2.4.0
Tool - bts
Tool for interacting with Guix's Issues tracker
guix package: debian-devscripts-bts
No update in progress
# all my guix code is in this location:
$ cd ~/workspace/guix-packages
$ git clone https://git.savannah.gnu.org/git/guix.git guix
$ cd guix$ guix shell --development guix graphviz
[env] $ ./pre-inst-env guix graph --type=reverse-bag borgmatic > borgmatic-reverse-bag.dot
[env] exit
$ xdot borgmatic-reverse-bag.dotClone the Guix archive:
Use graphviz to check package references:
Switch to master and update:
$ git fetch origin keyring:keyring
$ guix git authenticateCheck new commits are authentic:
$ cd ~/workspace/guix-packages/guix
$ git switch master
$ git pullCreate a new worktree for this update:
$ mkdir ~/workspace/guix-packages/worktrees
$ git worktree add ~/workspace/guix-packages/worktrees/borgmatic-1.8.14 \
-b borgmatic-1.8.14 origin/master --track
$ cd ../worktrees/borgmatic-1.8.14Configure git on the worktree:
$ stg init
$ stg branch --describe "Update borgmatic to 1.8.14"
# check the branch is correctly tracking origin/master
$ stg branch --listInitialise stgit on the worktree
$ cd ~/workspace/guix-packages/worktrees/borgmatic-1.8.14
$ git config user.name "Your Name"
$ git config user.email "your@email.com"Create a guix shell to build the source in:
[env]$ ./bootstrap
[env]$ ./configure --localstatedir=/var --sysconfdir=/etc
[env]$ make
[env]$ exitBootstrap, configure and build the guix source:
$ cd ~/workspace/guix-packages/worktrees/borgmatic-1.8.14
$ guix shell --container --nesting --development guix --pure
--manifest=../../scm/guix-dev-env.scm --verbosity=3Manifest has some basic tools:
(specifications->manifest (list "glibc-locales" "gcc-toolchain" "autoconf" "automake" "texinfo"
"coreutils" "inetutils" "findutils" "which" "lesspipe" "help2man"
"git" "strace"))Create build env in a Tmux split:
$ guix shell --development guix --container --network --nesting --preserve=^TERM$
coreutils nss-certs man-db ncurses
export PS1='[test-env]$ 'Create test env in a Tmux split:
$ guix shell --development guix --container --network --nesting --share=/var/log/guix
--preserve=^TERM$ coreutils
$ export PS1='[build-env]$ 'Another Tmux split for using an editor - not in guix shell:
$ export PS1='[dev-env]$ 'ensures guix build writes logs
installs all package inputs
installs packages for guix lint (nss-certs) and testing
In the dev env:
[dev-env]$ cd ~/tmp
[dev-env]$ wget \
https://files.pythonhosted.org/packages/0a/c5/b7237226724951d7aad79dc24d49b661e5aaad671b43f076beb6f6a4e647/ \
borgmatic-1.8.14.tar.gz
[dev-env]$ guix hash --hash=sha256 --format=hex borgmatic-1.8.14.tar.gz
598b3bc22c19d53bd375e5295afec56d111759f74671845aacfe055c539fa746
[dev-env]$ guix hash borgmatic-1.8.14.tar.gz
0im7kx9mq1gymid88wa6yxcif4bdqpz5lag5fp9kpm8r5k13p2srlines separated like this to fit in the slide!
In the dev env:
[dev-env]$ cd ~/workspace/guix-packages/worktrees/borgmatic-1.8.14
[dev-env]$ vim gnu/packages/backup.scm(define-public borgmatic
(package
(name "borgmatic")
(version "1.8.14")
(source
(origin
(method url-fetch)
(uri (pypi-uri "borgmatic" version))
(sha256
(base32 "0im7kx9mq1gymid88wa6yxcif4bdqpz5lag5fp9kpm8r5k13p2sr"))))
[... rest of the package definition ...]
Change the package definition:
change the version
use the hash
In the build env build the source:
[build-env]$ ./pre-inst-env guix build --source --no-substitutes borgmatic@1.8.14
Build the package:
[build-env]$ ./pre-inst-env guix build --no-substitutes --no-grafts borgmatic@1.8.14
Inspect the build log:
[build-env]$ ./pre-inst-env guix build --log-file --no-grafts borgmatic@1.8.14
In the test env install the built package:
[test-env]$ ./pre-inst-env guix package --install borgmatic@1.8.14
[test-env]$ GUIX_PROFILE="/home/steve/.guix-profile"
[test-env]$ . "$GUIX_PROFILE/etc/profile"
[test-env]$ borgmatic --version
In the build env - check the source downloads:
[build-env]$ ./pre-inst-env guix build --no-substitutes --check --source borgmatic@1.8.14Build the package and compare it to the previous build:
[build-env]$ ./pre-inst-env guix build --no-substitutes --check borgmatic@1.8.14
https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
In the dev env create a new StackedGit patch:
[dev-env]$ stg new borgmatic-1.8.14Create a commit message - there's a set format:
gnu: borgmatic: Update to 1.8.14.
* gnu/packages/backup.scm (borgmatic): Update to 1.8.14.Add the changes we've made into the patch:
[dev-env]$ stg refresh gnu/packages/backup.scm
[dev-env]$ stg series --reverse --description
[dev-env]$ stg showIn the test env check for dependants:
[test-env]$ ./pre-inst-env guix refresh --list-dependent borgmatic@1.8.14
No dependents other than itself: borgmatic@1.8.14
https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
Format the code in the dev env:
[dev-env]$ emacs -nw gnu/packages/backup.scmRun the styler in the test env:
[test-env]$ ./pre-inst-env guix style --dry-run borgmatic@1.8.14[test-env]$ ./pre-inst-env guix lint --dry-run borgmatic@1.8.14Run the linter in the test env:
Check if there are any changes in the dev env:
[dev-env]$ stg statusDo a diff:
[dev env]$ stg diff[dev-env]$ stg refresh gnu/packages/backup.scm
[dev-env]$ stg showIf there are changes update the patch:
Start a shell in the dev env:
[dev-env]$ guix shell --development guix guile git:send-email stgit@2.4.0 debian-devscripts-bts
[dev-env]$ export PS1='[email-env]$ '
# email passwords are locked - I use keychain
[email-env] keychain --agents ssh,gpgUse stg email format in the email env:
[email-env]$ stg email format --output-directory ../stg-out --numbered --base=auto --thread=shallow \
--cover-letter --all[email-env]$ vim ../stg-out/0000-cover-letter.patchEdit the cover letter email:
Get the base commit from the cover letter:
[email-env]$ view ~/workspace/guix-packages/worktrees/stg-out/0000-cover-letter.patchCreate a new branch:
[email-env]$ cd ~/workspace/guix-packages/guix
[email-env]$ stg branch --list
[email-env]$ stg branch master
[email-env]$ git branch borgmatic-test-apply <base-commit-from-cover-letter>
[email-env]$ git switch borgmatic-test-apply
[email-env]$ git log[email-env]$ git am --ignore-whitespace --ignore-space-change --no-scissors
~/workspace/guix-packages/worktrees/stg-out/0001-*
[email-env]$ git log
[email-env]$ git log --patchApply the patch:
Run the etc/teams.scm get-maintainer command:
[email-env]$ cd ~/workspace/guix-packages/guix/worktrees/borgmatic-1.8.14
[email-env]$ ./pre-inst-env etc/teams.scm get-maintainer \
~/workspace/guix-packages/worktrees/stg-out/0001-gnu-borgmatic-Update-to-1.8.14.patch
# check it ran correctly as it doesn't output anything if there's no applicable maintainer
[email-env]$ echo $?Other useful commands:
# list all the teams
[email-env]$ ./pre-inst-env list-team #list all teams
# print the cc's for any team (e.g. rust)
[email-env]$ ./pre-inst-env etc/teams.scm cc rustSend the cover-letter:
[email-env]$ git send-email --to=guix-patches@gnu.org --annotate --dry-run 0000-cover-letter.patch
# now rm the cover letter so there's no chance it's sent again!
[editor-split] rm 0000-cover-letter.patchTo add a Maintainer:
[editor-split]$ git send-email --to=guix-patches@gnu.org --cc="Some Person <maintainer@some.email>"
--annotate --dry-run 0000-cover-letter.patch
Use bts to query the bug number:
[email-env]$ bts --bts-server https://debbugs.gnu.org/ --mbox show NNNNRe-export the patches with the reply-to header set to the Message-ID:
[email-env]$ rm ~/workspace/guix-packages/worktrees/stg-out/*
[email-env]$ stg email format --output-directory ../stg-out --numbered --base=auto
--add-header="X-Debbugs-Cc: Jane Maintainer <jane@maintainer.email>, Bob Maintainer <bob@maintainer.email>"
--to NNNN@debbugs.gnu.org --in-reply-to <message-id-we-grabbed> --thread=shallow --all[email-env]$ git send-email --to=NNNN@debbugs.gnu.org --no-thread --no-chain-reply-to
--dry-run ../stg-out/*Send the patch with:
An example of a re-roll:
[email-env]$ stg email format --output-directory ../stg-out --numbered --base=auto \
--to NNNN@debbugs.gnu.org --in-reply-to <original-cover-letter-message-id> --thread=shallow \
--cover-letter
--reroll-count=2
--allDelete the worktree and the git branch:
$ cd ~/workspace/guix-packages/guix
$ git worktree list
$ git worktree remove ~/workspace/guix-packages/worktrees/test-borgmatic-1.8.14
$ stg branch --list
$ stg branch --delete borgmatic-1.8.14Altering a package is pretty simple
Quite involved ... but tools like worktrees and StackedGit can help
Meeting all the quality standards is a lot of steps and we need patience!
To learn more:
Next steps from here:
2:40 minutes