Make vardbapi.counter_tick_core() create the counter file's parent directory
authorZac Medico <zmedico@gentoo.org>
Mon, 3 May 2010 20:05:46 +0000 (13:05 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 3 May 2010 20:05:46 +0000 (13:05 -0700)
if necessary, in order to avoid FileNotFound error. Thanks to Fabio Erculiani
<lxnay@g.o> for reporting.

pym/portage/dbapi/vartree.py

index a306fb6d661807ea17105da100084b5e6870dc83..1b97c382f8314de132473302d4fd03b44f89c594 100644 (file)
@@ -1444,6 +1444,9 @@ class vardbapi(dbapi):
                if incrementing:
                        #increment counter
                        counter += 1
+                       # use same permissions as config._init_dirs()
+                       ensure_dirs(os.path.dirname(self._counter_path),
+                               gid=portage_gid, mode=0o2750, mask=0o2)
                        # update new global counter file
                        write_atomic(self._counter_path, str(counter))
                return counter