Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297255 - cmake-utils.eclass uses array for mycmakeargs and it doesn't work with <=portage-2.1.6.x
Summary: cmake-utils.eclass uses array for mycmakeargs and it doesn't work with <=port...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High normal with 1 vote (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on: 302001
Blocks:
  Show dependency tree
 
Reported: 2009-12-17 06:36 UTC by Nikoli
Modified: 2010-12-30 13:50 UTC (History)
2 users (show)

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


Attachments
emerge --info (einfo,4.14 KB, text/plain)
2009-12-18 01:07 UTC, Nikoli
Details
hugin-2009.4.0/temp/environment (environment,129.04 KB, text/plain)
2009-12-18 01:10 UTC, Nikoli
Details
Prevents erasing cmake args by accident (eclass.diff,1.43 KB, patch)
2010-06-26 18:42 UTC, Lamarque V. Souza
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikoli 2009-12-17 06:36:32 UTC
hugin was built on other machine and now it fails to install from binary (emerge -g) on other.

>>> Installing (1 of 1) media-gfx/hugin-2009.4.0
 * checking 627 files for package collisions
/mnt/g/portage/media-gfx/hugin-2009.4.0/temp/environment: line 149: syntax error near unexpected token `('
/mnt/g/portage/media-gfx/hugin-2009.4.0/temp/environment: line 149: `        [[ ${r} -eq ${2} ]] || echo "FAIL: ${@} (got ${r} exp ${2})"'
 *
 * ERROR: media-gfx/hugin-2009.4.0 failed.

Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2009-12-17 08:34:09 UTC
What versions of bash are on both machines?
Comment 2 Zac Medico gentoo-dev 2009-12-17 08:35:29 UTC
Please attach the environment file.
Comment 3 Nikoli 2009-12-18 01:07:32 UTC
Created attachment 213361 [details]
emerge --info

app-shells/bash:     4.0_p35
both machines are identical except kernel versions and some desktop software.
Comment 4 Nikoli 2009-12-18 01:10:05 UTC
Created attachment 213362 [details]
hugin-2009.4.0/temp/environment
Comment 5 Zac Medico gentoo-dev 2009-12-18 02:10:06 UTC
Your environment file contains this corrupt line which seems to trigger the problem:

mycmakeargs=([0]="-DENABLE_lapack=OFF 

Maybe it was a bug in cmake-utils.eclass that's been fixed. If I try to reproduce it now, the mycmakeargs is a normal space-separated string rather than an array. Adding the kde herd to CC since they might know how this happened.
Comment 6 Zac Medico gentoo-dev 2009-12-18 02:14:43 UTC
Now I see that enable_cmake-utils_src_configure() converts mycmakeargs to an array. This can cause problems with <=portage-2.1.6.x since those versions don't preserve arrays correctly.
Comment 7 Zac Medico gentoo-dev 2009-12-18 02:22:19 UTC
It was introduced in this commit on Dec 10:

http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/cmake-utils.eclass?r1=1.34&r2=1.35
Comment 8 Zac Medico gentoo-dev 2009-12-18 10:52:53 UTC
I've updated the eclass to us a local variable for the mycmakeargs array, so it works with <=portage-2.1.6.x if the global mycmakeargs variable is not an array. However, it's still broken with <=portage-2.1.6.x if mycmakeargs happens to be a global array.
Comment 9 Nikoli 2009-12-20 07:02:48 UTC
Did emerge --sync; recompiled hugin and now emerge -vg hugin works fine :)
Comment 10 Lamarque V. Souza 2010-01-28 09:15:52 UTC
Hi all, I think I have this problem with portage-2.2_rc61 too. Today I have compiled KDE SC 4.3.5 and my ~/.kde4.3 directory was ignored by KDE after relogin, in fact KDE is using ~/.kde instead. I did some debugging and it seems these lines in kde4-base_src_configure function in kde4-base.eclass are the culprit:

       if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then
               mycmakeargs=(${mycmakeargs})
       fi

commenting those lines makes kdelibs use ~/.kde4.3 as KDEHOME again. Those lines are overriding mycmakeargs when they must not do it. I am not sure how that code work, so I have not figure out how to fix it.
Comment 11 Zac Medico gentoo-dev 2010-01-28 15:31:02 UTC
Arrays are safer now since portage-2.1.7.16 is marked stable.
Comment 12 Lamarque V. Souza 2010-01-28 17:35:31 UTC
(In reply to comment #11)
> Arrays are safer now since portage-2.1.7.16 is marked stable.
> 

I use portage-2.2_rc61, I had to start using it when that was the only option to install kde-4.0.0. I suppose portage-2.2_r61 should have all fixes 2.1.7.6 has, right? Anyway, I have found the problem, the command declare -p mycmakeargs returns "declare -ax mycmakeargs=" and not "declare -a mycmakeargs=" (notice the "x" after "-a"), because of that the if is resolved to true and kde4-base_src_configure tries to convert an array into an array, which is wrong and results in an empty mycmakeargs in the end.

Unfortunately KDE_DEFAULT_HOME is still not set to .kde4.3. I had to add a patch to the ebuild to change it in kdelibs-4.3.5/CMakeList.txt. I do not know why it stopped working.
Comment 13 Lamarque V. Souza 2010-02-09 10:35:46 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > Arrays are safer now since portage-2.1.7.16 is marked stable.
> > 
> 
> I use portage-2.2_rc61, I had to start using it when that was the only option
> to install kde-4.0.0. I suppose portage-2.2_r61 should have all fixes 2.1.7.6
> has, right? Anyway, I have found the problem, the command declare -p
> mycmakeargs returns "declare -ax mycmakeargs=" and not "declare -a
> mycmakeargs=" (notice the "x" after "-a"), because of that the if is resolved
> to true and kde4-base_src_configure tries to convert an array into an array,
> which is wrong and results in an empty mycmakeargs in the end.
> 
> Unfortunately KDE_DEFAULT_HOME is still not set to .kde4.3. I had to add a
> patch to the ebuild to change it in kdelibs-4.3.5/CMakeList.txt. I do not know
> why it stopped working.
> 

Hi again, I had to apply to /usr/portage/eclass/cmake-utils.eclass the same change I did in /usr/portage/eclass/kde4-base.eclass to make kdelibs-4.4.0 compile correctly here. It seems because of the "declare -p" problem not all mycmakeargs content is being passed to cmake. Please fix this problem because since it is in cmake-utils too it probably affects all packages that use cmake.
Comment 14 Maciej Mrozowski gentoo-dev 2010-06-26 18:16:25 UTC
Is this still issue for you?
Comment 15 Lamarque V. Souza 2010-06-26 18:40:02 UTC
(In reply to comment #14)
> Is this still issue for you?
> 

I have added this script (/etc/portage/postsync.d/fix_eclass.sh) to patch cmake-utils.eclass and kde4-base.eclass on every "emerge --sync". Since then I do not have more problems :-) But I would like to see this patch added to portage, maybe other people has the some problem as me.
Comment 16 Lamarque V. Souza 2010-06-26 18:42:46 UTC
Created attachment 236663 [details, diff]
Prevents erasing cmake args by accident

This is the patch I am using.
Comment 17 Theo Chatzimichos (RETIRED) archtester gentoo-dev Security 2010-12-30 13:50:50 UTC
Sorry, we'll have to reject the patch, since stable portage versions work fine with the eclass there is no reason to patch it. thanks for you report though