1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

maint: update-guix-package: Prevent accidentally breaking guix pull.

Fixes <https://issues.guix.gnu.org/43893>.

This changes the 'update-guix-package' tool so that it:

1. Always uses a clean checkout to compute the hash of the updated 'guix'
package.
2. Ensures the commit used in the updated 'guix' package definition has already
been pushed upstream.

* build-aux/update-guix-package.scm (%savannah-guix-git-repo-push-url): New
variable.
(with-input-pipe-to-string, with-temporary-git-worktree): New syntaxes.
(find-origin-remote, git-add-worktree): New procedures.
(commit-already-pushed?): New predicate.
(main): Check the commit used has already been pushed upstream and compute the
hash from a clean checkout.
* doc/contributing.texi (Updating the Guix Package): Document it.
* .dir-locals.el (scheme-mode): Fix indentation of with-temporary-git-worktree.
This commit is contained in:
Maxim Cournoyer
2020-10-10 00:33:32 -04:00
parent c949530b6f
commit 5800d2aae2
3 changed files with 112 additions and 30 deletions

View File

@@ -28,6 +28,7 @@ choice.
* Submitting Patches:: Share your work.
* Tracking Bugs and Patches:: Using Debbugs.
* Commit Access:: Pushing to the official repository.
* Updating the Guix Package:: Updating the Guix package definition.
@end menu
@node Building from Git
@@ -1323,3 +1324,45 @@ only push their own awesome changes, but also offer some of their time
@emph{reviewing} and pushing other people's changes. As a committer,
you're welcome to use your expertise and commit rights to help other
contributors, too!
@node Updating the Guix Package
@section Updating the Guix Package
@cindex update-guix-package, updating the guix package
It is sometimes desirable to update the @code{guix} package itself (the
package defined in @code{(gnu packages package-management)}), for
example to make new daemon features available for use by the
@code{guix-service-type} service type. In order to simplify this task,
the following command can be used:
@example
make update-guix-package
@end example
The @code{update-guix-package} make target will use the last known
@emph{commit} corresponding to @code{HEAD} in your Guix checkout,
compute the hash of the Guix sources corresponding to that commit and
update the @code{commit}, @code{revision} and hash of the @code{guix}
package definition.
To validate that the updated @code{guix} package hashes are correct and
that it can be built successfully, the following command can be run from
the directory of your Guix checkout:
@example
./pre-inst-env guix build guix
@end example
To guard against accidentally updating the @code{guix} package to a
commit that others can't refer to, a check is made that the commit used
has already been pushed to the Savannah-hosted Guix git repository.
This check can be disabled, @emph{at your own peril}, by setting the
@code{GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT} environment variable.
To build the resulting 'guix' package when using a private commit, the
following command can be used:
@example
./pre-inst-env guix build guix --with-git-url=guix=$PWD
@end example