guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu-maintenance: update-package-source: Only update the desi


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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

On Tue 05 Apr 2016 11:47, address@hidden (Ludovic Courtès) writes:

> Andy Wingo <address@hidden> skribis:
>
>> Hi 宋文武 :)
>>
>> On Tue 05 Apr 2016 06:35, 宋文武 <address@hidden> 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 ‘package’ form 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,
宋文武 :)

Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]