From patchwork Wed Sep 29 22:19:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 33425 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6F99D27BBE3; Wed, 29 Sep 2021 23:21:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3A22A27BBE1 for ; Wed, 29 Sep 2021 23:21:24 +0100 (BST) Received: from localhost ([::1]:43248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVhx5-0006jh-B3 for patchwork@mira.cbaines.net; Wed, 29 Sep 2021 18:21:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVhwk-0006e3-Pd for guix-patches@gnu.org; Wed, 29 Sep 2021 18:21:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVhwk-0001yM-Hr for guix-patches@gnu.org; Wed, 29 Sep 2021 18:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mVhwk-0000iR-EC for guix-patches@gnu.org; Wed, 29 Sep 2021 18:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50905] [PATCH 05/38] build/minetest-build-system: Move png-file? to (guix build utils). Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 29 Sep 2021 22:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50905 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50905@debbugs.gnu.org Cc: Maxime Devos Received: via spool by 50905-submit@debbugs.gnu.org id=B50905.16329540072412 (code B ref 50905); Wed, 29 Sep 2021 22:21:02 +0000 Received: (at 50905) by debbugs.gnu.org; 29 Sep 2021 22:20:07 +0000 Received: from localhost ([127.0.0.1]:50647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVhvo-0000c2-Mh for submit@debbugs.gnu.org; Wed, 29 Sep 2021 18:20:06 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:36154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVhvW-0000YW-9u for 50905@debbugs.gnu.org; Wed, 29 Sep 2021 18:19:46 -0400 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by laurent.telenet-ops.be with bizsmtp id zyKh2500E0mfAB401yKlQs; Thu, 30 Sep 2021 00:19:45 +0200 From: Maxime Devos Date: Thu, 30 Sep 2021 00:19:05 +0200 Message-Id: <20210929221938.17168-5-maximedevos@telenet.be> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210929221938.17168-1-maximedevos@telenet.be> References: <20210929221938.17168-1-maximedevos@telenet.be> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1632953985; bh=VVt3ntCLp/UoKgWoBp+TFdwruGuf+mFnPp+kfLWP5Y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IuYSgdTT2H5PPz6mxdIGKK1JknMtg6UV5IELIcyt+HWVEFioRLLNTyuuirZsNrhog wkj0yy29ymh1gm7nToV+dFyLzVf7CPzoFR54p/S2x9xz3i04aBLGTSHQA4P8X60ntX v9R23NkPRsPNKbK2ciaICTDWLjKFCltXKNJe6/AmTIISap1G+armmkeLhLXue2CSAj jM6zqmr1DcE3VAYC9CCBD3Czb7PxONpPm+ixguYDgnWYOKL4Dv4q/tic1JF1vAcCdT KH6ibdA0IEHBRPX22STAe8n6IR2SajFGsTSfsvTt6Gtt2AjbX/eB+lzBp0sfs4RTh0 IhLim95jTk6Bg== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches It's not really Minetest-specific. It was only placed in (guix build minetest-build-system) to avoid a world rebuild. * guix/build/minetest-build-system.scm (%png-magic-bytes,png-file?): Move to ... * guix/build/utils.scm (%png-magic-bytes,png-file?): ... here. --- guix/build/minetest-build-system.scm | 9 --------- guix/build/utils.scm | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/guix/build/minetest-build-system.scm b/guix/build/minetest-build-system.scm index 477cc3d1d0..5d7d8d2292 100644 --- a/guix/build/minetest-build-system.scm +++ b/guix/build/minetest-build-system.scm @@ -90,15 +90,6 @@ If it is unknown, make an educated guess." #:install-plan (mod-install-plan (apply guess-mod-name arguments)) arguments)) -(define %png-magic-bytes - ;; Magic bytes of PNG images, see ‘5.2 PNG signatures’ in - ;; ‘Portable Network Graphics (PNG) Specification (Second Edition)’ - ;; on . - #vu8(137 80 78 71 13 10 26 10)) - -(define png-file? - ((@@ (guix build utils) file-header-match) %png-magic-bytes)) - (define* (minimise-png #:key inputs native-inputs #:allow-other-keys) "Minimise PNG images found in the working directory." (define optipng (which "optipng")) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 3beb7da67a..39e581b0fa 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -61,6 +61,8 @@ symbolic-link? call-with-temporary-output-file call-with-ascii-input-file + file-header-match + png-file? elf-file? ar-file? gzip-file? @@ -290,6 +292,15 @@ with the bytes in HEADER, a bytevector." #f ;FILE is a directory (apply throw args)))))) +(define %png-magic-bytes + ;; Magic bytes of PNG images, see ‘5.2 PNG signatures’ in + ;; ‘Portable Network Graphics (PNG) Specification (Second Edition)’ + ;; on . + #vu8(137 80 78 71 13 10 26 10)) + +(define png-file? + (file-header-match %png-magic-bytes)) + (define %elf-magic-bytes ;; Magic bytes of ELF files. See . (u8-list->bytevector (map char->integer (string->list "\x7FELF"))))