10

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.

12
  • 2
    You're saying "C.deb depends on B.deb and B.deb depends on A.deb", so I guess you're referring to binary packages? Also are you referring to the compilation of B against an external library in A? If so there simply shouldn't be the need to rebuild the package, given that the developer(s) of A didn't change such library's interface (so this is up to A's mantainer(s), not to B's mantainer(s); if you are the developer of all of them then just simply keep the implementation of A agnostic from its interface the most as possible, so that compatibility in ensured at its most).
    – kos
    Dec 2, 2015 at 5:22
  • 1
    I don't do stuff at this level on Linux, but I think that was what make was invented for. A makefile includes rules which determine what needs to be recompiled/rebuilt based on what has changed.
    – Joe
    Dec 2, 2015 at 22:02
  • 1
    @xiaodongjie - you are a dear person with a dear question - so you know bash already and bash-scripting ? ---> this way you could write a little script with switch-case loop and then like in an elevator build into different cases what to do about the packages. There is not my script. You are brainy like we are brainy - do laugh. - this script can of course can be set up like a daemon (to work automatically). Dec 4, 2015 at 23:10
  • 1
    A @Joe said: use make, and as you said yourself, @xiaodongjie, the make targets would be the resulting packages, with their package-to-package dependencies declared, and the associated action for each target would be the command that makes the package. Install make-doc and type info make to read all about it. Dec 7, 2015 at 10:51
  • 1
    What about creating an alias for the build process? Dec 10, 2015 at 11:25

2 Answers 2

3
+50

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.

1

Well, maybe I'm totally missing your point, but it sounds like you're recompiling package A and want to recompile packages B & C, wich I would simply us a makefile for.

2
  • Can you explain more detail? Dec 10, 2015 at 17:36
  • or any example. Dec 10, 2015 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .