def core_build_id():
	'''Unique id in URN form, distinguishing each unique build.
	
	If building from a repository checkout, the resulting string
	will have the format "urn:rcsid:IDENTIFIER". If building
	from source which is not under revision control, the build id 
	will have the format "urn:utcts:YYYYMMDDHHMMSS". (UTC timestamp)
	
	In the special case of a Debian package, there is a suffix of
	the following format: ":debian:" package-revision
	Examples of Debianized build ids:
		urn:rcsid:1d348b83a8a8297267c25a1dc86fa170c6d141df:debian:3
		urn:utcts:20081030020621:debian:3
	
	Dirty repositories generate a urn:rcsid with a trailing "+"
	followed by a base 16 encoded timestamp.
	
	A "unique build" is defined as the sum of all source code bytes
	combined. A single modification anywhere causes a new unique
	instance to be "born".
	
	This value can be overridden by exporting the SMISK_BUILD_ID
	environment variable, but keep in mind to use a URN av value.
	
	:return: URN
	:rtype: string
	'''
	global _core_build_id
	if _core_build_id is None:
		if 'SMISK_BUILD_ID' in os.environ:
			_core_build_id = os.environ['SMISK_BUILD_ID']
		else:
			# Maybe under revision control
			try:
				_core_build_id = shell_cmd(['git rev-parse master'])
			except __HOLE__:
				pass
			if _core_build_id:
				dirty_extra = ''
				if _core_build_id[-1] == '+':
					dirty_extra = '%x' % int(time.time())
				_core_build_id = 'urn:rcsid:%s%s' % (_core_build_id, dirty_extra)
			if not _core_build_id:
				# Not under revision control
				_core_build_id = time.strftime('urn:utcts:%Y%m%d%H%M%S', time.gmtime())
			if 'SMISK_BUILD_ID_SUFFIX' in os.environ:
				_core_build_id += os.environ['SMISK_BUILD_ID_SUFFIX']
	return _core_build_id
dataset/ETHPy150Open rsms/smisk/setup.py/core_build_id