From dc858f6a75f94c0a1b3d6e5c6e83a874e8b57d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= Date: Sat, 19 Dec 2015 18:50:00 +0100 Subject: perl-module.eclass and perl-functions.eclass: Add infrastructure to build .packlist files and keep/fix them in EAPI=6 --- eclass/perl-functions.eclass | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'eclass/perl-functions.eclass') diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass index c38ed6c4a651..756847318366 100644 --- a/eclass/perl-functions.eclass +++ b/eclass/perl-functions.eclass @@ -106,17 +106,46 @@ perl_delete_packlist() { debug-print-function $FUNCNAME "$@" perl_set_version if [[ -d ${D}/${VENDOR_ARCH} ]] ; then - find "${D}/${VENDOR_ARCH}" -type f -a \( -name .packlist \ - -o \( -name '*.bs' -a -empty \) \) -delete + find "${D}/${VENDOR_ARCH}" -type f -a -name .packlist -delete + perl_delete_emptybsdir + fi +} + +# @FUNCTION: perl_delete_emptybsdir +# @USAGE: perl_delete_emptybsdir +# @DESCRIPTION: +# Look through ${D} for empty .bs files and empty directories, +# and get rid of items found. +perl_delete_emptybsdir() { + debug-print-function $FUNCNAME "$@" + perl_set_version + if [[ -d ${D}/${VENDOR_ARCH} ]] ; then + find "${D}/${VENDOR_ARCH}" -type f \ + -a -name '*.bs' -a -empty -delete find "${D}" -depth -mindepth 1 -type d -empty -delete fi } +# @FUNCTION: perl_fix_packlist +# @USAGE: perl_fix_packlist +# @DESCRIPTION: +# Look through ${D} for .packlist text files containing the temporary installation +# folder (i.e. ${D}). If the pattern is found, silently replace it with `/'. +perl_fix_packlist() { + debug-print-function $FUNCNAME "$@" + + find "${D}" -type f -name '.packlist' -print0 | while read -rd '' f ; do + if file "${f}" | grep -q -i " text" ; then + sed -i -e "s:${D}:/:g" "${f}" + fi + done +} + # @FUNCTION: perl_remove_temppath # @USAGE: perl_remove_temppath # @DESCRIPTION: # Look through ${D} for text files containing the temporary installation -# folder (i.e. ${D}). If the pattern is found (i.e. " text"), replace it with `/'. +# folder (i.e. ${D}). If the pattern is found, replace it with `/' and warn. perl_remove_temppath() { debug-print-function $FUNCNAME "$@" -- cgit v1.2.3