大网数据广告活动
服务器运维问答

How to add multiple dependencies to debian package?

· 52CE 我爱测

Below is the working control file while creating debian package using the link . I kept a single dependency and it is creating the deb file. Package: my-program Version: 1.0 Architecture: all Essential: no Priority: optional Depe…

问题原文

原帖链接 · uday · CC BY-SA 4.0

Below is the working control file while creating debian package using the link. I kept a single dependency and it is creating the deb file.

Package: my-program
Version: 1.0
Architecture: all
Essential: no
Priority: optional
Depends: default-jdk
Maintainer: Your Name
Description: A short desc

But if I keep multiple dependencies, I am getting error. The dependencies I kept are not actual, just for testing.

Package: my-program
Version: 1.0
Architecture: all
Essential: no
Priority: optional
Depends: default-jdk;net-tools
Maintainer: Your Name
Description: A short desc

dpkg-deb --build my-program_version_architecture/ dpkg-deb: error: parsing file 'my-program_version_architecture//DEBIAN/control' near line 6 package 'my-program': 'Depends' field, invalid package name 'default-jdk;net-tools': character ';' not allowed (only letters, digits and characters '-+._')

Even for the deb file created with single dependency, when I am trying to install, I am getting error as below, for the folder I kept in DEBIAN folder for installation.

dpkg: error processing archive /home/azureuser/my-program_version_architecture.deb (--unpack): unable to open file '/var/lib/dpkg/tmp.ci//testing': Is a directory

已采纳解答

原帖链接 · Esa Jokinen · CC BY-SA 4.0

Syntactically, the ; is not the correct separator, but ,. Therefore, it is treated as a part of the package name. From Declaring relationships between packages, emphasis is mine:

These fields all have a uniform syntax. They are a list of package names separated by commas.

In the Depends, Recommends, Suggests, Pre-Depends, Build-Depends, Build-Depends-Indep and Build-Depends-Arch control fields of the package, which declare dependencies on other packages, the package names listed may also include lists of alternative package names, separated by vertical bar (pipe) symbols |. In such a case, that part of the dependency can be satisfied by any one of the alternative packages.

They also give examples:

Package: mutt 
Version: 1.3.17-1 
Depends: libc6 (>= 2.2.1), default-mta | mail-transport-agent

It is also good to take a look at the Syntax of control files.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-02-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。