~launchpad-pqm/launchpad/devel

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
Raw Static Translations custom files
====================================

Raw Static Translations are Gnome help files tarballs that have been stripped
out of a build and attached to the upload as a custom file.  The files
use a special section, like other custom uploads, "raw-translations-static".

When the CustomUploadFile object is created with the right section name,
its custom_type property returns the right DBEnum,
PackageUploadCustomFormat.STATIC_TRANSLATIONS.

    >>> from lp.archiveuploader.nascentuploadfile import CustomUploadFile
    >>> custom_upload_file = CustomUploadFile(
    ...     filepath="", digest="", size=1, priority_name="", policy=None,
    ...     component_and_section="main/raw-translations-static", logger=None)

    >>> print custom_upload_file.custom_type.name
    STATIC_TRANSLATIONS

Static translations tarballs are not published, they only exist in the
librarian and are retrieved using the webservice.  We can demonstrate the
publishing behaviour using a mock PackageUploadCustom object:

    >>> from zope.interface import implements
    >>> from lp.registry.interfaces.distribution import IDistributionSet
    >>> from lp.registry.interfaces.pocket import PackagePublishingPocket
    >>> from lp.soyuz.enums import PackageUploadCustomFormat
    >>> from lp.soyuz.interfaces.queue import (
    ...     IPackageUpload, IPackageUploadCustom)
    >>> from lp.soyuz.model.queue import PackageUploadCustom
    >>> class MockPackageUploadCustom(PackageUploadCustom):
    ...     implements(IPackageUploadCustom)
    ...     packageupload = None
    ...
    ...     def __init__(self):
    ...         self.customformat = (
    ...             PackageUploadCustomFormat.STATIC_TRANSLATIONS)


    >>> bat = getUtility(IDistributionSet)['ubuntu']['breezy-autotest']
    >>> package_upload = bat.createQueueEntry(
    ...     pocket=PackagePublishingPocket.RELEASE, changesfilename="test",
    ...     changesfilecontent="test",
    ...     archive=bat.main_archive)
    >>> custom_upload = MockPackageUploadCustom()
    >>> custom_upload.packageupload = package_upload
    >>> from lp.services.log.logger import FakeLogger
    >>> custom_upload.publish(logger=FakeLogger())
    DEBUG Publishing custom to ubuntu/breezy-autotest
    DEBUG Skipping publishing of static translations.