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
|
#!/usr/bin/python
#
# This is part of langpack-o-matic
#
# (C) 2011 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@canonical.com>
#
# Copy all packages from the weekly PPA to -proposed. This needs
# ~ubuntu-archive privilages.
# Usage: copy-ppa-proposed <release>
import sys
import apt
from launchpadlib.launchpad import Launchpad
if len(sys.argv) != 2:
sys.stderr.write('Usage: %s <release>\n' % sys.argv[0])
sys.exit(1)
release = sys.argv[1]
launchpad = Launchpad.login_with('langpack-o-matic', service_root='production')
ubuntu = launchpad.distributions['ubuntu']
archive = ubuntu.getArchive(name='primary')
distro_series = ubuntu.getSeries(name_or_version=release)
langpack_ppa = launchpad.people['ubuntu-langpack'].getPPAByName(name='ppa')
# get current versions in PPA for that series
for pub in langpack_ppa.getPublishedSources(source_name='language-pack-',
exact_match=False, status='Published', pocket='Release',
distro_series=distro_series):
newer = True
in_ubuntu = False
# get current versions in Ubuntu
for ubuntu_pub in archive.getPublishedSources(source_name=pub.source_package_name,
exact_match=True, status='Published', distro_series=distro_series):
in_ubuntu = True
if ubuntu_pub.pocket not in ('Release', 'Proposed', 'Updates', 'Security'):
# ignore backports
continue
if apt.apt_pkg.version_compare(ubuntu_pub.source_package_version,
pub.source_package_version) >= 0:
sys.stderr.write('%s already has the same/never version of %s: %s, PPA: %s\n' % (
ubuntu_pub.pocket, pub.source_package_name, ubuntu_pub.source_package_version, pub.source_package_version))
newer = False
break
if not in_ubuntu:
sys.stderr.write('%s is not yet in Ubuntu, not copying\n' % pub.source_package_name)
continue
if newer:
print('Copying %s %s from PPA to %s-proposed' % (pub.source_package_name,
pub.source_package_version, release))
try:
archive.syncSource(from_archive=langpack_ppa, include_binaries=True,
source_name=pub.source_package_name, to_series=release,
to_pocket='proposed', version=pub.source_package_version)
except:
continue
|