Skip to content

Commit 5f73027

Browse files
author
Sam Kleinman
committed
build: cleanup and hacking on race condition
1 parent 6e28ea1 commit 5f73027

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed

bin/makefile-builder/sphinx.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def make_all_sphinx(sphinx):
5353
value="sed $(SED_ARGS_REGEX) -e '/^WARNING: unknown mimetype.*ignoring$$/d' -e '/^WARNING: search index.*incomplete.$$/d'",
5454
block='vars')
5555

56+
m.section_break('sphinx prerequisites')
57+
m.target('sphinx-prerequisites', 'setup installation-guides tables', block='prereq')
58+
m.msg('[build]: completed $@ buildstep.', block='prereq')
59+
5660
m.section_break('sphinx targets', block='sphinx')
5761
m.comment('each sphinx target invokes and controls the sphinx build.', block='sphinx')
5862
m.newline(block='sphinx')
@@ -76,7 +80,7 @@ def sphinx_builder(target, production):
7680
m.target(target, block=b)
7781
else:
7882
b = 'testing'
79-
m.target(target, 'pre-build-dependencies', block=b)
83+
m.target(target, 'sphinx-prerequisites', block=b)
8084

8185
if target.split('-')[0] == 'draft':
8286
if target.split('-')[1] == 'html':

bin/makefile-builder/tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def build_all_tables(tables):
2121
m.target('.PHONY', 'tables clean-tables', block='footer')
2222
m.target('tables', '$(output-tables)', block='footer')
2323
m.job('git update-index --assume-unchanged', block='footer')
24-
m.msg('[build]: clensing git index of compiled tables', block='footer')
24+
m.msg('[tables]: clensing git index of compiled tables', block='footer')
2525
m.newline(block='footer')
2626
m.target('clean-tables', block='footer')
2727
m.job('rm -rf $(output-tables)', True)

makefile

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Makefile for MongoDB Sphinx documentation
2-
MAKEFLAGS += -j
3-
MAKEFLAGS += -r
4-
MAKEFLAGS += --no-print-directory
2+
MAKEFLAGS += -j -r --no-print-directory
53

64
# Build directory tweaking.
75
output = build
@@ -11,13 +9,11 @@ public-output = $(output)/public
119
branch-output = $(output)/$(current-branch)
1210
public-branch-output = $(public-output)/$(current-branch)
1311

14-
# intuit the current branch and commit
12+
# get current branch & commit; set the branch that "manual/" points to; + a conditional
13+
manual-branch = master
1514
current-branch := $(shell git symbolic-ref HEAD 2>/dev/null | cut -d "/" -f "3" )
1615
last-commit := $(shell git rev-parse --verify HEAD)
1716
timestamp := $(shell date +%Y%m%d%H%M)
18-
19-
# change this to reflect the branch that "manual/" will point to
20-
manual-branch = master
2117
ifeq ($(current-branch),$(manual-branch))
2218
current-if-not-manual = manual
2319
else
@@ -36,15 +32,14 @@ help:
3632
@echo " publish runs publication process and then deploys the build to $(public-output)"
3733
@echo " push runs publication process and pushes to docs site to production."
3834
@echo " draft builds a 'draft' build for pre-publication testing ."
39-
@echo " pdfs generates pdfs more efficently than latexpdf."
35+
@echo " pdfs generates pdfs."
4036

4137
############# makefile includes #############
4238
include bin/makefile.compatibility
4339
include bin/makefile.push
4440

4541
# Included, dynamically generated makefile sections, to build: sphinx
46-
# targets, LaTeX/PDFs, tables, the installation guides, and symbolic
47-
# links.
42+
# targets, LaTeX/PDFs, tables, the installation guides, and sym links.
4843

4944
-include $(output)/makefile.pdfs
5045
-include $(output)/makefile.tables
@@ -63,7 +58,7 @@ $(output)/makefile.%:bin/makefile-builder/%.py bin/makefile_builder.py bin/build
6358
publish-if-up-to-date:
6459
@bin/published-build-check $(current-branch) $(last-commit)
6560
@$(MAKE) publish
66-
publish:initial-dependencies pre-build-dependencies
61+
publish:initial-dependencies
6762
@echo [build]: starting build of sphinx components built at `date`
6863
@$(MAKE) sphinx-components
6964
@echo [build]: all sphinx components built at `date`
@@ -74,17 +69,20 @@ publish:initial-dependencies pre-build-dependencies
7469

7570
# Deployment targets to kick off the rest of the build process.
7671
# Only access these targets through the ``publish`` or ``publish-if-up-to-date`` targets.
77-
pre-build-dependencies:setup installation-guides tables
78-
@echo [build]: completed $@ buildstep.
79-
initial-dependencies:$(public-branch-output)/MongoDB-Manual.epub
80-
@echo [build]: completed $@ buildstep.
81-
static-components:$(public-output)/index.html $(public-output)/10gen-gpg-key.asc $(public-output)/10gen-security-gpg-key.asc $(public-branch-output)/.htaccess $(public-branch-output)/release.txt $(public-output)/osd.xml
82-
@echo [build]: completed $@ buildstep.
72+
static-components:security-keys static-pages meta-static
73+
@echo [build]: completed $1@ buildstep.
8374
post-processing:error-pages links
8475
@echo [build]: completed $@ buildstep.
85-
sphinx-components:manual-pdfs $(public-branch-output)/single $(public-branch-output)/single/index.html $(public-branch-output) $(public-branch-output)/sitemap.xml.gz
76+
sphinx-components:manual-pdfs single-output public-output
8677
@echo [build]: completed $@ buildstep.
8778

79+
initial-dependencies:$(public-branch-output)/MongoDB-Manual.epub
80+
single-output:$(public-branch-output)/single $(public-branch-output)/single/index.html
81+
public-output:$(public-branch-output) $(public-branch-output)/sitemap.xml.gz
82+
security-keys:$(public-output)/10gen-gpg-key.asc $(public-output)/10gen-security-gpg-key.asc
83+
static-pages:$(public-output)/index.html $(public-branch-output)/release.txt
84+
meta-static:$(public-branch-output)/.htaccess $(public-output)/osd.xml
85+
8886
############# Targets that define the production build process #############
8987
.PHONY:source/about.txt source/includes/hash.rst setup $(public-branch-output)/release.txt
9088

@@ -135,7 +133,7 @@ $(branch-output)/sitemap.xml.gz:$(public-output)/manual $(branch-output)/dirhtml
135133

136134
LATEX_CORRECTION = "s/(index|bfcode)\{(.*!*)*--(.*)\}/\1\{\2-\{-\}\3\}/g"
137135
LATEX_LINK_CORRECTION = "s%\\\code\{/%\\\code\{http://docs.mongodb.org/$(current-if-not-manual)/%g"
138-
PDFLATEXCOMMAND = TEXINPUTS=".:$(branch-output)/latex/:" pdflatex --interaction batchmode --output-directory $(branch-output)/latex/
136+
pdflatex-command = TEXINPUTS=".:$(branch-output)/latex/:" pdflatex --interaction batchmode --output-directory $(branch-output)/latex/ $(LATEXOPTS)
139137

140138
# Uses 'latex' target to generate latex files.
141139
pdfs:$(subst .tex,.pdf,$(wildcard $(branch-output)/latex/*.tex))
@@ -145,13 +143,13 @@ $(branch-output)/latex/%.tex:
145143
%.pdf:%.tex
146144
@echo [pdf]: pdf compilation of $@, started at `date`.
147145
@touch $(basename $@)-pdflatex.log
148-
@-$(PDFLATEXCOMMAND) $(LATEXOPTS) '$<' >> $(basename $@)-pdflatex.log
146+
@-$(pdflatex-command) '$<' >> $(basename $@)-pdflatex.log
149147
@echo [pdf]: \(1/4\) pdflatex $<
150148
@-makeindex -s $(branch-output)/latex/python.ist '$(basename $<).idx' >> $(basename $@)-pdflatex.log 2>&1
151149
@echo [pdf]: \(2/4\) Indexing: $(basename $<).idx
152-
@$(PDFLATEXCOMMAND) $(LATEXOPTS) '$<' >> $(basename $@)-pdflatex.log
150+
@$(pdflatex-command) '$<' >> $(basename $@)-pdflatex.log
153151
@echo [pdf]: \(3/4\) pdflatex $<
154-
@$(PDFLATEXCOMMAND) $(LATEXOPTS) '$<' >> $(basename $@)-pdflatex.log
152+
@$(pdflatex-command) '$<' >> $(basename $@)-pdflatex.log
155153
@echo [pdf]: \(4/4\) pdflatex $<
156154
@echo [pdf]: see '$(basename $@)-pdflatex.log' for a full report of the pdf build process.
157155
@echo [pdf]: pdf compilation of $@, complete at `date`.
@@ -171,7 +169,7 @@ clean-all:
171169

172170
# Archiving $(public-output) for more sane testing, and risk free cleaning.
173171
archive:$(public-output).$(timestamp).tar.gz
174-
@echo [archive]: created $< archive.
172+
@echo [$@]: created $< $@.
175173
$(public-output).%.tar.gz:$(public-output)
176174
tar -czvf $@ $<
177175

@@ -180,9 +178,12 @@ draft:draft-html
180178
draft-pdfs:draft-latex $(subst .tex,.pdf,$(wildcard $(branch-output)/draft-latex/*.tex))
181179

182180
# man page support, uses sphinx `man` builder output.
183-
UNCOMPRESSED_MAN := $(wildcard $(branch-output)/man/*.1)
184-
COMPRESSED_MAN := $(subst .1,.1.gz,$(UNCOMPRESSED_MAN))
185-
build-man:man $(COMPRESSED_MAN)
186-
compress-man:$(COMPRESSED_MAN)
181+
.PHONY:$(manpages)
182+
manpages := $(wildcard $(branch-output)/man/*.1)
183+
compressed-manpages := $(subst .1,.1.gz,$(manpages))
184+
manpages:$(compressed-manpages)
185+
$(compressed-manpages):$(manpages)
186+
$(manpages):man
187187
$(branch-output)/man/%.1.gz: $(branch-output)/man/%.1
188-
gzip $< -c > $@
188+
@gzip $< -c > $@
189+
@echo [man] compressing $< -- $@

0 commit comments

Comments
 (0)