Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 704624 - dev-python/PyQt5 Aborting due to QA concerns: there are files installed outside the prefix
Summary: dev-python/PyQt5 Aborting due to QA concerns: there are files installed outsi...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-03 06:41 UTC by Sammy Pfeiffer
Modified: 2020-01-28 00:34 UTC (History)
1 user (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 Sammy Pfeiffer 2020-01-03 06:41:03 UTC
The latest version of dev-python/PyQt5 fails to install with:

 * QA Notice: the following files are outside of the prefix:
 * /home
 * /home/user
 * /home/user/gentoo
 * /home/user/gentoo/usr
 * /home/user/gentoo/usr/share
 * /home/user/gentoo/usr/share/qt5
 * /home/user/gentoo/usr/share/qt5/qsci
 * /home/user/gentoo/usr/share/qt5/qsci/api
 * /home/user/gentoo/usr/share/qt5/qsci/api/python
 * /home/user/gentoo/usr/share/qt5/qsci/api/python/PyQt5.api
 * ERROR: dev-python/PyQt5-5.14.0::gentoo failed:
 *   Aborting due to QA concerns: there are files installed outside the prefix

Note that the previous version 5.13.2 installed correctly.
Also note, that my EPREFIX is '/tmp/gentoo' which is a softlink to '/home/user/gentoo'. This has never been a problem before. I suspect something in PyQt5-14.0 resolved to the real path instead of the EPREFIX path.

You can find yourself in a Docker image in exactly this state by doing:
docker pull awesomebytes/roogp_ros_kinetic_desktop_1:953
docker run -it awesomebytes/roogp_ros_kinetic_desktop_1:953 /bin/bash

You'll find yourself in a shell with a folder called gentoo in the home. You can 
cd gentoo
./startprefix

And you'll be in the environment. I can't take a look into it right now, but if anyone has the time, they can this way.

Reproducible: Always
Comment 1 Fabian Groffen gentoo-dev 2020-01-03 08:42:48 UTC
Hmmm, I'm a bit torn on this one.  We don't really support links in EPREFIX, for as soon as someone does a realpath on EPREFIX, you end up somewhere else, like for this bug.

You could override the QA check to just let you through, or modify the ebuild to move the stuff out of /home to /tmp again (in the image that is), but I don't think either are eligable for general consumption.
Comment 2 Sammy Pfeiffer 2020-01-03 08:47:10 UTC
How do I override a QA check on a specific package and version?

I'd prefer that over editing the ebuild if possible (it's easier for me to maintain).

(Note that this is the first time I see this problem and I build around 700 packages as of now. Happy to be lucky enough for the softlink trick to work!)
Comment 3 Fabian Groffen gentoo-dev 2020-01-03 08:54:06 UTC
perhaps using bashrc, see https://forums.gentoo.org/viewtopic-t-1056774-start-0.html

Probably you could hack up a generic check in post_src_install to see if there's anything in ${D}$(realpath ${EPREFIX}) and move it to ${ED} or something.
Comment 4 Sammy Pfeiffer 2020-01-03 08:58:24 UTC
Thanks Fabian, this is GREAT knowledge that I never encountered myself with!

I hope I have time soon to check it out. This will come very very handy for some little problems that keep happening from time to time.

I guess this bug won't be resolved then?
Comment 5 Fabian Groffen gentoo-dev 2020-01-03 09:00:19 UTC
I would say no, especially if you can make the hook to work around the problems you get from the symlink.  (I checked the ebuild, and there's nothing trivial there ...)
Comment 6 Sammy Pfeiffer 2020-01-03 09:02:29 UTC
I've also checked the ebuild and it's a copy from the previous version, which emerges without problems. So the change is somewhere in the package itself.
Comment 7 Fabian Groffen gentoo-dev 2020-01-03 09:08:14 UTC
let me know if you have issues getting the hook to work
Comment 8 Sammy Pfeiffer 2020-01-24 10:56:39 UTC
Hello Grobian, I'm not sure how to implement the hook you proposed. Could you help me please?

I succesfully managed to get a proof of concept that prints hooking into the different phases, the file looks like:  https://gist.github.com/awesomebytes/6c143b059a881afc43a6bdf3178d94bd

I can see every print being called putting this file in EPREFIX/etc/portage.

I also checked what variables the ebuild is seeing with some prints:

EPREFIX is /tmp/gentoo
EROOT is /tmp/gentoo
ED is /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/image/tmp/gentoo
D is /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/image
WORKDIR is /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/work
S is /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/work/PyQt5-5.14.1
T is /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/temp

And... I don't know what to do with this unfortunately. I don't know 'who' expands on ED, D, WORKDIR, S, T the softlink to a real path. My initial desire would be to undo that, as it would most probably avoid this problem for any package, ever. But it may not be the best option...

Otherwise I'd like to change whatever variable sets the installation path to replace the real path with the softlink path. 

Also, I checked which is the last phase I get a print from hooking into it, that one is "src_install". The end of that part outputs:

>>> Completed installing dev-python/PyQt5-5.14.1 into /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/image

And then I get the dreaded:
 * QA Notice: the following files are outside of the prefix:

With the last line of the error being:
!!! post install failed; exiting.

I guess there is no phase post_src_install where to do whatever I need to do before the QA check.
I also tried to overwrite the install_qa_check_prefix with a dummy one with no luck.
Comment 9 Fabian Groffen gentoo-dev 2020-01-24 11:45:59 UTC
according to https://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-ebuild-phase-hooks you should use post_src_install

Can you check if that triggers before the QA checks for you?
Comment 10 Sammy Pfeiffer 2020-01-24 12:15:52 UTC
Hello Grobian,

I updated the bashrc script: https://gist.github.com/awesomebytes/6c143b059a881afc43a6bdf3178d94bd

With pre_ and post_ hooks for src_configure, src_compile and src_install as you may see. They NEVER get called.

Given dev-python/PyQt5 is very slow to compile, I've tried with another package to fasten further tests, it behaves the same (the package I chose was app-arch/unzip).
Comment 11 Fabian Groffen gentoo-dev 2020-01-24 12:21:20 UTC
http://davydm.blogspot.com/2017/01/gentoo-adventures-running-script-after.html

suggests it's a function, not the env var


function post_src_install() {
  mv $whatever $wherever
}
Comment 12 Sammy Pfeiffer 2020-01-24 12:39:45 UTC
I confirm that it works as a function.

I'll confirm soon if I manage to solve it...

If I understand correctly, your proposal would be to do:

Being D: /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/image
and ED: /home/user/gentoo/var/tmp/portage/dev-python/PyQt5-5.14.1/image/tmp/gentoo

function post_src_install() {
# Just in case...
mkdir -p $ED
mv $D/home/user/gentoo/* $ED
}

I don't really know what's the magic that installs stuff in the correct place yet. I'm guessing anything under D gets installed in the general path after D. But I haven't tested it.

Have a great weekend!
Comment 13 Benda Xu gentoo-dev 2020-01-26 09:33:58 UTC
Hi Sam,

(In reply to Sammy Pfeiffer from comment #0)
> The latest version of dev-python/PyQt5 fails to install with:
> 
>  * QA Notice: the following files are outside of the prefix:
>  * /home
>  * /home/user
>  * /home/user/gentoo
>  * /home/user/gentoo/usr
>  * /home/user/gentoo/usr/share
>  * /home/user/gentoo/usr/share/qt5
>  * /home/user/gentoo/usr/share/qt5/qsci
>  * /home/user/gentoo/usr/share/qt5/qsci/api
>  * /home/user/gentoo/usr/share/qt5/qsci/api/python
>  * /home/user/gentoo/usr/share/qt5/qsci/api/python/PyQt5.api
>  * ERROR: dev-python/PyQt5-5.14.0::gentoo failed:
>  *   Aborting due to QA concerns: there are files installed outside the
> prefix
> 
> Note that the previous version 5.13.2 installed correctly.
> Also note, that my EPREFIX is '/tmp/gentoo' which is a softlink to
> '/home/user/gentoo'. This has never been a problem before. I suspect
> something in PyQt5-14.0 resolved to the real path instead of the EPREFIX
> path.

Is there any chance to ditch symlinks of EPREFIX?  Bind mount is a better way to achieve same goals.

Benda
Comment 14 Sammy Pfeiffer 2020-01-27 10:15:55 UTC
(In reply to Benda Xu from comment #13)
> Hi Sam,
> 
> Is there any chance to ditch symlinks of EPREFIX?  Bind mount is a better
> way to achieve same goals.
> 
> Benda

Hello Benda,

I just checked but any 'mount' command needs root permissions, including 'mount --bind'. The alternative is using bindfs apparently, but it is not available in my main deployment system (the same system that I have no root access). I even tried to get bindfs inside of my Gentoo Prefix and try to do some workaround that way but I got 'fuse: device not found' so I guess the base system kernel can't support it.

I do have a theoretical alternative which is to ACTUALLY bootstrap everything in /tmp/gentoo instead of in a softlink, and then only final users may experience problems with the softlink (which, if my project keeps going alright, they shoudn't need to emerge anything as I'll be providing binaries... but that's a bit far away for now).

Thanks for your feedback tho! I didn't know about mount --bind.
Comment 15 Sammy Pfeiffer 2020-01-27 12:16:20 UTC
Grobian, I succesfully achieved emerging dev-python/PyQt5 by using
a EPREFIX/etc/portage/bashrc with the contents:

# to workarond https://bugs.gentoo.org/704624
if [ "${PN}" == "PyQt5" ] && [ "${CATEGORY}" == "dev-python" ];
then
    echo "----------------------------------------------"
    echo "===== CATEGORY/PN is dev-python/PyQt5 ========"
    echo "Applying workaround for https://bugs.gentoo.org/704624"
    echo "----------------------------------------------"
    # Executes just before the QA check
    function post_src_install() {
      # Just in case...
      mkdir -p $ED
      echo "post_src_install called, moving stuff from D/home/user/gentoo to ED"
      cp -r $D/home/user/gentoo/ $ED
      rm -rf $D/home
    }
fi

Overcoming the link issue. Meanwhile I'm also trying to run my bootstrapping natively on my EPREFIX of /tmp/gentoo instead of using a softlink at that stage.
Comment 16 Benda Xu gentoo-dev 2020-01-28 00:34:04 UTC
(In reply to Sammy Pfeiffer from comment #14)
> (In reply to Benda Xu from comment #13)
> > Hi Sam,
> > 
> > Is there any chance to ditch symlinks of EPREFIX?  Bind mount is a better
> > way to achieve same goals.
> > 
> > Benda
> 
> Hello Benda,
> 
> I just checked but any 'mount' command needs root permissions, including
> 'mount --bind'. The alternative is using bindfs apparently, but it is not
> available in my main deployment system (the same system that I have no root
> access). I even tried to get bindfs inside of my Gentoo Prefix and try to do
> some workaround that way but I got 'fuse: device not found' so I guess the
> base system kernel can't support it.
> 
> I do have a theoretical alternative which is to ACTUALLY bootstrap
> everything in /tmp/gentoo instead of in a softlink, and then only final
> users may experience problems with the softlink (which, if my project keeps
> going alright, they shoudn't need to emerge anything as I'll be providing
> binaries... but that's a bit far away for now).
> 
> Thanks for your feedback tho! I didn't know about mount --bind.

Yes, you can set EPREFIX=/tmp/gentoo and bootstrap, and then link it to ~/gentoo.   emerge will not face any symlink, and users can still access Prefix easily from $HOME.