jordansissel/fpm · warning
Package version '#{@version}' includes dashes, converting to
Error message
Package version '#{@version}' includes dashes, converting to underscores What it means
RPM's Version field must not contain dashes; rpmbuild rejects them. When the rpm output target sees a String version containing '-', it rewrites every dash to an underscore in place and logs this warning. The package still builds, but its version metadata differs from the string you passed.
Source
Thrown at lib/fpm/package/rpm.rb:640
end
end # def prefix
def build_sub_dir
return "BUILD"
#return File.join("BUILD", prefix)
end # def build_sub_dir
def summary
if !attributes[:rpm_summary]
return @description.split("\n").find { |line| !line.strip.empty? } || "_"
end
return attributes[:rpm_summary]
end # def summary
def version
if @version.kind_of?(String) and @version.include?("-")
logger.warn("Package version '#{@version}' includes dashes, converting" \
" to underscores")
@version = @version.gsub(/-/, "_")
end
return @version
end
# The default epoch value must be nil, see #381
def epoch
return @epoch if @epoch.is_a?(Numeric)
if @epoch.nil? or @epoch.empty?
return nil
end
return @epoch
end # def epoch
View on GitHub (pinned to b6d77ba72a)
Solutions
- Strip or replace dashes before invoking fpm: `VER=${VER//-/_}`
- Split semver prereleases the RPM way: `--version 1.2.3 --iteration 0.1.beta1`
- Derive the version from the tag only, e.g. `git describe --tags --abbrev=0`, not the full describe string
Example fix
# before fpm -s dir -t rpm -n app -v $(git describe --tags) . # after fpm -s dir -t rpm -n app -v $(git describe --tags --abbrev=0) --iteration $(git rev-list --count HEAD) .
Defensive patterns
Strategy: validation
Validate before calling
VER="${VER//-/_}"
if [[ "$VER" == *-* ]]; then
echo "version contains dashes after sanitize: $VER" >&2
exit 1
fi Type guard
def rpm_safe_version?(str)
str.is_a?(String) && !str.include?('-') && !str.empty?
end Prevention
- Use `git describe --tags --abbrev=0` (tag only) for --version, and put the commit count into --iteration
- Put semver prerelease suffixes in --iteration with underscores, per RPM convention
- Assert the published rpm's %{VERSION} matches the intended tag in CI
When it happens
Trigger: Building an rpm with `--version 1.2.3-beta.1`, or with `--version $(git describe --tags)` which yields '1.2.3-14-g0abc1' that then becomes '1.2.3_14_g0abc1'.
Common situations: CI pipelines feeding git describe or npm/python prerelease versions straight into fpm; downstream tools comparing versions mismatch because the published rpm carries underscores where the tag had dashes.
Related errors
- Package iteration '#{@iteration}' includes dashes, convertin
- #{program} failed (exit code #{exit_code}). Full command was
- The version looks invalid for Debian packages. Debian versio
- Unsupported version string '#{parse.call("Version")}'
- Converting dependency #{dep} to #{name} >= #{version}, #{nam
AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21).
Data as JSON: /api/errors/cacf4ebedb4df133.
Report an issue: GitHub.