* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/emaint/modules/binhost/
@ 2012-08-09 20:34 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2012-08-09 20:34 UTC (permalink / raw
To: gentoo-commits
commit: 55a7b859d40e6130217cea63a9027730f6780239
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 9 20:34:44 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug 9 20:34:44 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55a7b859
emaint binhost: support compress-index
---
pym/portage/dbapi/bintree.py | 46 +++++++++++++-----------
pym/portage/emaint/modules/binhost/binhost.py | 8 +---
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 8dd7aad..6c01867 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -813,9 +813,7 @@ class binarytree(object):
del pkgindex.packages[:]
pkgindex.packages.extend(iter(metadata.values()))
self._update_pkgindex_header(pkgindex.header)
- f = atomic_ofstream(self._pkgindex_file)
- pkgindex.write(f)
- f.close()
+ self._pkgindex_write(pkgindex)
if getbinpkgs and not self.settings["PORTAGE_BINHOST"]:
writemsg(_("!!! PORTAGE_BINHOST unset, but use is requested.\n"),
@@ -1187,28 +1185,34 @@ class binarytree(object):
pkgindex.packages.append(d)
self._update_pkgindex_header(pkgindex.header)
- contents = codecs.getwriter(_encodings['repo.content'])(io.BytesIO())
- pkgindex.write(contents)
- contents = contents.getvalue()
- atime = mtime = long(pkgindex.header["TIMESTAMP"])
-
- pkgindex_filename = os.path.join(self.pkgdir, "Packages")
- output_files = [(atomic_ofstream(pkgindex_filename, mode="wb"), pkgindex_filename, None)]
- if "compress-index" in self.settings.features:
- gz_fname = pkgindex_filename + ".gz"
- fileobj = atomic_ofstream(gz_fname, mode="wb")
- output_files.append((GzipFile(filename='', mode="wb", fileobj=fileobj, mtime=mtime), gz_fname, fileobj))
- for f, fname, f_close in output_files:
- f.write(contents)
- f.close()
- if f_close is not None:
- f_close.close()
- # some seconds might have elapsed since TIMESTAMP
- os.utime(fname, (atime, mtime))
+ self._pkgindex_write(pkgindex)
+
finally:
if pkgindex_lock:
unlockfile(pkgindex_lock)
+ def _pkgindex_write(self, pkgindex):
+ contents = codecs.getwriter(_encodings['repo.content'])(io.BytesIO())
+ pkgindex.write(contents)
+ contents = contents.getvalue()
+ atime = mtime = long(pkgindex.header["TIMESTAMP"])
+ output_files = [(atomic_ofstream(self._pkgindex_file, mode="wb"),
+ self._pkgindex_file, None)]
+
+ if "compress-index" in self.settings.features:
+ gz_fname = self._pkgindex_file + ".gz"
+ fileobj = atomic_ofstream(gz_fname, mode="wb")
+ output_files.append((GzipFile(filename='', mode="wb",
+ fileobj=fileobj, mtime=mtime), gz_fname, fileobj))
+
+ for f, fname, f_close in output_files:
+ f.write(contents)
+ f.close()
+ if f_close is not None:
+ f_close.close()
+ # some seconds might have elapsed since TIMESTAMP
+ os.utime(fname, (atime, mtime))
+
def _pkgindex_entry(self, cpv):
"""
Performs checksums and evaluates USE flag conditionals.
diff --git a/pym/portage/emaint/modules/binhost/binhost.py b/pym/portage/emaint/modules/binhost/binhost.py
index b540d76..c297545 100644
--- a/pym/portage/emaint/modules/binhost/binhost.py
+++ b/pym/portage/emaint/modules/binhost/binhost.py
@@ -151,12 +151,8 @@ class BinhostHandler(object):
del pkgindex.packages[:]
pkgindex.packages.extend(metadata.values())
- from portage.util import atomic_ofstream
- f = atomic_ofstream(self._pkgindex_file)
- try:
- self._pkgindex.write(f)
- finally:
- f.close()
+ bintree._pkgindex_write(self._pkgindex)
+
finally:
locks.unlockfile(pkgindex_lock)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/emaint/modules/binhost/
@ 2017-11-21 18:48 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2017-11-21 18:48 UTC (permalink / raw
To: gentoo-commits
commit: 694419fc11af6cbda4944b21632acec9c641d1c3
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 21 18:37:33 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 21 18:47:29 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=694419fc
emaint binhost: use _populate_local instead of _populate (bug 638320)
Fixes: 8267445cf2f8 ("binarytree.populate: avoid lock when possible (bug 607872)")
Bug: https://bugs.gentoo.org/638320
pym/portage/dbapi/bintree.py | 2 +-
pym/portage/emaint/modules/binhost/binhost.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index ffac8d216..f4e8a1c66 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -532,7 +532,6 @@ class binarytree(object):
# prior to performing package moves since it only wants to
# operate on local packages (getbinpkgs=0).
self._remotepkgs = None
- self.dbapi.clear()
self._populating = True
try:
@@ -568,6 +567,7 @@ class binarytree(object):
self.populated = True
def _populate_local(self):
+ self.dbapi.clear()
_instance_key = self.dbapi._instance_key
if True:
pkg_paths = {}
diff --git a/pym/portage/emaint/modules/binhost/binhost.py b/pym/portage/emaint/modules/binhost/binhost.py
index ebcc9054f..f18878c7c 100644
--- a/pym/portage/emaint/modules/binhost/binhost.py
+++ b/pym/portage/emaint/modules/binhost/binhost.py
@@ -123,7 +123,7 @@ class BinhostHandler(object):
self._pkgindex_file, wantnewlockfile=1)
try:
# Repopulate with lock held.
- bintree._populate()
+ bintree._populate_local()
cpv_all = self._bintree.dbapi.cpv_all()
cpv_all.sort()
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-21 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 18:48 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/emaint/modules/binhost/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2012-08-09 20:34 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox