source: ubiquity/trunk/fuentes/d-i/update-control

Last change on this file was 1053, checked in by kbut, 4 years ago

add ubiquity

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#! /usr/bin/perl -w
2use strict;
3
4use Dpkg::Deps;
5
6# Get the first in a list of or-ed dependencies.
7sub first_dep ($) {
8        my $inner = shift;
9        while ($inner->isa('Dpkg::Deps::OR')) {
10                my @deps = $inner->get_deps();
11                $inner = $deps[0];
12        }
13        unless ($inner->isa('Dpkg::Deps::Simple')) {
14                die sprintf "Couldn't reduce $inner to a simple dependency!\n";
15        }
16        return $inner;
17}
18
19my $control = 'debian/control';
20unless (-e $control) {
21        $control = '../debian/control';
22        unless (-e $control) {
23                die "cannot find debian/control";
24        }
25}
26
27my %builddeps;
28
29# Always include base ubiquity build dependencies.
30my @basebd = (
31    'adwaita-icon-theme',
32    'apt',
33    'autopoint',
34    'dctrl-tools',
35    'debconf (>= 1.5.43)',
36    'debconf-utils',
37    'debhelper (>= 9)',
38    'dh-autoreconf',
39    'dh-di (>= 3)',
40    'dh-systemd',
41    'dpkg-dev (>= 1.14.4)',
42    'gir1.2-soup-2.4',
43    'gir1.2-timezonemap-1.0',
44    'gir1.2-webkit2-4.0',
45    'intltool (>= 0.40.0)',
46    'imagemagick',
47    'libcairo2-dev',
48    'keymapper (>= 0.5.3-7)',
49    'libgirepository1.0-dev',
50    'libglib2.0-dev',
51    'libgtk-3-dev',
52    'libido3-0.1-dev',
53    'libindicator3-dev',
54    'liblocale-gettext-perl',
55    'librsvg2-bin',
56    'gobject-introspection',
57    'pep8',
58    'pkg-config',
59    'po-debconf (>= 1.0)',
60    'pyflakes3 (>= 0.7.2)',
61    'python-gi-dev',
62    'python-scour',
63    'python3-all (>= 3.1)',
64    'python3-apt (>= 0.7.100.3~)',
65    'python3-cairo',
66    'python3-dbus',
67    'python3-gi',
68    'python3-gi-cairo',
69    'python3-icu (>= 1.0)',
70    'python3-mock (>= 0.7.0)',
71    'python3-pam',
72    'gir1.2-xkl-1.0',
73    'ubuntu-artwork',
74    'udev',
75    'xkb-data (>= 0.9)',
76    'xkb-data-i18n',
77    'xvfb',
78);
79my $basebd = join ', ', @basebd;
80my $parsed = Dpkg::Deps::deps_parse($basebd, reduce_arch => 1);
81for my $bd ($parsed->get_deps()) {
82        my $firstbd = first_dep($bd);
83        $builddeps{$firstbd->{package}} = $firstbd;
84}
85
86for my $source (<source/*/debian/control>) {
87        # We don't build console-setup, so skip its build-dependencies.
88        next if $source eq 'source/console-setup/debian/control';
89        open SOURCE, '<', $source or die "can't open $source: $!";
90        while (<SOURCE>) {
91                if (/^Build-Depends(?:-Indep)?:\s*(.*)/i) {
92                        $parsed = Dpkg::Deps::deps_parse($1, reduce_arch => 1);
93                        for my $bd ($parsed->get_deps()) {
94                                # Reduce any or-ed dependencies to the first
95                                # alternative.
96                                my $firstbd = first_dep($bd);
97                                my $package = $firstbd->{package};
98                                if (not exists $builddeps{$package} or
99                                    $firstbd->implies($builddeps{$package})) {
100                                        $builddeps{$package} = $firstbd;
101                                }
102                        }
103                        next;
104                }
105        }
106        close SOURCE;
107}
108
109my $builddeps =
110        join ', ', map { "$builddeps{$_}" } sort keys %builddeps;
111open IN, '<', $control or die "can't open $control: $!";
112open OUT, '>', "$control.tmp" or die "can't open $control.tmp for writing: $!";
113foreach (<IN>) {
114        s/^(Build-Depends:\s*)(.*)/$1$builddeps/;
115        print OUT or die "can't print to $control.tmp: $!";
116}
117close OUT or die "can't close $control.tmp: $!";
118close IN;
119rename "$control.tmp", $control
120        or die "can't rename $control.tmp to $control: $!";
Note: See TracBrowser for help on using the repository browser.