Skip to contentSkip to conversation

Files missing from package

DISCUSSION Gary Thomas 4 participants 14 messages Oct 8, 2012 – Oct 9, 2012

lore
Share & tools
lore
#0 lore raw

I'm building a package(recipe) for a system which uses opkg as the packaging tool. In my recipe, I have these additional lines (only the relevant parts shown):

  do_install_append() {
      install -d ${D}${sbindir}
      install -d ${D}/etc
      install -m 0755 ${S}/tools/get_tool ${D}${sbindir}
      ln -s get_tool ${D}${sbindir}/put_tool
      install -m 0644 ${WORKDIR}/tool.config ${D}/etc
  }

  PACKAGES += "${PN}-tools"
  FILES_${PN}-tools = "${sbindir}/get_tool \
  		     ${sbindir}/put_tool \
                       /etc/tool.config \
  "

When the recipe is built, I get the correct files in my image:

  $ find tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/etc
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/etc/tool.config
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin/get_tool
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin/put_tool
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/bin
  tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/bin/some_tool

However, the 'some-tool-tools' package it missing the '/etc/tools.config' file. I unpacked it manually to see this:

  $ tar -ztvf data.tar.gz
  drwxr-xr-x root/root         0 2012-10-08 09:28 ./
  drwxr-xr-x root/root         0 2012-10-08 09:28 ./usr/
  drwxr-xr-x root/root         0 2012-10-08 09:28 ./usr/sbin/
  lrwxrwxrwx root/root         0 2012-10-08 09:28 ./usr/sbin/put_tool -> get_tool
  -rwxr-xr-x root/root     15044 2012-10-08 09:28 ./usr/sbin/get_tool

There is no '/etc' directory to be seen.

What am I doing wrong? This is built using poky:master '7c39c87d52c20e47cf90275a16e4517a296c8388' from just a few days ago.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#1 lore raw
Quoted 43 lines · On Monday 08 October 2012 10:13:44 Gary Thomas wrote:

I'm building a package(recipe) for a system which uses opkg as the packaging tool. In my recipe, I have these additional lines (only the relevant parts shown):

   do_install_append() {
       install -d ${D}${sbindir}
       install -d ${D}/etc
       install -m 0755 ${S}/tools/get_tool ${D}${sbindir}
       ln -s get_tool ${D}${sbindir}/put_tool
       install -m 0644 ${WORKDIR}/tool.config ${D}/etc
   }

   PACKAGES += "${PN}-tools"
   FILES_${PN}-tools = "${sbindir}/get_tool \
   		     ${sbindir}/put_tool \
                        /etc/tool.config \
   "

When the recipe is built, I get the correct files in my image:

   $ find tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/
   tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/
   tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/etc

tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/etc/tool.conf ig tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin/get_ tool tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin/put_ tool tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/bin tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/bin/some_tool

However, the 'some-tool-tools' package it missing the '/etc/tools.config' file. I unpacked it manually to see this:

   $ tar -ztvf data.tar.gz
   drwxr-xr-x root/root         0 2012-10-08 09:28 ./
   drwxr-xr-x root/root         0 2012-10-08 09:28 ./usr/
   drwxr-xr-x root/root         0 2012-10-08 09:28 ./usr/sbin/
   lrwxrwxrwx root/root         0 2012-10-08 09:28 ./usr/sbin/put_tool ->
get_tool -rwxr-xr-x root/root     15044 2012-10-08 09:28
./usr/sbin/get_tool
Quoted 4 lines

There is no '/etc' directory to be seen.

What am I doing wrong? This is built using poky:master '7c39c87d52c20e47cf90275a16e4517a296c8388' from just a few days ago.

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#2 lore raw
Quoted 46 lines · Paul Eggleton
Quoted 45 lines · On Monday 08 October 2012 10:13:44 Gary Thomas wrote:

I'm building a package(recipe) for a system which uses opkg as the packaging tool. In my recipe, I have these additional lines (only the relevant parts shown):

    do_install_append() {
        install -d ${D}${sbindir}
        install -d ${D}/etc
        install -m 0755 ${S}/tools/get_tool ${D}${sbindir}
        ln -s get_tool ${D}${sbindir}/put_tool
        install -m 0644 ${WORKDIR}/tool.config ${D}/etc
    }

    PACKAGES += "${PN}-tools"
    FILES_${PN}-tools = "${sbindir}/get_tool \
    		     ${sbindir}/put_tool \
                         /etc/tool.config \
    "

When the recipe is built, I get the correct files in my image:

    $ find tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/
    tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/
    tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/etc

tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/etc/tool.conf ig tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin/get_ tool tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/usr/sbin/put_ tool tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/bin tmp/work/mytarget-poky-linux-gnueabi/some-tool-1.0-r0.1/image/bin/some_tool

However, the 'some-tool-tools' package it missing the '/etc/tools.config' file. I unpacked it manually to see this:

    $ tar -ztvf data.tar.gz
    drwxr-xr-x root/root         0 2012-10-08 09:28 ./
    drwxr-xr-x root/root         0 2012-10-08 09:28 ./usr/
    drwxr-xr-x root/root         0 2012-10-08 09:28 ./usr/sbin/
    lrwxrwxrwx root/root         0 2012-10-08 09:28 ./usr/sbin/put_tool ->
get_tool -rwxr-xr-x root/root     15044 2012-10-08 09:28
./usr/sbin/get_tool

There is no '/etc' directory to be seen.

Quoted 8 lines
Quoted 2 lines

What am I doing wrong? This is built using poky:master '7c39c87d52c20e47cf90275a16e4517a296c8388' from just a few days ago.

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Pretty obscure, but that did indeed solve the problem.

Thanks!

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#3 lore raw
In reply to Paul Eggleton
Quoted 5 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

Tomas

#4 lore raw
Quoted 8 lines · On Monday 08 October 2012 18:40:45 Tomas Frydrych wrote:
Quoted 6 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Quoted 9 lines

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

If we're using just the first item in PACKAGES for anything anywhere then that is wrong and we should fix it. I would be surprised if we were still doing that (other than the old fallback code in update-rc.d.bbclass that is probably never hit) since the first item in PACKAGES hasn't been ${PN} for some time now
- in fact it's currently the last item if you look at the default value of PACKAGES in conf/bitbake.conf in master.

In master and the upcoming release we do have PACKAGE_BEFORE_PN, which may be more appropriate for adding packages such as this one.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#5 lore raw
Quoted 19 lines · Paul Eggleton
Quoted 8 lines · On Monday 08 October 2012 18:40:45 Tomas Frydrych wrote:
Quoted 6 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Quoted 9 lines

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

Quoted 2 lines

If we're using just the first item in PACKAGES for anything anywhere then that is wrong and we should fix it. I would be surprised if we were still doing that

Denzil does,

http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/classes/package.bbclass?h=denzil#n110

Tomas

#6 lore raw
In reply to Tomas Frydrych
Quoted 7 lines · Tomas Frydrych
Quoted 5 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Quoted 9 lines

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

FWIW, there is the PACKAGE_BEFORE_PN variable for this and other scenarios where you want something just before PN in PACKAGES.

Cheers,

Richard

#7 lore raw
Quoted 18 lines · Richard Purdie
Quoted 7 lines · Tomas Frydrych
Quoted 5 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Quoted 9 lines

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

Quoted 2 lines

FWIW, there is the PACKAGE_BEFORE_PN variable for this and other scenarios where you want something just before PN in PACKAGES.

This does sound better, I always like to be explicit, especially when the default/background has a possibility of biting me!

So, how would I use that for my case (i.e. what lines do I add/change in my recipe to use it)?

Thanks

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#8 lore raw
Quoted 19 lines · Gary Thomas
Quoted 18 lines · Richard Purdie
Quoted 16 lines · Tomas Frydrych
Quoted 5 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

Quoted 8 lines
Quoted 2 lines

FWIW, there is the PACKAGE_BEFORE_PN variable for this and other scenarios where you want something just before PN in PACKAGES.

This does sound better, I always like to be explicit, especially when the default/background has a possibility of biting me!

So, how would I use that for my case (i.e. what lines do I add/change in my recipe to use it)?

PACKAGE_BEFORE_PN += "${PN}-tools"

FILES_${PN}-tools = "${sbindir}/get_tool \
                     ${sbindir}/put_tool \
                        /etc/tool.config \

PACKAGE_BEFORE_PN lets you put the package specifically after -dev/-dbg/-doc/-locale and so on but before PN.

Cheers,

Richard

#9 lore raw
Quoted 29 lines · Richard Purdie
Quoted 19 lines · Gary Thomas
Quoted 18 lines · Richard Purdie
Quoted 16 lines · Tomas Frydrych
Quoted 5 lines · Paul Eggleton

Since ${sysconfdir} is /etc by default and ${sysconfdir} is in the default value of FILES_${PN}, and your additional package is appended to PACKAGES, I suspect you'll find the file is being picked up by the main package first. You need to use =+ instead of += so that the some-tool-tools package is prepended to PACKAGES and thus gets the file before the main package.

Probably worth noting that using =+ with PACKAGES can have some undesirable side effects. For example, if the recipe in question generates packages dynamically, e.g., for plugins, the first package in the PACKAGES list will be considered the 'main' package, and the dynamic packages will RDEPEND on it. If you modify PACKAGES in such a recipe using the =+, this will result in broken dependency chain without any obvious signs something is not right. I think it's much better to explicitly specify what should go into the main package than using =+ to work around the unsuitable main package default.

Quoted 8 lines
Quoted 2 lines

FWIW, there is the PACKAGE_BEFORE_PN variable for this and other scenarios where you want something just before PN in PACKAGES.

This does sound better, I always like to be explicit, especially when the default/background has a possibility of biting me!

So, how would I use that for my case (i.e. what lines do I add/change in my recipe to use it)?

Quoted 8 lines

PACKAGE_BEFORE_PN += "${PN}-tools"

FILES_${PN}-tools = "${sbindir}/get_tool \
                      ${sbindir}/put_tool \
                         /etc/tool.config \

PACKAGE_BEFORE_PN lets you put the package specifically after -dev/-dbg/-doc/-locale and so on but before PN.

I needed to write this as
PACKAGES_BEFORE_${PN} += "${PN}-tools"

Thanks

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#10 lore raw
Quoted 6 lines · On Tuesday 09 October 2012 06:36:23 Gary Thomas wrote:
Quoted 2 lines · Richard Purdie

PACKAGE_BEFORE_PN lets you put the package specifically after -dev/-dbg/-doc/-locale and so on but before PN.

I needed to write this as
PACKAGES_BEFORE_${PN} += "${PN}-tools"

Just to be clear the variable is called PACKAGE_BEFORE_PN and not PACKAGES_BEFORE_PN; otherwise yes.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#11 lore raw
Quoted 10 lines · Paul Eggleton
Quoted 6 lines · On Tuesday 09 October 2012 06:36:23 Gary Thomas wrote:
Quoted 2 lines · Richard Purdie

PACKAGE_BEFORE_PN lets you put the package specifically after -dev/-dbg/-doc/-locale and so on but before PN.

I needed to write this as

    PACKAGES_BEFORE_${PN} += "${PN}-tools"

Just to be clear the variable is called PACKAGE_BEFORE_PN and not PACKAGES_BEFORE_PN; otherwise yes.

Indeed, that does work. Sorry about my typo...

How did 'PACKAGES_BEFORE_${PN}' manage to work?

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#12 lore raw
Quoted 8 lines · On Tuesday 09 October 2012 06:46:02 Gary Thomas wrote:
Quoted 7 lines · Paul Eggleton
Quoted 6 lines · On Tuesday 09 October 2012 06:36:23 Gary Thomas wrote:
Quoted 2 lines · Richard Purdie

PACKAGE_BEFORE_PN lets you put the package specifically after -dev/-dbg/-doc/-locale and so on but before PN.

I needed to write this as

Quoted 8 lines
Quoted 4 lines
Quoted 1 line
    PACKAGES_BEFORE_${PN} += "${PN}-tools"

Just to be clear the variable is called PACKAGE_BEFORE_PN and not PACKAGES_BEFORE_PN; otherwise yes.

Indeed, that does work. Sorry about my typo...

How did 'PACKAGES_BEFORE_${PN}' manage to work?

I'm not sure how it could have unless you have some additional statement or code that is getting the package into PACKAGES. By all means, change it back and see if your package appears in the final value of PACKAGES using:

bitbake -e recipename | grep ^PACKAGES=

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#13 lore raw
Quoted 16 lines · Paul Eggleton
Quoted 15 lines · On Tuesday 09 October 2012 06:46:02 Gary Thomas wrote:
Quoted 11 lines · Paul Eggleton
Quoted 7 lines · On Tuesday 09 October 2012 06:36:23 Gary Thomas wrote:
Quoted 2 lines · Richard Purdie

PACKAGE_BEFORE_PN lets you put the package specifically after -dev/-dbg/-doc/-locale and so on but before PN.

I needed to write this as

     PACKAGES_BEFORE_${PN} += "${PN}-tools"

Just to be clear the variable is called PACKAGE_BEFORE_PN and not PACKAGES_BEFORE_PN; otherwise yes.

Indeed, that does work. Sorry about my typo...

Quoted 7 lines
Quoted 1 line

How did 'PACKAGES_BEFORE_${PN}' manage to work?

I'm not sure how it could have unless you have some additional statement or code that is getting the package into PACKAGES. By all means, change it back and see if your package appears in the final value of PACKAGES using:

bitbake -e recipename | grep ^PACKAGES=

Right again :-) What I thought was working was just a left over .ipk file.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------