~launchpad-pqm/launchpad/devel

7675.1090.12 by Jeroen Vermeulen
Unified archive name suffixes.
1
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
11411.6.1 by Julian Edwards
Move archive enums to enums.py
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
"""Enumerations used in the lp/soyuz modules."""
5
6
__metaclass__ = type
7
__all__ = [
11411.6.4 by Julian Edwards
move ArchivePermissionType
8
    'ArchiveJobType',
9
    'ArchivePermissionType',
11411.6.2 by Julian Edwards
Change code imports for ArchivePurpose and ArchiveStatus
10
    'ArchivePurpose',
11
    'ArchiveStatus',
11411.6.5 by Julian Edwards
move ArchiveSubscriberStatus
12
    'ArchiveSubscriberStatus',
7675.1090.12 by Jeroen Vermeulen
Unified archive name suffixes.
13
    'archive_suffixes',
11411.6.6 by Julian Edwards
move BinaryPackageFormat and BinaryPackageFileType
14
    'BinaryPackageFileType',
15
    'BinaryPackageFormat',
7675.1176.9 by Jeroen Vermeulen
Adapter: PackageCopyPolicy to ICopyPolicy.
16
    'PackageCopyPolicy',
11411.6.8 by Julian Edwards
Move PackageDiffStatus
17
    'PackageCopyStatus',
18
    'PackageDiffStatus',
11411.6.12 by Julian Edwards
Move PackagePublishingStatus/Priority
19
    'PackagePublishingPriority',
20
    'PackagePublishingStatus',
11411.6.9 by Julian Edwards
Move PackageUploadStatus and PackageUploadCustomFormat
21
    'PackageUploadCustomFormat',
22
    'PackageUploadStatus',
13785.8.6 by Julian Edwards
Move another regex into enums.py
23
    're_bug_numbers',
13785.8.1 by Julian Edwards
Add regexes to enums.py that detect bug closing numbers in changelogs.
24
    're_closes',
25
    're_lp_closes',
11411.6.10 by Julian Edwards
Move PackageUploadCustomFormat again
26
    'SourcePackageFormat',
11411.6.1 by Julian Edwards
Move archive enums to enums.py
27
    ]
28
13785.8.1 by Julian Edwards
Add regexes to enums.py that detect bug closing numbers in changelogs.
29
import re
30
11411.6.1 by Julian Edwards
Move archive enums to enums.py
31
from lazr.enum import (
32
    DBEnumeratedType,
33
    DBItem,
34
    )
35
13785.8.2 by Julian Edwards
Add explanatory comment
36
# Regexes that match bug numbers for closing in change logs.
13785.8.1 by Julian Edwards
Add regexes to enums.py that detect bug closing numbers in changelogs.
37
re_closes = re.compile(
38
    r"closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*", re.I)
39
re_lp_closes = re.compile(r"lp:\s+\#\d+(?:,\s*\#\d+)*", re.I)
13785.8.6 by Julian Edwards
Move another regex into enums.py
40
re_bug_numbers = re.compile(r"\#?\s?(\d+)")
13785.8.1 by Julian Edwards
Add regexes to enums.py that detect bug closing numbers in changelogs.
41
42
11411.6.4 by Julian Edwards
move ArchivePermissionType
43
class ArchiveJobType(DBEnumeratedType):
44
    """Values that IArchiveJob.job_type can take."""
45
46
    COPY_ARCHIVE = DBItem(0, """
47
        Create a copy archive.
48
49
        This job creates a copy archive from the current state of
50
        the archive.
51
        """)
52
53
54
class ArchivePermissionType(DBEnumeratedType):
55
    """Archive Permission Type.
56
57
    The permission being granted, such as upload rights, or queue
58
    manipulation rights.
59
    """
60
61
    UPLOAD = DBItem(1, """
62
        Archive Upload Rights
63
64
        This permission allows a user to upload.
65
        """)
66
67
    QUEUE_ADMIN = DBItem(2, """
68
        Queue Administration Rights
69
70
        This permission allows a user to administer the distroseries
71
        upload queue.
72
        """)
73
74
11411.6.1 by Julian Edwards
Move archive enums to enums.py
75
class ArchivePurpose(DBEnumeratedType):
76
    """The purpose, or type, of an archive.
77
78
    A distribution can be associated with different archives and this
79
    schema item enumerates the different archive types and their purpose.
80
81
    For example, Partner/ISV software in ubuntu is stored in a separate
82
    archive. PPAs are separate archives and contain packages that 'overlay'
83
    the ubuntu PRIMARY archive.
84
    """
85
86
    PRIMARY = DBItem(1, """
87
        Primary Archive
88
89
        This is the primary Ubuntu archive.
90
        """)
91
92
    PPA = DBItem(2, """
93
        PPA Archive
94
95
        This is a Personal Package Archive.
96
        """)
97
98
    PARTNER = DBItem(4, """
99
        Partner Archive
100
101
        This is the archive for partner packages.
102
        """)
103
104
    COPY = DBItem(6, """
105
        Generalized copy archive
106
107
        This kind of archive will be used for rebuilds, snapshots etc.
108
        """)
109
110
    DEBUG = DBItem(7, """
111
        Debug Archive
112
113
        This kind of archive will be user for publishing package with
114
        debug-symbols.
115
        """)
116
117
7675.1090.12 by Jeroen Vermeulen
Unified archive name suffixes.
118
archive_suffixes = {
119
    ArchivePurpose.PRIMARY: '',
120
    ArchivePurpose.PARTNER: '-partner',
121
    ArchivePurpose.DEBUG: '-debug',
122
}
123
124
11411.6.1 by Julian Edwards
Move archive enums to enums.py
125
class ArchiveStatus(DBEnumeratedType):
126
    """The status of an archive, e.g. active, disabled. """
127
128
    ACTIVE = DBItem(0, """
129
        Active
130
131
        This archive accepts uploads, copying and publishes packages.
132
        """)
133
134
    DELETING = DBItem(1, """
135
        Deleting
136
137
        This archive is in the process of being deleted.  This is a user-
138
        requested and short-lived status.
139
        """)
140
141
    DELETED = DBItem(2, """
142
        Deleted
143
144
        This archive has been deleted and removed from disk.
145
        """)
146
147
11411.6.5 by Julian Edwards
move ArchiveSubscriberStatus
148
class ArchiveSubscriberStatus(DBEnumeratedType):
149
    """The status of an `ArchiveSubscriber`."""
7675.1090.12 by Jeroen Vermeulen
Unified archive name suffixes.
150
11411.6.5 by Julian Edwards
move ArchiveSubscriberStatus
151
    CURRENT = DBItem(1, """
152
        Active
153
154
        The subscription is current.
155
        """)
7675.1090.12 by Jeroen Vermeulen
Unified archive name suffixes.
156
11411.6.5 by Julian Edwards
move ArchiveSubscriberStatus
157
    EXPIRED = DBItem(2, """
158
        Expired
159
160
        The subscription has expired.
161
        """)
7675.1090.12 by Jeroen Vermeulen
Unified archive name suffixes.
162
11411.6.5 by Julian Edwards
move ArchiveSubscriberStatus
163
    CANCELLED = DBItem(3, """
164
        Cancelled
165
166
        The subscription was cancelled.
167
        """)
168
11411.6.6 by Julian Edwards
move BinaryPackageFormat and BinaryPackageFileType
169
170
class BinaryPackageFileType(DBEnumeratedType):
171
    """Binary Package File Type
172
173
    Launchpad handles a variety of packaging systems and binary package
174
    formats. This schema documents the known binary package file types.
175
    """
176
177
    DEB = DBItem(1, """
178
        DEB Format
179
180
        This format is the standard package format used on Ubuntu and other
181
        similar operating systems.
182
        """)
183
184
    RPM = DBItem(2, """
185
        RPM Format
186
187
        This format is used on mandrake, Red Hat, Suse and other similar
188
        distributions.
189
        """)
190
191
    UDEB = DBItem(3, """
192
        UDEB Format
193
194
        This format is the standard package format used on Ubuntu and other
195
        similar operating systems for the installation system.
196
        """)
197
198
    DDEB = DBItem(4, """
199
        DDEB Format
200
201
        This format is the standard package format used on Ubuntu and other
202
        similar operating systems for distributing debug symbols.
203
        """)
204
205
206
class BinaryPackageFormat(DBEnumeratedType):
207
    """Binary Package Format
208
209
    Launchpad tracks a variety of binary package formats. This schema
210
    documents the list of binary package formats that are supported
211
    in Launchpad.
212
    """
213
214
    DEB = DBItem(1, """
215
        Ubuntu Package
216
217
        This is the binary package format used by Ubuntu and all similar
218
        distributions. It includes dependency information to allow the
219
        system to ensure it always has all the software installed to make
220
        any new package work correctly.  """)
221
222
    UDEB = DBItem(2, """
223
        Ubuntu Installer Package
224
225
        This is the binary package format used by the installer in Ubuntu and
226
        similar distributions.  """)
227
228
    EBUILD = DBItem(3, """
229
        Gentoo Ebuild Package
230
231
        This is the Gentoo binary package format. While Gentoo is primarily
232
        known for being a build-it-from-source-yourself kind of
233
        distribution, it is possible to exchange binary packages between
234
        Gentoo systems.  """)
235
236
    RPM = DBItem(4, """
237
        RPM Package
238
239
        This is the format used by Mandrake and other similar distributions.
240
        It does not include dependency tracking information.  """)
241
242
    DDEB = DBItem(5, """
243
        Ubuntu Debug Package
244
245
        This is the binary package format used for shipping debug symbols
246
        in Ubuntu and similar distributions.""")
247
248
7675.1176.4 by Jeroen Vermeulen
Create enum for copy policies.
249
class PackageCopyPolicy(DBEnumeratedType):
7675.1176.9 by Jeroen Vermeulen
Adapter: PackageCopyPolicy to ICopyPolicy.
250
    """Package copying policy.
251
252
    Each of these is associated with one `ICopyPolicy`.
253
    """
7675.1176.4 by Jeroen Vermeulen
Create enum for copy policies.
254
255
    INSECURE = DBItem(1, """
256
        Copy from insecure source.
7675.1176.8 by Jeroen Vermeulen
Fixed docstrings that broke build.
257
258
        This is the default.
7675.1176.4 by Jeroen Vermeulen
Create enum for copy policies.
259
        """)
260
7675.1176.13 by Jeroen Vermeulen
Rename SyncPolicy to MassSyncPolicy (and concomitant changes) as per Julian's request.
261
    MASS_SYNC = DBItem(2, """
262
        Mass package sync.
7675.1176.8 by Jeroen Vermeulen
Fixed docstrings that broke build.
263
7675.1176.13 by Jeroen Vermeulen
Rename SyncPolicy to MassSyncPolicy (and concomitant changes) as per Julian's request.
264
        This policy applies when synchronizing packages en masse.
7675.1176.4 by Jeroen Vermeulen
Create enum for copy policies.
265
        """)
266
267
11411.6.8 by Julian Edwards
Move PackageDiffStatus
268
class PackageCopyStatus(DBEnumeratedType):
269
    """Package copy status type.
270
271
    The status may be one of the following: new, in progress, complete,
272
    failed, canceling, cancelled.
273
    """
274
275
    NEW = DBItem(0, """
276
        New
277
278
        A new package copy operation was requested.
279
        """)
280
281
    INPROGRESS = DBItem(1, """
282
        In progress
283
284
        The package copy operation is in progress.
285
        """)
286
287
    COMPLETE = DBItem(2, """
288
        Complete
289
290
        The package copy operation has completed successfully.
291
        """)
292
293
    FAILED = DBItem(3, """
294
        Failed
295
296
        The package copy operation has failed.
297
        """)
298
299
    CANCELING = DBItem(4, """
300
        Canceling
301
302
        The package copy operation was cancelled by the user and the
303
        cancellation is in progress.
304
        """)
305
306
    CANCELLED = DBItem(5, """
307
        Cancelled
308
309
        The package copy operation was cancelled by the user.
310
        """)
311
312
313
class PackageDiffStatus(DBEnumeratedType):
314
    """The status of a PackageDiff request."""
315
316
    PENDING = DBItem(0, """
317
        Pending
318
319
        This diff request is pending processing.
320
        """)
321
322
    COMPLETED = DBItem(1, """
323
        Completed
324
325
        This diff request was successfully completed.
326
        """)
327
328
    FAILED = DBItem(2, """
329
        Failed
330
331
        This diff request has failed.
332
        """)
333
11411.6.9 by Julian Edwards
Move PackageUploadStatus and PackageUploadCustomFormat
334
11411.6.12 by Julian Edwards
Move PackagePublishingStatus/Priority
335
class PackagePublishingPriority(DBEnumeratedType):
336
    """Package Publishing Priority
337
338
    Binary packages have a priority which is related to how important
339
    it is to have that package installed in a system. Common priorities
340
    range from required to optional and various others are available.
341
    """
342
343
    REQUIRED = DBItem(50, """
344
        Required
345
346
        This priority indicates that the package is required. This priority
347
        is likely to be hard-coded into various package tools. Without all
348
        the packages at this priority it may become impossible to use dpkg.
349
        """)
350
351
    IMPORTANT = DBItem(40, """
352
        Important
353
354
        If foo is in a package; and "What is going on?! Where on earth is
355
        foo?!?!" would be the reaction of an experienced UNIX hacker were
356
        the package not installed, then the package is important.
357
        """)
358
359
    STANDARD = DBItem(30, """
360
        Standard
361
362
        Packages at this priority are standard ones you can rely on to be in
363
        a distribution. They will be installed by default and provide a
364
        basic character-interface userland.
365
        """)
366
367
    OPTIONAL = DBItem(20, """
368
        Optional
369
370
        This is the software you might reasonably want to install if you did
371
        not know what it was or what your requiredments were. Systems such
372
        as X or TeX will live here.
373
        """)
374
375
    EXTRA = DBItem(10, """
376
        Extra
377
378
        This contains all the packages which conflict with those at the
379
        other priority levels; or packages which are only useful to people
380
        who have very specialised needs.
381
        """)
382
383
384
class PackagePublishingStatus(DBEnumeratedType):
385
    """Package Publishing Status
386
387
     A package has various levels of being published within a DistroSeries.
388
     This is important because of how new source uploads dominate binary
389
     uploads bit-by-bit. Packages (source or binary) enter the publishing
390
     tables as 'Pending', progress through to 'Published' eventually become
391
     'Superseded' and then become 'PendingRemoval'. Once removed from the
392
     DistroSeries the publishing record is also removed.
393
     """
394
395
    PENDING = DBItem(1, """
396
        Pending
397
398
        This [source] package has been accepted into the DistroSeries and
399
        is now pending the addition of the files to the published disk area.
400
        In due course, this source package will be published.
401
        """)
402
403
    PUBLISHED = DBItem(2, """
404
        Published
405
406
        This package is currently published as part of the archive for that
407
        distroseries. In general there will only ever be one version of any
408
        source/binary package published at any one time. Once a newer
409
        version becomes published the older version is marked as superseded.
410
        """)
411
412
    SUPERSEDED = DBItem(3, """
413
        Superseded
414
415
        When a newer version of a [source] package is published the existing
416
        one is marked as "superseded".  """)
417
418
    DELETED = DBItem(4, """
419
        Deleted
420
421
        When a publication was "deleted" from the archive by user request.
422
        Records in this state contain a reference to the Launchpad user
423
        responsible for the deletion and a text comment with the removal
424
        reason.
425
        """)
426
427
    OBSOLETE = DBItem(5, """
428
        Obsolete
429
430
        When a distroseries becomes obsolete, its published packages
431
        are no longer required in the archive.  The publications for
432
        those packages are marked as "obsolete" and are subsequently
433
        removed during domination and death row processing.
434
        """)
435
436
11411.6.9 by Julian Edwards
Move PackageUploadStatus and PackageUploadCustomFormat
437
# If you change this (add items, change the meaning, whatever) search for
438
# the token ##CUSTOMFORMAT## e.g. database/queue.py or nascentupload.py and
439
# update the stuff marked with it.
440
class PackageUploadCustomFormat(DBEnumeratedType):
441
    """Custom formats valid for the upload queue
442
443
    An upload has various files potentially associated with it, from source
444
    package releases, through binary builds, to specialist upload forms such
445
    as a debian-installer tarball or a set of translations.
446
    """
447
448
    DEBIAN_INSTALLER = DBItem(0, """
449
        raw-installer
450
451
        A raw-installer file is a tarball. This is processed as a version
452
        of the debian-installer to be unpacked into the archive root.
453
        """)
454
455
    ROSETTA_TRANSLATIONS = DBItem(1, """
456
        raw-translations
457
458
        A raw-translations file is a tarball. This is passed to the rosetta
459
        import queue to be incorporated into that package's translations.
460
        """)
461
462
    DIST_UPGRADER = DBItem(2, """
463
        raw-dist-upgrader
464
465
        A raw-dist-upgrader file is a tarball. It is simply published into
466
        the archive.
467
        """)
468
469
    DDTP_TARBALL = DBItem(3, """
470
        raw-ddtp-tarball
471
472
        A raw-ddtp-tarball contains all the translated package description
473
        indexes for a component.
474
        """)
475
476
    STATIC_TRANSLATIONS = DBItem(4, """
477
        raw-translations-static
478
479
        A tarball containing raw (Gnome) help file translations.
480
        """)
481
482
    META_DATA = DBItem(5, """
483
        meta-data
484
485
        A file containing meta-data about the package, mainly for use in
486
        the Software Center.
487
        """)
488
489
490
class PackageUploadStatus(DBEnumeratedType):
491
    """Distro Release Queue Status
492
493
    An upload has various stages it must pass through before becoming part
494
    of a DistroSeries. These are managed via the Upload table
495
    and related tables and eventually (assuming a successful upload into the
496
    DistroSeries) the effects are published via the PackagePublishing and
497
    SourcePackagePublishing tables.
498
    """
499
500
    NEW = DBItem(0, """
501
        New
502
503
        This upload is either a brand-new source package or contains a
504
        binary package with brand new debs or similar. The package must sit
505
        here until someone with the right role in the DistroSeries checks
506
        and either accepts or rejects the upload. If the upload is accepted
507
        then entries will be made in the overrides tables and further
508
        uploads will bypass this state. """)
509
510
    UNAPPROVED = DBItem(1, """
511
        Unapproved
512
513
        If a DistroSeries is frozen or locked out of ordinary updates then
514
        this state is used to mean that while the package is correct from a
515
        technical point of view; it has yet to be approved for inclusion in
516
        this DistroSeries. One use of this state may be for security
517
        releases where you want the security team of a DistroSeries to
518
        approve uploads.""")
519
520
    ACCEPTED = DBItem(2, """
521
        Accepted
522
523
        An upload in this state has passed all the checks required of it and
524
        is ready to have its publishing records created.""")
525
526
    DONE = DBItem(3, """
527
        Done
528
529
        An upload in this state has had its publishing records created if it
530
        needs them and is fully processed into the DistroSeries. This state
531
        exists so that a logging and/or auditing tool can pick up accepted
532
        uploads and create entries in a journal or similar before removing
533
        the queue item.""")
534
535
    REJECTED = DBItem(4, """
536
        Rejected
537
538
        An upload which reaches this state has, for some reason or another
539
        not passed the requirements (technical or human) for entry into the
540
        DistroSeries it was targetting. As for the 'done' state, this state
541
        is present to allow logging tools to record the rejection and then
542
        clean up any subsequently unnecessary records.""")
543
544
11411.6.10 by Julian Edwards
Move PackageUploadCustomFormat again
545
class SourcePackageFormat(DBEnumeratedType):
546
    """Source package format
547
548
    There are currently three formats of Debian source packages. The Format
549
    field in the .dsc file must specify one of these formats.
550
    """
551
552
    FORMAT_1_0 = DBItem(0, """
553
        1.0
554
555
        Specifies either a native (having a single tar.gz) or non-native
556
        (having an orig.tar.gz and a diff.gz) package. Supports only gzip
557
        compression.
558
        """)
559
560
    FORMAT_3_0_QUILT = DBItem(1, """
561
        3.0 (quilt)
562
563
        Specifies a non-native package, with an orig.tar.* and a debian.tar.*.
12632.3.1 by Colin Watson
Add support for xz-compressed tarballs in source packages.
564
        Supports gzip, bzip2, and xz compression.
11411.6.10 by Julian Edwards
Move PackageUploadCustomFormat again
565
        """)
566
567
    FORMAT_3_0_NATIVE = DBItem(2, """
568
        3.0 (native)
569
12632.3.1 by Colin Watson
Add support for xz-compressed tarballs in source packages.
570
        Specifies a native package, with a single tar.*. Supports gzip,
571
        bzip2, and xz compression.
11411.6.10 by Julian Edwards
Move PackageUploadCustomFormat again
572
        """)