From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 55139@debbugs.gnu.org
Subject: bug#55139: package-location is wrong for transformed packages
Date: Mon, 23 May 2022 15:28:10 +0200 [thread overview]
Message-ID: <87czg47505.fsf@gnu.org> (raw)
In-Reply-To: <87v8ty5eq7.fsf@gmail.com> (Maxim Cournoyer's message of "Sun, 22 May 2022 01:16:32 -0400")
Hi!
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> Yeah, I ended up with this [0]:
>
> (define (locate-package-via-git name)
> "Return the location object corresponding to package NAME, searched via git."
> (let* ((input-pipe (open-pipe* OPEN_READ
> "git" "grep" "-n" "--column"
> (format #f "^(define-public ~a$" name)))
> (output (get-string-all input-pipe)) ;file:line:column:match
> (exit-val (status:exit-val (close-pipe input-pipe))))
> (case exit-val
> ((0)
> (let ((components (string-split output #\:)))
> (location
> (first components) ;file
> (string->number (second components)) ;1-indexed line
> ;; FIXME: Comment discrepancy in (guix diagnostics), which
> ;; says the column is 0-indexed.
> (and=> (string->number (third components)) 1-)))) ;0-indexed column
> ((1) #f) ;no match
> (else (error "git grep failed with status" exit-val)))))
>
> and it does feel silly to have to shell out to git, but it did the job.
>
> Thanks,
>
> Maxim
>
> [0] https://notabug.org/apteryx/guix-api-examples/src/master/purge-python2-packages.scm#L42
Nice, it’s good to have these examples—and hopefully we’ll soon be able
to remove a whole bunch of ‘python2-’ packages!
As for ‘package-definition-location’, I don’t think we can reasonably do
any better, so I’m tempted to close the bug.
WDYT?
Ludo’.
next prev parent reply other threads:[~2022-05-23 13:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 1:48 bug#55139: package-location is wrong for transformed packages Maxim Cournoyer
2022-04-27 12:23 ` Liliana Marie Prikler
2022-05-02 20:57 ` Ludovic Courtès
2022-05-22 5:16 ` Maxim Cournoyer
2022-05-23 13:28 ` Ludovic Courtès [this message]
2022-06-08 21:29 ` Maxim Cournoyer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czg47505.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=55139@debbugs.gnu.org \
--cc=maxim.cournoyer@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.