• Stars
    star
    181
  • Rank 212,110 (Top 5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

debiman generates a static manpage HTML repository out of a Debian archive

debiman

Actions workflow Go Report Card

debiman logo

Goals

debiman makes (Debian) manpages accessible in a web browser. Its goals are, in order:

  1. completeness: all manpages in Debian should be available.
  2. visually appealing and convenient: reading manpages should be fun, convenience features (e.g. permalinks, URL redirects, easy navigation) should be available
  3. speed: manpages should be quick to load, new manpages should be quickly ingested, the program should run quickly for pleasant development

Currently, there is one known bug with regards to completeness (#12).

With regards to speed, debiman can process all manpages of Debian unstable in less than 10 minutes on a modern machine. Incremental updates complete in less than 15 seconds. For more details, see PERFORMANCE.md.

Prerequisites

  • mandoc
  • a local or remote Debian mirror or an apt-cacher-ng running on localhost:3142
  • a number of Go packages (which go get will automatically get for you, see below)
    • pault.ag/go/debian
    • pault.ag/go/archive
    • github.com/golang/protobuf/proto
    • golang.org/x/crypto/openpgp
    • golang.org/x/net/html
    • golang.org/x/sync/errgroup
    • golang.org/x/text

Architecture overview

debiman works in 4 stages:

  1. All Debian packages of all architectures of the specified suites are discovered. The following optimizations are used to reduce the number of packages, and hence the input size/required bandwidth:
    1. packages which do not own any files in /usr/share/man (as per the Contents- archive files) are skipped.
    2. each package is downloaded only for 1 of its architectures, as manpages are architecture-independent.
  2. Man pages and auxiliary files (e.g. content fragment files which are included by a number of manpages) are extracted from the identified Debian packages.
  3. All man pages are rendered into an HTML representation using mandoc(1).
  4. An index file for debiman-auxserver (which serves redirects) is written.

Each stage runs concurrently (e.g. Contents and Packages files are inspected concurrently), but only one stage runs at a time, e.g. extraction needs to complete before rendering can start.

Development quick start

Set up Go

Install the latest supported version of Go from https://go.dev/dl. If you prefer to install Go from Debian, ensure you get the same version — if you use Debian stable, you likely need to install from backports.

Install debiman

To download, compile and install debiman to ~/go/bin, run:

go install github.com/Debian/debiman/cmd/...@main

Run debiman

To synchronize Debian testing to ~/man and render a handful of packages, run:

~/go/bin/debiman -serving_dir=~/man -only_render_pkgs=qelectrotech,i3-wm,cron

Test the output

To serve manpages from ~/man on localhost:8089, run:

~/go/bin/debiman-minisrv -serving_dir=~/man

Note that for a production setup, you should not use debiman-minisrv. Instead, refer to the web server example configuration files in example/.

Recompile debiman

To update your debiman installation after making changes to the HTML templates or code in your debiman git working directory, run:

go generate github.com/Debian/debiman/...
go install github.com/Debian/debiman/cmd/...

Synchronizing

For https://manpages.debian.org, we run:

flock /srv/manpages.debian.org/debiman/exclusive.lock \
nice -n 5 \
ionice -n 7 \
debiman \
  -sync_codenames=oldstable,oldstable-backports,stable,stable-backports \
  -sync_suites=testing,unstable,experimental \
  -serving_dir=/srv/manpages.debian.org/www \
  -local_mirror=/srv/mirrors/debian

…resulting in the directories wheezy/, wheezy-backports/, jessie/, jessie-backports/, testing/, unstable/ and experimental/ (respectively).

Note that you will NOT need to change this command line when a new version of Debian is released.

When interrupted, you can just run debiman again with the same options. It will resume where it left off.

If for some reason you notice corruption or other mistakes in some manpages, just delete the directory in which they are placed, then re-run debiman to download and re-process these pages from scratch.

It is safe to run debiman while you are serving from -serving_dir. debiman will swap files atomically using rename(2).

Customization

You can copy the assets/ directory, modify its contents and start debiman with -inject_assets pointed to your directory. Any files whose name does not end in .tmpl are treated as static files and will be placed in -serving_dir (compressed and uncompressed).

There are a few requirements for the templates, so that debiman can re-use rendered manpages (for symlinked manpages):

  1. In assets/manpage.tmpl and assets/manpageerror.tmpl, the string <a class="toclink" is used to find table of content links.
  2. </div>\n</div>\n<div id="footer"> is used to delimit the mandoc output from the rest of the page.

interesting test cases

crontab(5) is present in multiple Debian versions, multiple languages, multiple sections and multiple conflicting packages. Hence, it showcases all debiman features.

w3m(1) has a Japanese translation which is only present in UTF-8 starting with Debian jessie. It also has a German translation starting with Debian stretch.

qelectrotech(1) has a French translation in 3 different encodings (none specified, ISO8859-1, UTF-8).

mysqld(8) is present in two conflicting packages: mariadb-server-core-10.0 and mysql-server-core-5.6.

recommended reading

https://wiki.debian.org/RepositoryFormat

URLs

The URL schema which debiman uses is (<suite>/)(<binarypkg/>)<name>(.<section>(.<lang>)). Any part aside from name can be omitted; here are a few examples:

Without suite and binary package:

  1. https://manpages.debian.org/i3
  2. https://manpages.debian.org/i3.fr
  3. https://manpages.debian.org/i3.1
  4. https://manpages.debian.org/i3.1.fr

With binary package:

  1. https://manpages.debian.org/i3-wm/i3
  2. https://manpages.debian.org/i3-wm/i3.fr
  3. https://manpages.debian.org/i3-wm/i3.1
  4. https://manpages.debian.org/i3-wm/i3.1.fr

With suite:

  1. https://manpages.debian.org/testing/i3
  2. https://manpages.debian.org/testing/i3.fr
  3. https://manpages.debian.org/testing/i3.1
  4. https://manpages.debian.org/testing/i3.1.fr

With suite and binary package:

  1. https://manpages.debian.org/testing/i3-wm/i3
  2. https://manpages.debian.org/testing/i3-wm/i3.fr
  3. https://manpages.debian.org/testing/i3-wm/i3.1
  4. https://manpages.debian.org/testing/i3-wm/i3.1.fr

More Repositories

1

apt

Mirror of the apt git repository - This is just a mirror of the upstream repository, please submit pull requests there: https://salsa.debian.org/apt-team/apt
C++
533
star
2

dh-make-golang

Automatically creates Debian packaging for Go packages
Go
368
star
3

dcs

Debian Code Search (codesearch.debian.net) is a search engine that searches through all the 130 GB of open source software that is included in Debian. Supports regular expressions!
Go
194
star
4

raspi3-image-spec

contains the files to build the https://wiki.debian.org/RaspberryPi3 image
127
star
5

.github

Description of the purpose for this GitHub organization
74
star
6

debhelper

Perl
39
star
7

devscripts

Mirror of https://salsa.debian.org/debian/devscripts.git
Perl
31
star
8

ratt

Rebuild All The Things!
Go
30
star
9

debsources

Mirrored from https://salsa.debian.org/qa/debsources
Python
22
star
10

pk4

make available the Debian source package producing the specified package
Go
21
star
11

mergebot

Minimize the number of steps required to accept contributions for Debian packages you maintain.
Go
17
star
12

dak

[MIRROR] - send patches to https://salsa.debian.org/ftp-team/dak
Python
16
star
13

dput-ng

[MIRROR] - do not open PRs here
Python
14
star
14

tensorflow

C++
11
star
15

debile

[MIRROR] - actually hosted @ git.d.o
Python
10
star
16

java-package

Utility for creating Java Debian packages (mirrored from git.debian.org)
Shell
9
star
17

britney2

Python
8
star
18

openjdk-8

OpenJDK 8 packaging for Debian (mirrored from git.debian.org)
7
star
19

pkg-go-tools

tools (implemented in Go) for the pkg-go Debian packaging team
Go
6
star
20

docker.io

Debian Docker packaging
6
star
21

kfreebsd-11

6
star
22

ud

a reimplementation of Debian's userdir-ldap, leveraging the Django framework
Python
4
star
23

intel-mkl

[Mirror] https://salsa.debian.org/science-team/intel-mkl
3
star
24

freebsd-utils

3
star
25

spdx-licenses

Packaging data for spdx-licenses
3
star
26

pytorch

PyTorch Debian Packaging (Mirrored from Salsa)
C++
2
star
27

freebsd-buildutils

2
star
28

rsnapshot

Debian packaging for rsnapshot
2
star
29

kfreebsd-10

2
star
30

freebsd-libs

2
star
31

ctfutils

2
star
32

xserver-xorg-video-nv

2
star
33

ufsutils

2
star
34

firewoes

[MIRROR ONLY] - real repo at git://git.upsilon.cc/firewose.git
Python
2
star
35

cdbs

Read only mirror of https://alioth.debian.org/anonscm/git/collab-maint/cdbs.git
Shell
2
star
36

zfsutils

1
star
37

cuse4bsd

1
star
38

kfreebsd-downloader-10

1
star
39

freebsd-manpages

1
star
40

istgt

1
star
41

freebsd-glue

C
1
star
42

fuse4bsd

1
star
43

kfreebsd-defaults

1
star
44

kfreebsd-kernel-headers

C
1
star
45

freebsd-quota

1
star
46

freebsd-smbfs

1
star