diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-01-04 00:06:39 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-01-04 00:06:39 +0000 |
commit | 61c32e717bf23f7ddad3de5d29af86b993533f67 (patch) | |
tree | 615d9fae347750041f0df9af1e032c1f2af1bdf3 | |
parent | eab078866e70b98616e1a78775fb3a847470210c (diff) | |
download | portage-61c32e717bf23f7ddad3de5d29af86b993533f67.tar.gz portage-61c32e717bf23f7ddad3de5d29af86b993533f67.tar.bz2 portage-61c32e717bf23f7ddad3de5d29af86b993533f67.zip |
Implement distlocks for --getbinpkg so that it works properly when parallel-fetch is enabled. Thanks to Brent Baude <ranger@gentoo.org> for reporting.
svn path=/main/trunk/; revision=5456
-rwxr-xr-x | bin/emerge | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/bin/emerge b/bin/emerge index 24f1f91d4..bb32835d1 100755 --- a/bin/emerge +++ b/bin/emerge @@ -2994,14 +2994,26 @@ class MergeTask(object): elif x[0]=="binary": #merge the tbz2 mytbz2 = self.trees[myroot]["bintree"].getname(pkg_key) - if self.trees[myroot]["bintree"].isremote(pkg_key): - short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Fetch" - emergelog(xterm_titles, " --- ("+str(mergecount)+\ - " of "+str(len(mymergelist))+\ - ") Fetching Binary ("+x[pkgindex]+\ - "::"+mytbz2+")", short_msg=short_msg) - if not self.trees[myroot]["bintree"].gettbz2(pkg_key): - sys.exit(1) + if "--getbinpkg" in self.myopts: + tbz2_lock = None + try: + if "distlocks" in pkgsettings.features and \ + os.access(pkgsettings["PKGDIR"], os.W_OK): + portage_util.ensure_dirs(os.path.dirname(mytbz2)) + tbz2_lock = portage_locks.lockfile(mytbz2, + wantnewlockfile=1) + if self.trees[myroot]["bintree"].isremote(pkg_key): + msg = " --- (%s of %s) Fetching Binary (%s::%s)" %\ + (mergecount, len(mymergelist), pkg_key, mytbz2) + short_msg = "emerge: (%s of %s) %s Fetch" % \ + (mergecount, len(mymergelist), pkg_key) + emergelog(xterm_titles, msg, short_msg=short_msg) + if not self.trees[myroot]["bintree"].gettbz2( + pkg_key): + return 1 + finally: + if tbz2_lock: + portage_locks.unlockfile(tbz2_lock) if "--fetchonly" in self.myopts or \ "--fetch-all-uri" in self.myopts: |