void-packages/srcpkgs/intltool/patches/avoid-process-race.patch
Đoàn Trần Công Danh 986c0a7d5e srcpkgs/i*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

36 lines
905 B
Diff

https://bazaar.launchpad.net/~intltool/intltool/trunk/revision/748?start_revid=748
=== modified file 'intltool-merge.in'
--- a/intltool-merge.in 2014-11-24 02:37:01 +0000
+++ b/intltool-merge.in 2017-05-18 19:09:18 +0000
@@ -43,6 +43,7 @@
use Text::Wrap;
use File::Basename;
use Encode;
+use Fcntl qw(:flock);
my $must_end_tag = -1;
my $last_depth = -1;
@@ -392,11 +393,14 @@
sub get_cached_translation_database
{
+ open(my $lockfh, ">", "$cache_file.lock") or die $!;
+ flock($lockfh, LOCK_EX) or die "Could not lock '$cache_file.lock' - $!";
my $cache_file_age = -M $cache_file;
if (defined $cache_file_age)
{
if ($cache_file_age <= &get_newest_po_age)
{
+ close($lockfh);
&load_cache;
return;
}
@@ -404,6 +408,7 @@
}
&create_cache;
+ close($lockfh);
}
sub add_translation