Merge lp:~barry/click/docs-n-stuff into lp:click
- docs-n-stuff
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 27 |
Proposed branch: | lp:~barry/click/docs-n-stuff |
Merge into: | lp:click |
Diff against target: |
653 lines (+480/-22) 10 files modified
.bzrignore (+4/-0) clickpackage/tests/test_build.py (+16/-0) clickpackage/tests/test_static.py (+1/-1) doc/Makefile (+153/-0) doc/conf.py (+242/-0) doc/constraints.rst (+13/-11) doc/file-format.rst (+3/-1) doc/hooks.rst (+9/-8) doc/index.rst (+35/-0) preload/clickpreload.c (+4/-1) |
To merge this branch: | bzr merge lp:~barry/click/docs-n-stuff |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson | Pending | ||
Review via email: mp+158967@code.launchpad.net |
Commit message
Description of the change
A bunch of small changes, some good, some questionable. ;)
* Convert the docs to reStructuredText and sphinx-ify them. `make html` in the doc/ directory to build.
* clickpreload_
* test_build() assumes umask 022 in the environment. The test and/or system should perhaps be made more robust, but since my env typically uses umask 002, add a decorator for the test to temporary smash the umask. At least this gets the test passing for me.
* Obviously, ignore the doc/ directory for PEP 8 checks
* Added a question in file-format.rst
- 32. By Barry Warsaw
-
typo
- 33. By Barry Warsaw
-
Changes based on feedback from Colin.
* Fix the copyright for the documentation.
* Remove question which I now understand ;)
* Fix reST markup.
* Restore an idiom common on the eastern side of the Atlantic
* Strictly speaking, the only check for dlsym() failing is to check dlerror(),
since dlsym() returning NULL could be valid.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2013-04-10 15:55:06 +0000 |
3 | +++ .bzrignore 2013-04-16 17:28:26 +0000 |
4 | @@ -1,2 +1,6 @@ |
5 | __pycache__ |
6 | ./click_installer.egg-info |
7 | +_build/doctrees |
8 | +_build/html |
9 | +doc/_build/doctrees |
10 | +doc/_build/html |
11 | |
12 | === modified file 'clickpackage/tests/test_build.py' |
13 | --- clickpackage/tests/test_build.py 2013-04-12 13:26:40 +0000 |
14 | +++ clickpackage/tests/test_build.py 2013-04-16 17:28:26 +0000 |
15 | @@ -30,6 +30,21 @@ |
16 | from clickpackage.tests.helpers import TestCase, mkfile, touch |
17 | |
18 | |
19 | +# BAW 2013-04-15: Some tests require umask 022. Use this decorator to |
20 | +# temporarily tweak the process's umask. The test -- or system -- should |
21 | +# probably be made more robust instead. |
22 | +def umask(force_umask): |
23 | + def decorator(func): |
24 | + def wrapper(*args, **kws): |
25 | + old_umask = os.umask(force_umask) |
26 | + try: |
27 | + return func(*args, **kws) |
28 | + finally: |
29 | + os.umask(old_umask) |
30 | + return wrapper |
31 | + return decorator |
32 | + |
33 | + |
34 | class TestClickBuilder(TestCase): |
35 | def test_read_metadata(self): |
36 | self.use_temp_dir() |
37 | @@ -64,6 +79,7 @@ |
38 | return subprocess.check_output( |
39 | ["dpkg-deb", "-I", path, name], universal_newlines=True) |
40 | |
41 | + @umask(0o22) |
42 | def test_build(self): |
43 | self.use_temp_dir() |
44 | scratch = os.path.join(self.temp_dir, "scratch") |
45 | |
46 | === modified file 'clickpackage/tests/test_static.py' |
47 | --- clickpackage/tests/test_static.py 2013-04-10 15:55:06 +0000 |
48 | +++ clickpackage/tests/test_static.py 2013-04-16 17:28:26 +0000 |
49 | @@ -32,7 +32,7 @@ |
50 | def all_paths(self): |
51 | paths = [] |
52 | for dirpath, dirnames, filenames in os.walk("."): |
53 | - for ignore in ".bzr", "__pycache__": |
54 | + for ignore in ('doc', ".bzr", "__pycache__"): |
55 | if ignore in dirnames: |
56 | dirnames.remove(ignore) |
57 | filenames = [ |
58 | |
59 | === added file 'doc/Makefile' |
60 | --- doc/Makefile 1970-01-01 00:00:00 +0000 |
61 | +++ doc/Makefile 2013-04-16 17:28:26 +0000 |
62 | @@ -0,0 +1,153 @@ |
63 | +# Makefile for Sphinx documentation |
64 | +# |
65 | + |
66 | +# You can set these variables from the command line. |
67 | +SPHINXOPTS = |
68 | +SPHINXBUILD = sphinx-build |
69 | +PAPER = |
70 | +BUILDDIR = _build |
71 | + |
72 | +# Internal variables. |
73 | +PAPEROPT_a4 = -D latex_paper_size=a4 |
74 | +PAPEROPT_letter = -D latex_paper_size=letter |
75 | +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
76 | +# the i18n builder cannot share the environment and doctrees with the others |
77 | +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
78 | + |
79 | +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext |
80 | + |
81 | +help: |
82 | + @echo "Please use \`make <target>' where <target> is one of" |
83 | + @echo " html to make standalone HTML files" |
84 | + @echo " dirhtml to make HTML files named index.html in directories" |
85 | + @echo " singlehtml to make a single large HTML file" |
86 | + @echo " pickle to make pickle files" |
87 | + @echo " json to make JSON files" |
88 | + @echo " htmlhelp to make HTML files and a HTML help project" |
89 | + @echo " qthelp to make HTML files and a qthelp project" |
90 | + @echo " devhelp to make HTML files and a Devhelp project" |
91 | + @echo " epub to make an epub" |
92 | + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" |
93 | + @echo " latexpdf to make LaTeX files and run them through pdflatex" |
94 | + @echo " text to make text files" |
95 | + @echo " man to make manual pages" |
96 | + @echo " texinfo to make Texinfo files" |
97 | + @echo " info to make Texinfo files and run them through makeinfo" |
98 | + @echo " gettext to make PO message catalogs" |
99 | + @echo " changes to make an overview of all changed/added/deprecated items" |
100 | + @echo " linkcheck to check all external links for integrity" |
101 | + @echo " doctest to run all doctests embedded in the documentation (if enabled)" |
102 | + |
103 | +clean: |
104 | + -rm -rf $(BUILDDIR)/* |
105 | + |
106 | +html: |
107 | + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html |
108 | + @echo |
109 | + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." |
110 | + |
111 | +dirhtml: |
112 | + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml |
113 | + @echo |
114 | + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." |
115 | + |
116 | +singlehtml: |
117 | + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml |
118 | + @echo |
119 | + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." |
120 | + |
121 | +pickle: |
122 | + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle |
123 | + @echo |
124 | + @echo "Build finished; now you can process the pickle files." |
125 | + |
126 | +json: |
127 | + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json |
128 | + @echo |
129 | + @echo "Build finished; now you can process the JSON files." |
130 | + |
131 | +htmlhelp: |
132 | + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp |
133 | + @echo |
134 | + @echo "Build finished; now you can run HTML Help Workshop with the" \ |
135 | + ".hhp project file in $(BUILDDIR)/htmlhelp." |
136 | + |
137 | +qthelp: |
138 | + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp |
139 | + @echo |
140 | + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ |
141 | + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" |
142 | + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ClickPackages.qhcp" |
143 | + @echo "To view the help file:" |
144 | + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ClickPackages.qhc" |
145 | + |
146 | +devhelp: |
147 | + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp |
148 | + @echo |
149 | + @echo "Build finished." |
150 | + @echo "To view the help file:" |
151 | + @echo "# mkdir -p $$HOME/.local/share/devhelp/ClickPackages" |
152 | + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ClickPackages" |
153 | + @echo "# devhelp" |
154 | + |
155 | +epub: |
156 | + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub |
157 | + @echo |
158 | + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." |
159 | + |
160 | +latex: |
161 | + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
162 | + @echo |
163 | + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." |
164 | + @echo "Run \`make' in that directory to run these through (pdf)latex" \ |
165 | + "(use \`make latexpdf' here to do that automatically)." |
166 | + |
167 | +latexpdf: |
168 | + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
169 | + @echo "Running LaTeX files through pdflatex..." |
170 | + $(MAKE) -C $(BUILDDIR)/latex all-pdf |
171 | + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." |
172 | + |
173 | +text: |
174 | + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text |
175 | + @echo |
176 | + @echo "Build finished. The text files are in $(BUILDDIR)/text." |
177 | + |
178 | +man: |
179 | + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man |
180 | + @echo |
181 | + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." |
182 | + |
183 | +texinfo: |
184 | + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
185 | + @echo |
186 | + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." |
187 | + @echo "Run \`make' in that directory to run these through makeinfo" \ |
188 | + "(use \`make info' here to do that automatically)." |
189 | + |
190 | +info: |
191 | + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo |
192 | + @echo "Running Texinfo files through makeinfo..." |
193 | + make -C $(BUILDDIR)/texinfo info |
194 | + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." |
195 | + |
196 | +gettext: |
197 | + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale |
198 | + @echo |
199 | + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." |
200 | + |
201 | +changes: |
202 | + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes |
203 | + @echo |
204 | + @echo "The overview file is in $(BUILDDIR)/changes." |
205 | + |
206 | +linkcheck: |
207 | + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck |
208 | + @echo |
209 | + @echo "Link check complete; look for any errors in the above output " \ |
210 | + "or in $(BUILDDIR)/linkcheck/output.txt." |
211 | + |
212 | +doctest: |
213 | + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest |
214 | + @echo "Testing of doctests in the sources finished, look at the " \ |
215 | + "results in $(BUILDDIR)/doctest/output.txt." |
216 | |
217 | === added directory 'doc/_build' |
218 | === added directory 'doc/_static' |
219 | === added directory 'doc/_templates' |
220 | === added file 'doc/conf.py' |
221 | --- doc/conf.py 1970-01-01 00:00:00 +0000 |
222 | +++ doc/conf.py 2013-04-16 17:28:26 +0000 |
223 | @@ -0,0 +1,242 @@ |
224 | +# -*- coding: utf-8 -*- |
225 | +# |
226 | +# Click Packages documentation build configuration file, created by |
227 | +# sphinx-quickstart on Mon Apr 15 11:34:57 2013. |
228 | +# |
229 | +# This file is execfile()d with the current directory set to its containing dir. |
230 | +# |
231 | +# Note that not all possible configuration values are present in this |
232 | +# autogenerated file. |
233 | +# |
234 | +# All configuration values have a default; values that are commented out |
235 | +# serve to show the default. |
236 | + |
237 | +import sys, os |
238 | + |
239 | +# If extensions (or modules to document with autodoc) are in another directory, |
240 | +# add these directories to sys.path here. If the directory is relative to the |
241 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
242 | +#sys.path.insert(0, os.path.abspath('.')) |
243 | + |
244 | +# -- General configuration ----------------------------------------------------- |
245 | + |
246 | +# If your documentation needs a minimal Sphinx version, state it here. |
247 | +#needs_sphinx = '1.0' |
248 | + |
249 | +# Add any Sphinx extension module names here, as strings. They can be extensions |
250 | +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
251 | +extensions = [] |
252 | + |
253 | +# Add any paths that contain templates here, relative to this directory. |
254 | +templates_path = ['_templates'] |
255 | + |
256 | +# The suffix of source filenames. |
257 | +source_suffix = '.rst' |
258 | + |
259 | +# The encoding of source files. |
260 | +#source_encoding = 'utf-8-sig' |
261 | + |
262 | +# The master toctree document. |
263 | +master_doc = 'index' |
264 | + |
265 | +# General information about the project. |
266 | +project = u'Click Packages' |
267 | +copyright = u'2013, Canonical Ltd.' |
268 | + |
269 | +# The version info for the project you're documenting, acts as replacement for |
270 | +# |version| and |release|, also used in various other places throughout the |
271 | +# built documents. |
272 | +# |
273 | +# The short X.Y version. |
274 | +version = '0.1' |
275 | +# The full version, including alpha/beta/rc tags. |
276 | +release = '0.1' |
277 | + |
278 | +# The language for content autogenerated by Sphinx. Refer to documentation |
279 | +# for a list of supported languages. |
280 | +#language = None |
281 | + |
282 | +# There are two options for replacing |today|: either, you set today to some |
283 | +# non-false value, then it is used: |
284 | +#today = '' |
285 | +# Else, today_fmt is used as the format for a strftime call. |
286 | +#today_fmt = '%B %d, %Y' |
287 | + |
288 | +# List of patterns, relative to source directory, that match files and |
289 | +# directories to ignore when looking for source files. |
290 | +exclude_patterns = ['_build'] |
291 | + |
292 | +# The reST default role (used for this markup: `text`) to use for all documents. |
293 | +#default_role = None |
294 | + |
295 | +# If true, '()' will be appended to :func: etc. cross-reference text. |
296 | +#add_function_parentheses = True |
297 | + |
298 | +# If true, the current module name will be prepended to all description |
299 | +# unit titles (such as .. function::). |
300 | +#add_module_names = True |
301 | + |
302 | +# If true, sectionauthor and moduleauthor directives will be shown in the |
303 | +# output. They are ignored by default. |
304 | +#show_authors = False |
305 | + |
306 | +# The name of the Pygments (syntax highlighting) style to use. |
307 | +pygments_style = 'sphinx' |
308 | + |
309 | +# A list of ignored prefixes for module index sorting. |
310 | +#modindex_common_prefix = [] |
311 | + |
312 | + |
313 | +# -- Options for HTML output --------------------------------------------------- |
314 | + |
315 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
316 | +# a list of builtin themes. |
317 | +html_theme = 'default' |
318 | + |
319 | +# Theme options are theme-specific and customize the look and feel of a theme |
320 | +# further. For a list of options available for each theme, see the |
321 | +# documentation. |
322 | +#html_theme_options = {} |
323 | + |
324 | +# Add any paths that contain custom themes here, relative to this directory. |
325 | +#html_theme_path = [] |
326 | + |
327 | +# The name for this set of Sphinx documents. If None, it defaults to |
328 | +# "<project> v<release> documentation". |
329 | +#html_title = None |
330 | + |
331 | +# A shorter title for the navigation bar. Default is the same as html_title. |
332 | +#html_short_title = None |
333 | + |
334 | +# The name of an image file (relative to this directory) to place at the top |
335 | +# of the sidebar. |
336 | +#html_logo = None |
337 | + |
338 | +# The name of an image file (within the static path) to use as favicon of the |
339 | +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
340 | +# pixels large. |
341 | +#html_favicon = None |
342 | + |
343 | +# Add any paths that contain custom static files (such as style sheets) here, |
344 | +# relative to this directory. They are copied after the builtin static files, |
345 | +# so a file named "default.css" will overwrite the builtin "default.css". |
346 | +html_static_path = ['_static'] |
347 | + |
348 | +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
349 | +# using the given strftime format. |
350 | +#html_last_updated_fmt = '%b %d, %Y' |
351 | + |
352 | +# If true, SmartyPants will be used to convert quotes and dashes to |
353 | +# typographically correct entities. |
354 | +#html_use_smartypants = True |
355 | + |
356 | +# Custom sidebar templates, maps document names to template names. |
357 | +#html_sidebars = {} |
358 | + |
359 | +# Additional templates that should be rendered to pages, maps page names to |
360 | +# template names. |
361 | +#html_additional_pages = {} |
362 | + |
363 | +# If false, no module index is generated. |
364 | +#html_domain_indices = True |
365 | + |
366 | +# If false, no index is generated. |
367 | +#html_use_index = True |
368 | + |
369 | +# If true, the index is split into individual pages for each letter. |
370 | +#html_split_index = False |
371 | + |
372 | +# If true, links to the reST sources are added to the pages. |
373 | +#html_show_sourcelink = True |
374 | + |
375 | +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. |
376 | +#html_show_sphinx = True |
377 | + |
378 | +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. |
379 | +#html_show_copyright = True |
380 | + |
381 | +# If true, an OpenSearch description file will be output, and all pages will |
382 | +# contain a <link> tag referring to it. The value of this option must be the |
383 | +# base URL from which the finished HTML is served. |
384 | +#html_use_opensearch = '' |
385 | + |
386 | +# This is the file name suffix for HTML files (e.g. ".xhtml"). |
387 | +#html_file_suffix = None |
388 | + |
389 | +# Output file base name for HTML help builder. |
390 | +htmlhelp_basename = 'ClickPackagesdoc' |
391 | + |
392 | + |
393 | +# -- Options for LaTeX output -------------------------------------------------- |
394 | + |
395 | +latex_elements = { |
396 | +# The paper size ('letterpaper' or 'a4paper'). |
397 | +#'papersize': 'letterpaper', |
398 | + |
399 | +# The font size ('10pt', '11pt' or '12pt'). |
400 | +#'pointsize': '10pt', |
401 | + |
402 | +# Additional stuff for the LaTeX preamble. |
403 | +#'preamble': '', |
404 | +} |
405 | + |
406 | +# Grouping the document tree into LaTeX files. List of tuples |
407 | +# (source start file, target name, title, author, documentclass [howto/manual]). |
408 | +latex_documents = [ |
409 | + ('index', 'ClickPackages.tex', u'Click Packages Documentation', |
410 | + u'Colin Watson', 'manual'), |
411 | +] |
412 | + |
413 | +# The name of an image file (relative to this directory) to place at the top of |
414 | +# the title page. |
415 | +#latex_logo = None |
416 | + |
417 | +# For "manual" documents, if this is true, then toplevel headings are parts, |
418 | +# not chapters. |
419 | +#latex_use_parts = False |
420 | + |
421 | +# If true, show page references after internal links. |
422 | +#latex_show_pagerefs = False |
423 | + |
424 | +# If true, show URL addresses after external links. |
425 | +#latex_show_urls = False |
426 | + |
427 | +# Documents to append as an appendix to all manuals. |
428 | +#latex_appendices = [] |
429 | + |
430 | +# If false, no module index is generated. |
431 | +#latex_domain_indices = True |
432 | + |
433 | + |
434 | +# -- Options for manual page output -------------------------------------------- |
435 | + |
436 | +# One entry per manual page. List of tuples |
437 | +# (source start file, name, description, authors, manual section). |
438 | +man_pages = [ |
439 | + ('index', 'clickpackages', u'Click Packages Documentation', |
440 | + [u'Colin Watson'], 1) |
441 | +] |
442 | + |
443 | +# If true, show URL addresses after external links. |
444 | +#man_show_urls = False |
445 | + |
446 | + |
447 | +# -- Options for Texinfo output ------------------------------------------------ |
448 | + |
449 | +# Grouping the document tree into Texinfo files. List of tuples |
450 | +# (source start file, target name, title, author, |
451 | +# dir menu entry, description, category) |
452 | +texinfo_documents = [ |
453 | + ('index', 'ClickPackages', u'Click Packages Documentation', |
454 | + u'Colin Watson', 'ClickPackages', 'One line description of project.', |
455 | + 'Miscellaneous'), |
456 | +] |
457 | + |
458 | +# Documents to append as an appendix to all manuals. |
459 | +#texinfo_appendices = [] |
460 | + |
461 | +# If false, no module index is generated. |
462 | +#texinfo_domain_indices = True |
463 | + |
464 | +# How to display URL addresses: 'footnote', 'no', or 'inline'. |
465 | +#texinfo_show_urls = 'footnote' |
466 | |
467 | === renamed file 'doc/constraints' => 'doc/constraints.rst' |
468 | --- doc/constraints 2013-04-12 10:13:31 +0000 |
469 | +++ doc/constraints.rst 2013-04-16 17:28:26 +0000 |
470 | @@ -1,28 +1,30 @@ |
471 | +================== |
472 | Design constraints |
473 | ------------------- |
474 | +================== |
475 | |
476 | Building packages |
477 | ================= |
478 | |
479 | * Building packages should not require any more than the Python standard |
480 | - library. In particular, it should not require dpkg, python-debian, or |
481 | - any other such Debian-specific tools. |
482 | - |
483 | - Rationale: We want people to be able to build Click packages easily on |
484 | - any platform (or at least any platform that can manage a Python |
485 | - installation, which is not too onerous a requirement). |
486 | + library. In particular, it should not require dpkg, python-debian, or any |
487 | + other such Debian-specific tools. |
488 | + |
489 | + Rationale: We want people to be able to build Click packages easily on any |
490 | + platform (or at least any platform that can manage a Python installation, |
491 | + which is not too onerous a requirement). |
492 | + |
493 | |
494 | Installing packages |
495 | =================== |
496 | |
497 | * For the purpose of rapid prototyping, package installation is also |
498 | implemented in Python. This may of course use Debian/Ubuntu-specific |
499 | - tools, since it will always be running on an Ubuntu system. In future, |
500 | - it will probably be reimplemented in C for performance. |
501 | + tools, since it will always be running on an Ubuntu system. In future, it |
502 | + will probably be re-implemented in C for performance. |
503 | |
504 | * Reading the system dpkg database is forbidden. This is partly to ensure |
505 | - strict separation, and partly because the system dpkg database is large |
506 | - and therefore slow to read. |
507 | + strict separation, and partly because the system dpkg database is large and |
508 | + therefore slow to read. |
509 | |
510 | * Nothing should require root, although it may be acceptable to make use of |
511 | root-only facilities if available (but remembering to pay attention to |
512 | |
513 | === renamed file 'doc/file-format' => 'doc/file-format.rst' |
514 | --- doc/file-format 2013-04-12 12:46:45 +0000 |
515 | +++ doc/file-format.rst 2013-04-16 17:28:26 +0000 |
516 | @@ -1,5 +1,6 @@ |
517 | +======================================== |
518 | "Click" package file format, version 0.1 |
519 | ----------------------------------------- |
520 | +======================================== |
521 | |
522 | This specification covers a packaging format intended for use by |
523 | self-contained third-party applications. It is intentionally designed to be |
524 | @@ -64,6 +65,7 @@ |
525 | to refuse to install it. The package manager must enforce the permitted |
526 | text of this script. |
527 | |
528 | + |
529 | Data area |
530 | ========= |
531 | |
532 | |
533 | === renamed file 'doc/hooks' => 'doc/hooks.rst' |
534 | --- doc/hooks 2013-04-11 16:57:36 +0000 |
535 | +++ doc/hooks.rst 2013-04-16 17:28:26 +0000 |
536 | @@ -1,5 +1,6 @@ |
537 | +===== |
538 | Hooks |
539 | ------ |
540 | +===== |
541 | |
542 | Of course, any sensible packaging format needs a hook mechanism of some |
543 | kind; just unpacking a filesystem tarball isn't going to cut it. But part |
544 | @@ -53,7 +54,7 @@ |
545 | What we can do with reasonable safety is populate symlink farms. As a |
546 | strawman proposal, consider the following: |
547 | |
548 | - * An integrated-with system package may add *.hook files to |
549 | + * An integrated-with system package may add ``*.hook`` files to |
550 | /usr/share/click-package/hooks/. These are standard Debian-style control |
551 | files with the following keys: |
552 | |
553 | @@ -69,7 +70,7 @@ |
554 | one %s substitution: the package manager substitutes an identifier |
555 | provided by the Click package into it and creates the resulting path as a |
556 | symlink to a path provided by the Click package. |
557 | - |
558 | + |
559 | If the Exec key is present, its value is executed as if passed to the |
560 | shell after the above symlink is created. |
561 | |
562 | @@ -77,11 +78,11 @@ |
563 | |
564 | * A Click package may include a "hooks" entry in its metadata (exact format |
565 | TBD). If present, it must contain a mapping of keys to values. The keys |
566 | - are used to look up *.hook files with an equal Hook field (see above). |
567 | + are used to look up ``*.hook`` files with an equal Hook field (see above). |
568 | The values are symlink target paths used by the package manager when |
569 | - creating symlinks according to the Pattern field in *.hook files. |
570 | + creating symlinks according to the Pattern field in ``*.hook`` files. |
571 | |
572 | - * There should be a dh_clickpackage which installs the *.hook files in |
573 | + * There should be a dh_clickpackage which installs the ``*.hook`` files in |
574 | system packages and adds maintainer script fragments to cause |
575 | click-package to catch up with any newly-provided hooks. |
576 | |
577 | @@ -89,13 +90,13 @@ |
578 | Click package to avoid code duplication between system and Click package |
579 | handling, although we must do so asynchronously and any errors must not |
580 | block the installation of Click packages. If "Trigger: yes" is set in a |
581 | - *.hook file, then click-install will activate an asynchronous D-Bus |
582 | + ``*.hook`` file, then click-install will activate an asynchronous D-Bus |
583 | service at the end of installation, passing the names of all the changed |
584 | paths resulting from Pattern key expansions; this will activate any file |
585 | triggers matching those paths, and process all the packages that enter |
586 | the triggers-pending state as a result. |
587 | |
588 | -Thus, a worked example would have: |
589 | +Thus, a worked example would have:: |
590 | |
591 | /usr/share/click-package/hooks/unity-lens-help.hook |
592 | Hook: unity-lens-help |
593 | |
594 | === added file 'doc/index.rst' |
595 | --- doc/index.rst 1970-01-01 00:00:00 +0000 |
596 | +++ doc/index.rst 2013-04-16 17:28:26 +0000 |
597 | @@ -0,0 +1,35 @@ |
598 | +.. Click Packages documentation master file, created by |
599 | + sphinx-quickstart on Mon Apr 15 11:34:57 2013. |
600 | + You can adapt this file completely to your liking, but it should at least |
601 | + contain the root `toctree` directive. |
602 | + |
603 | +============== |
604 | +Click packages |
605 | +============== |
606 | + |
607 | +*Click* is the code name used to describe a packaging format for Ubuntu mobile |
608 | +applications. This format specifies how individual apps are delivered to |
609 | +mobile devices, how they are packed into distributable format, and how they |
610 | +are installed on a mobile device by a system provided package manager. At a |
611 | +minimum they assume that a base system exists providing all the necessary |
612 | +infrastructure and dependencies needed in order to install and run such apps. |
613 | + |
614 | +The click packaging format is completely independent from facilities to do |
615 | +full-system installations or upgrades. |
616 | + |
617 | +Contents: |
618 | + |
619 | +.. toctree:: |
620 | + :maxdepth: 2 |
621 | + |
622 | + file-format.rst |
623 | + constraints.rst |
624 | + hooks.rst |
625 | + |
626 | + |
627 | +Indices and tables |
628 | +================== |
629 | + |
630 | +* :ref:`genindex` |
631 | +* :ref:`modindex` |
632 | +* :ref:`search` |
633 | |
634 | === modified file 'preload/clickpreload.c' |
635 | --- preload/clickpreload.c 2013-04-12 09:59:54 +0000 |
636 | +++ preload/clickpreload.c 2013-04-16 17:28:26 +0000 |
637 | @@ -42,12 +42,15 @@ |
638 | #define GET_NEXT_SYMBOL(name) \ |
639 | do { \ |
640 | libc_##name = dlsym (RTLD_NEXT, #name); \ |
641 | - if (!libc_##name || dlerror ()) \ |
642 | + if (dlerror ()) \ |
643 | _exit (1); \ |
644 | } while (0) |
645 | |
646 | void __attribute__ ((constructor)) clickpreload_init (void) |
647 | { |
648 | + /* Clear any old error conditions, albeit unlikely, as per dlsym(2) */ |
649 | + dlerror (); |
650 | + |
651 | GET_NEXT_SYMBOL (chown); |
652 | GET_NEXT_SYMBOL (execvp); |
653 | GET_NEXT_SYMBOL (fchown); |