Essential fact.sh functions git_lasthash() and semver() have been updated
so that they explicitly depend on git or fail, ie. forget about the cache.
Previously git_lasthash() would try to use cache or fail, while semver()
would try to use cache or rely on mkit.ini, which in turn had to be hacked
by dist() in order to make git-less targets expand version correctly
(with build data, eg. `0.1.2+ge1f4a77.dirty`).
The old code was guilty of four sins: inconsistency (git_lasthash()
vs. semver()), side effects (semver() would actually write cache),
hidden dependencies (both actually relied on functions from mkit.sh)
and unnecessary complexity (speculative $version use in semver()).
New code remediates all of these by making both functions just do their
job (ie. get data from VCS). Places that did benefit from the silent
caching are served by __cached() function created for this purpose.
Remove obsolete build_manpages target and markdown type
They're based on obsolete mkit.ini structure and is not used in any known
project. That said, at least build_manpages will be added in future,
most probably in form of plugin, once plugin structure is figured out.
(Stay tuned, but don't hold your breath!)
Decouple variable declarations so that each can have docstring.
In case of _relck() we also rename variable $relsrc to a more
context-specific term $oracle.
Merge sections lists, debstuff and rpmstuff to dist
They are all about "distribution", rpmstuff and debstuff have basically
just one item, and having "lists" section was ugly and meaningless in
the first place.
It's easier to do quoting at least mediocre-right in sed than in perl;
eg. with Perl, even e-mail address was causing quoting breakage due to
the at sign.
Provide last_hash value as __MKIT_PROJ_GIT_LASTHASH__ token
Note that similar to __MKIT_PROJ_VERSION__, this value cannot be
reliably determined when outside git (e.g. distributor's build dir),
therefore must be kept inside dist source package.
Unlike version, though, user (ie. app developer, ie. mkit.ini
maintainer) most probably does not want to edit it, therefore we're
normally keeping it out of sight.
The value itself is normally just the last git commit's hash (SHA1 these
days), suffixed with ".dirty" mark if there were uncommitted changes
during build. (Just the same as we do with semver())
If we're outside git and the hash could not be determined, that either
means the source package was mangled with or was built with older
version of mkit. In either case, the value provided will be 'UNKNOWN'.
Some parts got a bit confusing over time, also there was repetition.
In this commit:
* the release fact gathering routines have been moved to separate
module,
* some less useful routines have been removed,
* some internal interfaces have been changed to allow for more
readable code.
Fix lasttag expression to get "latest tag *so far*"
Turns out that the old version has always shown the last tag available
instead of last tag available *so far*, i.e. up to the current HEAD.
This made it impossible to determine version correctly when an older
version was checked out, i.e. installing or packaging an older version
would result in broken versioning.