Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 564070 - xpak: Replace/amend the fancy metadata with regular files inside the tarball
Summary: xpak: Replace/amend the fancy metadata with regular files inside the tarball
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on: 672672
Blocks:
  Show dependency tree
 
Reported: 2015-10-25 12:58 UTC by Michał Górny
Modified: 2022-07-19 00:06 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-10-25 12:58:08 UTC
Let's kill the fancy metadata format in .xpak files and instead store the metadata as files inside the tarball. Either some magical dot-directory or... var/db/pkg/* files.

Why?

1. Modifying (fixing) metadata in .xpak files is very hard atm. Like when somebody failed at pkg_pretend() and you can't install .xpak without rebuilding the whole huge thing. With file solution, you could use any .tar tool to fix it.

2. If we used var/db/pkg design, then unpacking .xpak on top of / would get vardb somehow updated. Better for the rescue case than having arbitrary unregistered files on top of system.
Comment 1 Zac Medico gentoo-dev 2015-10-25 20:18:09 UTC
(In reply to Michał Górny from comment #0)
> Let's kill the fancy metadata format in .xpak files and instead store the
> metadata as files inside the tarball. Either some magical dot-directory
> or... var/db/pkg/* files.

In order to apply metadata updates for things like package moves, we'll be forced to re-compress the whole tar file.

Also, the metadata would either have to be stored at the beginning of the tar file, or the tar file would have to be indexed for efficient access.

> 
> Why?
> 
> 1. Modifying (fixing) metadata in .xpak files is very hard atm. Like when
> somebody failed at pkg_pretend() and you can't install .xpak without
> rebuilding the whole huge thing.

This is a documentation issue. It's only "hard" if you're unfamiliar with the tools.

> With file solution, you could use any .tar
> tool to fix it.

As long as you are familiar with the embedded metadata format, which would have to be documented. That includes that part about putting them at the beginning of the tar file, or the tar file being indexed.

> 2. If we used var/db/pkg design, then unpacking .xpak on top of / would get
> vardb somehow updated. Better for the rescue case than having arbitrary
> unregistered files on top of system.

Unpacking files directly into /var/db/pkg will not lead to a valid entry, since portage generates a unique COUNTER for a package is installed (which is compared with that of another package with the same SLOT, to see which was installed last), and it will not properly invalidate package manager caches (see bug 290428).

Generally, I'm opposed to having anything modify /var/db/pkg if it was not explicitly designed to do so. It is a form database, and databases require special handling that tar simply cannot provide.
Comment 2 Zac Medico gentoo-dev 2015-10-25 21:44:39 UTC
(In reply to Zac Medico from comment #1)
> (In reply to Michał Górny from comment #0)
> > Let's kill the fancy metadata format in .xpak files and instead store the
> > metadata as files inside the tarball. Either some magical dot-directory
> > or... var/db/pkg/* files.
> 
> In order to apply metadata updates for things like package moves, we'll be
> forced to re-compress the whole tar file.

I think this issue kills the whole idea, since it will make package moves take several orders of magnitude longer to apply.

Maybe we simply need to provide a commandline tool which simplifies the process of updating the xpak data (or at least document existing tools better). Portage includes bin/xpak-helper.py which is capable of updating the xpak segment very efficiently (there's no need to re-write or re-compress the whole tar file).
Comment 3 SpanKY gentoo-dev 2015-10-29 19:52:03 UTC
portage-utils already provides qtbz2 for working with tbz2 archives (tar.bz2+xpak) and qxpak for working with xpak files

$ qtbz2 -x -O xz-utils-5.2.0.tbz2 | qxpak -l -
USE
FEATURES
LICENSE
...

it can also be used to unpack/repack the xpak archive:
$ qtbz2 -x xz-utils-5.2.0.tbz2
$ mkdir out
$ qxpak -d out -x xz-utils-5.2.0.xpak
$ cat out/EAPI
4
$ cd out
$ echo 5 > EAPI
$ qxpak -c ../new.xpak .
$ qxpak -x -O ../new.xpak EAPI
5

so while moving the vdb to a binary format entirely would be nice, i don't think the xpak in the tbz2 is a blocker at all here.
Comment 4 contactopublico57 2021-06-14 19:50:17 UTC Comment hidden (obsolete)
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-06-14 20:04:29 UTC Comment hidden (obsolete)
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-06-14 20:09:12 UTC Comment hidden (obsolete)
Comment 7 contactopublico57 2021-06-14 23:07:06 UTC Comment hidden (obsolete)
Comment 8 Zac Medico gentoo-dev 2021-06-14 23:15:22 UTC Comment hidden (obsolete)
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-06-15 05:10:00 UTC Comment hidden (obsolete)
Comment 10 contactopublico57 2021-06-15 19:37:14 UTC Comment hidden (obsolete)