setver.sh: rework buildid

Commit f1b0cc6 introduced buildid as a suffix after git tag to work around
the problem of rebuilding the package from the same git head (i.e.  same tag)
The other problem is, when we do something like "git commit --amend",
the tag changes but the release (the number after version) stays the same,
so setver.sh -U doesn't work, with rpm complaining about a newer package
version already installed.

The solution is to separate git revision (i.e. a number of commits since
the latest tag) from the git tag itself and only use revision to check
if we need to add buildid.

Modeled after commit 5415c32 in ploop.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed