Skip to content

Commit b9ccc43

Browse files
author
linux_name2
committed
build: install man pages, add man/clean targets and CI check
1 parent 4a96d9b commit b9ccc43

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
- 'lib/**'
88
- 'extras/**'
99
- 'tests/**'
10+
- 'man/**'
1011
- '.github/workflows/ci.yml'
1112
pull_request:
1213
paths:
1314
- 'bin/**'
1415
- 'lib/**'
1516
- 'extras/**'
1617
- 'tests/**'
18+
- 'man/**'
1719
- '.github/workflows/ci.yml'
1820

1921
jobs:
@@ -25,6 +27,7 @@ jobs:
2527
shell: ${{ steps.filter.outputs.shell }}
2628
python: ${{ steps.filter.outputs.python }}
2729
integration: ${{ steps.filter.outputs.integration }}
30+
man: ${{ steps.filter.outputs.man }}
2831
steps:
2932
- uses: actions/checkout@v6
3033
with:
@@ -52,6 +55,9 @@ jobs:
5255
- 'etc/atomic.conf'
5356
- 'tests/test_integration.sh'
5457
- '.github/workflows/ci.yml'
58+
man:
59+
- 'man/*.md'
60+
- '.github/workflows/ci.yml'
5561
5662
shellcheck:
5763
needs: changes
@@ -103,3 +109,21 @@ jobs:
103109
steps:
104110
- uses: actions/checkout@v6
105111
- run: bash tests/test_integration.sh
112+
113+
man-check:
114+
needs: changes
115+
if: needs.changes.outputs.man == 'true'
116+
runs-on: ubuntu-latest
117+
steps:
118+
- uses: actions/checkout@v6
119+
- name: Install pandoc
120+
run: sudo apt-get update && sudo apt-get install -y pandoc
121+
- name: Regenerate man pages
122+
run: make man
123+
- name: Check groff files are up to date
124+
run: |
125+
if ! git diff --quiet man/; then
126+
echo "::error::Man pages are out of date. Run 'make man' and commit the results."
127+
git diff man/
128+
exit 1
129+
fi

‎Makefile‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: install uninstall reinstall install-conf
1+
.PHONY: install uninstall reinstall install-conf man clean
22

33
PREFIX = /usr
44
SYSCONFDIR = /etc
@@ -8,11 +8,26 @@ pkgname = atomic-upgrade
88
BINDIR = $(PREFIX)/bin
99
LIBDIR = $(PREFIX)/lib/atomic
1010
SHAREDIR = $(PREFIX)/share
11+
MANDIR = $(SHAREDIR)/man
1112
ZSH_COMPDIR = $(SHAREDIR)/zsh/site-functions
1213
BASH_COMPDIR = $(SHAREDIR)/bash-completion/completions
1314
HOOKSDIR = $(SHAREDIR)/libalpm/hooks
1415
LICENSEDIR = $(SHAREDIR)/licenses/$(pkgname)
1516

17+
MANPAGES = man/atomic-upgrade.8 man/atomic-gc.8 man/atomic.conf.5
18+
19+
# Generate groff from markdown (requires pandoc, run locally)
20+
man: $(MANPAGES)
21+
22+
man/%.8: man/%.8.md
23+
pandoc -s -t man -o $@ $<
24+
25+
man/%.5: man/%.5.md
26+
pandoc -s -t man -o $@ $<
27+
28+
clean:
29+
rm -f $(MANPAGES)
30+
1631
install:
1732
install -Dm755 bin/atomic-upgrade $(DESTDIR)$(BINDIR)/atomic-upgrade
1833
install -Dm755 bin/atomic-gc $(DESTDIR)$(BINDIR)/atomic-gc
@@ -37,6 +52,10 @@ install:
3752

3853
install -Dm755 extras/pacman-wrapper $(DESTDIR)$(PREFIX)/local/bin/pacman
3954

55+
install -Dm644 man/atomic-upgrade.8 $(DESTDIR)$(MANDIR)/man8/atomic-upgrade.8
56+
install -Dm644 man/atomic-gc.8 $(DESTDIR)$(MANDIR)/man8/atomic-gc.8
57+
install -Dm644 man/atomic.conf.5 $(DESTDIR)$(MANDIR)/man5/atomic.conf.5
58+
4059
install -Dm644 LICENSE $(DESTDIR)$(LICENSEDIR)/LICENSE
4160

4261
@if [ ! -f "$(DESTDIR)$(SYSCONFDIR)/atomic.conf" ]; then \
@@ -58,6 +77,9 @@ uninstall:
5877
rm -f $(DESTDIR)$(BASH_COMPDIR)/atomic-rebuild-uki
5978
rm -f $(DESTDIR)$(HOOKSDIR)/00-block-direct-upgrade.hook
6079
rm -f $(DESTDIR)$(PREFIX)/local/bin/pacman
80+
rm -f $(DESTDIR)$(MANDIR)/man8/atomic-upgrade.8
81+
rm -f $(DESTDIR)$(MANDIR)/man8/atomic-gc.8
82+
rm -f $(DESTDIR)$(MANDIR)/man5/atomic.conf.5
6183
rm -rf $(DESTDIR)$(LICENSEDIR)/
6284
@echo "Note: $(SYSCONFDIR)/atomic.conf preserved. Remove manually if needed."
6385

0 commit comments

Comments
 (0)