diff options
author | y0169.zhang <y0169.zhang@samsung.com> | 2017-04-18 16:09:05 +0900 |
---|---|---|
committer | y0169.zhang <y0169.zhang@samsung.com> | 2017-04-18 16:09:05 +0900 |
commit | e3da5fcdb300a12c57e4b0828f9fcc50140f48fd (patch) | |
tree | 7f668dae6b6742e0d4e59f228485cd2dc60d932d | |
parent | f050406bac7b202d5bb868a43adc30fef5893538 (diff) | |
download | build-e3da5fcdb300a12c57e4b0828f9fcc50140f48fd.tar.gz build-e3da5fcdb300a12c57e4b0828f9fcc50140f48fd.tar.bz2 build-e3da5fcdb300a12c57e4b0828f9fcc50140f48fd.zip |
Drop commit-patch 2118b292cabcb7bb7d022cf9a233841b789c02aa
Path detail:
"""
Fix issue:https://bugs.tizen.org/jira/browse/DEVT-310
Let each process has it's own repomd dir
"""
Change-Id: I276471d7863e1947bed30c3d1bb39e8ce3c14e06
-rwxr-xr-x | createrepomddeps | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/createrepomddeps b/createrepomddeps index 35745dc..5c688af 100755 --- a/createrepomddeps +++ b/createrepomddeps @@ -33,7 +33,6 @@ use Build::Rpmmd; use Digest::MD5 (); use File::Path qw(mkpath rmtree); use File::Basename; -use File::Path; use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR IPC_CREAT IPC_EXCL SEM_UNDO); use IPC::Semaphore; @@ -83,52 +82,42 @@ my @packages; # for opt_dump for my $url (@ARGV) { my $dir; my $baseurl = $url; - my $needrm = 0; - my $repodir; if ($opt_zypp) { $dir = $opt_zypp; - $dir .= '/' unless $dir =~ /\/$/; - $baseurl .= '/' unless $baseurl =~ /\/$/; - $repodir = "${dir}repodata/"; } elsif ($url =~ /^(?:ftps?|https?):\/\/([^\/]*)\/?/) { my $repoid = Digest::MD5::md5_hex($url); $dir = "$cachedir/$repoid/"; $baseurl .= '/' unless $baseurl =~ /\/$/; - mkpath("${dir}repodata-$$"); 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(); - $repodir = "${dir}repodata-$$/"; - $needrm = 1; + 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; - $dir .= '/' unless $dir =~ /\/$/; - $baseurl .= '/' unless $baseurl =~ /\/$/; - $repodir = "${dir}repodata/"; } + $dir .= '/' unless $dir =~ /\/$/; + $baseurl .= '/' unless $baseurl =~ /\/$/; - if (! -s "${repodir}repomd.xml") { + if (! -s "${dir}repodata/repomd.xml") { die("zypp repo $url is not up to date, please refresh first\n") if $opt_zypp; die("repo $url does not contain a repomd.xml file\n"); } my @primaryfiles; - Build::Rpmmd::parse_repomd("${repodir}repomd.xml", \@primaryfiles); + Build::Rpmmd::parse_repomd("${dir}repodata/repomd.xml", \@primaryfiles); @primaryfiles = grep {$_->{'type'} eq 'primary' && defined($_->{'location'})} @primaryfiles; # print Dumper(\@primaryfiles); - rmtree "$repodir" if ($needrm == 1); for my $f (@primaryfiles) { my $u = "$dir$f->{'location'}"; |