Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 252243
Collapse All | Expand All

(-)pym/portage/dbapi/bintree.py (-6 / +17 lines)
Lines 322-328 Link Here
322
		myfile = mypkg + ".tbz2"
322
		myfile = mypkg + ".tbz2"
323
		mypath = os.path.join("All", myfile)
323
		mypath = os.path.join("All", myfile)
324
		dest_path = os.path.join(self.pkgdir, mypath)
324
		dest_path = os.path.join(self.pkgdir, mypath)
325
		if os.path.exists(dest_path):
325
326
		try:
327
			st = os.lstat(dest_path)
328
		except OSError:
329
			st = None
330
		else:
331
			if stat.S_ISLNK(st.st_mode):
332
				st = None
333
				try:
334
					os.unlink(dest_path)
335
				except OSError:
336
					if os.path.exists(dest_path):
337
						raise
338
339
		if st is not None:
326
			# For invalid packages, other_cat could be None.
340
			# For invalid packages, other_cat could be None.
327
			other_cat = portage.xpak.tbz2(dest_path).getfile("CATEGORY")
341
			other_cat = portage.xpak.tbz2(dest_path).getfile("CATEGORY")
328
			if other_cat:
342
			if other_cat:
Lines 330-340 Link Here
330
				other_cpv = other_cat + "/" + mypkg
344
				other_cpv = other_cat + "/" + mypkg
331
				self._move_from_all(other_cpv)
345
				self._move_from_all(other_cpv)
332
				self.inject(other_cpv)
346
				self.inject(other_cpv)
333
		"""The file may or may not exist. Move it if necessary and update
334
		internal state for future calls to getname()."""
335
		self._move_to_all(cpv)
347
		self._move_to_all(cpv)
336
		if os.path.exists(full_path):
337
			self.inject(cpv)
338
348
339
	def _ensure_dir(self, path):
349
	def _ensure_dir(self, path):
340
		"""
350
		"""
Lines 361-366 Link Here
361
		for future getname() calls."""
371
		for future getname() calls."""
362
		mycat, mypkg = catsplit(cpv)
372
		mycat, mypkg = catsplit(cpv)
363
		myfile = mypkg + ".tbz2"
373
		myfile = mypkg + ".tbz2"
374
		self._pkg_paths[cpv] = os.path.join("All", myfile)
364
		src_path = os.path.join(self.pkgdir, mycat, myfile)
375
		src_path = os.path.join(self.pkgdir, mycat, myfile)
365
		try:
376
		try:
366
			mystat = os.lstat(src_path)
377
			mystat = os.lstat(src_path)
Lines 371-377 Link Here
371
			dest_path = os.path.join(self.pkgdir, "All", myfile)
382
			dest_path = os.path.join(self.pkgdir, "All", myfile)
372
			_movefile(src_path, dest_path, mysettings=self.settings)
383
			_movefile(src_path, dest_path, mysettings=self.settings)
373
			self._create_symlink(cpv)
384
			self._create_symlink(cpv)
374
		self._pkg_paths[cpv] = os.path.join("All", myfile)
385
			self.inject(cpv)
375
386
376
	def _move_from_all(self, cpv):
387
	def _move_from_all(self, cpv):
377
		"""Move a package from ${PKGDIR}/All/${PF}.tbz2 to
388
		"""Move a package from ${PKGDIR}/All/${PF}.tbz2 to

Return to bug 252243