2017-02-03 113 views
1

我必須將我的RPM軟件包轉換爲DEB軟件包才能在Ubuntu上安裝它。由於我沒有任何構建DEB包的經驗,因此使用Google搜索建議從stdeb包中'bdist_rpm'使用python setuptools'bdist_deb'編譯C代碼

代碼主要是Python,配置文件等。但是有一個C代碼需要構建。該RPM安裝二進制文件在/ usr/bin中的setup.py

代碼創建二進制文件

if sys.argv and len(sys.argv) > 1 and sys.argv[1].strip().startswith('bdist'): 
try: 
    compiler = UnixCCompiler(verbose=1) 
    compiler.compile(['cutility/chown_sudo.c']) 
    compiler.link_executable((['cutility/chown_sudo.o']), 'bin/sudoown') 
except CompileError as compileError: 
    print "Failed to compile the binary file." 
    raise 

bdist_rpm理解這些代碼,並創建了C.但是bdist_deb忽略它:(

在網上搜索,debuild實用程序建議爲這個和其他複雜的東西創建一些Makefile文件

這是複雜嗎?一些搜索還建議使用'外星人'工具而不是?

直到現在我的想法是,使用以下命令

python setup.py --command-packages=stdeb.command debianize 

然後調整debian目錄postint,控制等 但我不知道如何建立的C代碼

回答

0

我原來,我在'bdist_rpm'中使用的'bdist'檢查在使用'bdist_deb'選項時引起了問題。當使用'bdist_deb'選項時,該腳本被調用'build'參數。在我爲startswith('build')添加OR之後,事情發展了