From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2OdXM6A16WO5JwEAbAwnHQ (envelope-from ) for ; Sun, 12 Feb 2023 19:53:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KNtQM6A16WOAVgEA9RJhRA (envelope-from ) for ; Sun, 12 Feb 2023 19:53:20 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 39DF324892 for ; Sun, 12 Feb 2023 19:53:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRHTE-0004Kj-Lo; Sun, 12 Feb 2023 13:53:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRHTC-0004EZ-Ke for guix-patches@gnu.org; Sun, 12 Feb 2023 13:53:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRHTC-0006qC-Av for guix-patches@gnu.org; Sun, 12 Feb 2023 13:53:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRHTB-00059j-SG for guix-patches@gnu.org; Sun, 12 Feb 2023 13:53:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61255] [PATCH 0/5] Add support for the RPM format to "guix pack" Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 Feb 2023 18:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61255 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: Josselin Poiret , Christopher Baines , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , Ricardo Wurmus , 61255@debbugs.gnu.org Received: via spool by 61255-submit@debbugs.gnu.org id=B61255.167622794919755 (code B ref 61255); Sun, 12 Feb 2023 18:53:01 +0000 Received: (at 61255) by debbugs.gnu.org; 12 Feb 2023 18:52:29 +0000 Received: from localhost ([127.0.0.1]:46730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRHSe-00058Z-Ho for submit@debbugs.gnu.org; Sun, 12 Feb 2023 13:52:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRHSc-00058M-4o for 61255@debbugs.gnu.org; Sun, 12 Feb 2023 13:52:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRHSW-0006mX-4q; Sun, 12 Feb 2023 13:52:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=1nYMqBzwmPx+RiYiMrmzMXfcbtvDPZMEWI/5EKHeWGM=; b=R2/O9E+GIO+KIi5OuKn4 uo3Paon+CF94DJyOz8wPLznb9HbIrL5AuxpbT47DVMj1AUVt1dAIqsKhWuHw00G6IjlvAoals31li h9djNld/080HA4a8ui+d4EA0hbdL4MNQYoD2NereyUXeNzprHaPl7TygWIPmlQOFgDmedbeyQTWFB rsPw1ptJYQMd3ZhzqHbXSv4GHYkgaGk6TAemX6AJ88mu5ZKJQ6hxswhfbvlyNQvTohQ/FBktvEmLN YV8lcEQfHEnhn3AWWWSjYiWPLWpgZ+QoC8ylXdf+UNBA1MpgIuma9HQ8K2+Lb6d/pBYj5GwJhIyIj APumo/y1gYnpGQ==; Received: from [185.228.228.230] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRHSS-00018U-Dy; Sun, 12 Feb 2023 13:52:19 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230203221409.15886-2-maxim.cournoyer@gmail.com> <20230203221409.15886-6-maxim.cournoyer@gmail.com> Date: Sun, 12 Feb 2023 19:52:08 +0100 In-Reply-To: <20230203221409.15886-6-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Fri, 3 Feb 2023 17:14:08 -0500") Message-ID: <87edquk97r.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676228000; a=rsa-sha256; cv=none; b=SPRCezLFEP/1oJbUK8rLoILos5baTjjtNqxFaDMA+Xzu10hMRAGa2ry0AxvLv2UwY5UL18 4IAE6bJUmHwZsjvdrIF/N92V0mxwQNtO3szs+LkYDNHwGMDxIiLUSaur0rUCFNXACJWeW1 OGLyGgoU+mLtWRYetC9TpqVMDadbTTkhSWbCjvBLw9PBVI20RN+oE+GG0X4PDC9df9/REZ n6BfVcIm+2+YxAhrQKamR6RB75U0d3u513DoXgukwHbNJHLpEqjsynrYrqspwHESgUr/vv 4aLv+Lx0KhvnfpZAuKFwsLeT48x4uJHctQ/kcZ4TIwo3zlLCJMOpIbc8Sbirtg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="R2/O9E+G"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676228000; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=1nYMqBzwmPx+RiYiMrmzMXfcbtvDPZMEWI/5EKHeWGM=; b=Z12ZFIhaRSEQw2SW610TY71ZfrObYn1pJ5Wmncx/F1w8ECAhySrIQF187Vnhz53T2h5/to J8e3ovNiO2cKzYhccN+dZZa745IQ+/Q+WgEllOMq4wuzXYEzuiF0e63CW3NcNfW63lRQhX /88imTjrZmYgwOem8mWewh4Ead5jaJtHUHOfpJNM9Q4ZUzJRAKEBKNiRlo002aS5eXS2FR B3qBmplG//qea9YheM6N6LdJoUuGfFce1wXvojzfLGkMHWV4bwdOZOv1wxmUKXnwwZIwM4 oV9ZXbt5s37vnXaCZrk/lywXjsfzfpsdd1hhAqpVpRaVOfRS/5SGZsEvxPSFCA== X-Migadu-Queue-Id: 39DF324892 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="R2/O9E+G"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -3.32 X-Spam-Score: -3.32 X-TUID: J8NRRjV8/rMe Hey! Maxim Cournoyer skribis: > * guix/rpm.scm: New file. > * guix/scripts/pack.scm (rpm-archive): New procedure. > (%formats): Register it. > (show-formats): Add it. > (guix-pack): Register supported extra-options for the rpm format. > * tests/pack.scm (rpm-for-tests): New variable. > ("rpm archive can be installed/uninstalled"): New test. > * tests/rpm.scm: New test. > * doc/guix.texi (Invoking guix pack): Document it. (=E2=80=98Makefile.am=E2=80=99 changes are missing here.) Woow, there=E2=80=99s a lot of fun stuff in here! :-) Nice work! Perhaps we=E2=80=99ll soon see Guix-generated RPMs for, say, Jami? :-) Overall it looks great to me. Perhaps you should submit an =E2=80=98etc/news.scm=E2=80=99 entry here so t= hat translators can work on it before it=E2=80=99s eventually pushed (I think t= hat=E2=80=99s the workflow Julien proposed). Some comments follow: > +@cindex Debian, build a .deb package with guix pack @file{.deb} and @command{guix pack} > +The RPM format supports relocatable packages via the @option{--prefix} > +option of the @command{rpm} command, which can be handy to install an > +RPM package to a specific prefix, making installing multiple > +Guix-produced RPM packages side by side possible. > + > +@example > +guix pack -f rpm -R -C xz -S /usr/bin/hello=3Dbin/hello hello > +sudo rpm --install --prefix=3D/opt /gnu/store/...-hello.rpm > +@end example Perhaps use two different @example boxes to distinguish between the Guix machine that produces the RPM, and the RPM-based system that installs it? > +@quotation Note > +Similarly to Debian packages, two RPM packages with conflicting files > +cannot be installed simultaneously. Contrary to Debian packages, RPM > +supports relocatable packages, so file conflicts can be avoided by > +installing the RPM packages under different installation prefixes, as > +shown in the above example. So for relocatable packages, one really needs =E2=80=98guix pack -R=E2=80= =99 IIUC. Interesting. > +;;; Commentary: > +;;; > +;;; This module provides the building blocks required to construct RPM > +;;; archives. It is intended to be importable on the build side, so sho= uldn't > +;;; depend on (guix diagnostics) or other host-side-only modules. > + > +(define-module (guix rpm) The commentary should be followed by =E2=80=9CCode:=E2=80=9D and it should = come after the =E2=80=98define-module=E2=80=99 form. That way, (ice-9 documentation) = can find it. > +(define (make-header-index+data entries) > + "Return the index and data sections as u8 number lists, via multiple v= alues. > +An index is composed of four u32 (16 bytes total) quantities, in order: = tag, > +type, offset and count." > + (match (fold (match-lambda* > + ((entry (offset . (index . data))) > + (let* ((tag (header-entry-tag entry)) > + (tag-number (rpm-tag-number tag)) > + (tag-type (rpm-tag-type tag)) > + (count (header-entry-count entry)) > + (data* (header-entry->data entry)) > + (alignment (entry-type->alignement tag-type)) > + (aligned-offset (next-aligned-offset offset ali= gnment)) > + (padding (make-list (- aligned-offset offset) 0= ))) > + (cons (+ aligned-offset (length data*)) > + (cons (append index > + (u32-number->u8-list tag-number) > + (u32-number->u8-list tag-type) > + (u32-number->u8-list aligned-off= set) > + (u32-number->u8-list count)) > + (append data padding data*)))))) I think it would be possible (throughout the code) to avoid building lists of bytes and instead directly produce bytevectors or, better, produce procedures that write bytes directly to an output port (with macros along the lines of =E2=80=98define-operation=E2=80=99 in (guix store= ) or =E2=80=98define-pack=E2=80=99 in (guix cpio)). I don=E2=80=99t think it should be a blocker though, it=E2=80=99s okay to k= eep it this way. > +(define (files->md5-checksums files) > + "Return the MD5 checksums (formatted as hexadecimal strings) for FILES= ." Does it have to be MD5? If RPM supports SHA1 or SHA2*, it would be best to pick one of these; MD5 is okay to detect unintended modifications, but it=E2=80=99s useless if we care about malicious tampering. > + (define name (or (and=3D> single-entry manifest-entry-name) > + (manifest->friendly-name manifest))) > + > + (define version (or (and=3D> single-entry manifest-entry-ver= sion) > + "0.0.0")) > + > + (define lead (generate-lead (string-append name "-" version) > + #:target (or #$target %host-type= ))) > + > + (define payload-digest (bytevector->hex-string > + (file-sha256 #$payload))) Nitpick: the convention usually followed is to write the value, when it=E2=80=99s long enough as is the case here, on the next line, as in: (define something value-thats-a-little-bit-long) > + (unless store (test-skip 1)) > + (test-assertm "rpm archive can be installed/uninstalled" store Really cool to have a full-blown test like this. > +(define-module (test-rpm) > + #:use-module (guix rpm) That too! Thanks, Ludo=E2=80=99.