Skip to content

Commit 5c09d8b

Browse files
author
Sam Kleinman
committed
build: fixing unneeded rebuild problem and resolving buildbot issues
1 parent c5a8721 commit 5c09d8b

File tree

4 files changed

+81
-45
lines changed

4 files changed

+81
-45
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/pythono
1+
#!/usr/bin/python
22
"""
33
This module defines a class.
44
"""
@@ -8,21 +8,10 @@
88

99
MANUAL_BRANCH = "manual"
1010

11-
def shell_value( args ):
12-
import subprocess
13-
if isinstance( args , str ):
14-
r = re.compile( "\s+" )
15-
args = r.split( args )
16-
p = subprocess.Popen( args , stdout=subprocess.PIPE , stderr=subprocess.PIPE )
17-
r = p.communicate()
18-
value = r[0].decode().rstrip()
19-
return value
20-
2111
class VersionMeta():
2212
def __init__(self):
2313
self.branch = shell_value('git symbolic-ref HEAD').split('/')[2]
2414
self.commit = shell_value('git rev-parse --verify HEAD')
25-
self.current_year = str(datetime.date.today().year)
2615

2716
if self.branch == MANUAL_BRANCH:
2817
self.manual_path = "manaul"
@@ -35,8 +24,7 @@ def main():
3524

3625
print("MongoDB Manual:" + BREAK +
3726
" Commit: " + meta.commit + BREAK +
38-
" Branch: " + meta.branch + BREAK +
39-
" Current year: " + meta.current_year)
27+
" Branch: " + meta.branch + BREAK)
4028

4129
if __name__ == "__main__":
4230
main()

bin/update_hash.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/usr/bin/python
22

3-
import mongodb_docs_meta
3+
import os
4+
import sys
5+
6+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
7+
8+
from conf import VersionMeta
49

510
def main():
6-
meta = mongodb_docs_meta.VersionMeta()
11+
meta = VersionMeta()
712

813
content = '.. |commit| replace:: ``' + meta.commit + '``' + '\n'
914

conf.py

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,34 @@
88
# All configuration values have a default; values that are commented out
99
# serve to show the default.
1010

11-
import sys, os
12-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../bin")))
13-
from mongodb_docs_meta import VersionMeta
11+
import sys
12+
import os
13+
import datetime
14+
15+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "bin")))
16+
17+
MANUAL_BRANCH = 'manual'
18+
19+
def shell_value( args ):
20+
import re
21+
import subprocess
22+
if isinstance( args , str ):
23+
r = re.compile( "\s+" )
24+
args = r.split( args )
25+
p = subprocess.Popen( args , stdout=subprocess.PIPE , stderr=subprocess.PIPE )
26+
r = p.communicate()
27+
value = r[0].decode().rstrip()
28+
return value
29+
30+
class VersionMeta():
31+
def __init__(self):
32+
self.branch = shell_value('git symbolic-ref HEAD').split('/')[2]
33+
self.commit = shell_value('git rev-parse --verify HEAD')
34+
35+
if self.branch == MANUAL_BRANCH:
36+
self.manual_path = MANUAL_BRANCH
37+
else:
38+
self.manual_path = self.branch
1439

1540
meta = VersionMeta()
1641

@@ -23,7 +48,7 @@
2348
extensions = ["sphinx.ext.intersphinx", "sphinx.ext.extlinks", "sphinx.ext.todo", "mongodb_domain", "additional_directives", "aggregation_domain"]
2449

2550
# Add any paths that contain templates here, relative to this directory.
26-
templates_path = ['../../.templates']
51+
templates_path = ['.templates']
2752

2853
# The suffix of source filenames.
2954
source_suffix = '.txt'
@@ -36,7 +61,7 @@
3661

3762
# General information about the project.
3863
project = u'MongoDB'
39-
copyright = u'2011-' + meta.current_year + ', 10gen, Inc.'
64+
copyright = u'2011-' + str(datetime.date.today().year) + ', 10gen, Inc.'
4065

4166
# The version info for the project you're documenting, acts as replacement for
4267
# |version| and |release|, also used in various other places throughout the
@@ -113,7 +138,7 @@
113138
# html_theme_options = {}
114139

115140
# Add any paths that contain custom themes here, relative to this directory.
116-
html_theme_path = ['../../themes']
141+
html_theme_path = ['themes']
117142

118143
# The name for this set of Sphinx documents. If None, it defaults to
119144
# "<project> v<release> documentation".
@@ -124,7 +149,7 @@
124149

125150
# The name of an image file (relative to this directory) to place at the top
126151
# of the sidebar.
127-
html_logo = "source/.static/logo-mongodb.png"
152+
html_logo = ".static/logo-mongodb.png"
128153

129154
# The name of an image file (within the static path) to use as favicon of the
130155
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -134,7 +159,7 @@
134159
# Add any paths that contain custom static files (such as style sheets) here,
135160
# relative to this directory. They are copied after the builtin static files,
136161
# so a file named "default.css" will overwrite the builtin "default.css".
137-
html_static_path = ['../../source/.static']
162+
html_static_path = ['source/.static']
138163

139164
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
140165
# using the given strftime format.
@@ -222,7 +247,7 @@
222247
epub_title = u'MongoDB'
223248
epub_author = u'MongoDB Documentation Project'
224249
epub_publisher = u'MongoDB Documentation Project'
225-
epub_copyright = u'2011-' + meta.current_year + ', 10gen Inc.'
250+
epub_copyright = u'2011-' + str(datetime.date.today().year) + ', 10gen Inc.'
226251
epub_theme = 'epub_mongodb'
227252
epub_tocdup = True
228253
epub_tocdepth = 3

makefile

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ else
2626
current-if-not-manual = $(current-branch)
2727
endif
2828

29-
sphinx-conf = $(branch-output)/conf.py
3029
# Sphinx variables.
31-
SPHINXOPTS = -c $(branch-output)
30+
sphinx-conf = $(branch-output)/conf.py
31+
SPHINXOPTS = -c ./
3232
SPHINXBUILD = sphinx-build
3333

3434
ifdef NITPICK
@@ -112,14 +112,14 @@ endif
112112
# access these targets through the ``publish`` target.
113113
.PHONY: initial-dependencies static-components sphinx-components post-processing
114114

115-
pre-build-dependencies:source/includes/hash.rst source/about.txt
115+
pre-build-dependencies:setup source/includes/hash.rst source/about.txt
116116
initial-dependencies:$(public-branch-output)/MongoDB-Manual.epub
117117
@echo [build]: completed the pre-publication routine for the $(manual-branch) branch of the Manual.
118118
static-components:$(public-output)/index.html $(public-output)/10gen-gpg-key.asc $(public-branch-output)/.htaccess $(public-branch-output)/release.txt $(public-output)/osd.xml
119119
@echo [build]: completed building and migrating all non-Sphinx components of the build.
120120
post-processing:error-pages links
121121
@echo [build]: completed all post processing steps.
122-
sphinx-components:$(public-branch-output)/ $(public-branch-output)/sitemap.xml.gz $(public-branch-output)/MongoDB-Manual.pdf $(public-branch-output)/single $(public-branch-output)/single/index.html
122+
sphinx-components:$(public-branch-output)/MongoDB-Manual.pdf $(public-branch-output)/single $(public-branch-output)/single/index.html $(public-branch-output)/ $(public-branch-output)/sitemap.xml.gz
123123
@echo [build]: completed the publication routine for all Sphinx Components of the Manual Build.
124124

125125
#
@@ -133,7 +133,7 @@ setup:source/includes/hash.rst
133133
@echo [build]: created $(public-branch-output)
134134

135135
source/includes/hash.rst:
136-
@./bin/update_hash.py
136+
@$(PYTHONBIN) bin/update_hash.py
137137
@echo [build]: \(re\)generated $@.
138138
source/about.txt:setup
139139
@touch $@
@@ -155,7 +155,7 @@ $(branch-output)/singlehtml/contents.html:$(branch-output)/singlehtml
155155
$(branch-output)/latex/MongoDB.tex:latex
156156
$(branch-output)/latex/MongoDB.pdf:$(branch-output)/latex/MongoDB-Manual.tex
157157
$(branch-output)/latex/MongoDB-Manual.tex:$(branch-output)/latex/MongoDB.tex
158-
@python bin/copy-if-needed.py -i $< -o $@ -b pdf
158+
@$(PYTHONBIN) bin/copy-if-needed.py -i $< -o $@ -b pdf
159159
$(public-branch-output)/MongoDB-Manual-$(current-branch).pdf:$(branch-output)/latex/MongoDB-Manual.pdf
160160
@cp $< $@
161161
@echo [build]: migrated $@
@@ -253,8 +253,26 @@ clean-all:
253253
-rm -rf $(output)/*
254254

255255
# Needed for all sphinx builds.
256-
$(sphinx-conf):
257-
@python bin/copy-if-needed.py -i conf.py -o $@ -b sphinx
256+
.PHONY: $(branch-output)/themes $(branch-output)/bin $(branch-output)/.static $(branch-output)/.templates
257+
258+
# $(sphinx-conf):
259+
# @$(PYTHONBIN) bin/copy-if-needed.py -i conf.py -o $@ -b sphinx
260+
# $(branch-output)/themes:themes
261+
# @mkdir -p $@
262+
# @rsync --recursive --delete $</ $@
263+
# @echo [build]: syncing '$<' directory
264+
# $(branch-output)/bin:bin
265+
# @mkdir -p $@
266+
# @rsync --recursive --delete $</ $@
267+
# @echo [build]: syncing '$<' directory
268+
# $(branch-output)/.templates:.templates
269+
# @mkdir -p $@
270+
# @rsync --recursive --delete $</ $@
271+
# @echo [build]: syncing '$<' directory
272+
# $(branch-output)/.static:source/.static
273+
# @mkdir -p $@
274+
# @rsync --recursive --delete $</ $@
275+
# @echo [build]: syncing '$<' directory
258276

259277
######################################################################
260278
#
@@ -263,19 +281,19 @@ $(sphinx-conf):
263281
######################################################################
264282

265283
.PHONY: html dirhtml singlehtml epub sitemap
266-
html:$(sphinx-conf)
284+
html:
267285
@echo [html]: build starting at `date`.
268286
@mkdir -p $(branch-output)/html
269287
@echo [html]: created $(branch-output)/html
270288
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(branch-output)/html
271289
@echo [html]: build complete at `date`.
272-
dirhtml:$(sphinx-conf)
290+
dirhtml:
273291
@echo [dirhtml]: build starting at `date`.
274292
@mkdir -p $(branch-output)/dirhtml
275293
@echo [dirhtml]: created $(branch-output)/dirhtml
276294
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(branch-output)/dirhtml
277295
@echo [dirhtml]: build complete at `date`.
278-
singlehtml:$(sphinx-conf)
296+
singlehtml:
279297
@echo [singlehtml]: build started at `date`.
280298
@mkdir -p $(branch-output)/singlehtml
281299
@echo [singlehtml]: created $(branch-output)/singlehtml
@@ -284,7 +302,7 @@ singlehtml:$(sphinx-conf)
284302

285303
epub-command = $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(branch-output)/epub
286304
epub-filter = sed $(SED_ARGS_REGEX) -e '/^WARNING: unknown mimetype.*ignoring$$/d' -e '/^WARNING: search index.*incomplete.$$/d'
287-
epub:pre-build-dependencies $(sphinx-conf)
305+
epub: pre-build-dependencies
288306
@echo [epub]: starting epub build at `date`.
289307
@mkdir -p $(branch-output)/epub
290308
@echo [epub]: created $(branch-output)/epub
@@ -320,7 +338,7 @@ $(branch-output)/sitemap.xml.gz:$(public-output)/manual
320338
UNCOMPRESSED_MAN := $(wildcard $(branch-output)/man/*.1)
321339
COMPRESSED_MAN := $(subst .1,.1.gz,$(UNCOMPRESSED_MAN))
322340

323-
man:$(sphinx-conf)
341+
man:
324342
@echo [man]: starting man build at `date`.
325343
@mkdir -p $(branch-output)/man
326344
@echo [build]: created $(branch-output)/man
@@ -342,13 +360,13 @@ $(branch-output)/man/%.1.gz: $(branch-output)/man/%.1
342360
.PHONY: aspirational aspiration draft draft-pdf draft-pdfs
343361
aspiration:draft
344362
aspirational:draft
345-
draft:$(sphinx-conf)
363+
draft:
346364
@echo [draft]: draft-html started at `date`.
347365
@mkdir -p $(branch-output)/draft
348366
@echo [draft]: created $(branch-output)/draft
349367
$(SPHINXBUILD) -b html $(DRAFTSPHINXOPTS) $(branch-output)/draft
350368
@echo [draft]: draft-html build finished at `date`.
351-
draft-latex:$(sphinx-conf)
369+
draft-latex:
352370
@echo [draft]: draft-latex build started at `date`.
353371
@mkdir -p $(branch-output)/draft-latex
354372
@echo [draft]: created $(branch-output)/draft-latex
@@ -366,25 +384,25 @@ draft-pdfs:draft-latex draft-pdf
366384
##########################################################################
367385

368386
.PHONY: changes linkcheck json doctest
369-
json:$(sphinx-conf)
387+
json:
370388
@echo [json]: build started at `date`.
371389
@mkdir -p $(branch-output)/json
372390
@echo [json]: created $(branch-output)/json
373391
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(branch-output)/json
374392
@echo [json]: build finished at `date`.
375-
changes:$(sphinx-conf)
393+
changes:
376394
@echo [changes]: build started at `date`.
377395
@mkdir -p $(branch-output)/changes
378396
@echo [changes]: created $(branch-output)/changes
379397
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(branch-output)/changes
380398
@echo [changes]: build finished at `date`.
381-
linkcheck:$(sphinx-conf)
399+
linkcheck:
382400
@echo [link]: build started at `date`.
383401
@mkdir -p $(branch-output)/linkcheck
384402
@echo [link]: created $(branch-output)/linkcheck
385403
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(branch-output)/linkcheck
386404
@echo [link]: Link check complete at `date`. See $(branch-output)/linkcheck/output.txt.
387-
doctest:$(sphinx-conf)
405+
doctest:
388406
@echo [test]: build started at `date`.
389407
@mkdir -p $(branch-output)/doctest
390408
@echo [test]: created $(branch-output)/doctest
@@ -399,7 +417,7 @@ doctest:$(sphinx-conf)
399417

400418
.PHONY:pdfs latex latexpdf
401419

402-
latex:$(sphinx-conf) $(hash-output-file)
420+
latex:
403421
@echo [latex]: starting TeX file generation at `date`.
404422
@mkdir -p $(branch-output)/latex
405423
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(branch-output)/latex

0 commit comments

Comments
 (0)