diff options
author | Jun Wang <junbill.wang@samsung.com> | 2016-05-21 08:55:16 +0800 |
---|---|---|
committer | SoonKyu Park <sk7.park@samsung.com> | 2016-06-15 14:23:01 +0900 |
commit | b6d5c95818cbc98b5c325df396d0092b32c87af5 (patch) | |
tree | 8bbe7f9fc7fe4fa4d559ca38cdc904d3b523200c /createrepomddeps | |
parent | cd92bc1d635ceaaf19d6f2e722b9bcb68f0226a1 (diff) | |
download | build-b6d5c95818cbc98b5c325df396d0092b32c87af5.tar.gz build-b6d5c95818cbc98b5c325df396d0092b32c87af5.tar.bz2 build-b6d5c95818cbc98b5c325df396d0092b32c87af5.zip |
rest patch add lock protection for download repodata using multi-threads
Change-Id: Iec790e275c22165108a1564131f7c74e91e29acb
Diffstat (limited to 'createrepomddeps')
-rwxr-xr-x | createrepomddeps | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/createrepomddeps b/createrepomddeps index 631f31e..1e9f624 100755 --- a/createrepomddeps +++ b/createrepomddeps @@ -88,16 +88,7 @@ for my $url (@ARGV) { $dir = "$cachedir/$repoid/"; $baseurl .= '/' unless $baseurl =~ /\/$/; mkpath("${dir}repodata"); - my $lock_file = $dir . 'repodata/down_repomd.lock'; - open(my $lfh, '>>', $lock_file) or die "Could not open '$lock_file' - $!"; - flock($lfh, LOCK_EX); - if (!-f "${dir}repodata/repomd.xml") { - if (system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml")) { - close($lfh) or die "Could not write '$lock_file' - $!"; - die("get metadata failed\n"); - } - } - close($lfh) or die "Could not write '$lock_file' - $!"; + system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml"); } else { $dir = $url; } @@ -121,9 +112,6 @@ for my $url (@ARGV) { utf8::downgrade($u); } my $cached; - my $lock_file = $dir . "repodata/down_primary.lock"; - open(my $lfh, '>>', $lock_file) or die "Could not open '$lock_file' - $!"; - flock($lfh, LOCK_EX); if (-e $u) { $cached = 1; $cached = 0 if exists($f->{'size'}) && $f->{'size'} != (-s _); @@ -139,7 +127,6 @@ for my $url (@ARGV) { die("inconsistent repodata in $url\n"); } } - close($lfh) or die "Could not write '$lock_file' - $!"; my $fh; open($fh, '<', $u) or die "Error opening $u: $!\n"; |