Ubuntu – Ubuntu source package dependency tree

aptdependenciesdpkgpackage-managementsoftware installation

I have some packages. Let's call them A.deb, B.deb and C.deb. Each package has a corresponding source package A.dsc and A.tar.gz, B.dsc and B.tar.gz, C.dsc and C.tar.gz. The packages depend on each other: C.deb depends on B.deb and B.deb depends on A.deb

If I modify A.deb, I need to rebuild B.deb or it won't work. The same goes for B.deb and C.deb. Is there a way to automate this process? Is there perhaps a tool or script that will do it for me? If not, how could I automate it myself?

In addition, There are not my packages.

Best Answer

You would use a Makefile with the build dependencies declared, for example as follows:

default: A.deb B.deb C.deb

C.deb: B.deb C.dsc C.tar.gz
        <command(s) to build C.deb>

B.deb: A.deb B.dsc B.tar.gz
        <command(s) to build B.deb>

A.deb: A.dsc A.tar.gz
        <command(s) to build A.deb>

Note that the command indentation is a TAB.

With that Makefile, you would use the command

make

and this would work out which packages to build and in which order, and then build them, all depending on the timestamps of the files. E.g., if say B.tar.gz has a timestamp later than B.deb (i.e. package B has new source), then that'd cause firstly B.deb to be rebuilt, and as that would make it be stamped later than C.deb, it would cause C.deb to be rebuilt as well.