Skip to content

Commit 99a4565

Browse files
authored
Merge pull request #76 from ByteInternet/build_manpage
Add bin/build_manpage for building docs as man page
2 parents 7713da2 + d6336ab commit 99a4565

File tree

11 files changed

+252
-0
lines changed

11 files changed

+252
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,48 @@ Then deploy to your local Hypernode Docker:
6666
docker run --rm -it --env SSH_PRIVATE_KEY="$(cat ~/.ssh/yourdeploykey | base64)" -v ${PWD}:/build quay.io/hypernode/deploy:latest hypernode-deploy build -vvv # First build the artifact
6767
docker run --rm -it --env SSH_PRIVATE_KEY="$(cat ~/.ssh/yourdeploykey | base64)" -v ${PWD}:/build quay.io/hypernode/deploy:latest hypernode-deploy deploy docker -vvv # Then perform the deploy
6868
```
69+
70+
## Building the manpage deb
71+
72+
The docs are also packaged as a debian package named `hndocsnext` so that on a Hypernode you can run `man hypernode` (or `hypernode-manual`) and page through a `manpage` version of the Hypernode docs. To build that debian package on a Debian machine you can run these commands:
73+
```
74+
# First create the cow environment
75+
export ARCH=amd64
76+
export DIST=buster
77+
apt-get install debhelper cowbuilder git-buildpackage
78+
cowbuilder --create --distribution buster --architecture amd64 --basepath /var/cache/pbuilder/base-$DIST-amd64.cow --mirror http://ftp.debian.org/debian/ --components=main
79+
80+
# We need to make sure our build process can use networking in order to pip install the requirements
81+
echo "USENETWORK=yes" > ~/.pbuilderrc
82+
83+
# Then clone the repository and build the .deb
84+
git clone https://github.com/ByteInternet/hypernode-docs-next
85+
cd hypernode-docs-next
86+
gbp buildpackage --git-pbuilder --git-dist=$DIST --git-arch=$ARCH --git-ignore-branch -us -uc -sa --git-ignore-new
87+
```
88+
89+
Then after building the Deb you could install it with dpkg. For example:
90+
```
91+
dpkg -i ../hndocsnext_20230121.173551_all.deb
92+
```
93+
94+
And test it out with:
95+
```
96+
man hypernode
97+
```
98+
99+
To inspect the contents of the deb archive you can run:
100+
```
101+
# dpkg -L hndocsnext
102+
/.
103+
/usr
104+
/usr/local
105+
/usr/local/man
106+
/usr/local/man/man3
107+
/usr/local/man/man3/hypernode.3
108+
/usr/share
109+
/usr/share/doc
110+
/usr/share/doc/hndocsnext
111+
/usr/share/doc/hndocsnext/README.md
112+
/usr/share/doc/hndocsnext/changelog.gz
113+
```

bin/build_manpage

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
pushd docs
6+
make man
7+
echo "manpage located at $(realpath _build/man/docs.1)"
8+
popd

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
hndocsnext (20230121.173551) UNRELEASED; urgency=medium
2+
3+
[ Rick van de Loo ]
4+
* Initial packaging
5+
6+
-- Rick van de Loo <vdloo@desktop> Sat, 21 Jan 2023 17:35:51 +0200

debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

debian/control

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Source: hndocsnext
2+
Priority: optional
3+
Maintainer: Hypernode Tech Team <support@hypernode.com>
4+
Build-Depends: debhelper (>= 9), python3, python3-venv, python3-dev
5+
Standards-Version: 3.9.4
6+
Homepage: https://github.com/ByteInternet/hypernode-docs-next
7+
Vcs-Git: git@github.com:ByteInternet/hypernode-docs-next.git
8+
9+
Package: hndocsnext
10+
Section: doc
11+
Architecture: all
12+
Depends: ${misc:Depends}
13+
Description: Hypernode docs in manpage form. Run 'man hypernode'.

debian/docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md

debian/hndocsnext.install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.debian.org/doc/manuals/maint-guide/dother.en.html#install
2+
3+
docs/_build/man/hypernode.3 /usr/local/man/man3/

debian/hndocsnext.postinst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
set -e
3+
mandb

debian/rules

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/make -f
2+
# -*- makefile -*-
3+
4+
# Uncomment this to turn on verbose mode.
5+
#export DH_VERBOSE=1
6+
.PHONY: build
7+
8+
build:
9+
python3 -m venv venv
10+
venv/bin/pip install -r requirements/development.txt
11+
bash -c 'source venv/bin/activate; bin/build_manpage'
12+
mv docs/_build/man/docs.1 docs/_build/man/hypernode.3
13+
14+
override_dh_usrlocal:
15+
16+
%:
17+
dh $@

debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

0 commit comments

Comments
 (0)