From 23b1d6c64625009297b2d29e0c6b81a5105077d1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 16 Jul 2012 21:47:38 +0200 Subject: [PATCH] Initial commit: Creates some of the debian files --- auto_debuild.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 auto_debuild.py diff --git a/auto_debuild.py b/auto_debuild.py new file mode 100755 index 0000000..098bc89 --- /dev/null +++ b/auto_debuild.py @@ -0,0 +1,47 @@ +#!/usr/bin/python +import os, stat + +def writeDebList(list): + return ', '.join(list) + +def createDebianFiles(config): + sourceName = config['sourceName'] + binaryName = config.get('binaryName', sourceName+'-local') + name = config.get('name', os.getlogin()) + email = config.get('email', os.getlogin()+'@'+os.uname()[1]) + # source format file + if not os.path.exists('debian/source'): os.mkdir('debian/source') + with open('debian/source/format', 'w') as f: + print >>f, "3.0 (native)" + # compat file + with open('debian/compat', 'w') as f: + print >>f, "9" + # changelog file + with open('debian/changlog', 'w') as f: + print >>f, "Auto-generated by auto-debuild, not suited for distribution" + # control file + with open('debian/control', 'w') as f: + print >>f, "Source:",sourceName + print >>f, "Section: misc" + print >>f, "Priority: extra" + print >>f, "Maintainer: %s <%s>" % (name, email) + print >>f, "Build-Depends:",writeDebList(["debhelper (>= 9)"] + config.get('buildDepends', [])) + print >>f, "Standards-Version: 3.9.3" + print >>f, "" + print >>f, "Package:",binaryName + print >>f, "Architecture:",config.get('architecture', 'any') + print >>f, "Depends:",writeDebList(["${shlibs:Depends}", "${misc:Depends}"] + config.get('binaryDepends', [])) + print >>f, "Provides:",writeDebList(config.get('binaryProvides', [sourceName])) + print >>f, "Description:",sourceName + print >>f, " Auto-generated package for",sourceName + # rules file + with open('debian/rules', 'w') as f: + pass + mode = os.stat('debian/rules').st_mode + os.chmod('debian/rules', mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) + +if __name__ == "__main__": + import imp + config = imp.load_source('config', 'debian/auto-debuild.py') + createDebianFiles(config.__dict__) + -- 2.30.2