~ubuntu-branches/ubuntu/natty/ubuntu-dev-tools/natty

« back to all changes in this revision

Viewing changes to pull-lp-source

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera, Felix Geyer, Stefano Rivera, Julian Taylor, Benjamin Drung
  • Date: 2011-03-12 22:07:47 UTC
  • Revision ID: james.westby@ubuntu.com-20110312220747-3047m3rilq3jva3y
Tags: 0.120
[ Felix Geyer ]
* pull-lp-source.1: Document -d option.

[ Stefano Rivera ]
* ubuntutools.archive: Filter rmadison results. (LP: #710579)
  - Canonicalise suites (use code-names) before passing them to rmadison.
* pull-{lp,debian}-source: Download requested versions, as well as simply
  the latest version in a release.
* pull-{lp,debian}-source, pull-debian-debdiff: Catch KeyboardInterrupt.
  (LP: #713845)
* pull-debian-source: Handle -p-u and -security suites.
* Bump X-Python-Version to >= 2.6, now that python-launchpadlib no longer
  supports Python 2.5.

[ Julian Taylor ]
* add support for cowbuilder and cowbuilder-dist in builder.py
  - allows use in sponsor-patch and backportpackage (LP: #728751)

[ Benjamin Drung ]
* data/ubuntu.csv: Add Oneiric Ocelot to the list of know releases.
* ubuntutools.distro_info: Fix TypeError crash and add a test case to
  catch regressions (LP: #731398).

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
from ubuntutools.archive import UbuntuSourcePackage, DownloadError
31
31
from ubuntutools.config import UDTConfig
 
32
from ubuntutools.distro_info import UbuntuDistroInfo
32
33
from ubuntutools.logger import Logger
33
34
from ubuntutools.lp.lpapicache import Distribution, Launchpad
34
35
from ubuntutools.lp.udtexceptions import (SeriesNotFoundException,
37
38
from ubuntutools.misc import split_release_pocket
38
39
 
39
40
def main():
40
 
    usage = "Usage: %prog <package> [release]"
 
41
    usage = "Usage: %prog <package> [release|version]"
41
42
    opt_parser = OptionParser(usage)
42
43
    opt_parser.add_option('-d', '--download-only',
43
44
                          dest='download_only', default=False,
63
64
 
64
65
    package = str(args[0]).lower()
65
66
 
66
 
    if len(args) >= 2: # Custom distribution specified.
67
 
        release = str(args[1]).lower()
 
67
    ubuntu_info = UbuntuDistroInfo()
 
68
    if len(args) > 1: # Custom distribution specified.
 
69
        version = str(args[1])
68
70
    else:
69
 
        release = os.getenv('DIST') or (Distribution('ubuntu')
70
 
                                        .getDevelopmentSeries().name)
 
71
        version = os.getenv('DIST') or ubuntu_info.devel()
 
72
    component = None
71
73
 
 
74
    # Release, not package version number:
 
75
    release = None
 
76
    pocket = None
72
77
    try:
73
 
        (release, pocket) = split_release_pocket(release)
 
78
        (release, pocket) = split_release_pocket(version)
74
79
    except PocketDoesNotExistError, e:
75
 
        Logger.error(str(e))
76
 
        sys.exit(1)
77
 
 
78
 
    try:
79
 
        spph = Distribution('ubuntu').getArchive().getSourcePackage(package,
80
 
                                                                    release,
81
 
                                                                    pocket)
82
 
    except (SeriesNotFoundException, PackageNotFoundException), e:
83
 
        Logger.error(str(e))
84
 
        sys.exit(1)
85
 
 
86
 
    srcpkg = UbuntuSourcePackage(package, spph.getVersion(),
87
 
                                 component=spph.getComponent(),
 
80
        pass
 
81
    if release in ubuntu_info.all and pocket is not None:
 
82
        try:
 
83
            spph = Distribution('ubuntu').getArchive().getSourcePackage(package,
 
84
                                                                        release,
 
85
                                                                        pocket)
 
86
        except (SeriesNotFoundException, PackageNotFoundException), e:
 
87
            Logger.error(str(e))
 
88
            sys.exit(1)
 
89
        version = spph.getVersion()
 
90
        component = spph.getComponent()
 
91
 
 
92
    Logger.normal('Downloading %s version %s', package, version)
 
93
    srcpkg = UbuntuSourcePackage(package, version, component=component,
88
94
                                 mirrors=[options.ubuntu_mirror])
89
95
    try:
90
96
        srcpkg.pull()
95
101
        srcpkg.unpack()
96
102
 
97
103
if __name__ == '__main__':
98
 
    main()
 
104
    try:
 
105
        main()
 
106
    except KeyboardInterrupt:
 
107
        Logger.normal('User abort.')