From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gDyUGFFC3GB5SAAAgWs5BA (envelope-from ) for ; Wed, 30 Jun 2021 12:07:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id iA9ZFFFC3GCjcQAA1q6Kng (envelope-from ) for ; Wed, 30 Jun 2021 10:07:13 +0000 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 BEADA167AF for ; Wed, 30 Jun 2021 12:07:09 +0200 (CEST) Received: from localhost ([::1]:60238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyX7c-0005FJ-E7 for larch@yhetil.org; Wed, 30 Jun 2021 06:07:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyX7W-0005Ew-1N for guix-patches@gnu.org; Wed, 30 Jun 2021 06:07:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyX7V-0001Nm-QE for guix-patches@gnu.org; Wed, 30 Jun 2021 06:07:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyX7V-0000Ty-MB for guix-patches@gnu.org; Wed, 30 Jun 2021 06:07:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49149] [PATCH 0/7] Add deb format for guix pack. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 30 Jun 2021 10:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 49149@debbugs.gnu.org Received: via spool by 49149-submit@debbugs.gnu.org id=B49149.16250476031826 (code B ref 49149); Wed, 30 Jun 2021 10:07:01 +0000 Received: (at 49149) by debbugs.gnu.org; 30 Jun 2021 10:06:43 +0000 Received: from localhost ([127.0.0.1]:56497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyX7C-0000TO-Ky for submit@debbugs.gnu.org; Wed, 30 Jun 2021 06:06:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyX7A-0000TA-SW for 49149@debbugs.gnu.org; Wed, 30 Jun 2021 06:06:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33782) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyX75-00015r-Nf; Wed, 30 Jun 2021 06:06:35 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42580 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyX75-0005zv-G3; Wed, 30 Jun 2021 06:06:35 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20210621061205.31878-1-maxim.cournoyer@gmail.com> <20210621061205.31878-6-maxim.cournoyer@gmail.com> Date: Wed, 30 Jun 2021 12:06:34 +0200 In-Reply-To: <20210621061205.31878-6-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Mon, 21 Jun 2021 02:12:03 -0400") Message-ID: <87wnqboedx.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625047632; 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; bh=xVVj9+nCuD2esQWplKYaAs9OfDmq8NtcgtDrMkm8EuA=; b=JDnLirHRepNWZkSy1XKliwNyquCMa8VGSw8bU0eNeAs7YSCkGxQj59EsYs/G/MaX5VTAir dWX91L5FiTHt3lPMfhUE0VCKIBgoP/hGolH7/k6AIg9ql5ebnpYVWVdEiV2uT+MyWM/JXJ PfzYvODV07KltVNCCO3+agBjolWt2Odo54mkFRKxDxeCNi7T8ZpCqwI9eTD7fmsi9zKyiS XNaYgQLDlzbxiNLJWCocxwbskmhfAUYlDBm5enmjFAhhOJgTpKGNHV1g448gGgS0ba2s3T RNAVvmiZiQHBboqakE1gTmW+LoMkTtLJQKMH+rsK2m+THbwD+MKFiMzkw40kTQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625047632; a=rsa-sha256; cv=none; b=LX1frDTwdr0+vSjCusTGO6Wz+aZll1421ckvTjHcFboUI4VoqQ+SaU69iC63LohnYpflPt RZJR96dKOER7qN0DN4yTyc5GpwO9tyUEwNNwq/N+RsBRWfLZTKcRQbGrqMTIASlQemcTRs ZKbuT3WA2ox62XopqFtR6DwRXAnUBmTDp7RtZquQP4wUXNpYTNCbrWtNPQQcShxzVbTIcW 07P4X4v7H5Jt9spUKA/mRrzbFd8gSaN/tC315bBX6ieLcvjazVz4Sbpw0QQ8sFgVuYpXmy P+q9zPqGZfnJ6zyteVn/ReI/3X1WtBy//GR2+AL7rCFv042mwN5lzMdML5Makg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: BEADA167AF X-Spam-Score: -2.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: eIIo+EDZ4+uN Hi, Maxim Cournoyer skribis: > Tar translate duplicate files in the archive into hard links. These can = cause > problems, as not every tool support them; for example dpkg doesn't. > > * gnu/system/file-systems.scm (reduce-directories): New procedure. > (file-prefix?): Lift the restriction on file prefix. The procedure can be > useful for comparing relative file names. Adjust doc. > (file-name-depth): New procedure, extracted from ... > (btrfs-store-subvolume-file-name): ... here. > * guix/scripts/pack.scm (self-contained-tarball/builder): Use > reduce-directories. > * tests/file-systems.scm ("reduce-directories"): New test. [...] > (define (file-prefix? file1 file2) > - "Return #t if FILE1 denotes the name of a file that is a parent of FIL= E2, > -where both FILE1 and FILE2 are absolute file name. For example: > + "Return #t if FILE1 denotes the name of a file that is a parent of FIL= E2. > +For example: >=20=20 > (file-prefix? \"/gnu\" \"/gnu/store\") > =3D> #t > @@ -240,19 +241,41 @@ where both FILE1 and FILE2 are absolute file name. = For example: > (file-prefix? \"/gn\" \"/gnu/store\") > =3D> #f > " > - (and (string-prefix? "/" file1) > - (string-prefix? "/" file2) Doesn=E2=80=99t it have the effect that now: (file-prefix? "gnu" "/gnu/store") =3D> #t ? I=E2=80=99d rather insist on absolute file names and preserve the initial semantics, to avoid bad surprises. > +(define (reduce-directories file-names) > + "Eliminate entries in FILE-NAMES that are children of other entries in > +FILE-NAMES. This is for example useful when passing a list of files to = GNU > +tar, which would otherwise descend into each directory passed and archiv= e the > +duplicate files as hard links, which can be undesirable." > + (let* ((file-names/sorted > + ;; Ascending sort by file hierarchy depth, then by file name l= ength. > + (stable-sort (delete-duplicates file-names) > + (lambda (f1 f2) > + (let ((depth1 (file-name-depth f1)) > + (depth2 (file-name-depth f2))) > + (if (=3D depth1 depth2) > + (string< f1 f2) > + (< depth1 depth2))))))) > + (reverse (fold (lambda (file-name results) > + (if (find (cut file-prefix? <> file-name) results) > + results ;parent found -- skipping > + (cons file-name results))) > + '() > + file-names/sorted)))) Likewise, I suspect it doesn=E2=80=99t work as intended if there are relati= ve file names in the list, no? Perhaps we could add an example to the docstring. Also, the word =E2=80=9Creduce=E2=80=9D doesn=E2=80=99t appear in the docstring, which to = me suggests suboptimal naming. ;-) Thanks, Ludo=E2=80=99.