- print >>f, "Source:",sourceName
- print >>f, "Section:",config.get('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:",packageArchitecture
- if 'binaryPreDepends' in config:
- print >>f, "Pre-Depends:",writeDebList(config['binaryPreDepends'])
- print >>f, "Depends:",writeDebList(["${shlibs:Depends}", "${misc:Depends}"] + config.get('binaryDepends', []))
- print >>f, "Provides:",writeDebList(config.get('binaryProvides', [sourceName]))
- print >>f, "Description:",sourceName,"(auto-debuild)"
- print >>f, " Package auto-generated by auto-debuild."
- files.append(os.path.join(debDir, "%s_%s_%s.deb" % (binaryName, version, arch)))
- if dbgPackage:
- print >>f, ""
- print >>f, "Package:",binaryName+"-dbg"
- print >>f, "Architecture:",packageArchitecture
- print >>f, "Depends:",writeDebList(["${misc:Depends}", binaryName+" (= ${binary:Version})"])
- print >>f, "Description:",sourceName,"debug smbols (auto-debuild)"
- print >>f, " Package containing debug symbols for "+sourceName+", auto-generated by auto-debuild."
- files.append(os.path.join(debDir, "%s-dbg_%s_%s.deb" % (binaryName, version, arch)))
+ # source package
+ print("Source:",sourceName, file=f)
+ print("Section:",config.getstr('section', 'misc'), file=f)
+ print("Priority: extra", file=f)
+ print("Maintainer: %s <%s>" % (name, email), file=f)
+ writeDependency(f, 'Build-Depends', ["debhelper (>= 9)"] + buildSystem.buildDepends + config.get('buildDepends', []))
+ print("Standards-Version: 3.9.3", file=f)
+ # main binary package
+ print(file=f)
+ print("Package:",binaryName, file=f)
+ print("Architecture:",packageArchitecture, file=f)
+ if 'binaryMultiArch' in config:
+ print("Multi-Arch:",config.getstr('binaryMultiArch'), file=f)
+ writeDependency(f, "Pre-Depends", ["${misc:Pre-Depends}"] + config.get('binaryPreDepends', []))
+ writeDependency(f, "Depends", ["${shlibs:Depends}", "${misc:Depends}"] + buildSystem.binaryDepends +
+ config.get('binaryDepends', []))
+ writeDependency(f, "Recommends", config.get('binaryRecommends', []))
+ writeDependency(f, "Provides", config.get('binaryProvides', [sourceName]))
+ writeDependency(f, "Conflicts", config.get('binaryConflicts', []))
+ writeDependency(f, "Breaks", config.get('binaryBreaks', []) + config.get('binaryBreaksReplaces', []))
+ writeDependency(f, "Replaces", config.get('binaryReplaces', []) + config.get('binaryBreaksReplaces', []))
+ print("Description:",sourceName,"(auto-debuild)", file=f)
+ print(" Package auto-generated by auto-debuild.", file=f)
+ files.append(os.path.join(debDir, "{}_{}_{}.deb".format(binaryName, version, arch)))
+ files.append(os.path.join(debDir, "{}-dbgsym_{}_{}.deb".format(binaryName, version, arch)))
+ # shim packages
+ for shim in config.get('binaryShims', []):
+ print(file=f)
+ print("Package:",shim, file=f)
+ print("Section:",config.getstr('section', 'misc'), file=f)
+ print("Priority: extra", file=f)
+ print("Architecture:",packageArchitecture, file=f)
+ writeDependency(f, "Depends", ["${misc:Depends}", binaryName+" (= ${binary:Version})"])
+ print("Description:",sourceName,"shim for",shim,"(auto-debuild)", file=f)
+ print(" Package pretending to be "+shim+", auto-generated by auto-debuild.", file=f)
+ files.append(os.path.join(debDir, "{}_{}_{}.deb".format(shim, version, arch)))
+ # install file
+ with open('debian/'+binaryName+'.install', 'w') as f:
+ for line in config.get('binaryInstallFiles', []):
+ if line.startswith('/'): # a file from within the package, not from the source tree
+ line = 'debian/'+binaryName+line
+ print(line, file=f)
+ # maintainer scripts for alternatives
+ if 'alternatives' in config:
+ with open('debian/'+binaryName+'.postinst', 'w') as f:
+ print("#!/bin/sh", file=f)
+ print("set -e", file=f)
+ print('if [ "$1" = "configure" ]; then', file=f)
+ for alternative in config.get('alternatives'):
+ alternative = shlex.split(alternative)
+ print(safeCall('update-alternatives', '--install', alternative[0], alternative[1], alternative[2], alternative[3]), file=f)
+ print('fi', file=f)
+ print(file=f)
+ print('#DEBHELPER#', file=f)
+ print(file=f)
+ print('exit 0', file=f)
+ with open('debian/'+binaryName+'.prerm', 'w') as f:
+ print("#!/bin/sh", file=f)
+ print("set -e", file=f)
+ print('if [ "$1" = "remove" ]; then', file=f)
+ for alternative in config.get('alternatives'):
+ alternative = shlex.split(alternative)
+ print(safeCall('update-alternatives', '--remove', alternative[1], alternative[2]), file=f)
+ print('fi', file=f)
+ print(file=f)
+ print('#DEBHELPER#', file=f)
+ print(file=f)
+ print('exit 0', file=f)