Commit dc40d543 authored by Richard Mansfield's avatar Richard Mansfield

Pull from launchpad export branches

When sanitising, remove files not in en.utf8
parent c818c9e0
......@@ -157,14 +157,31 @@ function get_langfile_list(&$list, $dir) {
}
}
$source = $argv[1];
$dest = $argv[2];
if (is_dir($argv[1])) {
$en_dir = $argv[1];
}
$source = $argv[2];
$dest = $argv[3];
$sourcefiles = array();
get_langfile_list($sourcefiles, $source);
if (!empty($sourcefiles)) {
foreach ($sourcefiles as $sourcefile) {
if (isset($en_dir)) {
// Skip files that don't exist in the en.utf8 langpack.
$langfile = substr($sourcefile, strlen($source) + 1);
$en_file = preg_replace('/lang\/[a-zA-Z_]+\.utf8\//', 'lang/en.utf8/', $langfile);
$en_file = $en_dir . '/' . $en_file;
if (!file_exists($en_file)) {
continue;
}
}
$destfile = str_replace($source, $dest, $sourcefile);
$destdir = dirname($destfile);
if (!is_dir($destdir)) {
......
......@@ -37,6 +37,9 @@ my $BZRDIR = "${DATA}/bzr";
my $DIRTY = "${DATA}/old";
my $CLEAN = "${DATA}/new";
my $TARBALLS = "${DATA}/tarballs";
my $MAHARA = "${DATA}/mahara";
my $MAHARAREMOTE = 'git://gitorious.org/mahara/mahara.git';
mkpath $GITDIR;
mkpath $DIRTY;
......@@ -92,13 +95,20 @@ else {
}
# Mahara checkout, used for reading the en.utf8 langpack
# during php langpack sanitisation.
! -d "$MAHARA" && system "git clone --quiet $MAHARAREMOTE $MAHARA";
chdir $MAHARA;
system "git fetch --quiet origin";
# For launchpad, all languages are in a single branch, so update the lot
! -d $BZRDIR && system "bzr init-repo $BZRDIR";
my @branches = qw(1.2_STABLE 1.3_STABLE 1.4_STABLE master);
foreach my $branch (@branches) {
if ( ! -d "$BZRDIR/$branch" ) {
system "bzr branch lp:~mahara-lang/mahara-lang/$branch $BZRDIR/$branch";
system "bzr branch lp:~mahara-lang/mahara-lang/$branch-export $BZRDIR/$branch";
}
else {
chdir "$BZRDIR/$branch";
......@@ -263,8 +273,12 @@ foreach my $lang (@langkeys) {
system("cp -r $currentdir/" . '[a-z]* ' . $dirtybranchdir);
# Make en.utf8 available
chdir $MAHARA;
system "git reset --hard -q origin/$branch";
# Clean out stray php from the langpacks
system "$CLEANCMD $dirtybranchdir $cleanbranchdir";
system "$CLEANCMD $MAHARA/htdocs $dirtybranchdir $cleanbranchdir";
chdir $DATA;
system "diff -Bwr $dirtybranchdir $cleanbranchdir > $diff";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment