#!/usr/bin/env python
import logging
import sys
log = logging.getLogger(__name__)
def main():
lines = file('debian/control').readlines()
l1 = None
l2 = None
for idx, x in enumerate(lines):
if x.startswith('Maintainer:'):
l1 = idx
elif x.startswith('XSBC-Original-Maintainer:'):
l2 = idx
if l1 is None:
log.error("can't find maintainer line")
sys.exit(1)
isUbuntu = l2 is not None
if isUbuntu:
maintainer = lines[l2].lstrip('XSBC-Original-Maintainer:').strip()
else:
maintainer = lines[l1].lstrip('Maintainer:').strip()
if isUbuntu:
lines[l1] = 'Maintainer: %s\n' % maintainer
del lines[l2]
else:
lines[l1] = 'Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>\n' \
+ 'XSBC-Original-Maintainer: %s\n' % maintainer
file('debian/control', 'w').writelines(lines)
if __name__ == '__main__':
main()
debian/control: switch between debian and ubuntu format
Tags: packaging, debian, ubuntu, python
Related Posts:
- 14 Sep 2013 » 出了问题不要靠猜
- 25 Aug 2013 » 小米盒子Tips
- 09 Aug 2013 » HTTP协议相关的若干安全问题
- 25 Dec 2012 » 日志分析工具
- 25 Oct 2012 » 世俗化的编程语言
- 15 Oct 2012 » [备忘]串号是如何发生的,我的一次串号Bug查找经历
- 21 Aug 2012 » Deploy snmpd on CentOS for jiankongbao
- 11 Jun 2012 » Rails & MongoDB
- 03 Jun 2012 » [备忘] Jekyll FAQ
- 16 Dec 2011 » [有问有答] 如何用邮件安全地传递密码