~ubuntu-langpack/langpack-o-matic/main

« back to all changes in this revision

Viewing changes to clean-ppa

  • Committer: Sebastien Bacher
  • Date: 2021-11-22 16:04:05 UTC
  • mfrom: (594.2.1 langpack-o-matic)
  • Revision ID: seb128@ubuntu.com-20211122160405-17hx41i98tvg459q
The repository has been moved to git

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
# this is part of langpack-o-matic, by Martin Pitt <martin.pitt@canonical.com>
4
 
#
5
 
# (C) 2010 Canonical Ltd.
6
 
#
7
 
# Remove packages from an obsolete distro release from the langpack PPA.
8
 
#
9
 
# Author: Martin Pitt <martin.pitt@canonical.com>
10
 
 
11
 
import sys
12
 
 
13
 
from launchpadlib.launchpad import Launchpad
14
 
 
15
 
if len(sys.argv) != 2:
16
 
    sys.stderr.write('Usage: %s <release>\n' % sys.argv[0])
17
 
    sys.exit(1)
18
 
 
19
 
release = sys.argv[1]
20
 
 
21
 
lp = Launchpad.login_with('langpack-o-matic', 'production')
22
 
 
23
 
ppa = lp.people['ubuntu-langpack'].getPPAByName(name='ppa')
24
 
series = lp.distributions['ubuntu'].getSeries(name_or_version=release)
25
 
 
26
 
for arch in ('i386', 'amd64', 'powerpc', 'armhf', 'armel'):
27
 
    try:
28
 
        das = series.getDistroArchSeries(archtag=arch)
29
 
    except Exception as e:
30
 
        print('Cannot get architecture %s: %s' % (arch, str(e)))
31
 
        continue
32
 
    for bpr in ppa.getPublishedBinaries(distro_arch_series=das, status='Published'):
33
 
        print('deleting %s %s (%s)' % (bpr.binary_package_name,
34
 
                bpr.binary_package_version, arch))
35
 
        bpr.requestDeletion()
36
 
 
37
 
for spr in ppa.getPublishedSources(distro_series=series, status='Published'):
38
 
    print('deleting %s %s' % (spr.source_package_name,
39
 
            spr.source_package_version))
40
 
    spr.requestDeletion()
41