From e4baee8d254fef2688381ea33072db5a48cd0495 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Wed, 13 May 2020 17:49:39 +0300 Subject: [PATCH] build/i18n-merge-master: ignore apps deleted in master Refine the code to ignore apps that have been deleted from master but still exist in release branches. E.g. luci-app-samba Previously the unhandled git error from non-existing master mangled the .po files in the release branch: the 18n header was removed and all non-ASCII chars were deleted from translation. Fix this by processing only those files where 'git show' succeeds. Signed-off-by: Hannu Nyman --- build/i18n-merge-master.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build/i18n-merge-master.pl b/build/i18n-merge-master.pl index d7479efb84..be0474da90 100755 --- a/build/i18n-merge-master.pl +++ b/build/i18n-merge-master.pl @@ -7,9 +7,14 @@ if (open F, '-|', 'find', $ARGV[0] || '.', '-type', 'f', '-name', '*.po') { (my $ref = $path) =~ s/\.po$/\.master.po/; printf 'Updating %s ', $path; - system("git show --format=\%B 'master:$path' > '$ref'"); - system('msgmerge', '-N', '-o', $path, $ref, $path); - system('msgattrib', '--no-obsolete', '-o', $path, $path); + my $returnCode = system("git show --format=\%B 'master:$path' > '$ref'"); + if ( $returnCode == 0 ) + { + system('msgmerge', '-N', '-o', $path, $ref, $path); + system('msgattrib', '--no-obsolete', '-o', $path, $path); + } else { + print "...failed due to git error.\n"; + } unlink($ref); } -- 2.30.2