![使用 stdeb 构建 debian 包](https://linux22.com/image/13981/%E4%BD%BF%E7%94%A8%20stdeb%20%E6%9E%84%E5%BB%BA%20debian%20%E5%8C%85.png)
我一直在尝试从 Python 模块为 Debian 构建 .deb 包。经过之后Debian 的 Python LibraryStyleGuide,pybuild和Python 打包概述,我决定最好选择一些可以简化流程的东西。我发现斯德布成为受欢迎的选择。我尝试根据自身构建 stdeb这。它给了我以下错误:
python3 setup.py --command-packages=stdeb.command bdist_deb
running bdist_deb
running sdist_dsc
running sdist
running check
reading manifest template 'MANIFEST.in'
writing manifest file 'MANIFEST'
creating stdeb-0.10.0
creating stdeb-0.10.0/scripts
creating stdeb-0.10.0/stdeb
creating stdeb-0.10.0/stdeb/command
creating stdeb-0.10.0/test_data
creating stdeb-0.10.0/test_data/py2_only_pkg
creating stdeb-0.10.0/test_data/py2_only_pkg/py2_only_pkg
creating stdeb-0.10.0/test_data/py3_only_pkg
creating stdeb-0.10.0/test_data/py3_only_pkg/py3_only_pkg
creating stdeb-0.10.0/test_data/simple_pkg
creating stdeb-0.10.0/test_data/simple_pkg/simple_pkg
making hard links in stdeb-0.10.0...
hard linking .gitignore -> stdeb-0.10.0
hard linking .travis.yml -> stdeb-0.10.0
hard linking CHANGELOG.txt -> stdeb-0.10.0
hard linking LICENSE.txt -> stdeb-0.10.0
hard linking MANIFEST.in -> stdeb-0.10.0
hard linking README.rst -> stdeb-0.10.0
hard linking RELEASE_NOTES.txt -> stdeb-0.10.0
hard linking Vagrantfile.debian-7-wheezy.rb -> stdeb-0.10.0
hard linking Vagrantfile.debian-8-jessie.rb -> stdeb-0.10.0
hard linking Vagrantfile.ubuntu-12.04-precise.rb -> stdeb-0.10.0
hard linking Vagrantfile.ubuntu-14.04-trusty.rb -> stdeb-0.10.0
hard linking error.txt -> stdeb-0.10.0
hard linking setup.py -> stdeb-0.10.0
hard linking stdeb.cfg -> stdeb-0.10.0
hard linking test-pypi-install.sh -> stdeb-0.10.0
hard linking test.sh -> stdeb-0.10.0
hard linking test2and3.sh -> stdeb-0.10.0
hard linking scripts/py2dsc -> stdeb-0.10.0/scripts
hard linking scripts/py2dsc-deb -> stdeb-0.10.0/scripts
hard linking scripts/pypi-download -> stdeb-0.10.0/scripts
hard linking scripts/pypi-install -> stdeb-0.10.0/scripts
hard linking stdeb/__init__.py -> stdeb-0.10.0/stdeb
hard linking stdeb/cli_runner.py -> stdeb-0.10.0/stdeb
hard linking stdeb/downloader.py -> stdeb-0.10.0/stdeb
hard linking stdeb/transport.py -> stdeb-0.10.0/stdeb
hard linking stdeb/util.py -> stdeb-0.10.0/stdeb
hard linking stdeb/command/__init__.py -> stdeb-0.10.0/stdeb/command
hard linking stdeb/command/bdist_deb.py -> stdeb-0.10.0/stdeb/command
hard linking stdeb/command/common.py -> stdeb-0.10.0/stdeb/command
hard linking stdeb/command/debianize.py -> stdeb-0.10.0/stdeb/command
hard linking stdeb/command/install_deb.py -> stdeb-0.10.0/stdeb/command
hard linking stdeb/command/sdist_dsc.py -> stdeb-0.10.0/stdeb/command
hard linking test_data/py2_only_pkg/setup.py -> stdeb-0.10.0/test_data/py2_only_pkg
hard linking test_data/py2_only_pkg/py2_only_pkg/__init__.py -> stdeb-0.10.0/test_data/py2_only_pkg/py2_only_pkg
hard linking test_data/py2_only_pkg/py2_only_pkg/py2_module.py -> stdeb-0.10.0/test_data/py2_only_pkg/py2_only_pkg
hard linking test_data/py3_only_pkg/setup.py -> stdeb-0.10.0/test_data/py3_only_pkg
hard linking test_data/py3_only_pkg/py3_only_pkg/py3_module.py -> stdeb-0.10.0/test_data/py3_only_pkg/py3_only_pkg
hard linking test_data/simple_pkg/setup.py -> stdeb-0.10.0/test_data/simple_pkg
hard linking test_data/simple_pkg/simple_pkg/__init__.py -> stdeb-0.10.0/test_data/simple_pkg/simple_pkg
Creating tar archive
removing 'stdeb-0.10.0' (and everything under it)
dpkg-buildpackage: info: source package stdeb
dpkg-buildpackage: info: source version 0.10.0-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Andrew Straw <[email protected]>
dpkg-source --before-build .
dpkg-source: info: using options from stdeb-0.10.0/debian/source/options: --extend-diff-ignore=\.egg-info$
fakeroot debian/rules clean
dh clean --with python3 --buildsystem=python_distutils
dh: warning: Compatibility levels before 10 are deprecated (level 9 in use)
dh: error: unable to load addon python3: Cant locate Debian/Debhelper/Sequence/python3.pm in @INC (you may need to install the Debian::Debhelper::Sequence::python3 module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at (eval 16) line 1.
BEGIN failed--compilation aborted at (eval 16) line 1.
make: *** [debian/rules:7: clean] Error 25
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
Traceback (most recent call last):
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/setup.py", line 8, in <module>
setup(
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/stdeb/command/bdist_deb.py", line 34, in run
self.run_command('sdist_dsc')
File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/stdeb/command/sdist_dsc.py", line 137, in run
build_dsc(debinfo,
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/stdeb/util.py", line 1569, in build_dsc
dpkg_buildpackage(*args, cwd=fullpath_repackaged_dirname)
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/stdeb/util.py", line 585, in dpkg_buildpackage
process_command(args, cwd=cwd)
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/stdeb/util.py", line 226, in process_command
check_call(args, cwd=cwd)
File "/home/user0/Documents/temp/pac/stdeb-release-0.10.0/stdeb/util.py", line 59, in check_call
raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 2
我发现了类似的错误报告这里和这里但它们似乎已经修复并且我的系统是最新的。
这是我的 /proc/version 它有帮助:
Linux version 5.8.0-1parrot1-amd64 ([email protected]) (gcc-10 (Debian 10.2.0-5) 10.2.0, GNU ld (GNU Binutils for Debian) 2.35) #1 SMP Debian 5.8.7-1parrot1 (2020-09-14)
有人可以告诉我问题到底是什么并帮助我构建它吗?
答案1
错误是
无法在 @INC 中找到 Debian/Debhelper/Sequence/python3.pm
要解决此问题,您需要安装dh-python
:
sudo apt install dh-python