Use pushd/popd instead of repeated `cd X/cd "${S}"` calls in comedilib-9999.ebuild.
authorW. Trevor King <wking@drexel.edu>
Sat, 11 Dec 2010 13:44:42 +0000 (08:44 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 11 Dec 2010 14:03:02 +0000 (09:03 -0500)
This removes the assumption that the build process was in ${S} at the
beginning of the block.  It also fixes problems with glob expansion as
explained below:

From the Pathname Expansion section of bash(1), pathname expansion
happens after word splitting, and therefore before variable expansion.
A simple example of this is
  tmp $ echo "${PWD}/*"
  /tmp/*
when I had originally expected the same output as
  pushd /tmp/; echo *; popd
  /tmp /tmp
  file1 file2 file3 ...
  /tmp

Manifest
comedilib-9999.ebuild

index cf19da4cd1532378dcd336f1899871fb4fb993a8..4122ab4052938ea1bcf3fa2969122f0d99a7fcfd 100644 (file)
--- a/Manifest
+++ b/Manifest
@@ -1,5 +1,5 @@
 AUX comedilib-9999-setup.py.patch 962 RMD160 efcd89f8528e18a68ba8ff3756f00c047fdb228e SHA1 60827fa147aba30d5b5749260e1a1d928047222a SHA256 219864acf1610e2ddd94eb14eca8983fd336511db7626dde5a6347e11822a983
 AUX comedilib-9999-setup.rb.patch 318 RMD160 c9bcd07119fb7c2c92ce9c133947f51a3bd85c51 SHA1 8e213fdc3c319b611e23a98fe0844db55ef28aed SHA256 afb1fa061a2b703a66e09c408b21a337592d519ead51984f78f7b64dbc74c5a9
-EBUILD comedilib-9999.ebuild 3338 RMD160 c178bb3448961a54d64a6dc7e00407d2c4a1277c SHA1 6e6718ebfc9184cb07129551ad94651429b151d5 SHA256 4e253bea2ef22a046cc501f6a2eaffe6c12596edbf1ac19c2c7e607b5cd64331
+EBUILD comedilib-9999.ebuild 3691 RMD160 4843c79767afd5405ace0c211880cc794c6d5e17 SHA1 0b2111ee6ae95447459e5d5b639797af42fe7a4c SHA256 60b414e7b6e0e030b19763095a14a791e504655d913c973d129c4fab8e56efa4
 MISC ChangeLog 1168 RMD160 62c9992630de85e02a25d5a4cc077386211b8859 SHA1 bc9d91fff9c4f05804d564f5e55fd63ed99c3426 SHA256 6766a0d3f76055ed559975a91df6f2876289f129248fa739853da0d2606bec9f
 MISC metadata.xml 247 RMD160 6735f3a5dd2d7a2b70589d1693f35d54291b7147 SHA1 c015969fe50967340dd050a44cb9f8a30b5e34a5 SHA256 9e65060e5f9d0a50d28c7a69d9c27fed6c3037fdd3e420cc276627fde2794f72
index b5bea7ddd21e05e3ba21c86ee9881296288a8326..e42ba9548474be12c566f44259ed3a257d918aed 100644 (file)
@@ -53,10 +53,10 @@ src_prepare()
        fi
        if use python ; then
                epatch "${FILESDIR}/${P}"-setup.py.patch
-               cd "${S}/swig/python"
+               pushd "${S}/swig/python" || die "failed to pushd"
                ln -s ../comedi.i
                distutils_src_prepare
-               cd "${S}"
+               popd || die "failed to popd"
        fi
        if use ruby ; then
                epatch "${FILESDIR}/${P}"-setup.rb.patch
@@ -81,12 +81,12 @@ src_compile()
 {
        emake || die "emake failed"
        if use python ; then
-               cd "${S}/swig/python"
+               pushd "${S}/swig/python" || die "failed to pushd"
                distutils_src_compile
-               cd "${S}"
+               popd || die "failed to popd"
        fi
        if use ruby ; then
-               cd "${S}/swig/ruby"
+               pushd "${S}/swig/ruby" || die "failed to pushd"
                swig -ruby -o ext/comedi_ruby_wrap.c -I${S}/include ../comedi.i \
                        || die "swigging ruby binding failed"
                DESTDIR="${D}" ruby setup.rb config --prefix="${D}/usr" \
@@ -96,7 +96,7 @@ src_compile()
                        || die "ruby setup.rb config failed"
                ruby setup.rb setup || die "ruby setup.rb setup failed"
                chrpath -d ext/comedi.so || die "chrpath -d failed"
-               cd "${S}"
+               popd || die "failed to popd"
        fi
 }
 
@@ -107,7 +107,9 @@ src_install()
        local DOCINTO="/usr/share/doc/${PF}"
        local DDOCINTO="${D}${DOCINTO}"
        if use doc ; then
-               mv ${DOCINTO}/*.conf "${DOCINTO}/etc/" || die || 'moving *.conf failed'
+               pushd "${DDOCINTO}" || die "failed to pushd"
+               mv *.conf etc/ || die 'moving *.conf failed'
+               popd || die "failed to popd"
                insinto ${DOCINTO}/demo
                doins demo/Makefile demo/README demo/*.c demo/*.h || die "doins failed"
                if use python ; then
@@ -122,19 +124,21 @@ src_install()
                rm -rf "${DDOCINTO}"
        fi
        if use python ; then
-               cd "${S}/swig/python"
+               pushd "${S}/swig/python" || die "failed to pushd"
                distutils_src_install
-               cd "${S}"
+               popd || die "failed to popd"
        fi
        if use ruby ; then
-               cd "${S}/swig/ruby"
+               pushd "${S}/swig/ruby" || die "failed to pushd"
                ruby setup.rb install || die "ruby setup.rb install failed"
-               cd "${S}"
+               popd || die "failed to popd"
        fi
        # comedi.h already installed by sci-misc/comedi-headers
-       rm ${D}/usr/include/comedi.h || die "failed to remove comedi.h"
+       rm "${D}/usr/include/comedi.h" || die "failed to remove comedi.h"
        # comedi_calibrate is a separate package
-       rm ${D}/usr/share/man/man8/comedi_calibrate.8*
+       pushd "${D}/usr/share/man/man8/" || die "failed to pushd"
+       rm comedi_calibrate.8*
+       popd || die "failed to popd"
 }
 
 pkg_postinst()