Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 154130 - scummvm-tools uses non portable find.
Summary: scummvm-tools uses non portable find.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-05 05:43 UTC by Javier Villavicencio (RETIRED)
Modified: 2006-11-05 14:30 UTC (History)
2 users (show)

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


Attachments
scummvm-tools-bsd.patch (scummvm-tools-bsd.patch,491 bytes, patch)
2006-11-05 05:44 UTC, Javier Villavicencio (RETIRED)
Details | Diff
scummvm-tools-bsd-v2.patch (scummvm-tools-bsd.patch,472 bytes, patch)
2006-11-05 08:41 UTC, Javier Villavicencio (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Villavicencio (RETIRED) gentoo-dev 2006-11-05 05:43:53 UTC
scummvm-tools ebuild uses find with -printf as argument which isn't supported on bsd find.
Attached patch uses a more portable way to do the same.
Comment 1 Javier Villavicencio (RETIRED) gentoo-dev 2006-11-05 05:44:39 UTC
Created attachment 101271 [details, diff]
scummvm-tools-bsd.patch

patch to the ebuild.
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2006-11-05 07:08:31 UTC
> src_install() {
>+	cd "${S}"

src_install always starts in $S, no need to cd there.

> 	local f
>-	for f in $(find -type f -perm +1 -printf '%f ') ; do
>-		newgamesbin $f ${PN}-$f || die "newgamesbin $f failed"
>+	find . -type f -perm +1 -print | while read f; do
>+		newgamesbin $f ${PN}-$(basename $f) || die "newgamesbin $f failed"
> 	done

You're calling die in a subshell. This will not abort the installation if anything goes wrong.
Comment 3 Javier Villavicencio (RETIRED) gentoo-dev 2006-11-05 07:24:08 UTC
(In reply to comment #2)
> > src_install() {
> >+	cd "${S}"
> 
> src_install always starts in $S, no need to cd there.
> 
Hmm somehow this one started in ${WORKDIR} instead.

> > 	local f
> >-	for f in $(find -type f -perm +1 -printf '%f ') ; do
> >-		newgamesbin $f ${PN}-$f || die "newgamesbin $f failed"
> >+	find . -type f -perm +1 -print | while read f; do
> >+		newgamesbin $f ${PN}-$(basename $f) || die "newgamesbin $f failed"
> > 	done
> 
> You're calling die in a subshell. This will not abort the installation if
> anything goes wrong.
> 
I've just replaced
- newgamesbin $f ${PN}-$(basename $f) || die "newgamesbin $f failed"
with
+ false || die "false"

and it dies pretty well. which subshell are you referring to? (cos we have two here, but die isn't called in any of them)
Comment 4 Harald van Dijk (RETIRED) gentoo-dev 2006-11-05 07:32:07 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > > src_install() {
> > >+    cd "${S}"
> > 
> > src_install always starts in $S, no need to cd there.
> > 
> Hmm somehow this one started in ${WORKDIR} instead.

From /usr/lib/portage/bin/ebuild.sh:

dyn_install() {
        [...]
        if [ -d "${S}" ]; then
                cd "${S}"
        fi
        vecho
        vecho ">>> Install ${PF} into ${D} category ${CATEGORY}"
        #our custom version of libtool uses $S and $D to fix
        #invalid paths in .la files
        export S D
        #some packages uses an alternative to $S to build in, cause
        #our libtool to create problematic .la files
        export PWORKDIR="$WORKDIR"
        src_install
        [...]
}

> > >     local f
> > >-    for f in $(find -type f -perm +1 -printf '%f ') ; do
> > >-            newgamesbin $f ${PN}-$f || die "newgamesbin $f failed"
> > >+    find . -type f -perm +1 -print | while read f; do
> > >+            newgamesbin $f ${PN}-$(basename $f) || die "newgamesbin $f failed"
> > >     done
> > 
> > You're calling die in a subshell. This will not abort the installation if
> > anything goes wrong.
> > 
> I've just replaced
> - newgamesbin $f ${PN}-$(basename $f) || die "newgamesbin $f failed"
> with
> + false || die "false"
> 
> and it dies pretty well. which subshell are you referring to? (cos we have two
> here, but die isn't called in any of them)

The subshell used for the while loop. In bash, all piped commands are evaluated in a subshell. Just try
 : | exit
in a bash command prompt. Or from a test ebuild:

KEYWORDS=~x86
src_unpack() {
        echo line | while read f
        do
                die
        done
}

>>> Emerging (1 of 1) test/test-1.0 to /
 * checking ebuild checksums ;-) ...                          [ ok ]
 * checking auxfile checksums ;-) ...                         [ ok ]
 * checking miscfile checksums ;-) ...                        [ ok ]
>>> Unpacking source...

!!! ERROR: test/test-1.0 failed.
Call stack:
  ebuild.sh, line 1568:   Called dyn_unpack
  ebuild.sh, line 708:   Called src_unpack
  test-1.0.ebuild, line 5:   Called die

!!! (no error message)
!!! If you need support, post the topmost build error, and the call 
stack if relevant.

>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/test/test-1.0 ...
>>> Source compiled.
>>> Test phase [not enabled]: test/test-1.0

>>> Install test-1.0 into /var/tmp/portage/test/test-1.0/image/ cate
gory test
>>> Completed installing test-1.0 into /var/tmp/portage/test/test-1.
0/image/

man:
>>> Merging test/test-1.0 to /
>>> test/test-1.0 merged.
>>> Recording test/test in "world" favorites file...
Comment 5 Javier Villavicencio (RETIRED) gentoo-dev 2006-11-05 08:41:19 UTC
Created attachment 101279 [details, diff]
scummvm-tools-bsd-v2.patch

replaced while with for, and removed the cd ${S}, thanks Harald for the corrections.
Comment 6 SpanKY gentoo-dev 2006-11-05 14:14:40 UTC
dont use basename if you dont have to ... ${f##*/} works just as well
Comment 7 Mr. Bones. (RETIRED) gentoo-dev 2006-11-05 14:30:50 UTC
ok, in portage.