8

I have a recipe to compile a printer driver and have a few simple lines to run in do_install.

do_install() {
  install -d ${D}${libdir}/cups/filter
  install -m 755 ${B}/src/rastertoprinter ${D}${libdir}/cups/filter/
  install -d ${D}${sysconfdir}/cups/ppd
  install -m 755 ${B}/../rastertoprinter/printer_name.ppd ${D}${sysconfdir}/cups/ppd/
}

To compile the source I have a DEPENDS on cups and also an RDEPENDS on cups as the OS needs cups installed to print of course.

The printer driver is not publicly available so as such I've renamed it to rastertoprinter and changed my path names.

Essentially I need to simply create or ensure the directory /usr/lib/cups/filter exists, and copy the rastertoprinter program there. I also need to create or ensure the directory /etc/cups/ppd exists and copy the .ppd file into that directory.

The first two lines run fine but the 3rd throws the following errors:

file /etc/cups conflicts between attempted installs of printername-r0.corei7_64 and cups-2.2.2-r0.corei7_64
file /etc/cups/ppd conflicts between attempted installs of printername-r0.corei7_64 and cups-2.2.2-r0.corei7_64

I don't understand why both recipes can't create this directory and put stuff in it? Strangely I'm able to do the first /usr/lib/cups/filter directory though fine.

egfconnor
  • 2,637
  • 1
  • 26
  • 44

2 Answers2

9

Turns out the issue is that each file to be packaged in Yocto will also generate a %dir for each parent of each file. We don't want to own a directory that is owned by another package, so if you add this to your recipe:

DIRFILES = "1"

It will cause your package to not own parent directories of the files you package.

This will generate an rpm spec file without the %dir entries.

Paul Knopf
  • 9,568
  • 23
  • 77
  • 142
  • so lucky somebody asked and answered such about such an arcane problem. – Paulo Neves Mar 24 '18 at 20:15
  • 1
    It's worth noting that it's possible to receive a very similar error if you mistakenly install a file in place of a directory - this can happen e.g. if you neglect to create a directory and then proceed to install a file specifying that directory as the destination instead of the full path. – bluelightning Sep 28 '18 at 03:10
1

This is a very old question but the answer is actually wrong. The reason there is a conflict is because both packages are trying to install different directories: cups ships an /etc/cups with group ownership of lp whereas gutenprint ships an /etc/cups with group ownership of root.

Make the permissions the same and you don't have to mess with DIRFILES.

Ross Burton
  • 3,516
  • 13
  • 12