-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
scandeps.pl
executable file
·133 lines (108 loc) · 2.96 KB
/
scandeps.pl
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env perl
###########################################################################
# scandeps.pl
# ---------------------
# begin : October 2010
# copyright : (C) 2010 by Juergen E. Fischer
# email : jef at norbit dot de
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
use strict;
use warnings;
my @dists;
open I, "debian/rules";
while(<I>) {
if( /ifneq \(\$\(DISTRIBUTION\),\$\(findstring \$\(DISTRIBUTION\),"(.*)"\)\)/ ) {
for my $d (split / /, $1) {
next if $d =~ /oracle/;
push @dists, $d;
}
push @dists, "sid";
last;
}
}
close I;
die "no dists" unless @dists;
open I, "INSTALL.md";
open O, ">INSTALL.md.new";
while(<I>) {
last if /^\|Distribution\|Install command for packages\|\n$/;
print O;
}
print O "|Distribution|Install command for packages|\n";
print O "|------------|----------------------------|\n";
for my $dist (@dists) {
system("git checkout debian/control" )==0 or die "git checkout failed: $!";
system("make -f debian/rules DISTRIBUTION=$dist cleantemplates templates" )==0 or die "make failed: $!";
open F, "debian/control";
while(<F>) {
chop;
last if /^Build-Depends:/i;
}
s/^Build-Depends:\s*//;
my $deps = $_;
while(<F>) {
chop;
last if /^\S/;
$deps .= $_;
}
while(<F>) {
chop;
last if /^Package: python3-qgis/;
}
while(<F>) {
chop;
last if /^Depends:/;
}
s/^Depends:\s*//;
$deps .= ",$_";
while(<F>) {
chop;
last if /^\S/;
$deps .= $_;
}
close F;
system("git checkout debian/control" )==0 or die "git checkout failed: $!";
$deps .= ",cmake-curses-gui,ccache,expect,libyaml-tiny-perl,flip,python3-autopep8,pandoc,build-essential";
$deps .= ",qt5-default" if $dist =~ /^(buster|bionic|focal|groovy)$/;
my @deps;
my %deps;
foreach my $p (split /,/, $deps) {
$p =~ s/^\s+//;
$p =~ s/\s+.*$//;
next if $p eq "";
next if $p =~ /\$|qgis/;
next if $p =~ /^(debhelper|subversion|python-central)$/;
push @deps, $p if not exists $deps{$p};
$deps{$p} = 1;
}
my $dep="";
my @dep;
foreach my $p (sort @deps) {
if( length("$dep $p") > 60 ) {
push @dep, $dep;
$dep = $p;
} else {
$dep .= " $p";
}
}
push @dep, $dep if $dep ne "";
print O "| $dist | ``apt-get install" . join( " ", @dep ) . "`` |\n";
}
while(<I>) {
last if /^$/;
}
print O;
while(<I>) {
print O;
}
close O;
close I;
rename "INSTALL.md", "INSTALL.md.orig";
rename "INSTALL.md.new", "INSTALL.md";