6 ###########################################################################
8 def updateRevision(target, source, env):
9 rev = env['ENV']['REVISION'][1:]
12 print "Working copy not clean. Run 'svn update'"
15 if 'm' in rev and not ARGUMENTS.get('force_deb'):
17 print "Working copy contains local changes. Commit first"
25 for line in os.popen("svn info"):
26 elts=line.split(':',1)
31 version = url.rsplit('/',1)[-1].split('_',1)[0]
32 if version[0] not in string.digits:
35 version = '1:0r%s' % rev
36 changelog = file('debian/changelog.template').read() % {
39 'user': pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0].strip(),
40 'date': time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) }
41 file('debian/changelog','w').write(changelog)
44 try: return os.stat(f).st_size > 0
45 except OSError: return False
47 def checkLocalConf(target, source, env):
48 if [ True for f in env['LOCAL_CONFIG_FILES'] if nonemptyFile(f) ]:
50 print "You have made local modifications to one of the following local configuration"
52 for f in env['LOCAL_CONFIG_FILES']:
55 print "Building a debian package would remove those files."
57 print "To continue, remove the offending file(s) and try again. Alternatively,"
58 print "build a source package using 'scons debsrc' and may then build debian"
59 print "binary packages from this source-package without disrupting your local"
60 print "configuration."
64 if os.environ.get('debian_build'):
65 rev = os.popen("dpkg-parsechangelog | awk '/^Version:/{print $2}'").read().strip()
67 rev = 'r' + os.popen("svnversion").read().strip().lower()
69 logname = os.environ.get('LOGNAME')
71 logname = pwd.getpwuid(os.getuid()).pw_name
73 def dpkgIgnoredFilesOpts(target, source, env, for_signature):
74 return [ '-I%s' % (('/' in f) and (os.path.split(os.getcwd())[1])+f or f)
75 for f in env.subst('$DPKG_IGNORED_FILES').split() ]
79 'LOGNAME' : logname, # needed by the debian build scripts
80 'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1",
85 LOCAL_CONFIG_FILES = [ '/Doxyfile.local', '/SConfig', '/local_config.hh' ],
86 DPKG_IGNORED_FILES = [ '$LOCAL_CONFIG_FILES', '.svn', '/_templates' ],
87 DPKG_IGNORED_FILES_OPTS = dpkgIgnoredFilesOpts,
88 BUILDPACKAGE_COMMAND = "dpkg-buildpackage -us -uc -rfakeroot $DPKG_IGNORED_FILES_OPTS",
91 SENFSCons.PhonyTarget(env, 'deb', [
94 "$BUILDPACKAGE_COMMAND",
95 "fakeroot ./debian/rules debclean"
98 SENFSCons.PhonyTarget(env, 'debsrc', [
100 "$BUILDPACKAGE_COMMAND -S",
103 SENFSCons.PhonyTarget(env, 'debbin', [
106 "$BUILDPACKAGE_COMMAND -b",
107 "fakeroot ./debian/rules debclean"