3
# This is part of langpack-o-matic
5
# (C) 2011 Canonical Ltd.
6
# Author: Martin Pitt <martin.pitt@canonical.com>
8
# Copy all packages from the weekly PPA to -proposed. This needs
9
# ~ubuntu-archive privilages.
10
# Usage: copy-ppa-proposed <release>
14
from launchpadlib.launchpad import Launchpad
16
if len(sys.argv) != 2:
17
sys.stderr.write('Usage: %s <release>\n' % sys.argv[0])
21
launchpad = Launchpad.login_with('langpack-o-matic', service_root='production')
22
ubuntu = launchpad.distributions['ubuntu']
23
archive = ubuntu.getArchive(name='primary')
24
distro_series = ubuntu.getSeries(name_or_version=release)
25
langpack_ppa = launchpad.people['ubuntu-langpack'].getPPAByName(name='ppa')
27
# get current versions in PPA for that series
28
for pub in langpack_ppa.getPublishedSources(source_name='language-pack-',
29
exact_match=False, status='Published', pocket='Release',
30
distro_series=distro_series):
35
# get current versions in Ubuntu
36
for ubuntu_pub in archive.getPublishedSources(source_name=pub.source_package_name,
37
exact_match=True, status='Published', distro_series=distro_series):
39
if ubuntu_pub.pocket not in ('Release', 'Proposed', 'Updates', 'Security'):
42
if apt.apt_pkg.version_compare(ubuntu_pub.source_package_version,
43
pub.source_package_version) >= 0:
44
sys.stderr.write('%s already has the same/never version of %s: %s, PPA: %s\n' % (
45
ubuntu_pub.pocket, pub.source_package_name, ubuntu_pub.source_package_version, pub.source_package_version))
50
sys.stderr.write('%s is not yet in Ubuntu, not copying\n' % pub.source_package_name)
54
print('Copying %s %s from PPA to %s-proposed' % (pub.source_package_name,
55
pub.source_package_version, release))
57
archive.syncSource(from_archive=langpack_ppa, include_binaries=True,
58
source_name=pub.source_package_name, to_series=release,
59
to_pocket='proposed', version=pub.source_package_version)