Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 206975 - x11-libs/qt-*-4.4* or qt4-build.eclass: Incorrect handling of QT_CONFIG options while upgrading/downgrading
Summary: x11-libs/qt-*-4.4* or qt4-build.eclass: Incorrect handling of QT_CONFIG optio...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-22 02:21 UTC by Arfrever Frehtes Taifersar Arahesis (RETIRED)
Modified: 2009-04-03 18:29 UTC (History)
3 users (show)

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


Attachments
qt-config.patch (qt-config.patch,9.00 KB, patch)
2008-02-26 13:26 UTC, Bo Ørsted Andresen (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-01-22 02:21:17 UTC
When a package is being upgraded/downgraded, pkg_postinst() will be invoked before invocation of pkg_postrm(), so e.g. `qconfig_add_option ${option}` will be invoked before `qconfig_remove_option ${option}` and eventually ${option} will be removed.

PMS 10.2 Call Order
...
The call order for upgrading or downgrading a package is:
   • pkg_setup
   • src_unpack
   • src_compile
   • src_test (except if RESTRICT=test)
   • src_install
   • pkg_preinst
   • pkg_postinst
   • pkg_prerm for the package being replaced
   • pkg_postrm for the package being replaced
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2008-01-22 14:23:52 UTC
hmm, any thoughts on what we should do?  should I have the pkg_postinst() add a second copy and have pkg_postrm() just remove one so that in the end we end up with the right amount?
Comment 2 Bernd Steinhauser 2008-02-14 06:08:45 UTC
I noticed this a few weeks ago, too.

What about a solution where you not only add the option to the file, but also set a environment variable, that you've added it. 

qconfig_add_option() {
    local option=$1
    qconfig_remove_option $1
    sed -i -e "s:QT_CONFIG +=:QT_CONFIG += ${option}:g" /usr/share/qt4/mkspecs/qconfig.pri
    ADDED_${option}=1
}

qconfig_remove_option() {
    local option=$1
    if [[ ADDED_${option}=0 ]]; then
        sed -i -e "s: ${option}::g" /usr/share/qt4/mkspecs/qconfig.pri
    fi
    ADDED_${option}=0
}

Would that work?
I didn't (yet) test this, even if it works, maybe there is a better solution.
Comment 3 Bo Ørsted Andresen (RETIRED) gentoo-dev 2008-02-26 13:26:30 UTC
Created attachment 144677 [details, diff]
qt-config.patch

This is the patch we intend to commit with the next qt-4.4 snapshot to fix this. It installs a qconfig.pri file in mkspecs/gentoo/ for each package in src_install() and generates mkspecs/gconfig.pri based on those files in pkg_post{inst,rm}().

This solution was chosen because it seems less error prone than has_version() hackery. Setting an env var won't work because env vars set in pkg_postinst() will be reloaded in post_rm()...

For all package managers using proper environment restoration (i.e. portage > 2.1.4 as well as paludis and pkgcore) there will be an issue with pkg_postrm() from the uninstalled package being run last during upgrading causing this bug to manifest itself until all 4.4.0_rc1 packages have been uninstalled or upgraded.

Solutions to this include: Uninstalling before upgrading. Reinstalling qt-core (or any package that sets QCONFIG_ADD) after having upgraded all of them. Running write_qconfig() manually (with QCONFIG_ADD and QTDATADIR set appropriately) after having upgraded all of them. Etc...

Adding blockers for this seems like overkill to me so probably the best cause of action is to just document it in pkg_postinst()...
Comment 4 Ingmar Vanhassel (RETIRED) gentoo-dev 2008-03-05 23:13:10 UTC
Fixed in CVS, for beta1, using the aforementioned patch by Bo Andresen & David Leverton.