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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
#! /usr/bin/perl -w
use strict;
use warnings;
use Carp;
use Switch;
use Archive::Tar;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use Compress::Zlib;
use POSIX;
use File::Copy;
sub adddir($$) {
my ($dir, $ref) = @_;
$dir =~ s/^\.\///;
my $base = $dir;
$base =~ s/^.+\/([^\/]+)$/$1/;
if (-f "$dir/$base.pro") {
push @{$ref}, "$dir/$base.pro";
}
opendir(DIR, $dir);
foreach my $e (grep { ! /^\./ } readdir(DIR)) {
if (-d "$dir/$e") {
adddir("$dir/$e", $ref);
}
}
}
my %files;
my $ver;
my %filevars = ( 'sources' => 1, 'headers' => 1, 'rc_file' => 1, 'dist' => 1, 'forms' => 1, 'resources' => 1, 'precompiled_header' => 1, 'translations' => 1);
system("rm mumble-*");
chdir("scripts");
system("bash mkini.sh");
chdir("..");
my @pro = ("main.pro");
#, "src/mumble.pri");
#adddir(".", \@pro);
my @resources;
while (my $pro = shift @pro) {
open(F, $pro) or croak "Failed to open $pro";
print "Processing $pro\n";
$files{$pro}=1;
my $basedir=$pro;
$basedir =~ s/[^\/]+\Z//g;
my @vpath = ($basedir);
while(<F>) {
chomp();
if (/^include\((.+)\)/) {
my $f = $basedir . $1;
while ($f =~ /\.\./) {
$f =~ s/(\/|\A)[^\/]+\/\.\.\//$1/g;
}
push @pro, $f;
} elsif (/^\s*(\w+)\s*?[\+\-\*]{0,1}=\s*(.+)$/) {
my ($var,$value)=(lc $1,$2);
switch ($var) {
case "version" {
if ($value !~ /\$\$/) {
if ($basedir !~ /mumble11x/) {
croak "Versions don't match" if (defined($ver) && ($ver ne $value));
$ver=$value;
}
}
}
case "vpath" {
if ($value eq '../$$SOURCEDIR/libcelt') {
my $vdir = $basedir;
$vdir =~ s/-build/-src/;
push @vpath, $vdir.'libcelt/';
} else {
push @vpath,map { "$basedir$_/"} split(/\s/, $value);
}
}
case "subdirs" {
push @pro,map { my ($b,$p) = ($_,$_); $p =~ s/^.+\///g; "$basedir$b/$p.pro" } split(/\s/, $value);
}
case %filevars {
foreach my $f (split(/\s+/,$value)) {
next if ($f =~ /^Murmur\.(h|cpp)$/);
next if ($f =~ /^Mumble\.pb\.(h|cc)$/);
my $ok = 0;
foreach my $d (@vpath) {
if (-f "$d$f") {
$f = $d.$f;
$ok = 1;
last;
}
}
if (! $ok) {
croak "Failed to find $f in ".join(" ",@vpath);
} else {
while ($f =~ /\.\./) {
$f =~ s/(\/|\A)[^\/]+\/\.\.\//$1/g;
}
$files{$f}=1;
if ($var eq "resources") {
push @resources,$f;
}
}
}
}
}
}
}
close(F);
}
foreach my $resfile (@resources) {
open(F, $resfile);
my $basedir=$resfile;
$basedir =~ s/[^\/]+\Z//g;
while(<F>) {
chomp();
if (/\>(.+)<\/file\>/) {
my $f = $basedir.$1;
next if $f =~ /\.qm$/;
while ($f =~ /\.\./) {
$f =~ s/(\/|\A)[^\/]+\/\.\.\//$1/g;
}
$files{$f}=1;
}
}
close(F);
}
my @fulldirs = ('speex','speex/include/speex','speex/libspeex','man');
foreach my $cver ('0.7.0') {
push @fulldirs, "celt-$cver-src";
push @fulldirs, "celt-$cver-src/libcelt";
}
foreach my $dir (@fulldirs) {
opendir(D, $dir) or croak "Could not open $dir";
foreach my $f (grep(! /^\./,readdir(D))) {
next if ($f =~ /\~$/);
my $ff=$dir . '/' . $f;
if (-f $ff) {
$files{$ff}=1;
}
}
closedir(D);
}
delete($files{'LICENSE'});
if ($#ARGV < 0) {
open(F, "git rev-parse --short=6 origin|");
while (<F>) {
chomp();
$ver .= "~" . strftime("%Y%m%d%H%M",gmtime()) . "-" . $_;
}
close(F);
print "REVISION $ver\n";
} elsif ($#ARGV == 0) {
$ver = $ARGV[0];
}
my $tar = new Archive::Tar();
my $zip = new Archive::Zip();
my $blob;
my $dir="mumble-$ver/";
my $zipdir = $zip->addDirectory($dir);
foreach my $file ('LICENSE', sort keys %files) {
print "Adding $file\n";
open(F, $file) or croak "Missing $file";
sysread(F, $blob, 1000000000);
if ($file eq "src/Version.h") {
$blob =~ s/(\#ifndef MUMBLE_VERSION)/$1\n\#define MUMBLE_VERSION $ver\n\#endif\n$1/;
}
$tar->add_data($dir . $file, $blob);
my $zipmember=$zip->addString($blob, $dir . $file);
$zipmember->desiredCompressionMethod( COMPRESSION_DEFLATED );
$zipmember->desiredCompressionLevel( 9 );
close(F);
}
my $gz=gzopen("mumble-${ver}.tar.gz", "w");
$gz->gzwrite($tar->write());
$gz->gzclose();
$zip->writeToFileNamed("mumble-${ver}.zip");
copy("mumble-${ver}.tar.gz", "../deb-mumble/tarballs/mumble_${ver}.orig.tar.gz");
system("/usr/bin/gpg", "--armor", "--default-key", "DEBA6F3E", "--sign", "--detach-sign", "--output", "mumble-${ver}.tar.gz.sig", "mumble-${ver}.tar.gz");
system("/usr/bin/scp", "-4", "mumble-${ver}.tar.gz", "mumble-${ver}.tar.gz.sig", "slicer\@mumble.hive.no:/var/www/snapshot/");
|