From f49116131f10ac04bb7d5f51609b59305500c244 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 8 Jul 2022 17:51:20 +0200 Subject: Written a manual page --- Makefile | 3 +++ pkgrel.1 | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 pkgrel.1 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) -- cgit v1.1