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
|
#!/usr/bin/env python
# this is part of langpack-o-matic, by Martin Pitt <martin.pitt@canonical.com>
#
# (C) 2005 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@canonical.com>
#
# Updates a language-support-%PKGNAME% source package after the supplemental
# dependencies changed.
#
# After this script finishes successfully, the source package path will be
# written to "updated-packages".
#
# Usage: update-depends <language> <distro-release>
import sys, os, os.path, time
# change working directory to the directory of this script
os.chdir(os.path.dirname(sys.argv[0]))
sys.path.append('lib')
import macros, makepkg
if len(sys.argv) != 3:
print >> sys.stderr, 'Usage:', sys.argv[0], '<language> <distro release>'
sys.exit(-1)
locale = sys.argv[1]
release = sys.argv[2]
# verify release and create config file
basepath = '../' + release
if not os.path.isdir(basepath):
raise OSError, 'Invalid distribution release, %s does not exist' % basepath
macr = macros.LangpackMacros(locale, '', release, os.getenv('LP_TIMESTAMP', time.strftime('%Y%m%d')))
metapkgs = {
'SUPDEPS': ['skel-support', macr.subst_string(basepath+'/sources-support/language-support-%PKGNAME%')],
'FNDEPS': ['skel-fonts', macr.subst_string(basepath+'/sources-support/language-support-fonts-%PKGNAME%')],
'IMDEPS': ['skel-input', macr.subst_string(basepath+'/sources-support/language-support-input-%PKGNAME%')],
'WADEPS': ['skel-writing', macr.subst_string(basepath+'/sources-support/language-support-writing-%PKGNAME%')],
'TRDEPS': ['skel-translations', macr.subst_string(basepath+'/sources-support/language-support-translations-%PKGNAME%')],
'EXDEPS': ['skel-extra', macr.subst_string(basepath+'/sources-support/language-support-extra-%PKGNAME%')]
}
for m, (skel_dir, pkg) in metapkgs.iteritems():
if macr[m]:
# get old support dependencies
old_deps = None
oldcontrol = os.path.join(pkg, 'debian', 'control')
if os.path.exists(oldcontrol):
for l in open(oldcontrol):
if l.startswith('Depends: '):
old_deps = set([p.strip() for p in l[9:].split(',')])
new_deps = set([p.strip() for p in macr.subst_string('%%%s%%' % m).split(',')])
if old_deps == new_deps:
print 'not regenerating %s, no dependency changes' % pkg
continue
makepkg.make_pkg(skel_dir, pkg, macr)
# Update changelog
if old_deps:
added = new_deps - old_deps
removed = old_deps - new_deps
if added:
assert (os.spawnlpe(os.P_WAIT, 'dch', 'dch', '-p',
'-c', os.path.join(pkg, 'debian', 'changelog'),
'Added: ' + (', '.join (added)),
{'DEBEMAIL': macr.subst_string('%UPLOADER%')}) == 0)
if removed:
assert (os.spawnlpe(os.P_WAIT, 'dch', 'dch', '-p',
'-c', os.path.join(pkg, 'debian', 'changelog'),
'Removed: ' + (', '.join (removed)),
{'DEBEMAIL': macr.subst_string('%UPLOADER%')}) == 0)
|