You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/general.rst
+83-25Lines changed: 83 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,10 @@ General
7
7
AboutCode Toolkit Defined
8
8
=========================
9
9
10
-
AboutCode Toolkit is a tool for your software development team to document your code inside your codebase, typically in preparation for a product release, side-by-side with the actual code. ABOUT file(s) have a simple, standard format that identifies components and their associated licenses. The current AboutCode Toolkit subcommands are:
10
+
AboutCode Toolkit is a tool for your software development team to document your code
11
+
inside your codebase, typically in preparation for a product release, side-by-side with the
12
+
actual code. ABOUT file(s) have a simple, standard format that identifies components and their
13
+
associated licenses. The current AboutCode Toolkit subcommands are:
11
14
12
15
- **attrib**: Generate a Product Attribution notice document from your ABOUT file(s), JSON, CSV or XLSX. You can also generate documents for other purposes (such as a License Reference) by varying your input control file and your template.
13
16
@@ -43,7 +46,11 @@ Using gen to Generate ABOUT file(s)
43
46
Prepare Your Software Inventory for gen Standard Field Names
You should start with a software inventory of your codebase in spreadsheet or JSON format. You need to prepare a version of it that will identify the field values that you want to appear in your .ABOUT files. Note the following standard field names (defined in the ABOUT File Specification), which gen will use to look for the values that it will store in your generated .ABOUT files, as well as any additional text files that you identify, which it will copy and store next to the .ABOUT files.
49
+
You should start with a software inventory of your codebase in spreadsheet or JSON format. You need
50
+
to prepare a version of it that will identify the field values that you want to appear in your .ABOUT
51
+
files. Note the following standard field names (defined in the ABOUT File Specification), which gen
52
+
will use to look for the values that it will store in your generated .ABOUT files, as well as any
53
+
additional text files that you identify, which it will copy and store next to the .ABOUT files.
47
54
48
55
.. list-table::
49
56
:widths: 10 45 45
@@ -171,9 +178,12 @@ You should start with a software inventory of your codebase in spreadsheet or JS
171
178
Fields Renaming and Optional Custom Fields
172
179
------------------------------------------
173
180
174
-
Since your input's field name may not match with the AboutCode Toolkit standard field name, you can use the transform subcommand to do the transformation.
181
+
Since your input's field name may not match with the AboutCode Toolkit standard field name,
182
+
you can use the transform subcommand to do the transformation.
175
183
176
-
A transform configuration file is used to describe which transformations and validations to apply to a source CSV/JSON/XLSX file. This is a simple text file using YAML format, using the same format as an .ABOUT file.
184
+
A transform configuration file is used to describe which transformations and validations to
185
+
apply to a source CSV/JSON/XLSX file. This is a simple text file using YAML format,
186
+
using the same format as an .ABOUT file.
177
187
178
188
The attributes that can be set in a configuration file are:
179
189
@@ -186,12 +196,15 @@ The attributes that can be set in a configuration file are:
186
196
bar : foo
187
197
188
198
189
-
The renaming is always applied first before other transforms and checks. All other field names referenced below are AFTER the renaming have been applied.
190
-
For instance with this configuration, the field "Directory/Location" will be renamed to "about_resource" and "foo" to "bar":
199
+
The renaming is always applied first before other transforms and checks. All other
200
+
field names referenced below are AFTER the renaming have been applied.
201
+
For instance with this configuration, the field "Directory/Location" will be
202
+
renamed to "about_resource" and "foo" to "bar":
191
203
192
204
- required_fields: An optional list of required field names that must have a value, beyond the standard field names. If a source CSV/JSON/XLSX does not have such a field or an entry is missing a value for a required field, an error is reported.
193
205
194
-
For instance with this configuration, an error will be reported if the fields "name" and "version" are missing, or if any entry does not have a value set for these fields:
206
+
For instance with this configuration, an error will be reported if the fields "name"
207
+
and "version" are missing, or if any entry does not have a value set for these fields:
195
208
196
209
.. code-block:: none
197
210
@@ -222,7 +235,9 @@ For instance with this configuration, the target file will not contain the "type
222
235
Run gen to Generate ABOUT file(s)
223
236
---------------------------------
224
237
225
-
When your software inventory is ready, you can save it as a .csv, .json or .xlsx file, and use it as input to run gen to generate ABOUT file(s). The official gen parameters are defined here: :ref:`reference`
238
+
When your software inventory is ready, you can save it as a .csv, .json or .xlsx file,
239
+
and use it as input to run gen to generate ABOUT file(s). The official gen parameters
240
+
are defined here: :ref:`reference`
226
241
227
242
Here is an example of a gen command:
228
243
@@ -240,7 +255,8 @@ This gen example command does the following:
240
255
241
256
- Specifies a target output directory.
242
257
243
-
Review the generated ABOUT file(s) to determine if it meets your requirements. Here is a simple example of a linux-redhat-7.2.ABOUT file that documents the directory /linux-redhat-7.2/ :
258
+
Review the generated ABOUT file(s) to determine if it meets your requirements. Here is a
259
+
simple example of a linux-redhat-7.2.ABOUT file that documents the directory /linux-redhat-7.2/ :
244
260
245
261
.. code-block:: none
246
262
@@ -259,28 +275,43 @@ Review the generated ABOUT file(s) to determine if it meets your requirements. H
259
275
owner: Red Hat
260
276
redistribute: Y
261
277
262
-
You can make appropriate changes to your input software inventory and then run gen as often as necessary to replace the ABOUT file(s) with the improved version.
278
+
You can make appropriate changes to your input software inventory and then run
279
+
gen as often as necessary to replace the ABOUT file(s) with the improved version.
263
280
264
281
Using attrib to Generate a Product Attribution Notice Package
If you choose to do that, you will most likely want to edit the generated .html file to provide header information about your own organization and product.
292
+
If you choose to do that, you will most likely want to edit the generated .html
293
+
file to provide header information about your own organization and product.
275
294
276
-
Running attrib with the default_html.template file is probably your best choice when you are still testing your AboutCode Toolkit process. Once you have a good understanding of the generated output, you can customize the template to provide the standard text that serve your needs. You can also create alternative versions of the template to use attrib to generate other kinds of documents, such as a License Reference.
295
+
Running attrib with the default_html.template file is probably your best choice when
296
+
you are still testing your AboutCode Toolkit process. Once you have a good understanding
297
+
of the generated output, you can customize the template to provide the standard text that
298
+
serve your needs. You can also create alternative versions of the template to use attrib
299
+
to generate other kinds of documents, such as a License Reference.
277
300
278
301
Use jinja2 Features to Customize Your Attribution Template
The attrib tool makes use of the open source python library jinja2 (http://jinja.pocoo.org/docs/dev/templates/) in order to extend .html capabilities and transform AboutCode Toolkit input data into the final format of the generated attribution file. The ``default_html.template`` file contains text that complies with jinja2 syntax specifications in order to support grouping, ordering, formatting and presentation of your AboutCode Toolkit data. If your attribution requirements are complex, you may wish to study the jinja2 documentation to modify the default_html.template logic or create your own template; alternatively, here are a few relatively simple concepts that relate to the attribution document domain.
304
+
The attrib tool makes use of the open source python library jinja2
305
+
(http://jinja.pocoo.org/docs/dev/templates/) in order to extend .html capabilities and
306
+
transform AboutCode Toolkit input data into the final format of the generated attribution file.
307
+
``default_html.template`` file contains text that complies with jinja2 syntax specifications
308
+
in order to support grouping, ordering, formatting and presentation of your AboutCode
309
+
Toolkit data. If your attribution requirements are complex, you may wish to study the jinja2
310
+
documentation to modify the default_html.template logic or create your own template; alternatively,
311
+
here are a few relatively simple concepts that relate to the attribution document domain.
282
312
283
-
The simplest modifications to the default_html.template file involve the labels and standard text. For example, here is the default template text for the Table of Contents:
313
+
The simplest modifications to the default_html.template file involve the labels and standard
314
+
text. For example, here is the default template text for the Table of Contents:
284
315
285
316
.. code-block:: none
286
317
@@ -292,7 +323,8 @@ The simplest modifications to the default_html.template file involve the labels
292
323
{% endfor %}
293
324
</div>
294
325
295
-
If you would prefer something other than a simple space between the component name and the component version, you can modify it to something like this:
326
+
If you would prefer something other than a simple space between the component name and
327
+
the component version, you can modify it to something like this:
296
328
297
329
.. code-block:: none
298
330
@@ -304,9 +336,20 @@ If you would prefer something other than a simple space between the component na
304
336
{% endfor %}
305
337
</div>
306
338
307
-
The ``if about_object.version.value`` is checking for a component version, and if one exists it generates output text that is either a space followed by the actual version value, or, as in this customized template, it generates output text as " - Version ", followed by the actual version value. You will, of course, want to test your output to get exactly the results that you need.
308
-
309
-
Note that you can actually use attrib to generate an AboutCode Toolkit-sourced document of any kind for varying business purposes, and you may want to change the grouping/ordering of the data for different reporting purposes. (Here we get into somewhat more complex usage of jinja2 features, and you may wish to consult the jinja2 documentation to reach a more comprehensive understanding of the syntax and features.) The default ordering is by component, but In the following example, which is intended to support a "license reference" rather than an attribution document, the customized template modifies the data grouping to use a custom field called "confirmed_license":
339
+
The ``if about_object.version.value`` is checking for a component version, and if one
340
+
exists it generates output text that is either a space followed by the actual version
341
+
value, or, as in this customized template, it generates output text as " - Version ",
342
+
followed by the actual version value. You will, of course, want to test your output to
343
+
get exactly the results that you need.
344
+
345
+
Note that you can actually use attrib to generate an AboutCode Toolkit-sourced document
346
+
of any kind for varying business purposes, and you may want to change the grouping/ordering
347
+
of the data for different reporting purposes. (Here we get into somewhat more complex usage of
348
+
jinja2 features, and you may wish to consult the jinja2 documentation to reach a more comprehensive
349
+
understanding of the syntax and features.) The default ordering is by component, but In the
350
+
following example, which is intended to support a "license reference" rather than an attribution
351
+
document, the customized template modifies the data grouping to use a custom field
352
+
called "confirmed_license":
310
353
311
354
.. code-block:: none
312
355
@@ -321,7 +364,10 @@ Note that you can actually use attrib to generate an AboutCode Toolkit-sourced d
321
364
{% endfor %}
322
365
</div>
323
366
324
-
After the table of contents, this example customized template continues with the license details using the jinja2 for-loop capabilities. Notice that the variable "group.grouper.value" is actually the license name here, and that “License URL” can be any URL that you have chosen to store in your .ABOUT files:
367
+
After the table of contents, this example customized template continues with the license details
368
+
using the jinja2 for-loop capabilities. Notice that the variable "group.grouper.value" is
369
+
actually the license name here, and that “License URL” can be any URL that you have chosen
370
+
to store in your .ABOUT files:
325
371
326
372
.. code-block:: none
327
373
@@ -362,12 +408,16 @@ After the table of contents, this example customized template continues with the
362
408
{% endfor %}
363
409
<hr>
364
410
365
-
In summary, you can start with simple, cosmetic customizations to the default_html.template, and gradually introduce a more complex structure to the attrib output to meet varying business requirements.
411
+
In summary, you can start with simple, cosmetic customizations to the default_html.template,
412
+
and gradually introduce a more complex structure to the attrib output to meet
413
+
varying business requirements.
366
414
367
415
Run attrib to Generate a Product Attribution Notice Package
You can then run the attrib to generate your product attribution notice package from the generated ABOUT file(s) or from an inventory (.csv/.json/.xlsx). The official attrib parameters are defined here: :ref:`reference`
418
+
You can then run the attrib to generate your product attribution notice package from the
419
+
generated ABOUT file(s) or from an inventory (.csv/.json/.xlsx). The official attrib
420
+
parameters are defined here: :ref:`reference`
371
421
372
422
Here is an example of a attrib command:
373
423
@@ -389,11 +439,19 @@ Using inventory to Generate a Software Inventory
389
439
Generate a Software Inventory of Your Codebase from ABOUT file(s)
One of the major features of the ABOUT File specification is that the .ABOUT files are very simple text files that can be created, viewed and edited using any standard text editor. Your software development and maintenance processes may require or encourage your software developers to maintain .ABOUT files and/or associated text files manually. For example, when a developer addresses a software licensing issue with a component, it is appropriate to adjust the associated ABOUT file(s) manually.
442
+
One of the major features of the ABOUT File specification is that the .ABOUT files
443
+
are very simple text files that can be created, viewed and edited using any standard
444
+
text editor. Your software development and maintenance processes may require or encourage
445
+
your software developers to maintain .ABOUT files and/or associated text files manually.
446
+
For example, when a developer addresses a software licensing issue with a component,
447
+
it is appropriate to adjust the associated ABOUT file(s) manually.
393
448
394
-
If your organization adopts the practice of manually creating and maintaining ABOUT file(s), you can easily re-create your software inventory from your codebase using inventory. The official inventory parameters are defined here: :ref:`reference`
449
+
If your organization adopts the practice of manually creating and maintaining ABOUT file(s),
450
+
you can easily re-create your software inventory from your codebase using inventory.
451
+
The official inventory parameters are defined here: :ref:`reference`
395
452
396
-
A successful execution of inventory will create a complete software inventory in .csv, .json or .xlsx format based on defined format.
453
+
A successful execution of inventory will create a complete software inventory in .csv,
Copy file name to clipboardExpand all lines: docs/source/reference.rst
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,8 @@ Options
80
80
Purpose
81
81
-------
82
82
83
-
Generate an attribution file which contains license information from the INPUT along with the license text.
83
+
Generate an attribution file which contains license information
84
+
from the INPUT along with the license text.
84
85
85
86
Assume the following:
86
87
@@ -254,7 +255,8 @@ Options
254
255
Purpose
255
256
-------
256
257
257
-
Collect sources that have 'redistribute' flagged as 'True' in .ABOUT files or inventory to the output location.
258
+
Collect sources that have 'redistribute' flagged as 'True' in .ABOUT
259
+
files or inventory to the output location.
258
260
259
261
Details
260
262
^^^^^^^
@@ -427,7 +429,8 @@ Options
427
429
Purpose
428
430
-------
429
431
430
-
Fetch licenses (Default: ScanCode LicenseDB) in the license_expression field and save to the output location.
432
+
Fetch licenses (Default: ScanCode LicenseDB) in the license_expression
433
+
field and save to the output location.
431
434
432
435
Details
433
436
^^^^^^^
@@ -590,7 +593,9 @@ Options
590
593
Purpose
591
594
-------
592
595
593
-
Transform the CSV/JSON/XLSX file at LOCATION by applying renamings, filters and checks and then write a new CSV/JSON/Excel to OUTPUT (Format for input and output need to be the same).
596
+
Transform the CSV/JSON/XLSX file at LOCATION by applying renamings,
597
+
filters and checks and then write a new CSV/JSON/Excel to OUTPUT
598
+
(Format for input and output need to be the same).
594
599
595
600
Details
596
601
^^^^^^^
@@ -728,4 +733,6 @@ output.csv
728
733
729
734
Special Notes
730
735
-------------
731
-
When using the field_filters configuration, all the standard required columns (about_resource and name) and the user defined required_fields need to be included.
736
+
When using the field_filters configuration, all the standard required
737
+
columns (about_resource and name) and the user defined required_fields
0 commit comments