From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#22693: `guix refresh -u` updates other packages with same version Date: Mon, 04 Apr 2016 22:57:09 +0200 Message-ID: <87inzxcct6.fsf@gnu.org> References: <20160216092724.GA10422@jasmine> <87pou5oete.fsf@member.fsf.org> <87r3elh9od.fsf@igalia.com> 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]:40140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anBYr-00026a-Aj for guix-devel@gnu.org; Mon, 04 Apr 2016 16:57:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anBYo-0000nn-0A for guix-devel@gnu.org; Mon, 04 Apr 2016 16:57:25 -0400 In-Reply-To: <87r3elh9od.fsf@igalia.com> (Andy Wingo's message of "Mon, 04 Apr 2016 13:53:38 +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: Andy Wingo Cc: guix-devel@gnu.org, 22693@debbugs.gnu.org Andy Wingo skribis: > On Mon 04 Apr 2016 12:20, iyzsong@member.fsf.org (=E5=AE=8B=E6=96=87=E6= =AD=A6) writes: > >> How to fix this? >> >> The procedure is =E2=80=98update-package-source=E2=80=99 in (guix upstre= am). >> it find the file, then use =E2=80=98substitute=E2=80=99 to replace the v= ersion and >> hash. =E2=80=98substitute=E2=80=99 works line-by-line, it can=E2=80=99t= match mutiple lines. >> >> I try: >> - use =E2=80=98package-location=E2=80=99 and =E2=80=98read=E2=80=99 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. Right. =E2=80=98package-field-location=E2=80=99 does something along these= lines. > Then limit your substitute* to work within those lines. A simpler yet less elegant trick used in =E2=80=98report-formatting-issues= =E2=80=99 in (guix scripts lint) is to have a maximum number of lines assumed to be part of the =E2=80=98package=E2=80=99 form following its starting line. Thanks, Ludo=E2=80=99.