#26 Remove tildes from goname
Merged a year ago by eclipseo. Opened 2 years ago by blowry.
blowry/go-rpm-macros master  into  master

file modified
+1 -1
@@ -47,7 +47,7 @@ 

      goname, i    = string.gsub(goname, "(%d)%.(%d)",           "%1:%2")

    until i == 0

    -- replace various separators rpm does not like with -

-   goname         = string.gsub(goname, "[%._/%-]+",            "-")

+   goname         = string.gsub(goname, "[%._/%-~]+",            "-")

    -- because of the Azure sdk

    goname         = string.gsub(goname, "%-for%-go%-",          "-")

    -- Tokenize along - separators and remove duplicates to avoid

Go modules are allowed to have tildes in their import paths, Fedora package names aren't.

This probably needs to be substituted with another character...

What character should it be changed to? My use-case for this is sourcehut urls like https://git.sr.ht/~sircmpwn/getopt, so goname will be set to something like "golang-sr-sircmpwn-getopt" instead of "golang-sr-~sircmpwn-getopt".

Also, are tildes really invalid in package names? I didn't think they were...

Do they trigger the special versioning (even though they're not in the version)?

They should not. If it's in the name field, it's like any other character, as far as I know. @pmatilai, @ffesti, or @ignatenkobrain would know for sure, though.

It would've taken anybody like 5s to test whether tilde is allowed in the name or not, certainly much less than speculating about its possible effect on version comparison and whatnot. Tilde, like many other special characters, is not allowed in package name. Name obviously cannot take part in version comparison.

~ should be replaced with "-" then. "-" is safe as intra-name separator.

That sounds good but then the modules hosted on sourcehut I'm trying to package would have two dashes in a row (golang-sr--sircmpwn-getopt). Is that allowed/a desirable outcome?

The split on line 60 should coalesce repeated separators.

rebased onto 2977f89

2 years ago

That will work but it’s better to add tilde to the generic forbidden separator cleanup rule:

-- replace various separators rpm does not like with -

rebased onto 4a12510

2 years ago

Pull-Request has been merged by eclipseo

a year ago