]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/contributor/lsr-work.itexi
01b136a470b5559cdfc317495efdb80249b35e31
[lilypond.git] / Documentation / contributor / lsr-work.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node LSR work
3 @chapter LSR work
4
5 @menu
6 * Introduction to LSR::
7 * Adding and editing snippets::
8 * Approving snippets::
9 * LSR to Git::
10 * Fixing snippets in LilyPond sources::
11 * Renaming a snippet::
12 * Updating LSR to a new version::
13 @end menu
14
15
16 @node Introduction to LSR
17 @section Introduction to LSR
18
19 The
20 @uref{http://lsr.dsi.unimi.it/, LilyPond Snippet Repository (LSR)}
21 is a collection of lilypond examples.  A subset of these examples
22 are automatically imported into the documentation, making it easy
23 for users to contribute to the docs without learning Git and
24 Texinfo.
25
26
27 @node Adding and editing snippets
28 @section Adding and editing snippets
29
30 @subheading General guidelines
31
32 When you create (or find!) a nice snippet, if it supported by LilyPond
33 version running on LSR, please add it to LSR.  Go to
34 @uref{http://lsr.dsi.unimi.it/, LSR} and log in -- if you haven't
35 already, create an account.  Follow the instructions on the website.
36 These instructions also explain how to modify existing snippets.
37
38 If you think the snippet is particularly informative and you think it
39 should be included in the documentation, tag it with @qq{docs} and one
40 or more other categories, or ask somebody who has editing permissions to
41 do it on the development list.
42
43 Please make sure that the lilypond code follows the guidelines in
44 @ref{LilyPond formatting}.
45
46 If a new snippet created for documentation purposes compiles with
47 LilyPond version currently on LSR, it should be added to LSR, and a
48 reference to the snippet should be added to the documentation.
49
50 If the new snippet uses new features that are not available in the
51 current LSR version, the snippet should be added to
52 @file{Documentation/@/snippets/@/new} and a reference should be added to the
53 manual.
54
55 Snippets created or updated in @file{Documentation/@/snippets/@/new} should
56 be copied to @file{Documentation/@/snippets} by invoking at top of the
57 source tree
58
59 @example
60 scripts/auxiliar/makelsr.py
61 @end example
62
63 @noindent
64 This also copies translated texidoc fields and snippet titles into
65 snippets in @file{Documentation/@/snippets}.  Note: this, in turn, could
66 make the translated texidoc fields to appear as out of sync when you
67 run @code{make check-translation}, if the originals changed from the
68 last translation update, even if the translations are also updated;
69 see @ref{Documentation translation maintenance} for details about
70 updating the docs; in particular, see @ref{Updating translation
71 committishes} to learn how to mark these translated fields as fully
72 updated.
73
74 Be sure that @command{make doc} runs successfully before submitting a
75 patch, to prevent breaking compilation.
76
77 @subheading Formatting snippets in @file{Documentation/@/snippets/@/new}
78
79 When adding a file to this directory, please start the file with
80
81 @example
82 \version "2.x.y"
83 \header @{
84   lsrtags = "rhythms,expressive-marks"  % use existing LSR tags other than
85 %   'docs'; see makelsr.py for the list of tags used to sort snippets.
86   texidoc = "This code demonstrates ..."  % this will be formated by Texinfo
87   doctitle = "Snippet title"  % please put this at the end so that
88     the '% begin verbatim' mark is added correctly by makelsr.py.
89 @}
90 @end example
91
92 \noindent
93 and name the file @file{snippet@/-title@/.ly}.
94
95
96 @node Approving snippets
97 @section Approving snippets
98
99 The main task of LSR editors is approving snippets.  To find a list of
100 unapproved snippets, log into @uref{http://lsr.dsi.unimi.it/, LSR} and
101 select @qq{No} from the dropdown menu to the right of the word
102 @qq{Approved} at the bottom of the interface, then click
103 @qq{Enable filter}.
104
105 Check each snippet:
106
107 @enumerate
108
109 @item
110 Does the snippet make sense and does what the author claims that
111 it does?  If you think the snippet is particularly helpful, add
112 the @qq{docs} tag and at least one other tag.
113
114 @item
115 If the snippet is tagged with @qq{docs}, check to see if it
116 matches our guidelines for @ref{LilyPond formatting}.
117
118 Also, snippets tagged with @qq{docs} should not be explaining
119 (replicating) existing material in the docs.  They should not
120 refer to the docs; the docs should refer to them.
121
122 @item
123 If the snippet uses scheme, check that everything looks good and
124 there are no security risks.
125
126 @warning{Somebody could sneak a @code{#'(system "rm -rf /")}
127 command into our source tree if you do not do this!  Take this
128 step @strong{VERY SERIOUSLY}.}
129
130 @end enumerate
131
132
133 @node LSR to Git
134 @section LSR to Git
135
136 @enumerate
137
138 @item
139 Make sure that @command{convert-ly} and @command{lilypond} commands in
140 current PATH are in a bleeding edge version -- latest release from
141 master branch, or even better a fresh snapshot from Git master branch.
142
143 @item
144 From the top source directory, run:
145
146 @example
147 wget http://lsr.dsi.unimi.it/download/lsr-snippets-docs-@var{YYYY-MM-DD}.tar.gz
148 tar -xzf lsr-snippets-docs-@var{YYYY-MM-DD}.tar.gz
149 scripts/auxiliar/makelsr.py lsr-snippets-docs-@var{YYYY-MM-DD}
150 @end example
151
152 @noindent
153 where @var{YYYY-MM-DD} is the current date, e.g. 2009-02-28.
154
155 @item
156 Follow the instructions printed on the console to manually check for
157 unsafe files.
158
159 @warning{Somebody could sneak a @code{#'(system "rm -rf /")}
160 command into our source tree if you do not do this!  Take this
161 step @strong{VERY SERIOUSLY}.}
162
163 @item
164 Do a git add / commit / push.
165
166 @end enumerate
167
168 Note that whenever there is one snippet from
169 @file{Documentation/@/snippets/@/new} and the other from LSR with the same
170 file name, the one from @file{Documentation/@/snippets/@/new} will be copied
171 by @command{makelsr.py}.
172
173
174 @node Fixing snippets in LilyPond sources
175 @section Fixing snippets in LilyPond sources
176
177 In case some snippet from @file{Documentation/@/snippets} causes the
178 documentation compilation to fail, the following steps should be
179 followed to fix it reliably.
180
181 @enumerate
182
183 @item
184 Look up the snippet filename @file{@var{foo}@/.ly} in the error output
185 or log, then fix the file @file{Documentation/@/snippets/@/@var{foo}@/.ly} to make the
186 documentation build successfully.
187
188 @item
189 Determine where it comes from by looking at its first line, e.g. run
190
191 @example
192 head -1 Documentation/snippets/@var{foo}.ly
193 @end example
194
195 @item
196 @strong{In case the snippet comes from LSR}, apply the fix to the
197 snippet in LSR and send a notification email to a LSR editor with CC to
198 the development list -- see @ref{Adding and editing snippets}.  The
199 failure may sometimes not be caused by the snippet in LSR but by the
200 syntax conversion made by @command{convert-ly}; in this case, try to fix
201 @command{convert-ly} or report the problem on the development list, then
202 run @command{makelsr.py} again, see @ref{LSR to Git}.  In some cases,
203 when some features has been introduced or vastly changed so it requires
204 (or takes significant advantage of) important changes in the snippet, it
205 is simpler and recommended to write a new version of the snippet in
206 @file{Documentation/@/snippets/@/new}, then run @command{makelsr.py}.
207
208 @item
209 @strong{In case the snippet comes from}
210 @file{Documentation/@/snippets/@/new}, apply in
211 @file{Documentation/@/snippets/@/new/@/@var{foo}@/.ly} the same fix you did in
212 @file{Documentation/@/snippets/@/@var{foo}@/.ly}.  In case the build failure
213 was caused by a translation string, you may have to fix
214 @file{input/@/texidocs/@/@var{foo}@/.texidoc} instead.
215
216 @item
217 In any case, commit all changes to Git.
218
219 @end enumerate
220
221
222 @node Renaming a snippet
223 @section Renaming a snippet
224
225 Due to the potential duality of snippets (i.e. they may exist both
226 in the LSR database, and in @code{Documentation/snippets/new/}),
227 this process is a bit more involved than we might like.
228
229 @enumerate
230 @item
231 Send an email LSR editor, requesting the renaming.
232
233 @item
234 The LSR editor does the renaming (or debates the topic with you),
235 then warns the LSR-to-git person (wanted: better title) about the
236 renaming.
237
238 @item
239 LSR-to-git person does his normal job, but then also renames any
240 copies of the snippets in @code{Documentation/snippets/new/}, and
241 any instances of the snippet name in the documentation.
242
243 @code{git grep} is highly recommended for this task.
244
245 @end enumerate
246
247
248 @node Updating LSR to a new version
249 @section Updating LSR to a new version
250
251 To update LSR, perform the following steps:
252
253 @enumerate
254
255 @item
256 Download the latest snippet tarball, extract it, and run
257 @code{convert-ly} on all files using the command-line option
258 @code{--to=VERSION} to ensure snippets are updated to the
259 correct stable version.
260
261 @item
262 Copy relevant snippets (i.e., snippets whose version is equal to or less
263 than the new version of LilyPond) from
264 @file{Documentation/@/snippets/@/new/} into the tarball.
265
266 You must not rename any files during this, or the next, stage.
267
268 @item
269 Verify that all files compile with the new version of LilyPond,
270 ideally without any warnings or errors.  To ease the process,
271 you may use the shell script that appears after this list.
272
273 Due to the workload involved, we @emph{do not} require that you
274 verify that all snippets produce the expected output.  If you
275 happen to notice any such snippets and can fix them, great; but as
276 long as all snippets compile, don't delay this step due to some
277 weird output.  If a snippet is broken, the hordes of willing
278 web-2.0 volunteers will fix it.  It's not our problem.
279
280 @item
281 Create a tarball and send it back to Sebastiano.
282
283 @item
284 When LSR has been updated, download another snippet tarball, verify that
285 the relevant snippets from @file{Documentation/@/snippets/@/new/} were
286 included, then delete those snippets from
287 @file{Documentation/@/snippets/@/new/}.
288
289 @end enumerate
290
291
292 Here is a shell script to run all @code{.ly} files in a directory
293 and redirect terminal output to text files, which are then
294 searched for the word "failed" to see which snippets do not compile.
295
296 @example
297 #!/bin/bash
298
299 for LILYFILE in *.ly
300 do
301   STEM=$(basename "$LILYFILE" .ly)
302   echo "running $LILYFILE..."
303   lilypond --format=png -ddelete-intermediate-files "$LILYFILE" >& "$STEM".txt
304 done
305
306 grep failed *.txt
307 @end example