summaryrefslogtreecommitdiff
blob: 4bee052b8917bc19c8eb0308eb5ea6f8d3416b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
\input texinfo.tex    @c -*-texinfo-*-
@c %**start of header
@setfilename ebuild-mode.info
@settitle Major mode for ebuilds and eclasses in Gentoo
@c %**end of header

@copying
This manual is for ebuild-mode, which is a major mode for ebuild
and eclass files.

Copyright @copyright{} 2009-2017 Gentoo Foundation

@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License, version 2 or any
later version published by the Free Software Foundation.
@end quotation
@end copying

@dircategory Gentoo
@dircategory Emacs
@direntry
* ebuild-mode: (ebuild-mode).   Major mode for ebuild and eclass files.
@end direntry


@titlepage
@title ebuild-mode 1.38
@subtitle Major mode for ebuilds and eclasses in Gentoo
@author Christian Faulhammer
@page
@insertcopying
@end titlepage

@node Top

@contents

@top ebuild-mode: An introduction
This collection of modes will help the user to efficiently write and
edit ebuilds and eclasses which are special to Gentoo,
a meta-distribution with various targets (Linux distribution, prefixed
environments in other operating systems, and integration of other
kernels and userlands like the BSDs).

Ebuilds describe the build process and dependencies of a software
package to automatically compile and install it under the control of a
package manager.  They are simple text files, based on Bash shell
scripts and there easy to create.  Eclasses are comparable to a library
which provides generic functions that a set of ebuilds can use by
sourcing it on request.

ebuild-mode provides a major mode to edit the above two file types.
Other features are the execution of often needed commands
(like KEYWORDS manipulation) or fast-track creation of new ebuilds
by skeleton support.

@menu
* Commands:: What ebuild-mode provides.
* ebuild-mode:: Editing ebuilds.
* eclass-mode:: Editing eclasses.
* gentoo-newsitem-mode:: Editing GLEP 42 news items.
@end menu

@node Commands, ebuild-mode, Top, Top
@chapter Available functionality
Two packages are available for installation:
@code{app-emacs/ebuild-mode} and @code{app-xemacs/ebuild-mode}
(there is support for GNU Emacs and XEmacs from the same source).  When
installed through the normal package management in Gentoo and proper
configuration of Emacs, ebuild-mode loads the appropriate mode on
opening files with the extensions @code{.ebuild} and @code{.eclass}.
As the ebuild format is based on the Bash syntax, sh-mode is called as
a base, where ebuild specific things are added/changed on top.

If font-locking is enabled, keywords are highlighted, both the standard
set defined by the package manager and special functions from all common
eclasses.  Missing highlighting should be reported on
@code{https://bugs.gentoo.org/}.

Generally all functionality is reachable through direct commands,
keybindings (described later) and menu entries, if the latter is
activated.  So every user has the choice for his/her preferred way of
interfacing with Emacs.

@node ebuild-mode, eclass-mode, Commands, Top
@chapter ebuild-mode
@section Writing a new ebuild
Starting a completely new ebuild from scratch is best done by inserting
an ebuild skeleton.  The command @code{ebuild-mode-skeleton} does this
for you and can be called via @kbd{C-c C-n}.  You are prompted for the
always needed information, while having the possibility to give more
than one item (in LICENSE for example) and choose via tab completion
from the possible choices.  Giving an empty input on items, that are not
mandatory, will remove it from the buffer.  After that adding custom
modifications is simple and straightforward.

@section Keywording
In ebuild-mode an interface to manipulation of the KEYWORDS variable is
provided in two different ways:
@enumerate
@item
Prompt for actions with tab completion or
@item
ekeyword syntax.
@end enumerate

The first command is called @code{ebuild-mode-keyword} (bound to
@kbd{C-c C-k}) and initially asks for the action to take which is one
out of
@table @code
@item drop
Remove the architecture entirely.
@item mask
State with a prefixed minus sign that the architecture is definitely not
supported.
@item stable
Mark as stable.
@item unstable
Mark as testing.
@end table

After choosing the action the architectures to handle need to be chosen.
Tab completion is available for all possible architectures.

Using the ekeyword syntax for the @code{ebuild-mode-ekeyword} command
(@kbd{C-c C-y} as keybinding) is equal what you can pass as argument to
said utility from the @code{app-portage/gentoolkit-dev} package:
@table @code
@item ^<arch>
Remove the architecture entirely.
@item -<arch>
State with a prefixed minus sign that the architecture is definitely not
supported.
@item <arch>
Mark as stable.
@item ~<arch>
Mark as testing.
@end table
It is possible to use @code{all} instead of an individual architecture
which works on all currently available architectures for the ebuild.

Handy for version/revision bumps is to mark all architectures from a
copied stable ebuild as testing.  The keybinding @kbd{C-c C-b} calling
the @code{ebuild-mode-all-keywords-unstable} command can be used for
this task.

@section Testing and interfacing with Portage

Apart from the normal external program calls via @kbd{M-!}, ebuild-mode
provides a direct interface to the ebuild utility found in the Portage
program suite.  @kbd{C-c C-e} calls @code{ebuild-run-command} which asks
for one of the possible actions as argument.  See the man page of ebuild
what actions are provided.

Creating a ChangeLog entry via the echangelog program from
@code{app-portage/gentoolkit-dev} is achieved via
@code{ebuild-run-echangelog} or @kbd{C-c C-a}.  Only type in the desired
text, formatting, time stamps and changed files are added automatically.

@section Keybindings
@table @kbd
@item C-c C-n
Insert a skeleton ebuild contents, with prompts for desired eclass
inclusions, licenses and USE flags.
@item C-c C-k
Keywording is done via prompts that narrows down your choices which
architectures to mark as testing, dropped among other things.
@item C-c C-y
Generate architecture keywords with the syntax from the ekeyword tool.
@item C-c C-b
Mark all architectures as testing.  Handy for version/revision bumps.
@item C-c C-e
Run Portage's ebuild command, you are prompted for the phase you want.
@item C-c C-a
Create a ChangeLog entry.
@end table

@node eclass-mode, gentoo-newsitem-mode, ebuild-mode, Top
@chapter eclass-mode
There is no special eclass-mode but ebuild-mode is used without the
commands that make no sense in eclasses.

@node gentoo-newsitem-mode, , eclass-mode, Top
@chapter gentoo-newsitem-mode for GLEP 42 news items
This mode supports the highlighting of relevant keywords for GLEP 42
news items.  These news items get displayed if special criteria for
installed packages or profiles are met on the user's system.  Special
upgrade instructions or other important news are then brought to the
notice of the user through the package manager.  As it is a seldom task
for a developer to write a news item, some assistance is surely welcome
when doing so, but GLEP 42 stays the reference for the whole process.

It gets automatically loaded when a file name matches the criteria of
GLEP 42 (see there for details), but can also be invoked through the
@code{gentoo-newsitem-mode} function.  The only available keybinding is
@kbd{C-c C-n} which starts a skeleton assistant similar to the one
available in @code{ebuild-mode}.  All mandatory information are asked
from the user so no item is forgotten.

@bye