how to make debian package install dependencies

2019-03-15 11:29发布

I want to make a simple debian package to install a simple tool that depends on Qt4 libs.

In control file I have defined that it depends on Qt4 libs however, by the time I'm testing the package it says that the dependency could not be met.

Question:

How can I make Debian trigger apt to install the dependencies as well?

Can't find that the documentation however I know that apt-get does that.

5条回答
萌系小妹纸
2楼-- · 2019-03-15 11:39

If you install it via dpkg it won't work because dkpg doesn't know where to find additional dependencies. You could do it via apt-get if you build your own repo, but it's kind of time-consuming the first time (it's not difficult, just something "new" the first time that needs some time to be learnt).

On the other hand, and the solution you are probably looking for is gdebi (you may need to install it: apt-get install gdebi-core). It's a tool that checks the dependencies for a package and calls apt-get to fetch and install them, and then calls dpkg to install your package.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-03-15 11:43

Per @textshell in this answer:

starting with apt 1.1 (available in Xenial (16.04), stretch) apt install also allows local files:

sudo apt install ./foo-1.2.3.deb

So much simpler and cleaner.

See the release announcment

This will also install dependencies, just like a normal apt install or apt-get install.

查看更多
别忘想泡老子
4楼-- · 2019-03-15 11:46

One way would be to create a local package repository on your computer and add it to /etc/apt/sources.list. Then you could install the package from your local repository with apt-get and have the dependencies resolved automatically.

There's probably an easier way to do it, but I don't know what that would be.

查看更多
闹够了就滚
5楼-- · 2019-03-15 11:57

If you're creating the Debian package, you specify its dependencies in the debian/ directory control files; I believe debian/control takes Depends: directives for that purpose.

I don't know the details too clearly, myself, but there are instructions at http://www.debian.org/doc/manuals/maint-guide/ ; in particular, http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control seems to be the right place to start looking.

查看更多
Melony?
6楼-- · 2019-03-15 12:04

If you want to avoid creating a local APT repository, you can do:

dpkg -i mypackage.deb
apt-get install --fix-missing

If you do want to create a local repository, you can use reprepro for this.

查看更多
登录 后发表回答