amtoine / pkgbuilds

A collection of PKGBUILDs to install my configuration
GNU General Public License v3.0
2 stars 0 forks source link

Use the true version of the source repo as package version #1

Closed amtoine closed 2 years ago

amtoine commented 2 years ago

Until now, the version of the packages have been computed using the git version of the PKGBUILDs repo, i.e. by using the number of commits in the packaged branch of the source repo git rev-list --count HEAD and the HEAD's hash git rev-parse --short HEAD.

The consequence is that all the packages have the same version and that that version is the version of the pkgbuilds repo, not any of the version of the "true" source repos.

This commit proposes to replace the global version by one different version per package, automaticcaly.

IMPLEMENTATION DETAILS: The idea is to use the -C flag of git and define the repo name as a constant in the PKGBUILD, e.g. for the a2n-s-scripts package, the two following git diffs would have to be applied:

 arch=(x86_64)
-url="https://github.com/a2n-s/scripts.git"
+host="github.com"
+user="a2n-s"
+repo="scripts"
+url="https://$host/$user/$repo.git"
 license=('GNU')

and

 pkgver() {
      cd "${_pkgname}"
-     printf "5.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+     printf "1.0.r%s.%s" "$(git -C "$repo" rev-list --count HEAD)" "$(git -C "$repo" rev-parse --short HEAD)"
 }