Skip to main content

Dpkg dh_install: copy files from the build directory rather than the debian/tmp dir? [Resolved]

Suppose I have a debian package housing as follows:

project_pkg/
  .git
  project_0.0-1/
     debian/
        install
        ...
     project (git submodule with tagged commit)

With the following install file:

// .../debian/install
#!/usr/bin/env bash
find $(pwd)/project/path/to/binaries -type f -executable -printf "$(pwd)/project/path/to/binaries/%f usr/bin\n"

And where the project has a make entrypoint such that make -C project build for example produces all the necessary files I would need to package.

The make/build component of the entire packaging process works right now. However, ideally, I find all the necessary files I need to install from the install folder.

I have a solution for now, which would involve copying the binaries in the project to the debian/tmp/ from either outside /debian or from /debian/rules.

But I could just as easily set the dh_install to fetch the files from the project, if there was some way to do so..

A) Is there a way to get dh_install to fetch files from the project,

B) Is simply running two find commands and copying the binaries to the debian/tmp dir the way to go?

C) Should I just hack it and prefix the printf in the install find command with ../..


Question Credit: donlan
Question Reference
Asked September 19, 2019
Posted Under: Unix Linux
18 views
1 Answers

  1. dh_install takes paths relative to the current directory, which is generally the top-level directory of the package. In your case that’s project_0.0-1, so your find invocations should output project/path/to/....

  2. Yes, that would work too. I know I recommended dh_install, but the first rule of debhelper remains that it’s a tool at your service, and if you find it’s easier to skip it, you might as well do so:

    override_dh_install:
            install -d debian/package/usr/bin
            find project/path/to/binaries -type f -executable -exec install -t debian/package/usr/bin {} + \;
    
  3. I don’t think that would work.

(In most cases I’d expect your main build to be capable of installing binaries to a given target, but that’s another discussion.)


credit: Stephen Kitt
Answered September 19, 2019
Your Answer