Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 416875 - prepinfo must not be used in ebuilds
Summary: prepinfo must not be used in ebuilds
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-21 09:09 UTC by Brian Harring (RETIRED)
Modified: 2019-11-25 09:02 UTC (History)
0 users

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 Brian Harring (RETIRED) gentoo-dev 2012-05-21 09:09:48 UTC
Two offenders; toolchain.eclass, and gcc-3.2.3-r4.

All of that looks to be working around gcc installing info files to /usr/share/gcc-data/<target>/<gcc-version>/info/ .

The problem here is that the eclass is relying on functionality outside of PMS.

Question is, how do we solve this?
Comment 1 SpanKY gentoo-dev 2012-05-22 02:57:12 UTC
the usage is harmless for people who don't have prepinfo (other than a "command not found" warning).  if $D was scanned for info dirs like we do for man dirs, then gcc wouldn't need it.
Comment 2 Ulrich Müller gentoo-dev 2012-05-22 06:04:16 UTC
In EAPI 4 it will fail as well, because prepinfo and prepman are essentially a no-op there. But you could just do:

    docompress /usr/share/gcc-data/<target>/<gcc-version>/info/
    docompress -x /usr/share/gcc-data/<target>/<gcc-version>/info/dir
Comment 3 Ulrich Müller gentoo-dev 2012-05-22 06:07:53 UTC
I don't know what the PMS team should do here. The problem has been addressed in EAPI 4, and there's nothing that we can do for earlier EAPIs.
Comment 4 Brian Harring (RETIRED) gentoo-dev 2012-05-22 08:18:05 UTC
(In reply to comment #2)
> In EAPI 4 it will fail as well, because prepinfo and prepman are essentially
> a no-op there. But you could just do:
> 
>     docompress /usr/share/gcc-data/<target>/<gcc-version>/info/
>     docompress -x /usr/share/gcc-data/<target>/<gcc-version>/info/dir

Doesn't run info's index generation, which is one of the main reasons they're invoking it.

At this point, from a quick scan of pms info pages don't even look covered, so that's an area that needs expansion (ebuilds have relied on it for a long while)...
Comment 5 Ulrich Müller gentoo-dev 2012-05-22 09:19:37 UTC
(In reply to comment #4)
> Doesn't run info's index generation, which is one of the main reasons
> they're invoking it.

It doesn't need to, because a) upstream's build system installs a dir/index file already (see $(DESTDIR)$(infodir)/%.info rule in gcc/Makefile.in), and b) Portage will eventually regenerate all dir files in INFOPATH (see function chk_updated_info_files).

Alternatively, if the ebuild/eclass really wants to rebuild it itself, it's also not complicated (code snippet from pkg_preinst of emacs-23.4-r1.ebuild):

    rm -f "${ED}"${infodir}/dir{,.*}
    for f in "${ED}"${infodir}/*; do
        if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
            install-info --info-dir="${ED}"${infodir} "${f}" \
                || die "install-info failed"
        fi
    done

> At this point, from a quick scan of pms info pages don't even look covered,
> so that's an area that needs expansion (ebuilds have relied on it for a long
> while)...

Please, not again this discussion. There even was a council decision (2009-02-12 meeting) that confirmed that prep* are internal functions of the package manager and should be avoided in ebuilds.

PMS mentions it in section 12.3.3.15 (in the eapi-4-approved version) as "reserved for package manager use and may not be used or relied upon by ebuilds".
Comment 6 SpanKY gentoo-dev 2012-05-22 14:16:17 UTC
(In reply to comment #5)

and we specifically do *not* rely on upstream's build system setting up the index files correctly because it's unreliable, especially when installing files by hand or doing fix-ups after the `make install` finishes.

Brian isn't talking about adding prep* funcs to the spec, but of documenting a way to make it unnecessary.

manually fixing things up is *not* a solution -- portage does this implicitly for all packages, and the only reason gcc does it manually is because of installing into unique paths.
Comment 7 Ulrich Müller gentoo-dev 2012-05-22 17:41:31 UTC
The only thing that prepinfo does (besides queueing the directory up for compression) is that it _removes_ the index ("dir") file. This needs to be done, because otherwise the dir file being merged from D could collide with one already present in ROOT.

Regeneration of the index isn't done by prepinfo, but will only take place at the end of the emerge command.
Comment 8 Brian Harring (RETIRED) gentoo-dev 2012-05-22 18:51:11 UTC
(In reply to comment #7)
> The only thing that prepinfo does (besides queueing the directory up for
> compression) is that it _removes_ the index ("dir") file. This needs to be
> done, because otherwise the dir file being merged from D could collide with
> one already present in ROOT.
> 
> Regeneration of the index isn't done by prepinfo, but will only take place
> at the end of the emerge command.

The point was to try and get it registered in some fashion w/ the PM; among other things, so the PM doesn't keep orphaning the generated index (and/or does simple things like *wiping* the index from ${D} to prevent such collisions).  The PM logic for regenerating the index is limited to paths in INFOPATH (which may not cover all actual INFO paths- just what is globally the norm).
Comment 9 Ulrich Müller gentoo-dev 2012-05-23 05:25:39 UTC
In directories like /usr/share/info where the index covers several packages there's no other way than having an orphaned file for it.

Are the Info directories of gcc, binutils, etc. uniquely used by the respective package? Or are they shared between several packages (or slots), too?
Comment 10 Brian Harring (RETIRED) gentoo-dev 2012-05-23 05:31:16 UTC
(In reply to comment #9)
> In directories like /usr/share/info where the index covers several packages
> there's no other way than having an orphaned file for it.

If the PM knows where index's are supposed to be (or were requested at a one point), it can track those locations pruning/removing as necessary.

> Are the Info directories of gcc, binutils, etc. uniquely used by the
> respective package? Or are they shared between several packages (or slots),
> too?

In gcc's case, afaik it's uniquely controlled by them (they have their own dir).
Comment 11 Ulrich Müller gentoo-dev 2012-05-23 10:57:06 UTC
If /usr/share/info is the only directory where the index is shared amongst packages, then I see no need for a new mechanism to register or track these locations.

Packages using a unique info directory could be modified such that the index file will not be orphaned, but belong to the installed package. This probably means that it should be regenerated in src_install or pkg_preinst.
Comment 12 Brian Harring (RETIRED) gentoo-dev 2012-05-23 11:40:24 UTC
(In reply to comment #11)
> If /usr/share/info is the only directory where the index is shared amongst
> packages, then I see no need for a new mechanism to register or track these
> locations.
Dude: INFOPATH.  Arbitary location, same sort of behaviour as MANPATH.

> Packages using a unique info directory could be modified such that the index
> file will not be orphaned, but belong to the installed package. This
> probably means that it should be regenerated in src_install or pkg_preinst.

Leaving devs up shit creek should multiple packages use the same space...
Comment 13 Ulrich Müller gentoo-dev 2019-11-25 09:02:08 UTC
$ find /var/db/repos/gentoo \( -name '*.ebuild' -o -name '*.eclass' \) -exec grep prepinfo {} +
$ 

Closing.