[Qbs] Qbs and debian packaging

Wookey wookey at wookware.org
Fri Dec 22 12:01:53 CET 2017

On 2017-12-21 09:40 +0100, Christian Kandeler wrote:
> On Thu, 21 Dec 2017 04:35:34 +0000
> Wookey <wookey at wookware.org> wrote:
> > You suggested 
> > > qbs build --no-install modules.qbs.installRoot:debian/tmp
> > > qbs install --no-build modules.qbs.installRoot:debian/tmp  
> > However this breaks the build, because nothing gets installed into debian/tmp.
> Works for me. Which version of qbs is this?


>  You should pass in an absolute path, by the way, e.g.:
> $ qbs build --no-install modules.qbs.installRoot:$PWD/debian/tmp

OK. It still fails even with absolute paths.

I have just uploaded dewalls 1.0.0+ds1-3 which has my test case in it.
        qbs install --settings-dir /tmp --no-build \
           --install-root $(PWD)/debian/tmp \
           profile:deb \
           project.libDir:lib/$(DEB_HOST_MULTIARCH) \

        qbs install --settings-dir /tmp --no-build \
           modules.qbs.installRoot:$(PWD)/debian/tmp \
           profile:deb \
           project.libDir:lib/$(DEB_HOST_MULTIARCH) \

and nothing is installed in $(PWD)/debian/tmp

> Also note that from qbs 1.9 on, you don't have to repeat any of the properties on subsequent qbs invocations, as the values are stored in the build graph.

That'll be nice, but still 1.8 in debian unstable. 

One other thing that is an issue for debian:

qbs clean doesn't actually clean out all it's files, indeed it'll
create one. It always leaves a $(PWD)/default/default.bg (or whatever
build-dir name is in use). The debian build notices this new binary
file added to the source tree and complains. A clean comand is
supposed to clean out generated files, not generate more :-)

Is there a way to stop this behaviour?

I am using this command:
qbs clean --settings-dir /tmp profile:deb qbs-build
which makes a qbs-build/qbs-build.bg

and also doesn't actually remove all the files in qbs-build. It
removes the built binaries and the .o files but not the directories
they were assembled in.

I have to do an 'rm -r qbs-build' anyway. Does the qbs clean command
actually do anything else significant (e.g. in the settings dir) or
should I just skip it and use 'rm -r qbs-build' ?

And finally, running tests.

A debian build runs build-time tests after building, but before installing the
files into the package location.  

Should I expect 'qbs run' to run a test program that needs a library,
after being built, or does it also have to be installed? Qbs knows
where it built the library, so it seems that it should be able to find
it, I can't put my own LD_PRELOAD in because Qbs has used some magic
directory ID to put it in which I don't know. 

How is this expected to work?

currently my test-case has a product for the library and a
'dewalls-test' product for the test binary. But

        qbs run --settings-dir /tmp --no-build -p dewalls-test \
           modules.qbs.installRoot:$(PWD)/debian/tmp \
           project.libDir:lib/$(DEB_HOST_MULTIARCH) \
           profile:deb qbs-build

only works if the package is actually installed on the build system,
otherwise the library is not found:

qbs run --settings-dir /tmp --no-build -p dewalls-test \
   modules.qbs.installRoot:/home/wookey/packages/cavewhere/dewalls/debian/dewalls-1.0.0/debian/tmp \
   project.libDir:lib/x86_64-linux-gnu \
   profile:deb qbs-build
Restoring build graph from disk
Starting target '/home/wookey/packages/cavewhere/dewalls/debian/dewalls-1.0.0/qbs-build/dewalls-test.deb.384b8e5c/dewalls-test'.
/home/wookey/packages/cavewhere/dewalls/debian/dewalls-1.0.0/qbs-build/dewalls-test.deb.384b8e5c/dewalls-test: error while loading shared libraries: libdewalls.so.1: cannot open shared object file: No such file or directory
debian/rules:36: recipe for target 'override_dh_auto_build' failed

I've updated the debian Qbs wiki page, adding some info on the debian
multiarch page on making it work with Qbs, and put some info on the
various issues into https://bugreports.qt.io/browse/QBS-417

Principal hats:  Linaro, Debian, Wookware, ARM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20171222/eb84ed8e/attachment.sig>

More information about the Qbs mailing list