{"record":{"id":"2c5207612af3d995","repo":"jordansissel/fpm","slug":"package-iteration-iteration-includes-dashes","errorCode":null,"errorMessage":"Package iteration '#{@iteration}' includes dashes, converting to underscores. rpmbuild does not allow the dashes in the package iteration (called 'Release' in rpm)","messagePattern":"Package iteration '#(.+?)' includes dashes, converting to underscores\\. rpmbuild does not allow the dashes in the package iteration \\(called 'Release' in rpm\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/fpm/package/rpm.rb","lineNumber":277,"sourceCode":"        return %x{uname -m}.chomp   # default to current arch\n      when \"amd64\" # debian and redhat disagree on architecture names\n        return \"x86_64\"\n      when \"arm64\" # debian and redhat disagree on architecture names\n        return \"aarch64\"\n      when \"native\"\n        return %x{uname -m}.chomp   # 'native' is current arch\n      when \"all\"\n        # Translate fpm \"all\" arch to what it means in RPM.\n        return \"noarch\"\n      else\n        return @architecture\n    end\n  end # def architecture\n\n  # This method ensures a default value for iteration if none is provided.\n  def iteration\n    if @iteration.kind_of?(String) and @iteration.include?(\"-\")\n      logger.warn(\"Package iteration '#{@iteration}' includes dashes, converting\" \\\n                   \" to underscores. rpmbuild does not allow the dashes in the package iteration (called 'Release' in rpm)\")\n      @iteration = @iteration.gsub(/-/, \"_\")\n    end\n\n    return @iteration ? @iteration : 1\n  end # def iteration\n\n  # Generate a generic changelog or return an existing definition\n  def changelog\n    if attributes[:rpm_changelog]\n      return attributes[:rpm_changelog]\n    end\n\n    reldate = if attributes[:source_date_epoch].nil?\n                Time.now()\n              else\n                Time.at(attributes[:source_date_epoch].to_i)\n              end","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/rpm.rb#L259-L295","documentation":"RPM's Release field — fpm calls it the package 'iteration' — must not contain dashes; rpmbuild rejects them. When the rpm output target sees a String iteration containing '-', it rewrites every dash to an underscore in place, logs this warning, and continues. Later reads see the already-rewritten value, so the conversion happens once.","triggerScenarios":"Building an rpm with `--iteration 2.1-beta` or with an iteration computed by a source plugin that embeds dashes (branch names, prerelease markers joined with '-').","commonSituations":"Build scripts deriving iteration from git branches or tags; reusing semver prerelease strings like 'beta-1' as the iteration; downstream rpm repos then display the underscore variant, confusing version comparisons.","solutions":["Pass an iteration without dashes, e.g. `--iteration 2.1_beta` or `--iteration 0.1.beta1`","Sanitize the value yourself before fpm sees it: `ITER=${ITER//-/_}` so the silent rewrite cannot surprise you","Keep prerelease identifiers out of --version too; move them into the iteration with underscore separators (RPM convention)"],"exampleFix":"# before\nfpm -s dir -t rpm -n app -v 1.2.3 --iteration 2.1-beta .\n\n# after\nfpm -s dir -t rpm -n app -v 1.2.3 --iteration 2.1_beta .","handlingStrategy":"validation","validationCode":"# Sanitize and hard-fail on dashes before fpm rewrites them silently\nITER=\"${ITER//-/_}\"\nif [[ \"$ITER\" == *-* ]]; then\n  echo \"iteration still contains dashes: $ITER\" >&2\n  exit 1\nfi","typeGuard":"def rpm_safe_field?(str)\n  str.is_a?(String) && !str.include?('-')\nend","tryCatchPattern":null,"preventionTips":["Never feed raw git describe output into --iteration or --version for rpm targets","Centralize version/iteration computation in one script that sanitizes dashes","Verify built rpms with `rpm -qp --qf '%{Release}\\n' pkg.rpm` to catch silent rewrites"],"tags":["rpm","iteration","release-field","rpmbuild","sanitization"],"backgroundTag":"invalid-rpm-metadata","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}