3

I am creating a binary package for local usage by reading http://chat.stackexchange.com/transcript/message/1313226#1313226 chat session. I followed the steps mentioned in the list.

My environment:
ubuntu 12.04
Project: MakeFile based C++ project which contains several sub directories and creating several shared libraries.

Below are the steps followed.

  1. create a gpg key using gpg --gen-key
  2. create necessary directories for packaging (folder for package with name-version, debian sub folder) and run dh_make --createorig in console. This step generated required files for packaging inside debian folder
  3. edit necessary files in ./debian folder

list of files in ./debian folder

source //folder
compat
rules
copyright
changelog
control
install

Below are the contents of important files.

$ cat control

Source: cscore
Section: misc
Priority: extra
Maintainer: dwft78 <[email protected]>
Build-Depends: debhelper (>= 8.0.0), autotools-dev
Standards-Version: 3.9.2
Homepage: <insert the upstream URL, if relevant>

Package: cscore
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: CoreScanner
CoreScanner for Ubuntu-12.04

$ cat install

/opt/installation-dir/bin/

this is where the binary files should be installed.

cat changelog

cscore (1.0-1) precise; urgency=low

  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>

 -- name <[email protected]>  Wed, 28 May 2014 14:16:29 +0530

$ cat rules

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
    dh $@ 

finally I run debuild command but I got bellow error.

find /home/dwft78/project/cscore/cscore-1.0/lib -name "libcs*" -type f -exec cp -f {} /home/dwft78/project/cscore/cscore-1.0/debian/cscore/opt/motorola-scanner//bin \;
find /home/dwft78/project/cscore/cscore-1.0/lib -name "libcs*" -type l -exec cp -Rf {} /home/dwft78/project/cscore/cscore-1.0/debian/cscore/opt/motorola-scanner//bin \;
make[1]: Leaving directory `/home/dwft78/project/cscore/cscore-1.0'
   dh_install
cp: cannot stat `debian/tmp//opt/motorola-scanner/bin/': No such file or directory
dh_install: cp -a debian/tmp//opt/motorola-scanner/bin/ debian/cscore///opt/motorola-scanner/ returned exit code 1
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

actually there is no folder created called tmp inside debian folder. debhelper noted the status of debuild command execution it has continued till dh_install level. output files also created excepting above set of files.

$ cat cscore.debhelper.log

dh_auto_configure
dh_auto_build
dh_auto_test
dh_prep
dh_installdirs
dh_auto_install

Please somebody help to go forward. -Thanks.

1
  • try opt/motorola-scanner/bin/ without leading / in the install file.
    – user.dz
    Jul 14, 2014 at 3:21

2 Answers 2

3

As the man page for dh_install says, the purpose of dh_install and the files that it reads are typically used for one of two purposes:

  • Specify which files go into multiple binary packages from a single source; or
  • Install files not handled by the package build system or move files to different directories

If you have a build system that can already build and install all the files needed for the binary package in the right directories, and you are only building one binary package from your source, then you don't need a debian/install file at all.

You mentioned that you are working with a Makefile-based project. As long as it supports standard targets like make all and make install and respects the $DESTDIR variable for installing, there's no need for a debian/install at all.

In fact, in the output you posted you can see a couple lines starting with find executing immediately before dh_install. I assume that is your project's make install target executing, and it looks to me like it is already installing files in the correct path, namely debian/cscore/opt/motorola-scanner/bin. So I think your build might work without a debian/install.

1
  • The $DESTDIR is automatically setup and changes between the dh_auto_install, from debian/<projectname>/sub-folders... to the dh_install that decides to use debian/tmp/sub-folders.... In effect, the dh_install command fails to find the files that were well installed indeed, but in a slightly different path. Why would dh_auto_install switch using the project-name instead of tmp in the installation path? Dec 23, 2015 at 8:01
0

Okay, I understand the problem.

Case A

The dh_auto_install will place the packages under debian/<project-name> if there is only one package.

Case B

However, it will place them under debian/tmp if you have multiple packages (i.e. multiple blah.install files and multiple package declarations in the control file.)

See info here:

http://manpages.ubuntu.com/manpages/trusty/en/man1/dh_auto_install.1.html

Somehow, dh_install only picks up files if these are under debian/tmp and fails completely if you had only one package. So running dh_install is probably not required... but if you use pdebuilder-dist, it is being run by default.

Solution

There is an override of the dh_install, which creates the problem:

override_dh_install:
    @echo "skip dh_install"

You must log in to answer this question.

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