.TH pkgrel 1 "2024-01-06" .SH NAME pkgrel - print out pkgrel number according to git repository history .SH SYNOPSIS .B pkgrel .RI [ prefix ] .br .B pkgrel .RB [ \-\- ] .B \-d .SH DESCRIPTION This program will check the history of the .I PKGBUILD file from the current working directory and print out the expected distribution release number. .PP The pkgrel is guessed based on the state of the working directory, index, and history starting from head and going back until the end of history. The pkgrel starts at 1. If pkgver is changed, the currently stored pkgrel is printed to standard output and the program exits. If the working directory, index or a commit contains any other changes that are not affecting pkgver value, then pkgrel is incremented and the program continues. .PP .I Prefix and .B \-d allow to specify text that will be prepended to the output. With .I prefix as argument user can prepend any value before the regular output. .B \-d option sets .I prefix to a handy constant .BR pkgrel= making the final output take a form of a shell variable assignment. Special option .B \-\- allows to use literal .B \-d as .IR prefix . .SH EXIT STATUS 0 will be returned on successful run and the pkgrel number will be printed to standard output. .PP 1 will be returned otherwise. This can happen when the current directory is not tracked as part of any git repository, if an error occurred when accessing the repository, or if .I PKGBUILD file does not exist in the current working directory or history of the repository. .SH ENVIRONMENT This program may use environment variables that are related to a git repository configuration. See .B The Git Repository subsection in .B ENVIRONMENT VARIABLES of .BR git (1). .SH NOTES This program was implemented as a result of a simple experiment to see if it would be possible to avoid managing the pkgrel inside the git repository. The reason to avoid it was to disconnect meta information related to versioning from the content of the version-controlled files. .SH SEE ALSO .BR PKGBUILD (5), .BR makepkg (8), .BR git (1)