Skip to content

Commit

Permalink
Sanitize RPM names further
Browse files Browse the repository at this point in the history
Both tilde and caret can show up in version numbers according to

  https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/

However, bazel doesn't like these symbols and reports that

  workspace names may contain only A-Z, a-z, 0-9, '-', '_' and '.'

Luckily we already have code in place that deals with colon and
plus, so we simply need to extend it.

Signed-off-by: Andrea Bolognani <[email protected]>
  • Loading branch information
andreabolognani committed Oct 18, 2022
1 parent 58fd7d2 commit e2e0fd8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/bazel/bazel.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,5 +308,7 @@ func (r *tar2Files) SetFiles(dirs []string, fileMap map[string][]string) {
func sanitize(name string) string {
name = strings.ReplaceAll(name, ":", "__")
name = strings.ReplaceAll(name, "+", "__plus__")
name = strings.ReplaceAll(name, "~", "__tilde__")
name = strings.ReplaceAll(name, "^", "__caret__")
return name
}

0 comments on commit e2e0fd8

Please sign in to comment.