Ubuntu – How to add multiple dependencies to debian package

debdebianUbuntu

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

Best Answer

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 DependsRecommendsSuggestsPre-DependsBuild-DependsBuild-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.