Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 275217 | Differences between
and this patch

Collapse All | Expand All

(-)_emerge.1/depgraph.py (-53 / +2 lines)
Lines 24-29 Link Here
24
from _emerge.Blocker import Blocker
24
from _emerge.Blocker import Blocker
25
from _emerge.BlockerCache import BlockerCache
25
from _emerge.BlockerCache import BlockerCache
26
from _emerge.BlockerDepPriority import BlockerDepPriority
26
from _emerge.BlockerDepPriority import BlockerDepPriority
27
from _emerge.changelog import calc_changelog
27
from _emerge.countdown import countdown
28
from _emerge.countdown import countdown
28
from _emerge.create_world_atom import create_world_atom
29
from _emerge.create_world_atom import create_world_atom
29
from _emerge.Dependency import Dependency
30
from _emerge.Dependency import Dependency
Lines 3767-3773 Link Here
3767
					if "--changelog" in self.myopts:
3768
					if "--changelog" in self.myopts:
3768
						inst_matches = vardb.match(pkg.slot_atom)
3769
						inst_matches = vardb.match(pkg.slot_atom)
3769
						if inst_matches:
3770
						if inst_matches:
3770
							changelogs.extend(self._calc_changelog(
3771
							changelogs.extend(calc_changelog(
3771
								portdb.findname(pkg_key),
3772
								portdb.findname(pkg_key),
3772
								inst_matches[0], pkg_key))
3773
								inst_matches[0], pkg_key))
3773
				else:
3774
				else:
Lines 4262-4319 Link Here
4262
			show_mask_docs()
4263
			show_mask_docs()
4263
			print
4264
			print
4264
4265
4265
	def _calc_changelog(self,ebuildpath,current,next):
4266
		if ebuildpath == None or not os.path.exists(ebuildpath):
4267
			return []
4268
		current = '-'.join(portage.catpkgsplit(current)[1:])
4269
		if current.endswith('-r0'):
4270
			current = current[:-3]
4271
		next = '-'.join(portage.catpkgsplit(next)[1:])
4272
		if next.endswith('-r0'):
4273
			next = next[:-3]
4274
		changelogpath = os.path.join(os.path.split(ebuildpath)[0],'ChangeLog')
4275
		try:
4276
			changelog = open(changelogpath).read()
4277
		except SystemExit, e:
4278
			raise # Needed else can't exit
4279
		except:
4280
			return []
4281
		divisions = self.find_changelog_tags(changelog)
4282
		#print 'XX from',current,'to',next
4283
		#for div,text in divisions: print 'XX',div
4284
		# skip entries for all revisions above the one we are about to emerge
4285
		for i in range(len(divisions)):
4286
			if divisions[i][0]==next:
4287
				divisions = divisions[i:]
4288
				break
4289
		# find out how many entries we are going to display
4290
		for i in range(len(divisions)):
4291
			if divisions[i][0]==current:
4292
				divisions = divisions[:i]
4293
				break
4294
		else:
4295
		    # couldnt find the current revision in the list. display nothing
4296
			return []
4297
		return divisions
4298
4299
	def _find_changelog_tags(self,changelog):
4300
		divs = []
4301
		release = None
4302
		while 1:
4303
			match = re.search(r'^\*\ ?([-a-zA-Z0-9_.+]*)(?:\ .*)?\n',changelog,re.M)
4304
			if match is None:
4305
				if release is not None:
4306
					divs.append((release,changelog))
4307
				return divs
4308
			if release is not None:
4309
				divs.append((release,changelog[:match.start()]))
4310
			changelog = changelog[match.end():]
4311
			release = match.group(1)
4312
			if release.endswith('.ebuild'):
4313
				release = release[:-7]
4314
			if release.endswith('-r0'):
4315
				release = release[:-3]
4316
4317
	def saveNomergeFavorites(self):
4266
	def saveNomergeFavorites(self):
4318
		"""Find atoms in favorites that are not in the mergelist and add them
4267
		"""Find atoms in favorites that are not in the mergelist and add them
4319
		to the world file if necessary."""
4268
		to the world file if necessary."""

Return to bug 275217