Why can't I see package contents after installation of a custom .deb in my PPA?

Asked by Michal Migurski on 2016-04-24

This is a followup to https://answers.launchpad.net/launchpad/+question/290253. I’m still new to this process, and my questions are beginner questions.

I have been successfully publishing packages to https://launchpad.net/~migurski/+archive/ubuntu/hello; they build, publish, and become available within 5-10 minutes. My test package contains a simple “hello world” shell script, but I’m not seeing it installed on a test system.

At version 0.1.3, I was able to see this message when running `apt-get install hellodeb`:

    …
    Unpacking hellodeb (0.1.3) ...
    Setting up hellodeb (0.1.3) ...
    Installing program : zenity_hello.sh ......

However, the file `zenity_hello.sh` (`pgmdir/zenity_hello.sh` in the source) does not appear anywhere on my system.

I actually want to see it in /usr/bin, so I modified the package in version 0.1.5 to locate the script under usr/bin, and I still see this helpful output upon installation:

    …
    Unpacking hellodeb (0.1.5) ...
    Setting up hellodeb (0.1.5) ...
    Installing program : zenity_hello.sh ......

Still no sign of my intended files in /usr/bin upon installation. What’s missing from my understanding of the correct contents of a debian file? My source material is structured like this:

    create_deb/usr/bin/zenity_hello
    create_deb/debian/rules
    create_deb/debian/changelog
    create_deb/debian/prerm
    create_deb/debian/control
    create_deb/debian/postinst

I create the package by running `debuild -k'8CBDE645' -S` from inside the create_deb directory, then I run `dput ppa:migurski/hello hellodeb_0.*_source.changes` with the resulting files placed alongside create_deb.

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Michal Migurski
Solved:
2016-04-24
Last query:
2016-04-24
Last reply:
2016-04-24
Colin Watson (cjwatson) said : #1

In most cases there's some kind of upstream build system that debhelper can automatically invoke to decide which files to install into the package. However, in your case there's no such build system in place, and your packaging doesn't explicitly install that file into the .deb, so the end result is a more or less empty package (apart from the documentation files that debhelper deals with automatically). The simplest way to fix this here would be to create a debian/install file as follows:

usr/bin/zenity_hello usr/bin

(Yes, there's no leading "/" on either path; this is intentional as the first path is relative to the current directory during the build, while the second path is an installation directory given relative to the root of the filesystem tree that goes into the resulting .deb. See "man dh_install" for more details.)

You should also drop debian/postinst and debian/prerm; it isn't usual to have maintainer scripts that just print a message like this, and in this case the message is a particularly confusing one.

Michal Migurski (migurski) said : #2

Thank you Colin. It sounds like explicitly listing each file in `debian/install` is good way to explicitly name everything that goes into an install, file-by-file.

How does debhelper know what upstream build system to invoke? I’ve noticed that it seems to be pretty smart about traditional configure/make/install processes. In my case, I’m learning the PPA process in order to package and release a Node-based application. I’m expecting to have a large number of dependencies vendored into the resulting .deb; is there some part of debhelper or debuild that might help me with this? Would it be automatically invoked by one of these tools, or would it be a manual process that I run as part of the package release process?

Colin Watson (cjwatson) said : #3

debhelper has a series of heuristics for this, which are at least roughly documented in "man dh_auto_configure" and "man dh_auto_build". As those manual pages say, it's intended to work for about 90% of packages and to be easy to override for everything else.

I have no Node experience, but I've never heard of any part of the standard packaging stack that would help with vendoring, which is not to say that it doesn't exist. My guess is that this is more likely to be handled by something that feels more like part of an upstream build system.

Michal Migurski (migurski) said : #4

Got it. So in this case, I might either list all the parts in debian/install, or I might create a Makefile which does that? If dh_auto_* finds a Makefile and determines that it can run `make install`, does it then automatically include the installed files in the created package without them needing to be listed in debian/install? Would that qualify as "upstream" as the term is used in the various packaging man pages and docs?

Michal Migurski (migurski) said : #5

After testing in versions 0.1.9 and 0.1.10, the Makefile doesn't seem to do entirely what I’m looking for so I’ll stick with debian/install listings for now. Thanks for your ongoing help.

Colin Watson (cjwatson) said : #6

The reason your Makefile didn't work was that it didn't honour DESTDIR, which is a widespread way of indicating to "make install" that it should be installing into a particular destination directory rather than the filesystem root. Based on 0.1.10, the rule should have been:

install:
        mkdir -p $(DESTDIR)/usr/bin && cp bin/zenity_hello $(DESTDIR)/usr/bin/zenity_hello

or, more concisely:

install:
        install -D -m0755 bin/zenity_hello $(DESTDIR)/usr/bin/zenity_hello

More sophisticated build systems such as autoconf/automake or cmake generally handle this kind of thing automatically.

Michal Migurski (migurski) said : #7

Interestingly, $DESTDIR appears to not exist. I see this error in 0.1.12:

    make[1]: Entering directory `/«PKGBUILDDIR»'
    install -D -m0755 bin/zenity_hello /usr/bin/zenity_hello
    install: cannot create regular file ‘/usr/bin/zenity_hello’: Permission denied
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/«PKGBUILDDIR»'

…for this Makefile:

    install:
     install -D -m0755 bin/zenity_hello $(DESTDIR)/usr/bin/zenity_hello

Full log is at https://launchpadlibrarian.net/256029917/buildlog_ubuntu-trusty-i386.hellodeb_0.1.12_BUILDING.txt.gz

Colin Watson (cjwatson) said : #8

Your Makefile isn't quite right. Because your "install" target is the first target in the Makefile, it's also used if you simply run "make", and so dh_auto_build tries to run it. dh_auto_build is meant for building the package, not for installing it, and so it doesn't pass DESTDIR.

The fix is to add a no-op target at the start of the file, like this:

all:

Michal Migurski (migurski) said : #9

That worked!