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

Collapse All | Expand All

(-)portage.py.orig (-12 / +22 lines)
Lines 922-951 Link Here
922
# version is None and error is a string
922
# version is None and error is a string
923
#
923
#
924
def ExtractKernelVersion(base_dir):
924
def ExtractKernelVersion(base_dir):
925
	pathname = os.path.join(base_dir, 'include/linux/version.h')
925
	lines = []
926
	pathname = os.path.join(base_dir, 'Makefile')
926
	try:
927
	try:
927
		lines = open(pathname, 'r').readlines()
928
		f = open(pathname, 'r')
928
	except OSError, details:
929
	except OSError, details:
929
		return (None, str(details))
930
		return (None, str(details))
930
	except IOError, details:
931
	except IOError, details:
931
		return (None, str(details))
932
		return (None, str(details))
932
933
934
	try:
935
		for i in range(4):
936
			lines.append(f.readline())
937
	except OSError, details:
938
		return (None, str(details))
939
	except IOError, details:
940
		return (None, str(details))
941
		
933
	lines = map(string.strip, lines)
942
	lines = map(string.strip, lines)
934
943
935
	version = ''
944
	version = ''
936
945
937
	for line in lines:
946
	for line in lines:
938
		items = string.split(line, ' ', 2)
947
		items = string.split(line, ' ')
939
		if items[0] == '#define' and \
948
		if items[0] == 'VERSION' or \
940
			items[1] == 'UTS_RELEASE':
949
			items[0] == 'PATCHLEVEL':
941
			version = items[2] # - may be wrapped in quotes
950
			version += items[2]
942
		break
951
			version += "."
943
952
		elif items[0] == 'SUBLEVEL':
944
	if version == '':
953
			version += items[2]
945
		return (None, "Unable to locate UTS_RELEASE in %s" % (pathname))
954
		elif items[0] == 'EXTRAVERSION' and \
955
			items[-1] != '=':
956
			version += "-"
957
			version += items[2]
946
958
947
	if version[0] == '"' and version[-1] == '"':
948
		version = version[1:-1]
949
	return (version,None)
959
	return (version,None)
950
960
951
aumtime=0
961
aumtime=0

Return to bug 32737