Can I install a .deb during a BitBake Build?
<h3>Problem Definition</h3>

<p>I'm attempting to adapt <a href="http://wiki.ros.org/rosjava/Tutorials/indigo/Installation" rel="nofollow">these rosjava installation instructions</a> so that I can include rosjava on a target image built by the BitBake build system. I'm using the jethro branch of Poky.</p>

<h3>Implementation Attempt: Build From <code>.deb</code> with <code>package_deb.bbclass</code></h3>

<p>According to the installation instructions, all that really needs to be done to install rosjava is the following: </p>

<pre><code>sudo apt-get install ros-indigo-rosjava
</code></pre>

<p>Which works perfectly fine on my build machine. I figured that if I can just point to a <code>.deb</code> and use the Poky metadata class <code>package_deb</code>, it would do all the heavy lifting for me, so I produced the following simple recipe adapted on <a href="https://lists.yoctoproject.org/pipermail/yocto/2013-June/014682.html" rel="nofollow">this posting</a> on the Yocto Project mailing list:</p>

<pre><code>inherit package_deb

SRC_URI = "http://packages.ros.org/ros/ubuntu/pool/main/r/ros-indigo-rosjava/ros-indigo-rosjava_0.2.1-0trusty-20160207-031808-0800_amd64.deb"
SRC_URI[md5sum] = "2020ccc8b4a67dd918a9a2c426eece0b"
SRC_URI[sha256sum] = "ab9493fabe1285b0d21aab031348d0d733d116b0b2470bae90025709b303b649"
</code></pre>

<p>The relevant part of the errors I get during the above recipe's <code>do_unpack</code> are: </p>

<pre><code>| no entry data.tar.gz in archive
|
| gzip: stdin: unexpected end of file
| tar: This does not look like a tar archive
| tar: Exiting with failure status due to previous errors
| DEBUG: Python function base_do_unpack finished
| DEBUG: Python function do_unpack finished
</code></pre>

<p>The following command produces the output below: </p>

<pre><code>$ ar t python-rosdistro_0.4.5-1_all.deb
debian-binary
control.tar.gz
data.tar.xz
</code></pre>

<p>You can see here that there's a <code>data.tar.</code><strong><code>xz</code></strong>, not  <code>data.tar.</code><strong><code>gz</code></strong>. What can I do to remedy this error and install from this particular <code>.deb</code>?</p>

<p><em>I've included <code>package_deb</code> in my <code>PACKAGE_CLASSES</code> variable and <code>package-management</code> in my <code>IMAGE_FEATURES</code>. I've tried other methods of installation which have all failed; I thought this method in particular would be very useful to know how to implement.</em></p>

<h2>Update - 3/22</h2>

<p>I'm attempting to circumvent the problems with the method above by doing my installation through a <code>ROOTFS_POSTPROCESS_COMMAND</code> which I've adapted from forum posts <a href="https://software.intel.com/en-us/forums/2014-intel-cup-embedded-system-design-contest/topic/518037" rel="nofollow">like this</a></p>

<pre><code>install_rosjava() {
  ${STAGING_BINDIR_NATIVE}/dpkg \
     --root=${IMAGE_ROOTFS}/  \
     --admindir=${IMAGE_ROOTFS}/var/lib/dpkg/ \
     -L /var/cache/apt/archives/ros-indigo-rosjava_0.2.1-0trusty-20160207-031808-0800_amd64.deb
}
ROOTFS_POSTPROCESS_COMMAND +=  " install_rosjava() ; "
</code></pre>

<p>However, this fails due to <code>dpkg</code> not being a command found within the <code>${STAGING_BINDIR_NATIVE}</code> path. The <a href="http://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-STAGING_BINDIR_NATIVE" rel="nofollow">Yocto Project Reference Manual</a> states that: </p>

<blockquote>
  <p><code>STAGING_BINDIR_NATIVE</code> Specifies the path to the <code>/usr/bin</code> subdirectory of the sysroot directory for the build host.</p>
</blockquote>

<p>Taking a look inside this directory yields a lot of commands but not <code>dpkg</code> (The recipe depends on the <code>dpkg</code> package, and this command can be found in my target rootfs after the build is finished; I've also tried pointing to <code>${IMAGE_ROOTFS}/usr/bin/dpkg</code> which yields the same results). From what I understand of the BitBake process, this command may be in another sysroot, but I must admit that this is where my understanding breaks down. </p>

<ol>
<li>Can I adjust this method so that it works, or will I need to start from scratch on an installation from source? </li>
<li>Perhaps there's a different method entirely which I could consider?</li>
</ol>