Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 42006 - Flag-o-Matic replace flag Fails, kills jpeg/graphviz issue
Summary: Flag-o-Matic replace flag Fails, kills jpeg/graphviz issue
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Graphics Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-17 23:36 UTC by Gary Stein
Modified: 2004-07-22 08:31 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 Gary Stein 2004-02-17 23:36:11 UTC
Trying to install a system with CFLAGS includeing -march=k6-2 -mcpu=k6-2

ran into trouble with graphviz not compiling, it doesn't accept the jpeg library
but I tracked that to the fact the jpeg library had some compile time issues

media-libs/jpeg/jpeg-6b-r3.ebuild (most recent, emerged a day ago)
has the line
replace-flags k6-2 i586

that should work and replace the flags using flag-o-matic
accoriding to the man page of flag-o-matic
"replace-flags <orig-flag> <new-flag>
              Replace all occurences of original flag with new flag."

well, it doesn't do that, it only replaces the first one using the code
    CFLAGS="${CFLAGS/${1}/${2} }"
standard bash syntax is that is replace the first occurance in the string


The code probably should read:
    CFLAGS="${CFLAGS//${1}/${2} }"
with two slashes, replaces all occurances, which is what it is supposed to do

I replaced my version, of the eclass flag-o-matic, works fine

actually that code does that alot, but most are contained within
for loops that hide the inaccuracy, I'm a hobbiest bash programmer
please someone in the know review flag-o-matic for full accuracy
versus the documentation



Reproducible: Always
Steps to Reproduce:
1. set cflags with multiple things to replace, (ex. -mcpu=k6-2 -march=k6-2)
2. emerge jpeg
3. notice how it uses the -2 "command"

Actual Results:  
it does that because the "replace-flag k6-2 i586" gets the first flag
and not any others, "replace-flag k6 i586" gets the second
and therefor strands a -2 on the end (kinda like Bugzilla Bug 12021
but for a different reason)

Expected Results:  
replace all the flags, as the documentation says (// in bash does all)
Comment 1 Gary Stein 2004-02-18 00:59:33 UTC
Well now, the proposed fix does resolve issues involving
multiple replaced cflags, but opens a new can of worms
with respect to the emerge process and dependancy calculations

it causes, undo output to the screen (centered mostly around
pam and tetex it seems)

that doesn't seem to happen with the old line, it is possible
someone is overloading that function, more than it was intended
using the other expected results (though the dependancy list
looks sane)

example:
StrongBad root # emerge -vup kde

These are the packages that I would merge, in order:

Calculating dependencies \pam
motif
encode
cups
oggvorbis
opengl
ssl
pam                                                                            /alsa
alsa
oggvorbis
mad
alsa
oggvorbis
mad                                                                            /has_version() in global scope: app-text/tetex-1.0.7-r13
has_version() in global scope: app-text/tetex-2.0.2-r1
has_version() in global scope: app-text/tetex-2.0.2-r3                         -sdl
sdl
xmms
sdl
xmms
sdl
xmms                                                                           \has_version() in global scope: media-libs/libmpeg3-1.5-r1
has_version() in global scope: media-libs/libmpeg3-1.5-r1
has_version() in global scope: media-libs/libmpeg3-1.5.1
has_version() in global scope: media-libs/libmpeg3-1.5.1                       -motif
gtk
slang
motif
slang
oggvorbis
motif
slang
oggvorbis                                                                      ...done!
Comment 2 SpanKY gentoo-dev 2004-02-18 19:44:07 UTC
flag-o-matic works on whole flags, not partials

in other words, the jpeg ebuild needs to be fixed
Comment 3 Gary Stein 2004-02-18 22:40:24 UTC
not really, that isn't the problem
jpeg follows the proper calling standard
that was a problem before when
replace-flag k6 i586
replace-flag k6-2 i586

but that was fixed with the previous bug
this is the fact that fact-o-matic should replace all
instances of k6-2 not just the first one

else in the jpeg ebuild
replace-flag k6-2 i586
would have to be called twice, which is silly

either the second / in the bash replacement script
or a for loop would fix the flags problem, it is
unrelated to jpeg truthfully
Comment 4 SpanKY gentoo-dev 2004-02-20 12:16:53 UTC
no, that is the problem

flag-o-matic *does not* and will *never again* work on partial flags
Comment 5 Aron Griffis (RETIRED) gentoo-dev 2004-07-22 08:31:18 UTC
This is fixed in current flag-o-matic and in jpeg-6b-r3.ebuild

Thanks for reporting the bug, Gary.