Subject: bug#22693: `guix refresh -u` updates other packages with same version

From: Andy Wingo <[email-masked]>
Date: Mon, 04 Apr 2016 13:53:38 +0200

On Mon 04 Apr 2016 12:20, [email-masked] (宋文武) writes:

> How to fix this?
>
> The procedure is ‘update-package-source’ in (guix upstream).
> it find the file, then use ‘substitute’ to replace the version and
> hash.  ‘substitute’ works line-by-line, it can’t match mutiple lines.
>
> I try:
>  - use ‘package-location’ and ‘read’ to get the package object,
>    but it lost all format and comments.

One option:

  1. open the source file for the package
  2. Call (read) until port-line / port-column are beyond the
     package-location of the package
  3. At that point you have the ending location of the package.

Then limit your substitute* to work within those lines.

Another option would be to extend substitute* to start on a certain
line, and to limit the number of substitutions.  That way if you start
on package-location and limit to one substitution you are likely to
update the correct version.

Andy