0

While building an rpm package we can use this exclude command in the spec file to exclude the particular file in certain packages.

ex.

%exclude foobar/bin/printjob_svr.bin

How and where do we specify the same while building a deb package? I have a list of files that need to be excluded while building different packages from the source. Right now I am able to build three different packages from the source but all the files are present while installation.

1

In a Debian package, you’d do this either by deleting the files after installation (in the source package) but before the package is built, or by not listing them in the lists of files to install, or by excluding them from the installation (for certain types of files only).

If you’re using short-style dh-based debian/rules, you’ll probably be using (implicitly)

  • dh_auto_install, which runs the upstream installation to place files in debian/tmp (since you’re building multiple packages);
  • dh_install, which copies files from debian/tmp to the appropriate installation target (debian/foobar etc.) based on the contents of .install files in debian (debian/foobar.install etc.).

The three options listed above translate to the following.

  1. To delete files after they’re copied to debian/tmp, do something like

    override_dh_intall:
            rm -f debian/tmp/bin/printjob_svr.bin
            dh_install
    
  2. To tell dh_install to skip files, don’t list them in .install files; that means you can’t use wildcards or plain directory names (bin, bin/*). You should also list the skipped files in debian/not-installed, but see the caveat in man dh_missing.

  3. To exclude files explicitly, override the targets and add -X options; this will only work for dh_ commands which support this:

    override_dh_installdocs:
            dh_installdocs -Xprintjob_svr.bin
    

    (this doesn’t correspond to your use-case, I’m listing it for completeness).

  • Hi, thanks for your awesome reply, I had already tried methods 1 and 2. Using .install file seems to be the easiest as i can find which files to exclude from debian/tmp (I already have a spec file in place). However I was looking for perhaps an easier method to do this rather than running a script to create .install files for all my packages. – Sanidhya Jun 30 '18 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.