Codebase list debiancontributors / c1c9c7a0-d4e1-49e0-842a-e99b021ba3bd/main DATAMINING.rst
c1c9c7a0-d4e1-49e0-842a-e99b021ba3bd/main

Tree @c1c9c7a0-d4e1-49e0-842a-e99b021ba3bd/main (Download .tar.gz)

DATAMINING.rst @c1c9c7a0-d4e1-49e0-842a-e99b021ba3bd/mainraw · history · blame

  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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
===================
dc-tool data mining
===================

dc-tool has several methods of data mining that can be controlled via a
configuration file.

It works like this:

1. Read this documentation and create a configuration file to test.
2. Run ``dc-tool --mine=mysource.conf`` to perform data mining and print
   results to standard output.
3. When you are satisfied of the results, run ``dc-tool --mine=mysource.conf --post``
   to post data to contributors.debian.org. Run that via cron and you have a
   full working data source.

-------------------------
Configuration file syntax
-------------------------

The configuration file follows the usual Debian RFC822/Yaml-like syntax.

If the first group of options does not have a "contribution:" field, it is used
for general configuration of the data source. All other sections define methods
of mining the data you want.


The data source configuration section
=====================================

Example::

  # You don't need this option if you call this file nm.debian.org.conf
  #source: nm.debian.org
  # Auhentication token used to post data. Use a leading '@' as in '@filename'
  # to use the contents of another file as auth token. Do not make this file
  # world-readable!
  auth_token: @secrets/auth_token.txt

The general configuration section has three configurable keywords:

``source``
  Data source name, as configured in contributors.debian.org. If omitted,
  dc-tool will use the configuration file name. If the file name ends in ``.ini``,
  ``.conf`` or ``.cfg``, the extension will be removed.

``auth_token``
  The authentication token used for posting data to the site.

  Anyone with this authentication token can post data for this data source, so
  be careful not to give this file world-readable permissions.

``baseurl``
  You never need this unless you want to test a local copy of the
  contributors.debian.org codebase: it defaults to ``https://contributors.debian.org/``
  but you can change it to submit data to your local development version.


Data mining sections
====================

Example::

  contribution: committer
  # Data mining method
  method: gitdirs
  # Configuration specific to this method
  dirs: /srv/git.debian.org/git/collab-maint/*.git
  url: https://alioth.debian.org/users/{user}/

Each data mining section has at least two configurable keywords:

``contribution``
  Contribution type for this data source, as configured in contributors.debian.org.
  You can have many sections with the same contribution types, and the results
  of their data mining will all be merged.

``method``
  The mining method. There are several mining method available, each with its
  own configuration options, documented below.

The rest of the options are specific to each data mining method. Below is a
full documentation of them.


Data mining methods
===================


bts
---
Parses the debbugs spool directories collecting contributions from mail
headers.

Example::
    contribution: correspondant
    method: bts
    dirs: /srv/bugs.debian.org/spool/db-h/ /srv/bugs.debian.org/spool/archive/
    url: https://bugs.debian.org/cgi-bin/pkgreport.cgi?correspondent={email}

Configuration options
`````````````````````

``dirs`` : Glob, required, default: None.
  debbugs spool directories to scan. You can give
  one or more, and even use shell-style globbing.

``threshold`` : Integer, optional, default: 5.
  Minimum number of mails that need to exist
  in the BTS for an email address to be
  considered

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  ``{email}`` will be replaced with the email address

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``Glob``
  A string with one or more filenames. Globbing is supported. Arguments can
  be quoted to deal with whitespace, but glob characters will always be
  expanded.

``Integer``
  An integer value.

files
-----
Recursively scan directories using file attributes to detect contributions.

Generates `login` types of identifiers, using the usernames of the system
where it is run.

Example::

    contribution: committer
    method: files
    dirs: /srv/cvs.debian.org/cvs/webwml
    url: https://alioth.debian.org/users/{user}/

Configuration options
`````````````````````

``dirs`` : Glob, required, default: None.
  directories to scan. You can give one or more, and
  even use shell-style globbing.

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  ``{user}`` will be replaced with the username

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``Glob``
  A string with one or more filenames. Globbing is supported. Arguments can
  be quoted to deal with whitespace, but glob characters will always be
  expanded.

gitdirs
-------
Scan git directories using file attributes to detect contributions.

Generates `login` types of identifiers, using the usernames of the system
where it is run.

Example::

    contribution: committer
    method: gitdirs
    dirs: /srv/git.debian.org/git/collab-maint/*.git
    url: https://alioth.debian.org/users/{user}/

Configuration options
`````````````````````

``dirs`` : Glob, required, default: None.
  ``.git`` directories to scan. You can give one or more,
  and even use shell-style globbing.

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  ``{user}`` will be replaced with the username

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``Glob``
  A string with one or more filenames. Globbing is supported. Arguments can
  be quoted to deal with whitespace, but glob characters will always be
  expanded.

gitlogs
-------
Scan git logs, taking note of committer and author activity

Generates `email` types of identifiers, trusting whatever is in the git
log.

Example::

    contribution: committer
    method: gitlogs
    dirs: /srv/git.debian.org/git/collab-maint/*.git

Configuration options
`````````````````````

``author_map`` : IdentMap, optional, default: None.
  Convert author emails using the given expressions

``dirs`` : Glob, required, default: None.
  ``.git`` directories to scan. You can give one or more,
  and even use shell-style globbing.

``subdir`` : Char, optional, default: None.
  Limit the scan to subdirectories in the repository.

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  ``{email}`` will be replaced with the email address.

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``Glob``
  A string with one or more filenames. Globbing is supported. Arguments can
  be quoted to deal with whitespace, but glob characters will always be
  expanded.

``IdentMap``
  A string with one or more identifier mapping expressions.
  
  Each expression is on a line by its own. Leading and trailing spaces do not
  matter.
  
  Lines can be in one of two forms:
  
      regexp replace
      regexp replace flags
  
  If regexp, replace or flags contain spaces, they can be shell-quoted.
  
  Regexp and replace use the syntax as found in re.sub. Flags are as found in
  re.X.
  
  For each mapping line, re.sub if called on each value found.

mailfrom
--------
Scan email address from From: headers in mailboxes

Example::

    contribution: developer
    method: mailfrom
    folders: /home/debian/lists/debian-devel-announce/*
    url: http://www.example.com/{email}

Configuration options
`````````````````````

``blacklist`` : Emails, optional, default: None.
  if present, emails from this list will not be
  considered as contributors.

``folders`` : Glob, required, default: None.
  mail folders to scan. You can give one or more,
  and even use shell-style globbing. Mailbox,
  mailbox.gz and Maildir folders are supported.

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  ``{email}`` will be replaced with the email address

``whitelist`` : Emails, optional, default: None.
  if present, only emails from this list will be
  considered as contributors.

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``Emails``
  A list of email addresses, like in email To: or Cc: headers.

``Glob``
  A string with one or more filenames. Globbing is supported. Arguments can
  be quoted to deal with whitespace, but glob characters will always be
  expanded.

mock
----
Generate random contributions for random people

Example::

    identifier_type: email
    method: mock
    count: 10000

Configuration options
`````````````````````

``count`` : Integer, optional, default: 1000.
  Number of contributions to generate.

``identifier_type`` : IdentifierType, optional, default: None.
  identifier type

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's
  contributions. ``{email}`` will be replaced with
  the email address, ``{user}`` will be replaced with
  the user name, ``{fpr}`` will be replaced with
  the user key fingerprint.

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``IdentifierType``
  An identifier type. Can be one of:
  
  ``auto``
    autodetect. "ident" or "Name <ident>" are accepted, and ident can be any
    email, login or OpenPGP fingerprint
  ``login``
    debian.org or Alioth login name.
  ``email``
    email address.
  ``fpr``
    OpenPGP key fingerprint.

``Integer``
  An integer value.

postgres
--------
Perform data mining using a SQL query on a Postgres database.

This requires python-psycopg2 to be installed.

Example::

    contribution: uploader
    method: postgres
    db: service=projectb
    identifier: login
    query:
      SELECT s.install_date as date,
             u.uid as id,
             u.name as desc
        FROM source s
        JOIN fingerprint f ON s.sig_fpr = f.id
        JOIN uid u ON f.uid = u.id
    url: http://qa.debian.org/developer.php?login={id}&comaint=yes

Configuration options
`````````````````````

``db`` : Char, required, default: None.
  database connection string. See `psycopg2.connect
  <http://initd.org/psycopg/docs/module.html#psycopg2.connect>`_
  for details.

``identifier`` : IdentifierType, optional, default: 'auto'.
  type of identifier that is found by this SQL query.

``query`` : Char, required, default: None.
  SQL query used to list contributions. SELECT column field names are
  significant: ``id`` is the contributor name, email, or fingerprint,
  depending on how ``identifier`` is configured. ``date`` is the
  contribution date, as a date or datetime. ``desc`` (optional) is a
  human-readable description for this ``id``, like a person's name.
  All other SELECT columns are ignored, but can be useful to provide
  values for the ``url`` template.

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  Words in curly braces (like ``{id}``) will be
  expanded with the SELECT column of the same name.

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``IdentifierType``
  An identifier type. Can be one of:
  
  ``auto``
    autodetect. "ident" or "Name <ident>" are accepted, and ident can be any
    email, login or OpenPGP fingerprint
  ``login``
    debian.org or Alioth login name.
  ``email``
    email address.
  ``fpr``
    OpenPGP key fingerprint.

svndirs
-------
Scan subversion directories using file attributes to detect contributions.

Generates `login` types of identifiers, using the usernames of the system
where it is run.

Example::

    contribution: committer
    method: svndirs
    dirs: /srv/svn.debian.org/svn/collab-maint
    url: https://alioth.debian.org/users/{user}/

Configuration options
`````````````````````

``dirs`` : Glob, required, default: None.
  subversion directories to scan. You can give one or more,
  and even use shell-style globbing.

``url`` : Char, optional, default: None.
  template used to build URLs to link to people's contributions.
  ``{user}`` will be replaced with the username

Option types
````````````

``Char``
  A string value. Can be any UTF-8 string.

``Glob``
  A string with one or more filenames. Globbing is supported. Arguments can
  be quoted to deal with whitespace, but glob characters will always be
  expanded.