This file is indexed.

/usr/share/clam/sconstools/versionInfo.py is in libclam-dev 1.4.0-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os, re
#reminder if we want to use the date: datetime.date.today()

# private methods:

def _svnRevisionOf( whatToCheck ):
	os.environ['LANG']='C'
	output = os.popen("svn info "+whatToCheck)
	revisionLocator = re.compile(r'^Revision:(?P<revision>.*)')
	for line in output :
		match = revisionLocator.match(line)
		if not match: continue
		return match.group('revision').strip()
	raise "No svn revision found for "+ whatToCheck

def _parseChangesFile( changesFile, product='CLAM' ) :
	versionExtractor = re.compile(r'[0-9?]+-[0-9?]+-[0-9?]+ %s (?P<Major>[0-9]+)\.(?P<Minor>[0-9]+)\.(?P<Patch>[0-9]+)(?P<SVN>.*SVN[^0-9]*(?P<Revision>[0-9]+))?'%product)
	for line in file(changesFile) :
		match = versionExtractor.match(line)
		if match is None: continue
		major, minor, patch, revision = [ match.group(tag) for tag in ('Major', 'Minor', 'Patch', 'Revision') ]
		version = "%s.%s.%s"%(major,minor,patch)
		return version, revision
	assert "not found a valid CHANGES file: "+changesFile

def _svnVersion(version, revision) :
	return "%s~svn%05i"%(version, int(revision))


# public methods:

remoteRepository = 'http://clam-project.org/clam/trunk/'

def remoteSvnRevision() :
	return _svnRevisionOf( remoteRepository )

def versionFromLocalInfo( product='CLAM', changesFile="CHANGES" ):
	"If available take the revision in (local) svn info, else use CHANGES"
	version, revision = _parseChangesFile( changesFile, product ) 
	if not revision : # it's a release. forget about svnVersion
		return version, version 
	try : 
		revision = _svnRevisionOf(".")
	except:	
		pass
	return version, _svnVersion(version, revision)

def versionFromRemoteSvn( product="CLAM" ) :
	os.system("rm CHANGES*" )
	os.system("svn export "+ remoteRepository + product + "/CHANGES" )
	version, revision = _parseChangesFile( "CHANGES", product ) 
	if not revision : return version, version
	revision = _svnRevisionOf( remoteRepository )
	return version, _svnVersion(version, revision)
	
def generateVersionSources(fileBase, namespace, versionString, fullVersionString=None) :
	if not fullVersionString:  fullVersionString = versionString
	header = file(fileBase+".hxx", "w")
	header.write('namespace %s { const char * GetFullVersion(); }\n'%namespace)
	header.write('namespace %s { const char * GetVersion(); }\n'%namespace)
	header.close()
	source = file(fileBase+".cxx", "w")
	source.write('namespace %s { const char * GetFullVersion() {return "%s";} }\n'%(namespace,fullVersionString))
	source.write('namespace %s { const char * GetVersion() {return "%s";} }\n'%(namespace,versionString))
	source.close()