2012-11-11 04:14:57 +01:00
|
|
|
// -*- mode:doc; -*-
|
2013-02-13 13:59:02 +01:00
|
|
|
// vim: set syntax=asciidoc:
|
2012-11-11 04:14:57 +01:00
|
|
|
|
manual: use one-line titles instead of two-line titles (trivial)
Asciidoc supports two syntaxes for section titles: two-line titles (title
plus underline consisting of a particular symbol), and one-line titles
(title prefixed with a specific number of = signs).
The two-line title underlines are:
Level 0 (top level): ======================
Level 1: ----------------------
Level 2: ~~~~~~~~~~~~~~~~~~~~~~
Level 3: ^^^^^^^^^^^^^^^^^^^^^^
Level 4 (bottom level): ++++++++++++++++++++++
and the one-line title prefixes:
= Document Title (level 0) =
== Section title (level 1) ==
=== Section title (level 2) ===
==== Section title (level 3) ====
===== Section title (level 4) =====
The buildroot manual is currenly using the two-line titles, but this has
multiple disadvantages:
- asciidoc also uses some of the underline symbols for other purposes (like
preformatted code, example blocks, ...), which makes it difficult to do
mass replacements, such as a planned follow-up patch that needs to move
all sections one level down.
- it is difficult to remember which level a given underline symbol (=-~^+)
corresponds to, while counting = signs is easy.
This patch changes all two-level titles to one-level titles in the manual.
The bulk of the change was done with the following Python script, except for
the level 1 titles (-----) as these underlines are also used for literal
code blocks.
This patch only changes the titles, no other changes. In
adding-packages-directory.txt, I did add missing newlines between some
titles and their content.
----------------------------------------------------------------------------
#!/usr/bin/env python
import sys
import mmap
import re
for input in sys.argv[1:]:
f = open(input, 'r+')
f.flush()
s = mmap.mmap(f.fileno(), 0)
# Level 0 (top level): ====================== =
# Level 1: ---------------------- ==
# Level 2: ~~~~~~~~~~~~~~~~~~~~~~ ===
# Level 3: ^^^^^^^^^^^^^^^^^^^^^^ ====
# Level 4 (bottom level): ++++++++++++++++++++++ =====
def replace_title(s, symbol, replacement):
pattern = re.compile(r'(.+\n)\%s{2,}\n' % symbol, re.MULTILINE)
return pattern.sub(r'%s \1' % replacement, s)
new = s
new = replace_title(new, '=', '=')
new = replace_title(new, '+', '=====')
new = replace_title(new, '^', '====')
new = replace_title(new, '~', '===')
#new = replace_title(new, '-', '==')
s.seek(0)
s.write(new)
s.resize(s.tell())
s.close()
f.close()
----------------------------------------------------------------------------
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-02 07:47:30 +02:00
|
|
|
=== Tips and tricks
|
2012-11-11 04:14:57 +01:00
|
|
|
|
|
|
|
[[package-name-variable-relation]]
|
manual: use one-line titles instead of two-line titles (trivial)
Asciidoc supports two syntaxes for section titles: two-line titles (title
plus underline consisting of a particular symbol), and one-line titles
(title prefixed with a specific number of = signs).
The two-line title underlines are:
Level 0 (top level): ======================
Level 1: ----------------------
Level 2: ~~~~~~~~~~~~~~~~~~~~~~
Level 3: ^^^^^^^^^^^^^^^^^^^^^^
Level 4 (bottom level): ++++++++++++++++++++++
and the one-line title prefixes:
= Document Title (level 0) =
== Section title (level 1) ==
=== Section title (level 2) ===
==== Section title (level 3) ====
===== Section title (level 4) =====
The buildroot manual is currenly using the two-line titles, but this has
multiple disadvantages:
- asciidoc also uses some of the underline symbols for other purposes (like
preformatted code, example blocks, ...), which makes it difficult to do
mass replacements, such as a planned follow-up patch that needs to move
all sections one level down.
- it is difficult to remember which level a given underline symbol (=-~^+)
corresponds to, while counting = signs is easy.
This patch changes all two-level titles to one-level titles in the manual.
The bulk of the change was done with the following Python script, except for
the level 1 titles (-----) as these underlines are also used for literal
code blocks.
This patch only changes the titles, no other changes. In
adding-packages-directory.txt, I did add missing newlines between some
titles and their content.
----------------------------------------------------------------------------
#!/usr/bin/env python
import sys
import mmap
import re
for input in sys.argv[1:]:
f = open(input, 'r+')
f.flush()
s = mmap.mmap(f.fileno(), 0)
# Level 0 (top level): ====================== =
# Level 1: ---------------------- ==
# Level 2: ~~~~~~~~~~~~~~~~~~~~~~ ===
# Level 3: ^^^^^^^^^^^^^^^^^^^^^^ ====
# Level 4 (bottom level): ++++++++++++++++++++++ =====
def replace_title(s, symbol, replacement):
pattern = re.compile(r'(.+\n)\%s{2,}\n' % symbol, re.MULTILINE)
return pattern.sub(r'%s \1' % replacement, s)
new = s
new = replace_title(new, '=', '=')
new = replace_title(new, '+', '=====')
new = replace_title(new, '^', '====')
new = replace_title(new, '~', '===')
#new = replace_title(new, '-', '==')
s.seek(0)
s.write(new)
s.resize(s.tell())
s.close()
f.close()
----------------------------------------------------------------------------
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-02 07:47:30 +02:00
|
|
|
==== Package name, config entry name and makefile variable relationship
|
2012-11-11 04:14:57 +01:00
|
|
|
|
2012-11-16 05:54:19 +01:00
|
|
|
In Buildroot, there is some relationship between:
|
2012-11-11 04:14:57 +01:00
|
|
|
|
|
|
|
* the _package name_, which is the package directory name (and the
|
|
|
|
name of the +*.mk+ file);
|
|
|
|
|
|
|
|
* the config entry name that is declared in the +Config.in+ file;
|
|
|
|
|
|
|
|
* the makefile variable prefix.
|
|
|
|
|
2012-11-16 05:54:19 +01:00
|
|
|
It is mandatory to maintain consistency between these elements,
|
|
|
|
using the following rules:
|
2012-11-11 04:14:57 +01:00
|
|
|
|
2012-11-27 12:59:17 +01:00
|
|
|
* the package directory and the +*.mk+ name are the _package name_
|
|
|
|
itself (e.g.: +package/foo-bar_boo/foo-bar_boo.mk+);
|
|
|
|
|
|
|
|
* the _make_ target name is the _package name_ itself (e.g.:
|
2012-11-11 04:14:57 +01:00
|
|
|
+foo-bar_boo+);
|
|
|
|
|
|
|
|
* the config entry is the upper case _package name_ with `.` and `-`
|
|
|
|
characters substituted with `_`, prefixed with +BR2_PACKAGE_+ (e.g.:
|
|
|
|
+BR2_PACKAGE_FOO_BAR_BOO+);
|
|
|
|
|
|
|
|
* the +*.mk+ file variable prefix is the upper case _package name_
|
2014-03-20 23:07:30 +01:00
|
|
|
with `.` and `-` characters substituted with `_` (e.g.:
|
2012-11-11 04:14:57 +01:00
|
|
|
+FOO_BAR_BOO_VERSION+).
|
|
|
|
|
|
|
|
|
|
|
|
[[github-download-url]]
|
2014-06-02 17:55:59 +02:00
|
|
|
==== How to add a package from GitHub
|
2012-11-11 04:14:57 +01:00
|
|
|
|
2014-06-02 17:55:59 +02:00
|
|
|
Packages on GitHub often don't have a download area with release tarballs.
|
2012-11-27 12:59:17 +01:00
|
|
|
However, it is possible to download tarballs directly from the repository
|
2014-06-02 17:55:59 +02:00
|
|
|
on GitHub. As GitHub is known to have changed download mechanisms in the
|
2013-12-05 18:20:45 +01:00
|
|
|
past, the 'github' helper function should be used as shown below.
|
2012-11-11 04:14:57 +01:00
|
|
|
|
2012-11-27 12:59:17 +01:00
|
|
|
------------------------
|
2013-11-02 15:57:27 +01:00
|
|
|
FOO_VERSION = v1.0 # tag or full commit ID
|
2013-12-05 18:20:45 +01:00
|
|
|
FOO_SITE = $(call github,<user>,<package>,$(FOO_VERSION))
|
2012-11-27 12:59:17 +01:00
|
|
|
------------------------
|
|
|
|
|
2013-06-07 10:48:45 +02:00
|
|
|
.Notes
|
|
|
|
- The FOO_VERSION can either be a tag or a commit ID.
|
|
|
|
- The tarball name generated by github matches the default one from
|
2013-11-02 15:57:27 +01:00
|
|
|
Buildroot (e.g.: +foo-f6fb6654af62045239caed5950bc6c7971965e60.tar.gz+),
|
2013-06-07 10:48:45 +02:00
|
|
|
so it is not necessary to specify it in the +.mk+ file.
|
2013-11-02 15:57:27 +01:00
|
|
|
- When using a commit ID as version, you should use the full 40 hex characters.
|