From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timothy Sample Subject: Graft hooks Date: Sun, 12 Aug 2018 15:49:54 -0400 Message-ID: <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]:57081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fowND-0002lH-Dq for guix-devel@gnu.org; Sun, 12 Aug 2018 15:50:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fowNA-0006wA-Bw for guix-devel@gnu.org; Sun, 12 Aug 2018 15:49:59 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:43373) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fowNA-0006w1-63 for guix-devel@gnu.org; Sun, 12 Aug 2018 15:49:56 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 77A1D21B5A for ; Sun, 12 Aug 2018 15:49:55 -0400 (EDT) Received: from mrblack (74-116-186-44.qc.dsl.ebox.net [74.116.186.44]) by mail.messagingengine.com (Postfix) with ESMTPA id E79C5E47A1 for ; Sun, 12 Aug 2018 15:49:54 -0400 (EDT) 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: guix-devel@gnu.org Hi Guix, I just submitted a patch for , but now I=E2=80= =99m wondering if there isn=E2=80=99t a more general way to solve the problem. The bug has to do with grafting and checksums. I know three bugs that follow this theme: the one above (Racket), (GDB), and (Go). The basic problem is that these packages store checksums of files during build time. If they get updated due to grafting, the files change, but the checksums do not. The checksums become invalid, which causes other problems like trying to update files in the store or asserting that debugging information is invalid. The patch I submitted makes Racket assume that files in the store are good. It patches Racket to skip checksum validation if it is checking a file in the store. A similar approach could be taken for GDB and Go. It occurs to me that if we had some way to run package-specific code during grafting we could solve problems like this easily and without patching software that is not broken. 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 wo= uld 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 at = all the details yet, because maybe this is a bad idea and I shouldn=E2=80=99t w= aste 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! -- Tim