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

(-)a/pym/portage/__init__.py (-6 / +15 lines)
Lines 125-130 try: Link Here
125
			'cpv_getkey@getCPFromCPV,endversion_keys,' + \
125
			'cpv_getkey@getCPFromCPV,endversion_keys,' + \
126
			'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
126
			'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
127
		'portage.xpak',
127
		'portage.xpak',
128
		'time',
128
	)
129
	)
129
130
130
	try:
131
	try:
Lines 541-552 if VERSION == 'HEAD': Link Here
541
			if VERSION is not self:
542
			if VERSION is not self:
542
				return VERSION
543
				return VERSION
543
			if os.path.isdir(os.path.join(PORTAGE_BASE_PATH, '.git')):
544
			if os.path.isdir(os.path.join(PORTAGE_BASE_PATH, '.git')):
544
				status, output = subprocess_getstatusoutput(
545
				status, output = subprocess_getstatusoutput((
545
					"cd %s ; git describe --tags" % \
546
					"cd %s ; git describe --tags || exit $? ; " + \
546
					_shell_quote(PORTAGE_BASE_PATH))
547
					"[ -n \"`git diff-index --name-only --diff-filter=M HEAD`\" ] && echo modified ; " + \
548
					"exit 0") % _shell_quote(PORTAGE_BASE_PATH))
547
				if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK:
549
				if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK:
548
					VERSION = output
550
					output = output.split()
549
					return VERSION
551
					if output:
552
						version_split = output[0].split('-')
553
						if version_split:
554
							VERSION = version_split[0].lstrip('v')
555
							if len(version_split) > 1:
556
								VERSION = "%s_p%s" %(VERSION, version_split[1])
557
							if output[-1] == 'modified':
558
								VERSION = "%s_p%d" % (VERSION, time.time())
559
							return VERSION
550
			VERSION = 'HEAD'
560
			VERSION = 'HEAD'
551
			return VERSION
561
			return VERSION
552
	VERSION = _LazyVersion()
562
	VERSION = _LazyVersion()
553
- 

Return to bug 338002