summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--pkgrel.135
2 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 1003a77..d877394 100644
--- a/Makefile
+++ b/Makefile
@@ -15,9 +15,12 @@ install: pkgrel
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(MANDIR)
cp -f pkgrel $(DESTDIR)$(BINDIR)/pkgrel
+ cp -f pkgrel.1 $(DESTDIR)$(MANDIR)/pkgrel.1
chmod 755 $(DESTDIR)$(BINDIR)/pkgrel
+ chmod 644 $(DESTDIR)$(MANDIR)/pkgrel.1
uninstall:
rm -f $(DESTDIR)$(BINDIR)/pkgrel
+ rm -f $(DESTDIR)$(MANDIR)/pkgrel.1
.PHONY: all clean install uninstall
diff --git a/pkgrel.1 b/pkgrel.1
new file mode 100644
index 0000000..a292d83
--- /dev/null
+++ b/pkgrel.1
@@ -0,0 +1,35 @@
+.TH pkgrel 1 "2022-07-08"
+.SH NAME
+pkgrel \- print out pkgrel number according to git repository history
+.SH SYNOPSIS
+.SY pkgrel
+.YS
+.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.
+.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),\ makepkg (8),\ git (1)