~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
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
= Distro Series Binary Packages =

A DistroSeriesBinaryPackage is really a BinaryPackageName for a particular
DistroSeries. That is, it doesn't represent a particular package release or
architecture, but is a reference point for obtaining particular package
releases and/or architectures for a given binary package name within a
specific distribution series.

    >>> from zope.component import getUtility
    >>> from lp.soyuz.model.binarypackagename import (
    ...     BinaryPackageName)
    >>> from lp.registry.interfaces.distribution import IDistributionSet

A DistroSeriesBinaryPackage is normally accessed via a Distro
Series:

    >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
    >>> firefox_bin_name =  BinaryPackageName.selectOneBy(
    ...     name="mozilla-firefox")
    >>> firefox_dsbp = ubuntu['warty'].getBinaryPackage(firefox_bin_name)

It has a name, summary, description and title:

    >>> print firefox_dsbp.name
    mozilla-firefox

    >>> print firefox_dsbp.summary
    Mozilla Firefox Web Browser

    >>> print firefox_dsbp.description
    Mozilla Firefox Web Browser is .....

    >>> print firefox_dsbp.title
    Binary package "mozilla-firefox" in ubuntu warty

    >>> print firefox_dsbp.distribution.name
    ubuntu

It provides the current publishings for the binary package in the
distro series (ordered by architecture then datecreated):

    >>> for published in firefox_dsbp.current_publishings:
    ...     print "%s %s in %s" % (
    ...         published.distroarchseriesbinarypackagerelease.name,
    ...         published.distroarchseriesbinarypackagerelease.version,
    ...         published.distroarchseries.architecturetag)
    mozilla-firefox 0.9 in hppa
    mozilla-firefox 0.9 in i386
    mozilla-firefox 1.0 in i386

The last published binary can also be accessed directly:

    >>> last_published = firefox_dsbp.last_published
    >>> "%s %s" % (last_published.name, last_published.version)
    u'mozilla-firefox 1.0'

It also provides access to the last DistroSeriesSourcePackageRelease:

    >>> print firefox_dsbp.last_sourcepackagerelease.title
    "iceweasel" 1.0 source package in The Warty Warthog Release

If a DistroSeriesBinaryPackage doesn't have a DistroSeriesPackageCache,
then the summary and description fields reflect the situation:

    >>> firefox_hoary_dsbp = ubuntu['hoary'].getBinaryPackage(
    ...     firefox_bin_name)
    >>> firefox_hoary_dsbp.summary
    u'No summary available for mozilla-firefox in ubuntu hoary.'
    >>> firefox_hoary_dsbp.description
    u'No description available for mozilla-firefox in ubuntu hoary.'

If a DistroSeriesBinaryPackage doesn't have a publishing history (for
whatever reason), then last_published returns None.

    >>> firefox_hoary_dsbp.current_publishings
    []
    
    >>> print firefox_hoary_dsbp.last_published
    None

In this case, the last DistroSeriesSourcePackageRelease will also be None:

    >>> print firefox_hoary_dsbp.last_sourcepackagerelease
    None