Opened 14 years ago

Closed 14 years ago

#26034 closed defect (fixed)

qt4-mac fails on Tiger: find: 1: unknown expression primary

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 1.9.1
Keywords: Cc:
Port: qt4-mac

Description

Couldn't upgrade qt4-mac on my Tiger i386 machine; it said:

[snip]
:info:destroot xinstall: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/qt-everywhere-opensource-src-4.6.3/INSTALL -> /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/destroot/opt/local/libexec/qt4-mac/share/doc/qt4-mac/INSTALL
:info:destroot xinstall: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/qt-everywhere-opensource-src-4.6.3/LGPL_EXCEPTION.txt -> /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/destroot/opt/local/libexec/qt4-mac/share/doc/qt4-mac/LGPL_EXCEPTION.txt
:info:destroot xinstall: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/qt-everywhere-opensource-src-4.6.3/LICENSE.GPL3 -> /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/destroot/opt/local/libexec/qt4-mac/share/doc/qt4-mac/LICENSE.GPL3
:info:destroot xinstall: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/qt-everywhere-opensource-src-4.6.3/LICENSE.LGPL -> /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/destroot/opt/local/libexec/qt4-mac/share/doc/qt4-mac/LICENSE.LGPL
:info:destroot xinstall: /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/qt-everywhere-opensource-src-4.6.3/README -> /opt/local/var/macports/build/_Users_rschmidt_macports_dports_aqua_qt4-mac/work/destroot/opt/local/libexec/qt4-mac/share/doc/qt4-mac/README
:error:destroot Target org.macports.destroot returned: find: 1: unknown expression primary

The problem is this part of the portfile:

        foreach tfm [exec find ${destroot}${qt_dir}/lib -name "*.framework" \
                         -type d -depth 1 | sed -e "s@\.framework@@g" \
                         -e "s@${destroot}${qt_dir}/lib/@@g"] {

According to "man find" on Tiger, the "-depth" option does not take an argument.

     -d      The -d option causes find to perform a depth-first traversal,
             i.e., directories are visited in post-order and all entries in a
             directory will be acted on before the directory itself.  By
             default, find visits directories in pre-order, i.e., before their
             contents.  Note, the default is not a breadth-first traversal.
[snip]
     -depth  Always true; same as the -d option.  -depth can be useful when
             find is used with cpio(1) to process files that are contained in
             directories with unusual permissions.  It enures that you have
             write permission while you are placing files in a directory, then
             sets the directory's permissions as the last thing.

Perhaps you can replace "exec find" with "fs-traverse" or, since via the "-depth 1" option, you seem to be wanting only immediate children of the directory, likely "glob" is what you should be using.

Change History (8)

comment:1 Changed 14 years ago by michaelld (Michael Dickens)

Go figure about 'find' ... Looks like 'glob' will work, though that involves 2 steps instead of the 1 I had :( I think the following will work; I'll test tomorrow.

        foreach frms [glob -type d -directory ${destroot}${qt_dir}/lib \
                          *.framework] {
            set tfm [exec echo ${frms} | \
                         sed -e "s@\[^ \]*/\\(\[^ \]*\\)\\.framework.*@\\1@"]

I'm trying to avoid using 'ls' since it generates an error if it finds nothing, though in this case there had darn better be *.framework directories since it's a framework build ...

comment:2 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Don't use "exec echo | sed"; use a Tcl function, like strsed or regsub.

comment:3 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

I'd also tend toward more self-explanitory variable names, e.g. "frms" takes a little while to comprehend; "frameworks" would be so much clearer.

comment:4 Changed 14 years ago by michaelld (Michael Dickens)

OK; I'll look up strsed & regsub and see what makes the most sense. I'm not really a TCL programmer.

comment:5 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

That's one of the joys of working on the innards of MacPorts: becoming one. :)

comment:6 Changed 14 years ago by michaelld (Michael Dickens)

Indeed and not a bad thing IMHO; I certainly have learned a lot about regex, both regular and extended.

comment:7 Changed 14 years ago by michaelld (Michael Dickens)

This works for me:

    foreach full_framework [glob -type d -directory ${destroot_qt}/lib \
                                *.framework] {
        regexp {[^ ]*/(.+)\.framework.*} ${full_framework} match framework

and then 'framework' holds the desired value. In this case, because I know that qt4-mac is a framework install, I can also do:

    foreach framework [exec ls ${destroot_qt}/lib | \
                           grep framework | \
                           sed -e "s@\\.framework.*@@"] {

which is, overall, about as simple (or complex) as the combined 'glob' and 'regexp'. If the 'ls' command allowed me to specify '*.framework' then I'd do that to remove the 'grep' -- /bin/ls does allow me to do this. If I do "exec ls ${destroot_qt}/lib/*.framework" instead of the above, then I get back "ls: ${destroot_qt}/lib/*.framework: No such file or directory" ... while from 'bash' I get the listing I want.

Anyway, do you have a preference as to which of the above I use?

comment:8 Changed 14 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

I'm going with the 'ls | grep | sed' option, since I think it's a little clearer. Fixed in r70523.

Note: See TracTickets for help on using tickets.