4 def writeDebList(list):
7 def createDebianFiles(config):
8 sourceName = config['sourceName']
9 binaryName = config.get('binaryName', sourceName+'-local')
10 name = config.get('name', os.getlogin())
11 email = config.get('email', os.getlogin()+'@'+os.uname()[1])
13 if not os.path.exists('debian/source'): os.mkdir('debian/source')
14 with open('debian/source/format', 'w') as f:
15 print >>f, "3.0 (native)"
17 with open('debian/compat', 'w') as f:
20 with open('debian/changlog', 'w') as f:
21 print >>f, "Auto-generated by auto-debuild, not suited for distribution"
23 with open('debian/control', 'w') as f:
24 print >>f, "Source:",sourceName
25 print >>f, "Section: misc"
26 print >>f, "Priority: extra"
27 print >>f, "Maintainer: %s <%s>" % (name, email)
28 print >>f, "Build-Depends:",writeDebList(["debhelper (>= 9)"] + config.get('buildDepends', []))
29 print >>f, "Standards-Version: 3.9.3"
31 print >>f, "Package:",binaryName
32 print >>f, "Architecture:",config.get('architecture', 'any')
33 print >>f, "Depends:",writeDebList(["${shlibs:Depends}", "${misc:Depends}"] + config.get('binaryDepends', []))
34 print >>f, "Provides:",writeDebList(config.get('binaryProvides', [sourceName]))
35 print >>f, "Description:",sourceName
36 print >>f, " Auto-generated package for",sourceName
38 with open('debian/rules', 'w') as f:
40 mode = os.stat('debian/rules').st_mode
41 os.chmod('debian/rules', mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
43 if __name__ == "__main__":
45 config = imp.load_source('config', 'debian/auto-debuild.py')
46 createDebianFiles(config.__dict__)