Scripts to create debian package exist and work. I have to modify them. In new specific case there may be some optional files which I want to include to package.

If I add them to package.install, then I fail as only those file don't exist. If I don't add them to package.install, then they will never be included to package even if they exist.

To determine specific case I have special environment variable: SPECIFIC_CASE=CASE

How should I set up debian package creation scripts to search for those files just in case of specific case?

In file rules (which is designed as Makefile) I have targets:

override_dh_auto_install: (empty)
...list of other overrides...
  • What does your debian/rules look like? Does it mostly just use debhelper (dh)? Does it override it (e.g., override_dh_auto_install, etc.)?
    – muru
    Commented May 27, 2019 at 7:37
  • Yes, rules contains targets with overrride_* name pattern. I've updated the question.
    – Arkady
    Commented May 27, 2019 at 7:45

1 Answer 1


With most packaging tools in Debian, the contents of the a package package end up being whatever is in debian/package when dpkg-deb is run. You can place files there in whichever way you want, you don’t have to rely on dh_install (which is the tool which processes .install files).


        install blah debian/package/wherever

and so on. This is where you’d add your conditional file handling.

However it’s important to realise that a packaging specification (and this isn’t specific to Debian) should be consistent: i.e. on a given architecture, building a package should always result in the same package contents. Packaging optional content usually involves building the project so that all the files are generated, and then dispatching them into different packages, not all of which need to be installed. (This can involve going to great lengths, e.g. the GCC build which has a few tricks so that the compiler driver knows about all the available languages but they don’t all have to be installed.)

  • So your suggestion is to create additional package for optional files? My idea was to create specific debug version with coverage (*.gcov) files, so our jenkins would use it as for usual tests, but we would get additional coverage info from it. And for that task, I would like to make the whole process transparent, controlling the process by explicit environment variable
    – Arkady
    Commented May 27, 2019 at 8:11
  • Yes. For coverage you’d end up with two builds, driven by debian/rules in all cases: one with the usual build, building the standard package, and another with -O0 --coverage, building a -coverage package (with the .gcno files). See the dosbox debian/rules for a similar example (standard package and debugger-enabled package). Commented May 27, 2019 at 8:54

You must log in to answer this question.

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