diff options
Diffstat (limited to 'createrepomddeps')
-rwxr-xr-x | createrepomddeps | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/createrepomddeps b/createrepomddeps index 5c688af..fdb5346 100755 --- a/createrepomddeps +++ b/createrepomddeps @@ -89,20 +89,20 @@ for my $url (@ARGV) { $dir = "$cachedir/$repoid/"; $baseurl .= '/' unless $baseurl =~ /\/$/; mkpath("${dir}repodata"); - my $sem; - my $key = IPC::SysV::ftok($dir, '1'); - if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) { - $sem->setval(0, 1); - } else { - $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT); - } - - $sem->op(0, -1, SEM_UNDO); - if (!-f "${dir}repodata/repomd.xml") { - system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml"); - } - $sem->op(0, 1, SEM_UNDO); - $sem->remove(); + my $sem; + my $key = IPC::SysV::ftok($dir, '1'); + if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) { + $sem->setval(0, 1); + } else { + $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT); + } + + $sem->op(0, -1, SEM_UNDO); + if (!-f "${dir}repodata/repomd.xml") { + system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml"); + } + $sem->op(0, 1, SEM_UNDO); + $sem->remove(); } else { $dir = $url; } @@ -126,14 +126,14 @@ for my $url (@ARGV) { utf8::downgrade($u); } my $cached; - my $sem; - my $key = IPC::SysV::ftok("${dir}repodata/", '1'); - if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) { - $sem->setval(0, 1); - } else { - $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT); - } - $sem->op(0, -1, SEM_UNDO); + my $sem; + my $key = IPC::SysV::ftok("${dir}repodata/", '1'); + if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) { + $sem->setval(0, 1); + } else { + $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT); + } + $sem->op(0, -1, SEM_UNDO); if (-e $u) { $cached = 1; $cached = 0 if exists($f->{'size'}) && $f->{'size'} != (-s _); @@ -149,8 +149,8 @@ for my $url (@ARGV) { die("inconsistent repodata in $url\n"); } } - $sem->op(0, 1, SEM_UNDO); - $sem->remove(); + $sem->op(0, 1, SEM_UNDO); + $sem->remove(); my $fh; open($fh, '<', $u) or die "Error opening $u: $!\n"; |