Commit fead8592 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

When generating sanitised langpacks, use po file if there's one available in the git repo

parent 1ee1ee41
...@@ -63,7 +63,7 @@ for lang in ${langs} ; do ...@@ -63,7 +63,7 @@ for lang in ${langs} ; do
git fetch --quiet git fetch --quiet
for remotebranch in `git branch -r | grep -v "HEAD\|1.0_STABLE\|1.1_STABLE"`; do for remotebranch in `git branch -r | grep -v "HEAD" | grep "origin\/\(master\|1.2_STABLE\|1.3_STABLE\)$"`; do
remotecommit=`git log --pretty=format:"%H %ai %an" ${remotebranch} | head -1` remotecommit=`git log --pretty=format:"%H %ai %an" ${remotebranch} | head -1`
...@@ -96,42 +96,71 @@ for lang in ${langs} ; do ...@@ -96,42 +96,71 @@ for lang in ${langs} ; do
git reset --hard -q ${remotebranch} git reset --hard -q ${remotebranch}
fi fi
dirtybranchdir=${dirtylangdir}/${localbranch} errors=0
cleanbranchdir=${cleanlangdir}/${localbranch} cleanbranchdir=${cleanlangdir}/${localbranch}
[ ! -d ${dirtybranchdir} ] && mkdir ${dirtybranchdir}
[ -d ${cleanbranchdir}/lang ] && rm -fr ${cleanbranchdir} [ -d ${cleanbranchdir}/lang ] && rm -fr ${cleanbranchdir}
[ ! -d ${cleanbranchdir} ] && mkdir ${cleanbranchdir} [ ! -d ${cleanbranchdir} ] && mkdir ${cleanbranchdir}
cp -r ${gitlangdir}/[^\\.]* ${dirtybranchdir} pofile="${gitlangdir}/${lang}-${localbranch}.po"
# Clean out stray php from the langpacks
${CLEANCMD} ${dirtybranchdir} ${cleanbranchdir}
errors=0
cd ${DATA} if [ -f $pofile ] ; then
diff -Bwr ${dirtybranchdir} ${cleanbranchdir} > ${diff} echo "$lang $localbranch: using .po file"
# Check syntax of php files # Check utf8ness of .po file?
cd ${cleanbranchdir} output=`${UTF8CMD} ${pofile}`
for file in `find . -name "*.php"`; do
output=`${SYNTAXCMD} $file`
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo ${file} >> ${log} echo ${pofile} >> ${log}
echo -e "${output}" >> ${log} echo -e "${output}" >> ${log}
errors=1 errors=1
fi fi
done
# Check utf8ness of all files # Create langpack from .po file
for file in `find .`; do output=`/usr/bin/perl ${SCRIPTS}/po-php.pl $pofile $cleanbranchdir "${lang}.utf8"`
output=`${UTF8CMD} ${file}`
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo ${file} >> ${log} echo "Failed to create langpack from .po file ${pofile}" >> ${log}
echo ${pofile} >> ${log}
echo -e "${output}" >> ${log} echo -e "${output}" >> ${log}
errors=1 errors=1
fi fi
done
else
echo "$lang $localbranch: sanitising"
# sanitise langpack
dirtybranchdir=${dirtylangdir}/${localbranch}
[ ! -d ${dirtybranchdir} ] && mkdir ${dirtybranchdir}
cp -r ${gitlangdir}/[^\\.]* ${dirtybranchdir}
# Clean out stray php from the langpacks
${CLEANCMD} ${dirtybranchdir} ${cleanbranchdir}
cd ${DATA}
diff -Bwr ${dirtybranchdir} ${cleanbranchdir} > ${diff}
# Check syntax of php files
cd ${cleanbranchdir}
for file in `find . -name "*.php"`; do
output=`${SYNTAXCMD} $file`
if [ $? -ne 0 ]; then
echo ${file} >> ${log}
echo -e "${output}" >> ${log}
errors=1
fi
done
# Check utf8ness of all files
for file in `find .`; do
output=`${UTF8CMD} ${file}`
if [ $? -ne 0 ]; then
echo ${file} >> ${log}
echo -e "${output}" >> ${log}
errors=1
fi
done
fi
if [ $errors = 0 ]; then if [ $errors = 0 ]; then
strip=`echo ${cleanbranchdir} | sed 's,^/,,'` strip=`echo ${cleanbranchdir} | sed 's,^/,,'`
......
...@@ -203,3 +203,5 @@ if (!empty($sourcefiles)) { ...@@ -203,3 +203,5 @@ if (!empty($sourcefiles)) {
} }
} }
} }
file_put_contents($destfile, "\n", FILE_APPEND);
\ No newline at end of file
Supports Markdown
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