diff --git a/tools/mk_deb_fpmdir b/tools/mk_deb_fpmdir index 5945925..d18164b 100755 --- a/tools/mk_deb_fpmdir +++ b/tools/mk_deb_fpmdir @@ -22,8 +22,16 @@ shift # Defaults that can be overridden: # All packages are 1.0 unless otherwise specifed: : ${PKGVERSION:=1.0} ; -# If there is no iteration setting, assume "1": -: ${PKGRELEASE:=1} +# If there is no iteration set, default to use the number of commits in the repository: +if [[ -z "${PKGRELEASE}" ]]; then + PKGRELEASE=$(git rev-list HEAD --count) + if [[ $? != 0 ]]; then + # We're not in a git repo, fall back to 1 so we cope with being built from + # a tarball + PKGRELEASE=1 + fi +fi + # If there is no epoch, assume 0 : ${PKGEPOCH:=0} diff --git a/tools/mk_rpm_fpmdir b/tools/mk_rpm_fpmdir index 4fbe5e4..98b04eb 100755 --- a/tools/mk_rpm_fpmdir +++ b/tools/mk_rpm_fpmdir @@ -22,8 +22,16 @@ shift # Defaults that can be overridden: # All packages are 1.0 unless otherwise specifed: : ${PKGVERSION:=1.0} ; -# If there is no iteration setting, assume "1": -: ${PKGRELEASE:=1} +# If there is no iteration set, default to use the number of commits in the repository: +if [[ -z "${PKGRELEASE}" ]]; then + PKGRELEASE=$(git rev-list HEAD --count) + if [[ $? != 0 ]]; then + # We're not in a git repo, fall back to 1 so we cope with being built from + # a tarball + PKGRELEASE=1 + fi +fi + # If there is no epoch, assume 0 : ${PKGEPOCH:=0}