public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r15302 - in main/branches/prefix: bin pym/portage/cache
@ 2010-01-31  9:44 Fabian Groffen (grobian)
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2010-01-31  9:44 UTC (permalink / raw
  To: gentoo-commits

Author: grobian
Date: 2010-01-31 09:44:08 +0000 (Sun, 31 Jan 2010)
New Revision: 15302

Modified:
   main/branches/prefix/bin/repoman
   main/branches/prefix/pym/portage/cache/flat_hash.py
Log:
   Merged from trunk -r15292:15298

   | 15293   | Fix: change os.mkdir to os.makedirs in case of there are     |
   | volkmar | more than one directory depth missing. According to          |
   |         | docs.python.org, permissions may be not respected with       |
   |         | os.makedirs... with some systems.                            |
   
   | 15294   | Avoid NameError when cwd is $FILESDIR. Thanks to Christian   |
   | zmedico | Ruppert <idl0r@g.o> for reporting.                           |
   
   | 15295   | Bug #302764 - Inside __iter__, only recurse 1 deep, in order |
   | zmedico | to avoid iteration over entries from another nested cache    |
   |         | instance. This can happen if the user nests an overlay       |
   |         | inside /usr/portage/local. Thanks to Vlastimil Babka         |
   |         | <caster@g.o> for this patch.                                 |
   
   | 15296   | Make __iter__ use list.pop() instead of pop(0), for greater  |
   | zmedico | efficiency.                                                  |
   
   | 15297   | In __iter__, handle OSError from lstat in case a cache entry |
   | zmedico | disappears.                                                  |
   
   | 15298   | Reverting r15293, it was actually not needed.                |
   | volkmar |                                                              |


Modified: main/branches/prefix/bin/repoman
===================================================================
--- main/branches/prefix/bin/repoman	2010-01-31 09:43:08 UTC (rev 15301)
+++ main/branches/prefix/bin/repoman	2010-01-31 09:44:08 UTC (rev 15302)
@@ -748,6 +748,12 @@
 		caterror(catdir)
 	scanlist.append(catdir+"/"+reposplit[-1])
 	repo_subdir = scanlist[-1] + os.sep
+else:
+	msg = 'Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY' + \
+		' from the current working directory'
+	logging.critical(msg)
+	sys.exit(1)
+
 repo_subdir_len = len(repo_subdir)
 scanlist.sort()
 

Modified: main/branches/prefix/pym/portage/cache/flat_hash.py
===================================================================
--- main/branches/prefix/pym/portage/cache/flat_hash.py	2010-01-31 09:43:08 UTC (rev 15301)
+++ main/branches/prefix/pym/portage/cache/flat_hash.py	2010-01-31 09:44:08 UTC (rev 15302)
@@ -120,24 +120,32 @@
 
 	def __iter__(self):
 		"""generator for walking the dir struct"""
-		dirs = [self.location]
+		dirs = [(0, self.location)]
 		len_base = len(self.location)
-		while len(dirs):
+		while dirs:
+			depth, dir_path = dirs.pop()
 			try:
-				dir_list = os.listdir(dirs[0])
+				dir_list = os.listdir(dir_path)
 			except OSError as e:
 				if e.errno != errno.ENOENT:
 					raise
 				del e
-				dirs.pop(0)
 				continue
 			for l in dir_list:
 				if l.endswith(".cpickle"):
 					continue
-				p = os.path.join(dirs[0],l)
-				st = os.lstat(p)
+				p = os.path.join(dir_path, l)
+				try:
+					st = os.lstat(p)
+				except OSError:
+					# Cache entry disappeared.
+					continue
 				if stat.S_ISDIR(st.st_mode):
-					dirs.append(p)
+					# Only recurse 1 deep, in order to avoid iteration over
+					# entries from another nested cache instance. This can
+					# happen if the user nests an overlay inside
+					# /usr/portage/local as in bug #302764.
+					if depth < 1:
+						dirs.append((depth+1, p))
 					continue
 				yield p[len_base+1:]
-			dirs.pop(0)




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-31  9:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-31  9:44 [gentoo-commits] portage r15302 - in main/branches/prefix: bin pym/portage/cache Fabian Groffen (grobian)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox