From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Wingo Subject: Re: [PATCH] gnu-maintenance: update-package-source: Only update the desired package. Date: Tue, 05 Apr 2016 12:16:21 +0200 Message-ID: <87inzwe4y2.fsf@igalia.com> References: <1459830946-2583-1-git-send-email-iyzsong@gmail.com> <87h9fgfomg.fsf@igalia.com> <87shz0v13q.fsf@gnu.org> 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]:34487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anO29-0007iq-Ms for guix-devel@gnu.org; Tue, 05 Apr 2016 06:16:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anO26-0008Rv-FY for guix-devel@gnu.org; Tue, 05 Apr 2016 06:16:29 -0400 In-Reply-To: <87shz0v13q.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Tue, 05 Apr 2016 11:47:21 +0200") 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org, =?utf-8?B?5a6L5paH5q2m?= On Tue 05 Apr 2016 11:47, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Andy Wingo skribis: > >> Hi =E5=AE=8B=E6=96=87=E6=AD=A6 :) >> >> On Tue 05 Apr 2016 06:35, =E5=AE=8B=E6=96=87=E6=AD=A6 writes: >> >>> diff --git a/guix/upstream.scm b/guix/upstream.scm >>> index cea23fe..f4bc09c 100644 >>> --- a/guix/upstream.scm >>> +++ b/guix/upstream.scm >>> @@ -205,6 +209,37 @@ and 'interactive' (default)." >>> "Modify the source file that defines PACKAGE to refer to VERSION, >>> whose tarball has SHA256 HASH (a bytevector). Return the new version = string >>> if an update was made, and #f otherwise." >>> + (define (substitute+ file start end pattern+procs) >> >> Sorry to tell you mixed signals, but did you consider Ludovic's >> suggestion to use `package-field-location' ? > > I mentioned it mostly as a possible source of inspiration, but I think > it cannot be used as-is here. Why not? Using that, you could limit the edit to the field and not the whole package. Anyway, just a thought. > The trick to determine the boundaries of the =E2=80=98package=E2=80=99 fo= rm looks > reasonable to me. In that case I think the ideal is something like "edit-expression", which takes a source location that starts an expression, uses "read" to advance to the end of the expression, then edits the intervening string using whatever but verifies that the result can still be read as one expression. Having recorded the absolute byte positions of the start and end of the expression, you can then create the output by doing an efficient bytevector read of the prologue, then display the string for the edited expression, then the bytevector tail. Again, just a thought! Feel free to incorporate or not as you like, =E5=AE=8B=E6=96=87=E6=AD=A6 :) Andy