[pacman-dev] [PATCH] doc: Document pkgver() function

William Giokas 1007380 at gmail.com
Tue Apr 23 03:15:44 EDT 2013


Originally from Jason St. John's patch, This is a much simplified
version explaining some basic functions the four vcs's makepkg supports
can use to get package version information.

Signed-off-by: William Giokas <1007380 at gmail.com>
---

I know that Allan didn't like this patch last time it was sent in, and
neither did I, but I think that this should be documented. I took out the
two terrible package versions for the git section, and cut it down to just
the commands used to actually print out the pkgver, not the whole 

    pkgver() {
        cd ...
        foo bar baz
    }

which makes a lot more sense and keeps things to a minimum.

 doc/PKGBUILD.5.txt | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index ea280a0..bb185ea 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -450,6 +450,41 @@ The source URL is divided into three components:
 
 	*svn*;;
 		revision
+*pkgver() Function*::
+	This function allows 'makepkg' to automatically update the package version of
+	a package using a script. This is meant to be used with VCS packages.
+	*Git*::
+		*Using git tags*;;
+			Example output: 1.5.1.g123defa
+
+			git describe --long | sed 's/-/./'
+
+		*Using the total number of commits (used when there are no tags)*;;
+			Example output: 0.r6283.g123defa
+
+			echo "0.r$(git rev-list --count HEAD).$(git log -1 --format="%h")"
+
+	*Subversion*::
+		Example output: 8546
+
+		svnversion | tr -d [A-z]
+
+	*Mercurial*::
+		Example output: 2813.75881cc5391e
+
+		hg identify -ni | awk 'BEGIN{OFS=".";} {print $2 $1}'
+
+	*Bazaar*::
+		Example output: 830
+
+		bzr revno
+
+	*Fallback*::
+		If no acceptable version information can be extracted from the
+		repository, use the current date.
+		Example output: 20130408
+
+		date +%Y%m%d
 
 Example
 -------
-- 
1.8.2.1.573.g118f60e



More information about the pacman-dev mailing list