From: Sarah Morgensen via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: 48111@debbugs.gnu.org, raingloom <raingloom@riseup.net>
Subject: bug#48111: tilde in Go package names (eg. sourcehut hosted packages)
Date: Sun, 04 Jul 2021 15:51:07 -0700 [thread overview]
Message-ID: <86czrxae1w.fsf@mgsn.dev> (raw)
In-Reply-To: <9ea8a08c75fc1a7b26f0380ba3a42161f3d5c570.camel@student.tugraz.at> (Leo Prikler's message of "Fri, 30 Apr 2021 11:53:40 +0200")
[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]
Hello,
Leo Prikler <leo.prikler@student.tugraz.at> writes:
> Am Donnerstag, den 29.04.2021, 19:54 +0200 schrieb raingloom:
>> Trying to import kineto and getting this error when building it:
>>
>> guix build: error: invalid character `~' in name
>> `go-git-sr-ht-~sircmpwn-kineto-0.0.0-20210225135222-edd4fe31f16f-
>> checkout.drv'
>>
>> I know the names are significant in go-build-system so I'm not sure
>> how
>> to work around the issue without breaking anything.
As far as I can tell, the go-build-system doesn't care about the actual
package names, just #:import-path and #:unpack-path. The names should
only be significant to the go importer insofar as
go-module->guix-package-name does not generate collisions.
> The way Go works, I would hazard a guess, that
> module git.sr.ht/~sircmpwn/kineto
> and
> module git.sr.ht/sircmpwn/kineto
> name two different modules. However, as the latter can't exist since
> sr.ht prefixes user names with ~, I think a name transformation, that
> maps the former to the latter should be safe. On the other hand, since
> this just affects store file names, we might instead want to map "~" to
> "-" in the general case of it appearing anywhere. WDYT?
It might be slightly uglier, but I think it's better to keep a
consistent policy of "replace any invalid characters with a hyphen", as
it is less likely to generate collisions and it provides a hint to the
reader that there *is* a character there.
I have attached a patch to do so below, verified that a recursive import
of the package mentioned above builds without modification (well, I had
to update a dependency...) and verified that there are not currently any
go packages using a tilde in their name with:
$ egrep -r '"go-[^"]*~[^"]*"' gnu/packages
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: import: go: Replace tildes with hyphens in package names. --]
[-- Type: text/x-patch, Size: 1451 bytes --]
From 2c942a06cf94acdca07f2a59736c89521953af0f Mon Sep 17 00:00:00 2001
Message-Id: <2c942a06cf94acdca07f2a59736c89521953af0f.1625436903.git.iskarian@mgsn.dev>
From: Sarah Morgensen <iskarian@mgsn.dev>
Date: Sun, 4 Jul 2021 15:00:15 -0700
Subject: [PATCH] import: go: Replace tildes with hyphens in package names.
Fixes <https://issues.guix.gnu.org/48111>.
* guix/import/go.scm (go-module->guix-package-name): Replace tildes with
hyphens.
---
guix/import/go.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/guix/import/go.scm b/guix/import/go.scm
index 5e23d6a2b3..d8f838f635 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -430,9 +430,9 @@ hence the need to derive this information."
(define* (go-module->guix-package-name module-path #:optional version)
"Converts a module's path to the canonical Guix format for Go packages.
Optionally include a VERSION string to append to the name."
- ;; Map dot, slash and underscore characters to hyphens.
+ ;; Map dot, slash, underscore and tilde characters to hyphens.
(let ((module-path* (string-map (lambda (c)
- (if (member c '(#\. #\/ #\_))
+ (if (member c '(#\. #\/ #\_ #\~))
#\-
c))
module-path)))
base-commit: 9e63bafafbe7a7c2d9804fae62302ac8a7e90090
--
2.31.1
[-- Attachment #3: Type: text/plain, Size: 10 bytes --]
--
Sarah
next prev parent reply other threads:[~2021-07-04 22:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 17:54 bug#48111: tilde in Go package names (eg. sourcehut hosted packages) raingloom
2021-04-30 9:53 ` Leo Prikler
2021-05-03 2:16 ` raingloom
2021-07-04 22:51 ` Sarah Morgensen via Bug reports for GNU Guix [this message]
2021-07-05 7:57 ` Leo Prikler
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=86czrxae1w.fsf@mgsn.dev \
--to=bug-guix@gnu.org \
--cc=48111@debbugs.gnu.org \
--cc=iskarian@mgsn.dev \
--cc=leo.prikler@student.tugraz.at \
--cc=raingloom@riseup.net \
/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).