unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andy Wingo <wingo@igalia.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org, 宋文武 <iyzsong@gmail.com>
Subject: Re: [PATCH] gnu-maintenance: update-package-source: Only update the desired package.
Date: Tue, 05 Apr 2016 12:16:21 +0200	[thread overview]
Message-ID: <87inzwe4y2.fsf@igalia.com> (raw)
In-Reply-To: <87shz0v13q.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 05 Apr 2016 11:47:21 +0200")

On Tue 05 Apr 2016 11:47, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@igalia.com> skribis:
>
>> Hi 宋文武 :)
>>
>> On Tue 05 Apr 2016 06:35, 宋文武 <iyzsong@gmail.com> 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	other threads:[~2016-04-05 10:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05  4:35 [PATCH] gnu-maintenance: update-package-source: Only update the desired package 宋文武
2016-04-05  8:25 ` Andy Wingo
2016-04-05  9:47   ` Ludovic Courtès
2016-04-05 10:16     ` Andy Wingo [this message]
2016-04-05 14:05       ` 宋文武
2016-04-05 14:52         ` Andy Wingo
2016-04-05 20:20       ` Ludovic Courtès
2016-04-05  9:45 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87inzwe4y2.fsf@igalia.com \
    --to=wingo@igalia.com \
    --cc=guix-devel@gnu.org \
    --cc=iyzsong@gmail.com \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).