Method: Pkg::Config.load_versioning

Defined in:
lib/packaging/config.rb

.load_versioningObject

Set all aspects of how the package will be versioned. Versioning

relies exclusively on the git describe of the project, which will
fail if either Pkg::Config.project_root is nil, isn't in a git repo,
or is in a git repo, but there are no tags in the repo, in which case
git-describe will fail.

It probably seems odd to load packaging-specific version
determinations, such as rpmversion here, at the top-level, and it is.
The reason for this that the creation of the most basic package
composition, the tarball, includes the generation of many different
packaging-specific files from templates in the source, and if faced
with loading rpmversion in the Tar object vs rpmversion in the
Config, I opt for the latter. It's basically a lose-lose, since it
really belongs in the Rpm object.


292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/packaging/config.rb', line 292

def load_versioning
  if @project_root and Pkg::Util::Git.describe
    @ref         = Pkg::Util::Git.sha_or_tag
    @short_ref   = Pkg::Util::Git.sha_or_tag(7)
    @version     = Pkg::Util::Version.dash_version
    @gemversion  = Pkg::Util::Version.dot_version
    @debversion  = Pkg::Util::Version.debversion
    @origversion = Pkg::Util::Version.origversion
    @rpmversion  = Pkg::Util::Version.rpmversion
    @rpmrelease  = Pkg::Util::Version.rpmrelease
  else
    puts "Skipping determination of version via git describe, Pkg::Config.project_root is not set to the path of a tagged git repo."
  end
end