File: update_languages

package info (click to toggle)
phpbb2 2.0.21-6
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 4,224 kB
  • ctags: 12
  • sloc: sh: 476; makefile: 108; perl: 29; php: 21
file content (38 lines) | stat: -rw-r--r-- 959 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w
use strict;

die "Must be executed in the 'debian' subdir" unless -d 'upstream';

`rm -f upstream/lang.*.info`;

my @files;

open DOWNLOADS, "wget -q -O- http://www.phpbb.com/downloads.php|";
while (<DOWNLOADS>) {
	m,prdownloads\.sourceforge\.net/phpbb/((?:lang|subSilver)_[^"]+\.tar\.gz),
		or next;
	push @files, $1;
}
close DOWNLOADS;

for (@files) {
	/([^_]+)_(.*)\.tar\.gz/;
	my $prefix = $1 eq "lang" ? "" : "lang.";
	open INFO, "> upstream/$prefix$1.$2.info";
	my $target = $_;
	$target =~ s,_,/,;
	print INFO "Filename=$target\n";
	# Hack due to upstream bug
	s/.tar.gz/.tgz/ if /lang_esperanto.tar.gz/;
	my $url = "http://surfnet.dl.sourceforge.net/sourceforge/phpbb/$_";
	if ($url =~ m,[^a-z/_.:],i) {
		die "Invalid character in language URL: $url\n";
	}
	print INFO "Url=$url\n";
	print INFO "Md5=".`wget -q -N -O- $url | md5sum | sed 's/ .*//'`;
	print INFO "Copyright=Unknown\n";
	print INFO "Include=yes\n";
	close INFO;
}