Skip to content

Commit 8b58d19

Browse files
committed
Bump version to 1.19.0
2 parents e72241c + e6b1ef8 commit 8b58d19

File tree

4 files changed

+53
-31
lines changed

4 files changed

+53
-31
lines changed

CHANGELOG

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
CHANGELOG
22
`````````
3+
Version 1.19.0 -- 2022-01-24
4+
----------------------------
5+
6+
- Change man page extension from .roff to its chapter.
7+
8+
This commit is in preparation for Litani to be installed on users'
9+
systems, where the man pages need to be installed in the correct
10+
location and have the correct prefix in order for the man program to
11+
find them.
12+
13+
- Inform user that jobs must be added in order for Litani to run a build
14+
315

416
Version 1.18.0 -- 2022-01-24
517
----------------------------
18+
619
- Add new transform-jobs command
720
- Add --fast option to Litani test suite
821
- Add --output-dir flag to Litani test suite

doc/bin/build-html-doc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_args():
3333
"required": True,
3434
"type": pathlib.Path,
3535
}, {
36-
"flags": ["--roff-html-dir"],
36+
"flags": ["--man-html-dir"],
3737
"required": True,
3838
"type": pathlib.Path,
3939
}, {
@@ -50,12 +50,12 @@ def get_args():
5050
return pars.parse_args()
5151

5252

53-
def get_manual(man, roff_html_dir):
53+
def get_manual(man, man_html_dir):
5454
record = {
5555
"title": re.sub("litani-", "litani ", man.stem),
5656
"anchor": man.stem,
5757
"body": [],
58-
"chapter": get_chapter(roff_html_dir / man.name),
58+
"chapter": get_chapter(man_html_dir / man.name),
5959
}
6060
with open(man) as handle:
6161
for line in handle:
@@ -70,14 +70,14 @@ def get_chapter(man_html):
7070
if m:
7171
return int(m["chap"])
7272
raise UserWarning(
73-
f"No line of roff html output '{man_html}' matched chapter pattern "
73+
f"No line of man html output '{man_html}' matched chapter pattern "
7474
f"'{CHAPTER_PAT_STR}'")
7575

7676

77-
def get_manuals(html_manuals, roff_html_dir):
77+
def get_manuals(html_manuals, man_html_dir):
7878
ret = []
7979
for man in html_manuals:
80-
ret.append(get_manual(man, roff_html_dir))
80+
ret.append(get_manual(man, man_html_dir))
8181
return ret
8282

8383

@@ -88,7 +88,7 @@ def main():
8888
autoescape=jinja2.select_autoescape(
8989
enabled_extensions=('html'),
9090
default_for_string=True))
91-
manuals = get_manuals(args.html_manuals, args.roff_html_dir)
91+
manuals = get_manuals(args.html_manuals, args.man_html_dir)
9292

9393
templ = env.get_template("index.jinja.html")
9494
page = templ.render(manuals=manuals)

doc/configure

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import sys
1818
import pathlib
1919

20-
import jinja2
21-
2220

2321
DOC_DIR = pathlib.Path(sys.path[0]).resolve()
2422
sys.path.insert(1, str(DOC_DIR.parent))
@@ -36,19 +34,19 @@ SRC_DIR = DOC_DIR / "src"
3634
TEMPLATE_DIR = DOC_DIR / "templates"
3735
TMP_DIR = DOC_DIR / "tmp"
3836

39-
ROFF_DIR = OUT_DIR / "man"
37+
MAN_DIR = OUT_DIR / "man"
4038

41-
HTML_MAN_SRC_DIR = TMP_DIR / "roff_to_html"
39+
HTML_MAN_SRC_DIR = TMP_DIR / "man_to_html"
4240
HTML_UNIQUE_DIR = TMP_DIR / "html_unique"
4341

4442

4543
RULES = [{
46-
"name": "sc_to_roff",
47-
"description": "converting ${man-name} to roff",
44+
"name": "sc_to_man",
45+
"description": "converting ${man-name} to man",
4846
"command": "scdoc < ${in} > ${out}"
4947
}, {
50-
"name": "voluptuous_to_roff",
51-
"description": "converting ${man-name} to roff",
48+
"name": "voluptuous_to_man",
49+
"description": "converting ${man-name} to man",
5250
"command": f"{BIN_DIR / 'schema-to-scdoc'}"
5351
f" --project-root { DOC_DIR.parent }"
5452
" --page-name ${man-name}"
@@ -57,8 +55,8 @@ RULES = [{
5755
f" { TEMPLATE_DIR / 'voluptuous-man.jinja.scdoc' }"
5856
" | scdoc > ${out}"
5957
}, {
60-
"name": "roff_to_html",
61-
"description": "converting ${man-name}.roff HTML",
58+
"name": "man_to_html",
59+
"description": "converting ${man-name} HTML",
6260
"command": "mandoc -O fragment -Thtml < ${in} > ${out}"
6361
}, {
6462
"name": "uniquify_header_ids",
@@ -79,7 +77,7 @@ RULES = [{
7977
" --html-manuals ${html-mans}"
8078
f" --template-dir {TEMPLATE_DIR}"
8179
" --out-file ${out}"
82-
" --roff-html-dir ${roff-html-dir}"
80+
" --man-html-dir ${man-html-dir}"
8381
}]
8482

8583

@@ -97,12 +95,12 @@ def make_html_unique(man, html_man, html_mans, builds):
9795
html_mans.append(html_unique)
9896

9997

100-
def roff_to_html(man, roff_out, builds):
98+
def man_to_html(man, man_out, builds):
10199
html_man = HTML_MAN_SRC_DIR / f"{man.stem}.html"
102100
builds.append({
103-
"inputs": [roff_out],
101+
"inputs": [man_out],
104102
"outputs": [html_man],
105-
"rule": "roff_to_html",
103+
"rule": "man_to_html",
106104
"variables": {
107105
"man-name": man.stem,
108106
"in-file": html_man,
@@ -111,30 +109,36 @@ def roff_to_html(man, roff_out, builds):
111109
return html_man
112110

113111

114-
def convert_man_dir_to_roff(src_dir, dst_dir, rule, html_mans, builds):
112+
def convert_man_dir_to_man(src_dir, dst_dir, rule, html_mans, builds):
115113
for man in (src_dir).iterdir():
116-
roff_out = dst_dir / f"{man.stem}.roff"
114+
if man.suffix == ".scdoc":
115+
with open(man) as fp:
116+
line = fp.readline().rstrip()
117+
index = line[line.find('(')+1:line.find(')')]
118+
man_out = dst_dir / f"{man.stem}.{index}"
119+
else:
120+
man_out = dst_dir / f"{man.stem}.5"
117121
builds.append({
118122
"inputs": [man],
119-
"outputs": [roff_out],
123+
"outputs": [man_out],
120124
"rule": rule,
121125
"variables": {
122126
"man-name": man.stem,
123127
"data-path": man.resolve(),
124128
}
125129
})
126-
html_man = roff_to_html(man, roff_out, builds)
130+
html_man = man_to_html(man, man_out, builds)
127131
make_html_unique(man, html_man, html_mans, builds)
128132

129133

130134
def main():
131135
builds = []
132136
html_mans = []
133137

134-
convert_man_dir_to_roff(
135-
SRC_DIR / "man", ROFF_DIR, "sc_to_roff", html_mans, builds)
136-
convert_man_dir_to_roff(
137-
SRC_DIR / "voluptuous-man", ROFF_DIR, "voluptuous_to_roff", html_mans,
138+
convert_man_dir_to_man(
139+
SRC_DIR / "man", MAN_DIR, "sc_to_man", html_mans, builds)
140+
convert_man_dir_to_man(
141+
SRC_DIR / "voluptuous-man", MAN_DIR, "voluptuous_to_man", html_mans,
138142
builds)
139143

140144
builds.append({
@@ -146,7 +150,7 @@ def main():
146150
"rule": "build_html_doc",
147151
"variables": {
148152
"html-mans": " ".join([str(h) for h in html_mans]),
149-
"roff-html-dir": HTML_MAN_SRC_DIR,
153+
"man-html-dir": HTML_MAN_SRC_DIR,
150154
}
151155
})
152156

lib/litani.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
TIME_FORMAT_W = "%Y-%m-%dT%H:%M:%SZ"
3434
TIME_FORMAT_MS = "%Y-%m-%dT%H:%M:%S.%fZ"
3535
VERSION_MAJOR = 1
36-
VERSION_MINOR = 18
36+
VERSION_MINOR = 19
3737
VERSION_PATCH = 0
3838
RC = False
3939

@@ -239,6 +239,11 @@ def add_jobs_to_cache():
239239
jobs = []
240240
cache_dir = get_cache_dir()
241241
jobs_dir = cache_dir / JOBS_DIR
242+
if not jobs_dir.exists():
243+
logging.error(
244+
"Cannot run build: no jobs were added. Run `litani add-job` one or "
245+
"more times before running `litani run-build`.")
246+
sys.exit(1)
242247
for job_file in os.listdir(jobs_dir):
243248
with open(jobs_dir / job_file) as handle:
244249
jobs.append(json.load(handle))

0 commit comments

Comments
 (0)