ebuild that installs a tar file with no changes

12 views
Skip to first unread message

Luigi Semenzato

unread,
Mar 8, 2023, 1:35:11 PM3/8/23
to Chromium OS dev
I have a tar file with everything I want to install in the target filesystem, already with the final directory layout and attributes (owner, group, and permission bits).  What is the right way of untarring the file?  I can get this to almost work with

SRC_URI="<the tar file>"
S="${WORKDIR}"
src_install() {
        insinto /
        doins -r .
}

This puts all the files in the right places, but it doesn't preserve their attributes.  I am also suspecting that the files are first extracted into a temporary location by the default src_unpack(), and then copied---not a huge deal, but it would help to avoid the extra copy (a few gigabytes).

I am tempted to get this to work by making src_unpack() do nothing, and rewriting src_install() to invoke tar directly, but would that be horrible?

Thanks!

Mike Frysinger

unread,
Mar 8, 2023, 1:38:32 PM3/8/23
to Luigi Semenzato, Chromium OS dev
this is kind of WAI.  it's trivial for tarballs to be created with the wrong permissions & owners, and we don't want to preserve them in the install.  the point of the src_install phase is to set the perms & owners correctly.
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev

Luigi Semenzato

unread,
Mar 8, 2023, 1:55:58 PM3/8/23
to Mike Frysinger, Chromium OS dev
On Wed, Mar 8, 2023 at 10:38 AM Mike Frysinger <vap...@chromium.org> wrote:
this is kind of WAI.  it's trivial for tarballs to be created with the wrong permissions & owners, and we don't want to preserve them in the install.  the point of the src_install phase is to set the perms & owners correctly.
-mike

Sounds like a case of "we know what's best for you", which works in most cases, but can get in the way of doing something that may be reasonable.  It's easier for us to set the perms and owners correctly in the tar file than in the ebuild.

In our use case, we produce binaries outside of a standard ChromiumOS build, together with a manifest which specifies where the binaries should go (and their attributes).  Then we can use the manifest in two ways.  One is to rsync the files directly to a DUT, during development.  The other is to create a tar file which can be used in a batch build.

Luigi Semenzato

unread,
Mar 8, 2023, 2:31:43 PM3/8/23
to Mike Frysinger, Chromium OS dev
Ah.  But I can include the manifest in the tar file, and use it to set perms/owners in src_install after the doins.

Or should I use one of the pkg_ functions for that? pkg_postinst()?

Mike Frysinger

unread,
Mar 8, 2023, 11:08:01 PM3/8/23
to Luigi Semenzato, Chromium OS dev
it's also easier to get it wrong and not notice.  this isn't theoretical ... we've had this break us in CrOS more than once.  if it means one package has a harder time so that we have a more reliable build, then so be it.
-mike

Mike Frysinger

unread,
Mar 8, 2023, 11:08:12 PM3/8/23
to Luigi Semenzato, Chromium OS dev
do not use pkg_* funcs.  this is what src_install is for.
-mike

Luigi Semenzato

unread,
Mar 9, 2023, 11:33:17 AM3/9/23
to Mike Frysinger, Chromium OS dev
Sounds good, thank you.

Mike Frysinger

unread,
Mar 9, 2023, 11:35:53 AM3/9/23
to Luigi Semenzato, Chromium OS dev
i should have also said that your idea of processing a manifest file in src_install is good.  i assume that file is maintained in a code review system somewhere and isn't just `tar tvvvf` output ;).
-mike

Luigi Semenzato

unread,
Mar 9, 2023, 11:41:00 AM3/9/23
to Mike Frysinger, Chromium OS dev
On Thu, Mar 9, 2023 at 8:35 AM Mike Frysinger <vap...@chromium.org> wrote:
i should have also said that your idea of processing a manifest file in src_install is good.  i assume that file is maintained in a code review system somewhere and isn't just `tar tvvvf` output ;).

Yes, thank you, I am still figuring this out.  We need something similar to a "verified MPM"---perhaps exactly that.
Reply all
Reply to author
Forward
0 new messages