From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] gnu: Mark /gnu/store as needed for boot. Date: Mon, 16 Jan 2017 23:28:17 +0100 Message-ID: <87lgua63ni.fsf@gnu.org> References: <1484164902-10160-1-git-send-email-jmd@gnu.org> <877f5xjpmk.fsf@gnu.org> <20170115063226.GA20478@jocasta.intra> <87shokdkrl.fsf@gnu.org> <20170116124617.GB16013@jocasta.intra> 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]:40700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTFlH-0003dT-Oc for guix-devel@gnu.org; Mon, 16 Jan 2017 17:28:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTFlE-0000pv-LF for guix-devel@gnu.org; Mon, 16 Jan 2017 17:28:23 -0500 In-Reply-To: <20170116124617.GB16013@jocasta.intra> (John Darrington's message of "Mon, 16 Jan 2017 13:46:17 +0100") 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: John Darrington Cc: guix-devel@gnu.org, John Darrington John Darrington skribis: > On Sun, Jan 15, 2017 at 11:24:30PM +0100, Ludovic Court??s wrote: >=20=20=20=20=20=20 > Then maybe this: >=20=20=20=20=20=20 > (define (file-system-needed-for-boot? fs) > (or (%file-system-needed-for-boot? fs) > (and (file-prefix? (file-system-needed-for-boot? fs) > (%store-directory)) > (not (memq 'bind-mount (file-system-flags fs)))))) >=20=20=20=20=20=20 > with: >=20=20=20=20=20=20 > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> (define (file-prefix? file1 file2) > (define not-slash > (char-set-complement (char-set #\/))) > (and (string-prefix? "/" file1) > (let loop ((file1 (string-tokenize file1 not-slash)) > (file2 (string-tokenize file2 not-slash))) > (match file1 > (() > #t) > ((head1 tail1 ...) > (match file2 > ((head2 tail2 ...) > (and (string=3D? head1 head2) > (loop tail1 tail2))) > (() > #f))))))) > scheme@(guile-user)> (file-prefix? "/gn" "/gnu/store") > $13 =3D #f > scheme@(guile-user)> (file-prefix? "/gnu/store/foo" "/gnu/store") > $14 =3D #f > scheme@(guile-user)> (file-prefix? "/gnu/store" "/gnu/store") > $15 =3D #t > scheme@(guile-user)> (file-prefix? "/gnu" "/gnu/store") > $16 =3D #t > scheme@(guile-user)> (file-prefix? "/" "/gnu/store") > $17 =3D #t > --8<---------------cut here---------------end--------------->8--- >=20=20=20=20=20=20 > This seems more natural to me than computing the set of prefixes like > ???all-subpaths??? does. >=20=20=20=20=20=20 > WDYT? >=20=20=20=20=20=20 > If that???s fine with you I can commit this. >=20=20=20=20=20=20 > > It looks fine to me. I haven't tested it .... Pushed with tests as 384344198dcaa97847e66d3dd82f279ede08d690. Thanks! Ludo=E2=80=99.