commit:     ff64744a2fdeb36717c350eea48cd4a46fa4f049
Author:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
AuthorDate: Tue Aug 26 18:54:49 2014 +0000
Commit:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
CommitDate: Tue Aug 26 18:54:49 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=ff64744a

perl-module.eclass: Fix a bunch of bugs in perl_rm_files function. Add 
PERL_RM_FILES bash array to ebuilds that gets pruned automatically during 
src_prepare if defined

---
 eclass/perl-module.eclass | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass
index 6f7b5f4..1dc824e 100644
--- a/eclass/perl-module.eclass
+++ b/eclass/perl-module.eclass
@@ -99,6 +99,10 @@ perl-module_src_prepare() {
        [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
        debug-print "$FUNCNAME: applying user patches"
        epatch_user
+       if [[ ${PERL_RM_FILES[@]} ]]; then
+               debug-print "$FUNCNAME: stripping unneeded files"
+               perl_rm_files "${PERL_RM_FILES[@]}"
+       fi
        perl_fix_osx_extra
        esvn_clean
 }
@@ -442,18 +446,24 @@ perl_remove_temppath() {
 # users about files "missing from their kit".
 perl_rm_files() {
        debug-print-function $FUNCNAME "$@"
-       local skipfile=${S}/.gentoo_makefile_skip
-       local manifile=${S}/MANIFEST
-       local manitemp=${S}/.gentoo_manifest_temp
+       local skipfile="${T}/.gentoo_makefile_skip"
+       local manifile="${S}/MANIFEST"
+       local manitemp="${T}/.gentoo_manifest_temp"
+       oldifs="$IFS"
+       IFS="\n"
        for filename in "$@"; do
                einfo "Removing un-needed ${filename}";
                # Remove the file
-               rm ${S}/$filename
-               echo ${filename} >> ${skipfile}
+               rm -f "${S}/${filename}"
+               [[ -e "${manifile}" ]] && echo "${filename}" >> "${skipfile}"
        done
-       grep -v -F -f $skipfile $manifile > $manitemp
-       mv $manitemp $manifile
-       rm $skipfile;
+       if [[ -e "${manifile}" && -e "${skipfile}" ]]; then
+               einfo "Fixing Manifest"
+               grep -v -F -f "${skipfile}" "${manifile}" > "${manitemp}"
+               mv -f -- "${manitemp}" "${manifile}"
+               rm -- "${skipfile}";
+       fi
+       IFS="$oldifs"
 }
 
 perl_link_duallife_scripts() {

Reply via email to