+ # debug package
+ if dbgPackage:
+ print(file=f)
+ print("Package:",binaryName+"-dbg", file=f)
+ print("Section: debug", file=f)
+ print("Priority: extra", file=f)
+ print("Architecture:",packageArchitecture, file=f)
+ writeDependency(f, "Depends", ["${misc:Depends}", binaryName+" (= ${binary:Version})"])
+ print("Description:",sourceName,"debug smbols (auto-debuild)", file=f)
+ print(" Package containing debug symbols for "+sourceName+", auto-generated by auto-debuild.", file=f)
+ files.append(os.path.join(debDir, "%s-dbg_%s_%s.deb" % (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, "%s_%s_%s.deb" % (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)