From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Graft hooks Date: Mon, 20 Aug 2018 11:12:29 +0200 Message-ID: <87y3d1h05e.fsf@gnu.org> References: <87k1ovbc0t.fsf@ngyro.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frgEk-0005D2-G6 for guix-devel@gnu.org; Mon, 20 Aug 2018 05:12:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frgEh-0000Lq-Cv for guix-devel@gnu.org; Mon, 20 Aug 2018 05:12:34 -0400 In-Reply-To: <87k1ovbc0t.fsf@ngyro.com> (Timothy Sample's message of "Sun, 12 Aug 2018 15:49:54 -0400") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Timothy Sample Cc: guix-devel@gnu.org Hello Timothy, Timothy Sample skribis: > The basic idea would be to add a field (or use a property) to the > package record. Let=E2=80=99s call it =E2=80=9Cgraft-hook=E2=80=9D. It = would be Scheme code > that gets run after grafting takes place, giving us a chance to patch > special things like checksums. The hook would be passed the list of > files that were been modified during grafting. Then, in the Racket > package for example, I could write a graft-hook that updates the SHA-1 > hash of each of the modified source files. > > Since grafting is done at the derivation level, the hook code would have > to be propagated down from the package level. I haven=E2=80=99t looked a= t all > the details yet, because maybe this is a bad idea and I shouldn=E2=80=99t= waste > my time! :) My first impression is that it is not too tricky. > > Are these problems too specialized to deserve a general mechanism like > this? Let me know what you think! I agree that this would be the right thing to do! (I=E2=80=99d really like= to do it for GDB as discussed in .) Package properties would be the right way to make it extensible, but there are complications (notably we=E2=80=99d need to use gexps, but build systems don=E2=80=99t use gexps yet.) So as a first step, would like to try and implement the checksum update for Racket directly in (guix build grafts)? The implementation would need to be clearly separate from the generic grafting code (like profile hooks in (guix profiles)) such that we can easily add similar hooks and move them to a separate file later. WDYT? Thanks, Ludo=E2=80=99.