def rpm_safe(string)
      string = "\"#{string}\"" if string[/\s/]

      string.dup
        .gsub("[", "[\\[]")
        .gsub("*", "[*]")
        .gsub("?", "[?]")
        .gsub("%", "[%]")
    end
def rpm_safe(string)
      string = "\"#{string}\"" if string[/\s/]

      string.dup
        .gsub("[", "[\\[]")
        .gsub("*", "[*]")
        .gsub("?", "[?]")
        .gsub("%", "[%]")
    end
Generate an RPM-safe name from the given string, doing the following:

 - Replace [ with [\[] to make rpm not use globs
 - Replace * with [*] to make rpm not use globs
 - Replace ? with [?] to make rpm not use globs
 - Replace % with [%] to make rpm not expand macros

 @param [String] string
   the string to sanitize